Search in sources :

Example 1 with VTreePanel

use of org.compiere.grid.tree.VTreePanel in project adempiere by adempiere.

the class VTreeMaintenance method preInit.

//	init
/**
	 * 	Fill Tree Combo
	 */
private void preInit() {
    treeField = new CComboBox(getTreeData());
    treeField.addActionListener(this);
    //
    centerTree = new VTreePanel(m_WindowNo, false, true);
    centerTree.addPropertyChangeListener(VTreePanel.NODE_SELECTION, this);
}
Also used : CComboBox(org.compiere.swing.CComboBox) VTreePanel(org.compiere.grid.tree.VTreePanel)

Example 2 with VTreePanel

use of org.compiere.grid.tree.VTreePanel in project adempiere by adempiere.

the class GridController method init.

//  initGrid
private void init() {
    //  Set up Multi Row Table
    vTable.setModel(m_mTab.getTableModel());
    //  Update Table Info -------------------------------------------------
    int size = setupVTable(m_aPanel, m_mTab, vTable);
    //  Single Row  -------------------------------------------------------
    if (!m_onlyMultiRow) {
        //	Set Softcoded Mnemonic &x
        for (int i = 0; i < size; i++) {
            GridField mField = m_mTab.getField(i);
            if (mField.isDisplayed())
                vPanel.setMnemonic(mField);
        }
        //	Add Fields
        for (int i = 0; i < size; i++) {
            GridField mField = m_mTab.getField(i);
            if (mField.isDisplayed()) {
                VEditor vEditor = VEditorFactory.getEditor(m_mTab, mField, false);
                if (vEditor == null) {
                    log.warning("Editor not created for " + mField.getColumnName());
                    continue;
                }
                //  MField => VEditor - New Field value to be updated to editor
                mField.addPropertyChangeListener(vEditor);
                //  VEditor => this - New Editor value to be updated here (MTable)
                vEditor.addVetoableChangeListener(this);
                //  Add to VPanel
                vPanel.addFieldBuffered(vEditor, mField);
                //  APanel Listen to buttons
                if (mField.getDisplayType() == DisplayType.Button && m_aPanel != null)
                    ((JButton) vEditor).addActionListener(m_aPanel);
            }
        }
        //  for all fields
        // flush the last one through
        vPanel.addFieldBuffered(null, null);
        //	No Included Grid Controller
        /*
			srPane.setResizeWeight(1);	//	top part gets all
			srPane.setDividerSize (0);
			srPane.setDividerLocation (9999);
			*/
        //  Use SR to size MR
        mrPane.setPreferredSize(vPanel.getPreferredSize());
    }
    //  Single-Row
    //  Tree Graphics Layout
    int AD_Tree_ID = 0;
    if (m_mTab.isTreeTab())
        AD_Tree_ID = MTree.getDefaultAD_Tree_ID(Env.getAD_Client_ID(Env.getCtx()), m_mTab.getKeyColumnName());
    if (m_mTab.isTreeTab() && AD_Tree_ID != 0) {
        m_tree = new VTreePanel(m_WindowNo, false, true);
        if (//	initialize other tabs later
        m_mTab.getTabNo() == 0)
            m_tree.initTree(AD_Tree_ID);
        m_tree.addPropertyChangeListener(VTreePanel.NODE_SELECTION, this);
        graphPanel.add(m_tree, BorderLayout.CENTER);
        splitPane.setDividerLocation(250);
    //	splitPane.resetToPreferredSizes();
    } else //  No Graphics - hide
    {
        graphPanel.setPreferredSize(new Dimension(0, 0));
        splitPane.setDividerSize(0);
        splitPane.setDividerLocation(0);
    }
    //  Receive DataStatusChanged info from MTab
    m_mTab.addDataStatusListener(this);
    //  Receive vetoableChange info from MTable when saving
    m_mTab.getTableModel().addVetoableChangeListener(this);
    //	Selection Listener -> valueChanged
    vTable.getSelectionModel().addListSelectionListener(this);
    //  Navigation (RowChanged)
    m_mTab.addPropertyChangeListener(vTable);
    //  Update UI
    vTable.autoSize(true);
    //  Set initial presentation
    if (m_onlyMultiRow || !m_mTab.isSingleRow())
        switchMultiRow();
    else
        switchSingleRow();
    init = true;
}
Also used : VTreePanel(org.compiere.grid.tree.VTreePanel) GridField(org.compiere.model.GridField) VEditor(org.compiere.grid.ed.VEditor) Dimension(java.awt.Dimension)

Aggregations

VTreePanel (org.compiere.grid.tree.VTreePanel)2 Dimension (java.awt.Dimension)1 VEditor (org.compiere.grid.ed.VEditor)1 GridField (org.compiere.model.GridField)1 CComboBox (org.compiere.swing.CComboBox)1