Search in sources :

Example 11 with CLabel

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

the class VBrowserSearch method formatEditor.

@Override
public void formatEditor(CEditor editor1, CEditor editor2) {
    log.fine("");
    VEditor editor = (VEditor) editor1;
    VEditor editorTo = (VEditor) editor2;
    if (editor == null) {
        return;
    }
    configColumns(editor, editorTo);
    //  Create label
    CLabel label = VEditorFactory.getLabel(editor.getField());
    if (label == null) {
        //	left gap
        centerPanel.add(Box.createHorizontalStrut(12), new ALayoutConstraint(row, cols++));
    } else {
        centerPanel.add(label, new ALayoutConstraint(row, cols++));
    }
    //
    centerPanel.add((Component) editor, new ALayoutConstraint(row, cols++));
    //	To
    if (editorTo == null) {
        m_separators.add(null);
        return;
    }
    //	Add
    CLabel dash = new CLabel(" - ");
    centerPanel.add(dash, new ALayoutConstraint(row, cols++));
    m_separators.add(dash);
    //
    centerPanel.add((Component) editorTo, new ALayoutConstraint(row, cols++));
}
Also used : CLabel(org.compiere.swing.CLabel) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) VEditor(org.compiere.grid.ed.VEditor)

Example 12 with CLabel

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

the class POSQuantityPanel method init.

