/*
 * UIAlgebraInfo.java
 *
 * Created on 22 maart 2007, 10:01
 *
 * This file is part of SimpLie.
 * 
 * SimpLie is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * SimpLie is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with SimpLie.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

package edu.simplie.ui.reusable;

import edu.simplie.Helper;
import edu.simplie.algebra.Algebra;

/**
 *
 * @author  Teake Nutma
 * @version $Revision$, $Date$
 */
public class UIAlgebraInfo extends javax.swing.JPanel
{
	
	/**
	 * Creates new form UIAlgebraInfo
	 */
	public UIAlgebraInfo()
	{
		initComponents();
	}
	
	public void setTitle(String title)
	{
		setBorder(javax.swing.BorderFactory.createTitledBorder(null, title, javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12)));
	}
		
	public void update(Algebra algebra)
	{
		algebraInfoType.setText(algebra.typeHTML);
		algebraInfoRank.setText(Helper.intToString(algebra.rank));
		algebraInfoDim.setText(algebra.dimension);
		algebraInfoCMDet.setText(Helper.intToString(algebra.det));
		algebraInfoCMrank.setText(Helper.intToString(algebra.rankA));
		algebraInfoCoxNum.setText(Helper.intToString(algebra.coxeterNumber));
		algebraInfoDualCoxNum.setText(Helper.intToString(algebra.dualCoxeterNumber));
	}
	
	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel4 = new javax.swing.JLabel();
        algebraInfoType = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        algebraInfoCMDet = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        algebraInfoCMrank = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        algebraInfoRank = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        tfCoxNum = new javax.swing.JLabel();
        algebraInfoCoxNum = new javax.swing.JLabel();
        tfDualCoxNum = new javax.swing.JLabel();
        algebraInfoDualCoxNum = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        algebraInfoDim = new javax.swing.JLabel();

        setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Algebra information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N

        jLabel4.setText("Type:");
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(edu.simplie.SimpLieApp.class).getContext().getResourceMap(UIAlgebraInfo.class);
        jLabel4.setToolTipText(resourceMap.getString("algebra.typeDef")); // NOI18N

        algebraInfoType.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        algebraInfoType.setText("   ");
        algebraInfoType.setToolTipText(resourceMap.getString("algebra.typeDef")); // NOI18N

        jLabel3.setText("CM det:");
        jLabel3.setToolTipText(resourceMap.getString("algebra.cmDetDef")); // NOI18N

        algebraInfoCMDet.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        algebraInfoCMDet.setText("   ");
        algebraInfoCMDet.setToolTipText(resourceMap.getString("algebra.cmDetDef")); // NOI18N

        jLabel5.setText("CM rank:");
        jLabel5.setToolTipText(resourceMap.getString("algebra.cmRankDef")); // NOI18N

        algebraInfoCMrank.setText("   ");
        algebraInfoCMrank.setToolTipText(resourceMap.getString("algebra.cmRankDef")); // NOI18N

        jLabel1.setText("Rank:");
        jLabel1.setToolTipText(resourceMap.getString("algebra.rankDef")); // NOI18N

        algebraInfoRank.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        algebraInfoRank.setText("    ");
        algebraInfoRank.setToolTipText(resourceMap.getString("algebra.rankDef")); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel5)
                    .addComponent(jLabel1))
                .addGap(15, 15, 15)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(algebraInfoRank, javax.swing.GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE)
                    .addComponent(algebraInfoCMDet, javax.swing.GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE)
                    .addComponent(algebraInfoCMrank, javax.swing.GroupLayout.DEFAULT_SIZE, 37, Short.MAX_VALUE)))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(algebraInfoRank))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(algebraInfoCMDet))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(algebraInfoCMrank)))
        );

        tfCoxNum.setText("Coxeter number:");
        tfCoxNum.setToolTipText(resourceMap.getString("algebra.coxeterDef")); // NOI18N

        algebraInfoCoxNum.setText(" ");
        algebraInfoCoxNum.setToolTipText(resourceMap.getString("algebra.coxeterDef")); // NOI18N

        tfDualCoxNum.setText("Dual number:");

        jLabel2.setText("Dimension:");
        jLabel2.setToolTipText(resourceMap.getString("algebra.dimensionDef")); // NOI18N

        algebraInfoDim.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        algebraInfoDim.setText("    ");
        algebraInfoDim.setToolTipText(resourceMap.getString("algebra.dimensionDef")); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tfCoxNum)
                    .addComponent(tfDualCoxNum)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(algebraInfoDim, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)
                    .addComponent(algebraInfoCoxNum, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)
                    .addComponent(algebraInfoDualCoxNum, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(algebraInfoDim, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfCoxNum)
                    .addComponent(algebraInfoCoxNum))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(tfDualCoxNum)
                    .addComponent(algebraInfoDualCoxNum, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(algebraInfoType, javax.swing.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(algebraInfoType, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
	
	
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel algebraInfoCMDet;
    private javax.swing.JLabel algebraInfoCMrank;
    private javax.swing.JLabel algebraInfoCoxNum;
    private javax.swing.JLabel algebraInfoDim;
    private javax.swing.JLabel algebraInfoDualCoxNum;
    private javax.swing.JLabel algebraInfoRank;
    private javax.swing.JLabel algebraInfoType;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JLabel tfCoxNum;
    private javax.swing.JLabel tfDualCoxNum;
    // End of variables declaration//GEN-END:variables
	
}
