Search in sources :

Example 21 with ALayoutConstraint

use of org.compiere.apps.ALayoutConstraint in project adempiere by adempiere.

the class VProductConfigurationBOM 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 22 with ALayoutConstraint

use of org.compiere.apps.ALayoutConstraint in project adempiere by adempiere.

the class VProductConfigurationBOM method addDisplay.

//	addBOMLine
/**
	 * 	Add Line to Display
	 *	@param parentM_Product_ID parent product
	 *	@param M_Product_ID product
	 *	@param bomType bom type
	 *	@param name name
	 *	@param lineQty qty
	 */
private void addDisplay(int parentM_Product_ID, int M_Product_ID, String bomType, String name, BigDecimal lineQty, int PP_Product_BOM_ID, String M_Feature, int PP_Product_BOMLine_ID) {
    log.fine("M_Product_ID=" + M_Product_ID + ",Type=" + bomType + ",Name=" + name + ",Qty=" + lineQty);
    //
    boolean selected = true;
    if (MPPProductBOMLine.COMPONENTTYPE_Component.equals(bomType)) {
        String title = "";
        JCheckBox cb = new JCheckBox(title);
        cb.setSelected(true);
        cb.setEnabled(false);
        m_selectionList.add(cb);
        this.add(cb, new ALayoutConstraint(m_bomLine++, 0));
    } else //FIXME:  add different types for libero
    if (MPPProductBOMLine.COMPONENTTYPE_Variant.equals(bomType)) {
        String title = Msg.getMsg(Env.getCtx(), "Optional");
        JCheckBox cb = new JCheckBox(title);
        cb.setSelected(false);
        selected = false;
        cb.addActionListener(this);
        m_selectionList.add(cb);
        this.add(cb, new ALayoutConstraint(m_bomLine++, 0));
    } else //	Alternative
    {
        //String title = Msg.getMsg(Env.getCtx(), "Alternative") + " " + bomType;
        String title = M_Feature;
        JRadioButton b = new JRadioButton(title);
        //String groupName = String.valueOf(parentM_Product_ID) + "_" + bomType;
        String groupName = String.valueOf(getProductFromMPPProductBOM(PP_Product_BOM_ID).get_ID()) + "_" + bomType;
        ButtonGroup group = (ButtonGroup) m_buttonGroups.get(groupName);
        if (group == null) {
            log.fine("ButtonGroup=" + groupName);
            group = new ButtonGroup();
            m_buttonGroups.put(groupName, group);
            group.add(b);
            //	select first one
            b.setSelected(true);
        } else {
            group.add(b);
            b.setSelected(false);
            selected = false;
        }
        b.addActionListener(this);
        m_selectionList.add(b);
        this.add(b, new ALayoutConstraint(m_bomLine++, 0));
    }
    //	Add to List & display
    m_productList.add(new Integer(M_Product_ID));
    m_bomLineIDList.add(new Integer(PP_Product_BOMLine_ID));
    /*VNumber qty = new VNumber ("Qty", true, false, true, DisplayType.Quantity, name);
		qty.setValue(lineQty);
		qty.setReadWrite(selected);
		m_qtyList.add(qty);
		*/
    CLabel label = new CLabel(name);
    //label.setLabelFor(qty);
    this.add(label);
//this.add(qty);	
}
Also used : JCheckBox(javax.swing.JCheckBox) CLabel(org.compiere.swing.CLabel) JRadioButton(javax.swing.JRadioButton) ButtonGroup(javax.swing.ButtonGroup) ALayoutConstraint(org.compiere.apps.ALayoutConstraint)

Example 23 with ALayoutConstraint

use of org.compiere.apps.ALayoutConstraint 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 24 with ALayoutConstraint

use of org.compiere.apps.ALayoutConstraint 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)

Aggregations

ALayoutConstraint (org.compiere.apps.ALayoutConstraint)24 Dimension (java.awt.Dimension)11 ALayout (org.compiere.apps.ALayout)10 VLookup (org.compiere.grid.ed.VLookup)9 CLabel (org.compiere.swing.CLabel)8 CPanel (org.compiere.swing.CPanel)7 BorderLayout (java.awt.BorderLayout)5 CComboBox (org.compiere.swing.CComboBox)5 JScrollPane (javax.swing.JScrollPane)3 MAttributeSet (org.compiere.model.MAttributeSet)3 ButtonGroup (javax.swing.ButtonGroup)2 JCheckBox (javax.swing.JCheckBox)2 JRadioButton (javax.swing.JRadioButton)2 TitledBorder (javax.swing.border.TitledBorder)2 VComboBox (org.compiere.grid.ed.VComboBox)2 VNumber (org.compiere.grid.ed.VNumber)2 VString (org.compiere.grid.ed.VString)2 ColumnInfo (org.compiere.minigrid.ColumnInfo)2 KeyNamePair (org.compiere.util.KeyNamePair)2 Component (java.awt.Component)1