@Override
protected void init() {
    //	Content
    setLayout(new GridBagLayout());
    //	Button Panel
    buttonPanel = new CPanel(new GridBagLayout());
    //	
    topPadding = 0;
    leftPadding = 1;
    bottonPadding = 0;
    rightPadding = 1;
    buttonDelete = createButtonAction("Cancel", KeyStroke.getKeyStroke(KeyEvent.VK_F3, Event.CTRL_MASK));
    buttonDelete.setToolTipText("CTL+F3-" + Msg.translate(ctx, "DeleteLine"));
    buttonDelete.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonDelete.addActionListener(posPanel.getUserPinListener());
    buttonPanel.add(buttonDelete, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    buttonPlus = createButtonAction("Plus", KeyStroke.getKeyStroke(KeyEvent.VK_1, Event.CTRL_MASK));
    buttonPlus.setToolTipText("CTL+1-" + Msg.translate(ctx, "add"));
    buttonPlus.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonPanel.add(buttonPlus, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    buttonMinus = createButtonAction("Minus", KeyStroke.getKeyStroke(KeyEvent.VK_0, Event.CTRL_MASK));
    // TODO: Create message for decrementing qty by 1
    buttonMinus.setToolTipText("CTL+0-" + Msg.translate(ctx, "decrement"));
    buttonMinus.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonPanel.add(buttonMinus, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    buttonUp = createButtonAction("Previous", KeyStroke.getKeyStroke(KeyEvent.VK_UP, Event.ALT_MASK));
    buttonUp.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonUp.setToolTipText("ALT+up-" + Msg.translate(ctx, "Previous"));
    buttonPanel.add(buttonUp, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    buttonDown = createButtonAction("Next", KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, Event.ALT_MASK));
    buttonDown.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonDown.setToolTipText("ALT+down-" + Msg.translate(ctx, "Next"));
    buttonPanel.add(buttonDown, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    if (posPanel.isPresentElectronicScales()) {
        buttonScales = createButtonAction("Calculator", KeyStroke.getKeyStroke(KeyEvent.VK_W, Event.CTRL_MASK));
        buttonScales.setToolTipText("ALT+down-" + Msg.translate(ctx, "Calculator"));
        buttonScales.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
        buttonPanel.add(buttonScales, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
        buttonScales.addActionListener(posPanel.getScalesListener());
    }
    CLabel qtyLabel = new CLabel(Msg.translate(Env.getCtx(), "Qty"));
    qtyLabel.setDisplayedMnemonic(KeyEvent.VK_Q);
    buttonPanel.add(qtyLabel, new GridBagConstraints(6, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    Dimension preferredSize = new Dimension(70, posPanel.getButtonSize());
    Dimension minimumSize = new Dimension(70, posPanel.getButtonSize());
    //
    fieldQuantity = new VNumber();
    fieldQuantity.addActionListener(this);
    fieldQuantity.setFont(posPanel.getFont());
    fieldQuantity.setPreferredSize(preferredSize);
    fieldQuantity.setMinimumSize(minimumSize);
    fieldQuantity.setDisplayType(DisplayType.Quantity);
    fieldQuantity.setValue(Env.ZERO);
    qtyLabel.setLabelFor(fieldQuantity);
    buttonPanel.add(fieldQuantity, new GridBagConstraints(7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    CLabel priceLabel = new CLabel(Msg.translate(Env.getCtx(), "Price"));
    priceLabel.setDisplayedMnemonic(KeyEvent.VK_P);
    buttonPanel.add(priceLabel, new GridBagConstraints(8, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    //
    fieldPrice = new VNumber();
    fieldPrice.setValue(Env.ZERO);
    fieldPrice.setFont(posPanel.getFont());
    fieldPrice.setName(priceLabel.getName());
    fieldPrice.setPreferredSize(preferredSize);
    fieldPrice.setMinimumSize(minimumSize);
    fieldPrice.addActionListener(this);
    if (!posPanel.isModifyPrice())
        fieldPrice.setReadWrite(false);
    else {
        fieldPrice.addActionListener(posPanel.getUserPinListener());
        fieldPrice.addActionListener(this);
    }
    priceLabel.setLabelFor(fieldPrice);
    buttonPanel.add(fieldPrice, new GridBagConstraints(9, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    CLabel discountPercentageLabel = new CLabel(Msg.translate(Env.getCtx(), "Discount"));
    discountPercentageLabel.setDisplayedMnemonic(KeyEvent.VK_T);
    buttonPanel.add(discountPercentageLabel, new GridBagConstraints(10, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    fieldDiscountPercentage = new VNumber();
    fieldDiscountPercentage.setValue(Env.ZERO);
    fieldDiscountPercentage.addActionListener(this);
    fieldDiscountPercentage.setName(discountPercentageLabel.getName());
    fieldDiscountPercentage.setFont(posPanel.getFont());
    fieldDiscountPercentage.setPreferredSize(preferredSize);
    fieldDiscountPercentage.setMinimumSize(minimumSize);
    if (!posPanel.isModifyPrice())
        fieldDiscountPercentage.setReadWrite(false);
    else {
        fieldDiscountPercentage.addActionListener(posPanel.getUserPinListener());
        fieldDiscountPercentage.addActionListener(this);
    }
    discountPercentageLabel.setLabelFor(fieldDiscountPercentage);
    buttonPanel.add(fieldDiscountPercentage, new GridBagConstraints(11, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    add(buttonPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(11, 0, 0, 0), 0, 0));
    changeStatus(false);
}
Also used : CLabel(org.compiere.swing.CLabel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) CPanel(org.compiere.swing.CPanel) VNumber(org.compiere.grid.ed.VNumber) Dimension(java.awt.Dimension)

Example 13 with CLabel

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

the class QueryBPartner method init.

/**
	 * 	Set up Panel
	 */
protected void init() {
    setTitle(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
    //	North
    parameterPanel.setLayout(new MigLayout("fill", "", "[50][50][]"));
    parameterPanel.setBorder(new TitledBorder(Msg.getMsg(ctx, "Query")));
    CLabel labelValue = new CLabel(Msg.translate(ctx, "Value"));
    parameterPanel.add(labelValue, " growy");
    fieldValue = new POSTextField("", posPanel.getKeyboard());
    labelValue.setLabelFor(fieldValue);
    parameterPanel.add(fieldValue, "h 30, w 200");
    fieldValue.addActionListener(this);
    CLabel labelTaxID = new CLabel(Msg.translate(ctx, "TaxID"));
    parameterPanel.add(labelTaxID, " growy");
    fieldTaxID = new POSTextField("", posPanel.getKeyboard());
    labelTaxID.setLabelFor(fieldTaxID);
    parameterPanel.add(fieldTaxID, "h 30, w 200");
    fieldTaxID.addActionListener(this);
    //
    CLabel labelContact = new CLabel(Msg.translate(ctx, "Contact"));
    parameterPanel.add(labelContact, " growy");
    fieldContact = new POSTextField("", posPanel.getKeyboard());
    labelContact.setLabelFor(fieldContact);
    parameterPanel.add(fieldContact, "h 30, w 200");
    fieldContact.addActionListener(this);
    //
    CLabel labelPhone = new CLabel(Msg.translate(ctx, "Phone"));
    parameterPanel.add(labelPhone, " growy");
    fieldPhone = new POSTextField("", posPanel.getKeyboard());
    labelPhone.setLabelFor(fieldPhone);
    parameterPanel.add(fieldPhone, "h 30, w 200, wrap");
    fieldPhone.addActionListener(this);
    //
    CLabel labelName = new CLabel(Msg.translate(ctx, "Name"));
    parameterPanel.add(labelName, " growy");
    fieldName = new POSTextField("", posPanel.getKeyboard());
    labelName.setLabelFor(fieldName);
    parameterPanel.add(fieldName, "h 30, w 200");
    fieldName.addActionListener(this);
    CLabel labelName2 = new CLabel(Msg.translate(ctx, "Name2"));
    parameterPanel.add(labelName2, " growy");
    fieldName2 = new POSTextField("", posPanel.getKeyboard());
    labelName2.setLabelFor(fieldName2);
    parameterPanel.add(fieldName2, "h 30, w 200");
    fieldName2.addActionListener(this);
    //
    CLabel labelEmail = new CLabel(Msg.translate(ctx, "Email"));
    parameterPanel.add(labelEmail, " growy");
    fieldEmail = new POSTextField("", posPanel.getKeyboard());
    labelEmail.setLabelFor(fieldEmail);
    parameterPanel.add(fieldEmail, "h 30, w 200");
    fieldEmail.addActionListener(this);
    //
    CLabel labelCity = new CLabel(Msg.translate(ctx, "City"));
    parameterPanel.add(labelCity, " growy");
    fieldCity = new POSTextField("", posPanel.getKeyboard());
    labelCity.setLabelFor(fieldCity);
    parameterPanel.add(fieldCity, "h 30, w 200");
    fieldCity.addActionListener(this);
    //	Center
    posTable.prepareTable(s_layout, sqlFrom, sqlWhere, false, "RV_BPartner");
    //	
    posTable.growScrollbars();
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            fieldValue.requestFocus();
        }
    });
    addNewAction();
}
Also used : CLabel(org.compiere.swing.CLabel) POSTextField(org.adempiere.pos.POSTextField) MigLayout(net.miginfocom.swing.MigLayout) TitledBorder(javax.swing.border.TitledBorder)

Example 14 with CLabel

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

the class Find method addSelectionColumn.

//	initFind
/**
	 * 	Add Selection Column to first Tab
	 * 	@param mField field
	 */
private void addSelectionColumn(GridField mField) {
    log.config(mField.getHeader());
    int displayLength = mField.getDisplayLength();
    if (displayLength > FIELDLENGTH)
        mField.setDisplayLength(FIELDLENGTH);
    else
        displayLength = 0;
    //	Editor
    VEditor editor = null;
    //#221
    VEditor editor2 = null;
    CLabel label = null;
    if (mField.isLookup()) {
        VLookup vl = new VLookup(mField.getColumnName(), false, false, true, mField.getLookup());
        //setting mField to avoid NPE
        vl.setField(mField);
        vl.setName(mField.getColumnName());
        editor = vl;
        //
        if (//	set it back
        displayLength > 0)
            mField.setDisplayLength(displayLength);
        //
        label = VEditorFactory.getLabel(mField);
        //m_sLine++;
        int lpos = 1;
        int fpos = 2;
        if (isTwoColumns) {
            if (!isPair) {
                lpos = 1;
                fpos = 2;
                m_sLine++;
            } else {
                lpos = 3;
                fpos = 4;
            }
        } else {
            lpos = 1;
            fpos = 2;
            m_sLine++;
        }
        if (//	may be null for Y/N
        label != null)
            scontentPanel.add(label, new GridBagConstraints(lpos, m_sLine, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(7, 5, 5, 5), 0, 0));
        scontentPanel.add((Component) editor, new GridBagConstraints(fpos, m_sLine, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    } else {
        if (mField.isRangeLookup()) {
            new Box(BoxLayout.X_AXIS);
            Box box = Box.createHorizontalBox();
            editor = VEditorFactory.getEditor(mField, false);
            label = VEditorFactory.getLabel(mField);
            editor.setMandatory(false);
            editor.setReadWrite(true);
            box.add((Component) editor);
            //#221
            editor2 = VEditorFactory.getEditor(mField, false);
            editor2.setMandatory(false);
            editor2.setReadWrite(true);
            if (editor2 instanceof CTextField) {
                ((CTextField) editor2).addActionListener(this);
            }
            CLabel separator = new CLabel(" - ");
            box.add(separator);
            box.add((Component) editor2);
            if (//	set it back
            displayLength > 0)
                mField.setDisplayLength(displayLength);
            int lpos = 1;
            int fpos = 2;
            if (isTwoColumns) {
                if (!isPair) {
                    lpos = 1;
                    fpos = 2;
                    m_sLine++;
                } else {
                    lpos = 3;
                    fpos = 4;
                }
            } else {
                lpos = 1;
                fpos = 2;
                m_sLine++;
            }
            if (//	may be null for Y/N
            label != null)
                scontentPanel.add(label, new GridBagConstraints(lpos, m_sLine, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(7, 5, 5, 5), 0, 0));
            scontentPanel.add((Component) box, new GridBagConstraints(fpos, m_sLine, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
        } else {
            editor = VEditorFactory.getEditor(mField, false);
            editor.setMandatory(false);
            editor.setReadWrite(true);
            label = VEditorFactory.getLabel(mField);
            //
            if (//	set it back
            displayLength > 0)
                mField.setDisplayLength(displayLength);
            int lpos = 1;
            int fpos = 2;
            if (isTwoColumns) {
                if (!isPair) {
                    lpos = 1;
                    fpos = 2;
                    m_sLine++;
                } else {
                    lpos = 3;
                    fpos = 4;
                }
            } else {
                lpos = 1;
                fpos = 2;
                m_sLine++;
            }
            //
            label = VEditorFactory.getLabel(mField);
            //m_sLine++;
            if (//	may be null for Y/N
            label != null)
                scontentPanel.add(label, new GridBagConstraints(lpos, m_sLine, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(7, 5, 5, 5), 0, 0));
            scontentPanel.add((Component) editor, new GridBagConstraints(fpos, m_sLine, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
        }
    }
    // Add action listener to custom text fields - teo_sarca [ 1709292 ]
    if (editor instanceof CTextField) {
        ((CTextField) editor).addActionListener(this);
    }
    m_sEditors.add(editor);
    // #221
    m_sEditors2.add(editor2);
}
Also used : CLabel(org.compiere.swing.CLabel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) CTextField(org.compiere.swing.CTextField) VLookup(org.compiere.grid.ed.VLookup) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) CComboBox(org.compiere.swing.CComboBox) VEditor(org.compiere.grid.ed.VEditor)

Example 15 with CLabel

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

the class VPAttributeDialog method initAttributes.

//	jbInit
/**
	 *	Dyanmic Init.
	 *  @return true if initialized
	 */
private boolean initAttributes() {
    if (m_M_Product_ID == 0 && !m_productWindow)
        return false;
    MAttributeSet as = null;
    if (m_M_Product_ID != 0) {
        //	Get Model
        m_product = MProduct.get(Env.getCtx(), m_M_Product_ID);
        if (m_product.getM_AttributeSetInstance_ID() > 0) {
            m_productASI = true;
            //  The product has an instance associated with it.
            if (m_M_AttributeSetInstance_ID != m_product.getM_AttributeSetInstance_ID()) {
                log.fine("Different ASI than what is specified on Product!");
            }
        } else {
            // Only show product attributes when in the product window.
            m_productASI = m_productWindow;
        }
        m_masi = MAttributeSetInstance.get(Env.getCtx(), m_M_AttributeSetInstance_ID, m_M_Product_ID);
        if (m_masi == null) {
            log.severe("No Model for M_AttributeSetInstance_ID=" + m_M_AttributeSetInstance_ID + ", M_Product_ID=" + m_M_Product_ID);
            return false;
        }
        Env.setContext(Env.getCtx(), m_WindowNo, "M_AttributeSet_ID", m_masi.getM_AttributeSet_ID());
        //	Get Attribute Set
        as = m_masi.getMAttributeSet();
    } else {
        int M_AttributeSet_ID = Env.getContextAsInt(Env.getCtx(), m_WindowNoParent, "M_AttributeSet_ID");
        m_masi = new MAttributeSetInstance(Env.getCtx(), 0, M_AttributeSet_ID, null);
        as = m_masi.getMAttributeSet();
    }
    //	Product has no Attribute Set
    if (as == null) {
    //ADialog.error(m_WindowNo, this, "PAttributeNoAttributeSet");
    //return false;
    }
    //  always read/write.  The two are exclusive and can't co-exist.  
    if (//	Set Instance Attributes and dialog controls
    !m_productWindow || !m_productASI) {
        if (// Instance attributes possible.  Set up controls.
        !m_productASI) {
            //	New/Edit - Selection
            if (//	new
            m_M_AttributeSetInstance_ID == 0)
                cbNewEdit.setText(Msg.getMsg(Env.getCtx(), "NewRecord"));
            else
                cbNewEdit.setText(Msg.getMsg(Env.getCtx(), "EditRecord"));
            cbNewEdit.addActionListener(this);
            centerPanel.add(cbNewEdit, new ALayoutConstraint(m_row++, 0));
            bSelect.setText(Msg.getMsg(Env.getCtx(), "SelectExisting"));
            bSelect.addActionListener(this);
            centerPanel.add(bSelect, null);
        }
        //	Add the Instance Attributes if any.  If its a product attribute set
        //  this will do nothing.
        MAttribute[] attributes = as.getMAttributes(true);
        log.fine("Instance Attributes=" + attributes.length);
        for (int i = 0; i < attributes.length; i++) addAttributeLine(attributes[i], false, false);
    }
    if (as != null) {
        //  Product attributes can be shown in any window but are read/write in the Product window only.
        //  This will do nothing if it is an instance attribute set. 
        // False = product attribute instances
        MAttribute[] attributes = as.getMAttributes(false);
        log.fine("Product Attributes=" + attributes.length);
        for (int i = 0; i < attributes.length; i++) addAttributeLine(attributes[i], true, !m_productWindow);
    }
    //	Lot
    if ((!m_productWindow || !m_productASI) && as.isLot()) {
        CLabel label = new CLabel(Msg.translate(Env.getCtx(), "Lot"));
        label.setLabelFor(fieldLotString);
        centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
        centerPanel.add(fieldLotString, null);
        fieldLotString.setText(m_masi.getLot());
        //	M_Lot_ID
        //	int AD_Column_ID = 9771;	//	M_AttributeSetInstance.M_Lot_ID
        //	fieldLot = new VLookup ("M_Lot_ID", false,false, true, 
        //		MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, AD_Column_ID, DisplayType.TableDir));
        String sql = "SELECT M_Lot_ID, Name " + "FROM M_Lot l " + "WHERE EXISTS (SELECT M_Product_ID FROM M_Product p " + "WHERE p.M_AttributeSet_ID=" + m_masi.getM_AttributeSet_ID() + " AND p.M_Product_ID=l.M_Product_ID)";
        fieldLot = new CComboBox(DB.getKeyNamePairs(sql, true));
        label = new CLabel(Msg.translate(Env.getCtx(), "M_Lot_ID"));
        label.setLabelFor(fieldLot);
        centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
        centerPanel.add(fieldLot, null);
        if (m_masi.getM_Lot_ID() != 0) {
            for (int i = 1; i < fieldLot.getItemCount(); i++) {
                KeyNamePair pp = (KeyNamePair) fieldLot.getItemAt(i);
                if (pp.getKey() == m_masi.getM_Lot_ID()) {
                    fieldLot.setSelectedIndex(i);
                    fieldLotString.setEditable(false);
                    break;
                }
            }
        }
        fieldLot.addActionListener(this);
        //	New Lot Button
        if (m_masi.getMAttributeSet().getM_LotCtl_ID() != 0 && m_readWrite) {
            if (MRole.getDefault().isTableAccess(MLot.Table_ID, false) && MRole.getDefault().isTableAccess(MLotCtl.Table_ID, false) && !m_masi.isExcludeLot(m_AD_Column_ID, Env.isSOTrx(Env.getCtx(), m_WindowNoParent))) {
                centerPanel.add(bLot, null);
                bLot.addActionListener(this);
            }
        }
        //	Popup 
        //  popup
        fieldLot.addMouseListener(new VPAttributeDialog_mouseAdapter(this));
        mZoom = new CMenuItem(Msg.getMsg(Env.getCtx(), "Zoom"), Env.getImageIcon("Zoom16.gif"));
        mZoom.addActionListener(this);
        popupMenu.add(mZoom);
    }
    //	SerNo
    if ((!m_productWindow || !m_productASI) && as.isSerNo()) {
        CLabel label = new CLabel(Msg.translate(Env.getCtx(), "SerNo"));
        label.setLabelFor(fieldSerNo);
        fieldSerNo.setText(m_masi.getSerNo());
        centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
        centerPanel.add(fieldSerNo, null);
        //	New SerNo Button
        if (m_masi.getMAttributeSet().getM_SerNoCtl_ID() != 0 && m_readWrite) {
            if (MRole.getDefault().isTableAccess(MSerNoCtl.Table_ID, false) && !m_masi.isExcludeSerNo(m_AD_Column_ID, Env.isSOTrx(Env.getCtx(), m_WindowNoParent))) {
                centerPanel.add(bSerNo, null);
                bSerNo.addActionListener(this);
            }
        }
    }
    //	GuaranteeDate
    if ((!m_productWindow || !m_productASI) && as.isGuaranteeDate()) {
        CLabel label = new CLabel(Msg.translate(Env.getCtx(), "GuaranteeDate"));
        label.setLabelFor(fieldGuaranteeDate);
        if (m_M_AttributeSetInstance_ID == 0)
            fieldGuaranteeDate.setValue(m_masi.getGuaranteeDate(true));
        else
            fieldGuaranteeDate.setValue(m_masi.getGuaranteeDate());
        centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
        centerPanel.add(fieldGuaranteeDate, null);
    }
    if (m_row == 0) {
        ADialog.error(m_WindowNo, this, "PAttributeNoInfo");
    //return false;
    }
    //	New/Edit Window
    if ((!m_productWindow || !m_productASI) && m_AD_Column_ID != 0 && m_readWrite) {
        cbNewEdit.setSelected(m_M_AttributeSetInstance_ID == 0);
        cmd_newEdit();
    }
    //	Attribute Set Instance Description
    CLabel label = new CLabel(Msg.translate(Env.getCtx(), "Description"));
    label.setLabelFor(fieldDescription);
    fieldDescription.setText(m_masi.getDescription());
    fieldDescription.setEditable(false);
    centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
    centerPanel.add(fieldDescription, null);
    //	Window usually to wide (??)
    Dimension dd = centerPanel.getPreferredSize();
    dd.width = Math.min(500, dd.width);
    centerPanel.setPreferredSize(dd);
    return true;
}
Also used : CLabel(org.compiere.swing.CLabel) CComboBox(org.compiere.swing.CComboBox) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) Dimension(java.awt.Dimension) MAttributeSetInstance(org.compiere.model.MAttributeSetInstance) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) MAttributeSet(org.compiere.model.MAttributeSet) CMenuItem(org.compiere.swing.CMenuItem) KeyNamePair(org.compiere.util.KeyNamePair) MAttribute(org.compiere.model.MAttribute)

Aggregations

CLabel (org.compiere.swing.CLabel)36 CPanel (org.compiere.swing.CPanel)14 Dimension (java.awt.Dimension)12 GridBagConstraints (java.awt.GridBagConstraints)10 Insets (java.awt.Insets)10 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)8 BorderLayout (java.awt.BorderLayout)7 CComboBox (org.compiere.swing.CComboBox)7 GridBagLayout (java.awt.GridBagLayout)6 TitledBorder (javax.swing.border.TitledBorder)6 Component (java.awt.Component)5 JScrollPane (javax.swing.JScrollPane)5 MigLayout (net.miginfocom.swing.MigLayout)5 Font (java.awt.Font)3 JRadioButton (javax.swing.JRadioButton)3 POSTextField (org.adempiere.pos.POSTextField)3 AppsAction (org.compiere.apps.AppsAction)3 VEditor (org.compiere.grid.ed.VEditor)3 VLookup (org.compiere.grid.ed.VLookup)3 VNumber (org.compiere.grid.ed.VNumber)3