Search in sources :

Example 11 with CComboBox

use of org.compiere.swing.CComboBox in project adempiere by adempiere.

the class VAttributeGrid method init.

/**
	 * 	Init
	 *	@param WindowNo
	 *	@param frame
	 */
public void init(int WindowNo, FormFrame frame) {
    m_WindowNo = WindowNo;
    m_frame = frame;
    //	Layout
    frame.getContentPane().add(this, BorderLayout.CENTER);
    this.setLayout(new BorderLayout());
    this.add(tabbedPane, BorderLayout.CENTER);
    this.add(confirmPanel, BorderLayout.SOUTH);
    tabbedPane.addChangeListener(this);
    confirmPanel.addActionListener(this);
    //
    tabbedPane.add(selectPanel, Msg.getMsg(Env.getCtx(), "Selection"));
    selectPanel.add(attributeLabel1, new ALayoutConstraint(0, 0));
    m_attributes = MAttribute.getOfClient(Env.getCtx(), true, true);
    Vector<KeyNamePair> vector = new Vector<KeyNamePair>();
    vector.add(new KeyNamePair(0, ""));
    for (int i = 0; i < m_attributes.length; i++) vector.add(m_attributes[i].getKeyNamePair());
    attributeCombo1 = new CComboBox(vector);
    selectPanel.add(attributeCombo1, null);
    selectPanel.add(attributeLabel2, new ALayoutConstraint(1, 0));
    attributeCombo2 = new CComboBox(vector);
    selectPanel.add(attributeCombo2, null);
    //
    fillPicks();
    selectPanel.add(labelPriceList, new ALayoutConstraint(2, 0));
    selectPanel.add(pickPriceList);
    selectPanel.add(labelWarehouse, new ALayoutConstraint(3, 0));
    selectPanel.add(pickWarehouse);
    //
    selectPanel.setPreferredSize(new Dimension(300, 200));
    //
    //	Grid
    tabbedPane.add(gridPanel, "AttributeGrid");
    modePanel.add(modeLabel);
    modePanel.add(modeCombo);
    modeCombo.addActionListener(this);
}
Also used : BorderLayout(java.awt.BorderLayout) CComboBox(org.compiere.swing.CComboBox) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) KeyNamePair(org.compiere.util.KeyNamePair) Dimension(java.awt.Dimension) Vector(java.util.Vector) ALayoutConstraint(org.compiere.apps.ALayoutConstraint)

Example 12 with CComboBox

use of org.compiere.swing.CComboBox in project adempiere by adempiere.

the class VBOMDrop method createSelectionPanel.

/**************************************************************************
	 * 	Create Selection Panel
	 *	@param order
	 *	@param invoice
	 *	@param project
	 */
private void createSelectionPanel(boolean order, boolean invoice, boolean project) {
    int row = 0;
    selectionPanel.setBorder(new TitledBorder(Msg.translate(Env.getCtx(), "Selection")));
    productField = new CComboBox(getProducts());
    CLabel label = new CLabel(Msg.translate(Env.getCtx(), "M_Product_ID"));
    label.setLabelFor(productField);
    selectionPanel.add(label, new ALayoutConstraint(row++, 0));
    selectionPanel.add(productField);
    productField.addActionListener(this);
    //	Qty
    label = new CLabel(productQty.getTitle());
    label.setLabelFor(productQty);
    selectionPanel.add(label);
    selectionPanel.add(productQty);
    productQty.setValue(Env.ONE);
    productQty.addActionListener(this);
    if (order) {
        orderField = new CComboBox(getOrders());
        label = new CLabel(Msg.translate(Env.getCtx(), "C_Order_ID"));
        label.setLabelFor(orderField);
        selectionPanel.add(label, new ALayoutConstraint(row++, 0));
        selectionPanel.add(orderField);
        orderField.addActionListener(this);
    }
    if (invoice) {
        invoiceField = new CComboBox(getInvoices());
        label = new CLabel(Msg.translate(Env.getCtx(), "C_Invoice_ID"));
        label.setLabelFor(invoiceField);
        selectionPanel.add(label, new ALayoutConstraint(row++, 0));
        selectionPanel.add(invoiceField);
        invoiceField.addActionListener(this);
    }
    if (project) {
        projectField = new CComboBox(getProjects());
        label = new CLabel(Msg.translate(Env.getCtx(), "C_Project_ID"));
        label.setLabelFor(projectField);
        selectionPanel.add(label, new ALayoutConstraint(row++, 0));
        selectionPanel.add(projectField);
        projectField.addActionListener(this);
    }
    //	Enabled in ActionPerformed
    confirmPanel.getOKButton().setEnabled(false);
    //	Size
    Dimension size = selectionPanel.getPreferredSize();
    size.width = WINDOW_WIDTH;
    selectionPanel.setPreferredSize(size);
}
Also used : CLabel(org.compiere.swing.CLabel) CComboBox(org.compiere.swing.CComboBox) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder) ALayoutConstraint(org.compiere.apps.ALayoutConstraint)

Example 13 with CComboBox

use of org.compiere.swing.CComboBox in project adempiere by adempiere.

the class RecordAccessDialog method dynInit.

/**
	 * 	Dynamic Init
	 */
private void dynInit() {
    //	Load Roles
    String sql = MRole.getDefault().addAccessSQL("SELECT AD_Role_ID, Name FROM AD_Role ORDER BY 2", "AD_Role", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
    roleField = new CComboBox(DB.getKeyNamePairs(sql, false));
    //	Load Record Access for all roles
    sql = "SELECT * FROM AD_Record_Access " + "WHERE AD_Table_ID=? AND Record_ID=? AND AD_Client_ID=?";
    PreparedStatement pstmt = null;
    try {
        pstmt = DB.prepareStatement(sql, null);
        pstmt.setInt(1, m_AD_Table_ID);
        pstmt.setInt(2, m_Record_ID);
        pstmt.setInt(3, Env.getAD_Client_ID(Env.getCtx()));
        ResultSet rs = pstmt.executeQuery();
        while (rs.next()) m_recordAccesss.add(new MRecordAccess(Env.getCtx(), rs, null));
        rs.close();
        pstmt.close();
        pstmt = null;
    } catch (Exception e) {
        log.log(Level.SEVERE, sql, e);
    }
    try {
        if (pstmt != null)
            pstmt.close();
        pstmt = null;
    } catch (Exception e) {
        pstmt = null;
    }
    log.fine("#" + m_recordAccesss.size());
    setLine(0, false);
}
Also used : CComboBox(org.compiere.swing.CComboBox) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement) MRecordAccess(org.compiere.model.MRecordAccess)

Aggregations

CComboBox (org.compiere.swing.CComboBox)13 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)6 CLabel (org.compiere.swing.CLabel)6 Dimension (java.awt.Dimension)4 KeyNamePair (org.compiere.util.KeyNamePair)3 BorderLayout (java.awt.BorderLayout)2 JScrollPane (javax.swing.JScrollPane)2 JTable (javax.swing.JTable)2 TitledBorder (javax.swing.border.TitledBorder)2 MAttribute (org.compiere.model.MAttribute)2 MAttributeSet (org.compiere.model.MAttributeSet)2 MAttributeValue (org.compiere.model.MAttributeValue)2 CCheckBox (org.compiere.swing.CCheckBox)2 CheckboxTree (it.cnr.imaa.essi.lablib.gui.checkboxtree.CheckboxTree)1 Font (java.awt.Font)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 GridLayout (java.awt.GridLayout)1 Insets (java.awt.Insets)1 ActionEvent (java.awt.event.ActionEvent)1