Search in sources :

Example 16 with ALayoutConstraint

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

the class InfoGeneral method statInit.

/**
	 *	Static Setup - add fields to parameterPanel (GridLayout)
	 */
private void statInit() {
    label1.setLabelFor(textField1);
    label1.setText("Label1");
    label1.setHorizontalAlignment(JLabel.LEADING);
    textField1.setBackground(AdempierePLAF.getInfoBackground());
    label2.setLabelFor(textField2);
    label2.setText("Label2");
    label2.setHorizontalAlignment(JLabel.LEADING);
    textField2.setBackground(AdempierePLAF.getInfoBackground());
    label3.setLabelFor(textField3);
    label3.setText("Label3");
    label3.setHorizontalAlignment(JLabel.LEADING);
    textField3.setBackground(AdempierePLAF.getInfoBackground());
    label4.setLabelFor(textField4);
    label4.setText("Label4");
    label4.setHorizontalAlignment(JLabel.LEADING);
    textField4.setBackground(AdempierePLAF.getInfoBackground());
    //
    p_criteriaGrid.setLayout(new ALayout());
    p_criteriaGrid.add(label1, new ALayoutConstraint(0, 0));
    p_criteriaGrid.add(label2, null);
    p_criteriaGrid.add(label3, null);
    p_criteriaGrid.add(label4, null);
    //
    p_criteriaGrid.add(textField1, new ALayoutConstraint(1, 0));
    p_criteriaGrid.add(textField2, null);
    p_criteriaGrid.add(textField3, null);
    p_criteriaGrid.add(textField4, null);
}
Also used : ALayoutConstraint(org.compiere.apps.ALayoutConstraint) ALayout(org.compiere.apps.ALayout)

Example 17 with ALayoutConstraint

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

the class PAttributeInstance method jbInit.

/**
	 * 	Static Init
	 * 	@throws Exception
	 */
private void jbInit() throws Exception {
    mainPanel.setLayout(mainLayout);
    this.getContentPane().add(mainPanel, BorderLayout.CENTER);
    //	North
    northPanel.setLayout(new ALayout());
    northPanel.add(showAll, new ALayoutConstraint(0, 0));
    showAll.addActionListener(this);
    this.getContentPane().add(northPanel, BorderLayout.NORTH);
    //	Center
    mainPanel.add(centerScrollPane, BorderLayout.CENTER);
    centerScrollPane.getViewport().add(m_table, null);
    //	South
    mainPanel.add(confirmPanel, BorderLayout.SOUTH);
    mainPanel.setPreferredSize(new Dimension(SCREEN_WIDTH, SCREEN_HEIGHT));
    confirmPanel.addActionListener(this);
}
Also used : ALayoutConstraint(org.compiere.apps.ALayoutConstraint) Dimension(java.awt.Dimension) ALayout(org.compiere.apps.ALayout)

Example 18 with ALayoutConstraint

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

the class InfoPAttribute method addAttributes.

//	dynInit
/**
	 * 	Add Attributes
	 *	@return rows
	 */
private int addAttributes() {
    int row = 0;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String whereAttributeSet;
    if (p_M_AttributeSet_ID > 0)
        whereAttributeSet = "AND M_Attribute_ID IN (SELECT M_Attribute_ID FROM M_AttributeUse WHERE M_AttributeSet_ID=" + p_M_AttributeSet_ID + ")";
    else
        whereAttributeSet = "";
    String sql = MRole.getDefault().addAccessSQL("SELECT M_Attribute_ID, Name, Description, AttributeValueType, IsInstanceAttribute " + "FROM M_Attribute " + "WHERE IsActive='Y' " + whereAttributeSet + " ORDER BY IsInstanceAttribute, Name", "M_Attribute", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
    boolean instanceLine = false;
    boolean productLine = false;
    try {
        pstmt = DB.prepareStatement(sql, null);
        rs = pstmt.executeQuery();
        while (rs.next()) {
            int attribute_ID = rs.getInt(1);
            String name = rs.getString(2);
            String description = rs.getString(3);
            String attributeValueType = rs.getString(4);
            boolean isInstanceAttribute = "Y".equals(rs.getString(5));
            // Add label for product attributes if there are any
            if (!productLine && !isInstanceAttribute) {
                CPanel group = new CPanel();
                group.setBorder(new VLine(Msg.translate(Env.getCtx(), "IsProductAttribute")));
                group.add(Box.createVerticalStrut(VLine.SPACE));
                centerPanel.add(group, new ALayoutConstraint(row++, 0));
                productLine = true;
            }
            //	Add label for Instances attributes
            if (!instanceLine && isInstanceAttribute) {
                CPanel group = new CPanel();
                group.add(Box.createVerticalStrut(VLine.SPACE));
                group.setBorder(new VLine(Msg.translate(Env.getCtx(), "IsInstanceAttribute")));
                group.add(Box.createVerticalStrut(VLine.SPACE));
                centerPanel.add(group, new ALayoutConstraint(row++, 0));
                instanceLine = true;
            }
            //
            CLabel label = new CLabel(name);
            if (description != null && description.length() > 0)
                label.setToolTipText(description);
            centerPanel.add(label, new ALayoutConstraint(row++, 0));
            Component field = null;
            if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(attributeValueType))
                field = new VComboBox(getAttributeList(attribute_ID));
            else if (MAttribute.ATTRIBUTEVALUETYPE_Number.equals(attributeValueType))
                field = new VNumber(name, false, false, true, DisplayType.Number, name);
            else
                field = new VString(name, false, false, true, 10, 40, null, null);
            label.setLabelFor(field);
            centerPanel.add(field, null);
            //
            field.setName(String.valueOf(attribute_ID));
            if (isInstanceAttribute)
                m_instanceEditors.add(field);
            else
                m_productEditors.add(field);
            //	To (numbers)
            Component fieldTo = null;
            if (MAttribute.ATTRIBUTEVALUETYPE_Number.equals(attributeValueType)) {
                fieldTo = new VNumber(name, false, false, true, DisplayType.Number, name);
                centerPanel.add(new CLabel("-"), null);
                centerPanel.add(fieldTo, null);
            }
            if (isInstanceAttribute)
                m_instanceEditorsTo.add(fieldTo);
            else
                m_productEditorsTo.add(fieldTo);
        }
    } catch (Exception e) {
        log.log(Level.SEVERE, sql, e);
    } finally {
        DB.close(rs, pstmt);
        rs = null;
        pstmt = null;
    }
    // print instance line if not printed
    if (!instanceLine) {
        boolean isGuarantee = true;
        boolean isSerial = true;
        boolean isLot = true;
        if (p_M_AttributeSet_ID > 0) {
            MAttributeSet as = new MAttributeSet(Env.getCtx(), p_M_AttributeSet_ID, null);
            isGuarantee = as.isGuaranteeDate();
            isSerial = as.isSerNo();
            isLot = as.isLot();
        }
        if (isGuarantee || isSerial || isLot) {
            CPanel group = new CPanel();
            group.setBorder(new VLine(Msg.translate(Env.getCtx(), "IsInstanceAttribute")));
            group.add(Box.createVerticalStrut(VLine.SPACE));
            centerPanel.add(group, new ALayoutConstraint(row++, 0));
            instanceLine = true;
        }
    }
    return row;
}
Also used : CLabel(org.compiere.swing.CLabel) CPanel(org.compiere.swing.CPanel) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) PreparedStatement(java.sql.PreparedStatement) VLine(org.compiere.grid.ed.VLine) VNumber(org.compiere.grid.ed.VNumber) VString(org.compiere.grid.ed.VString) VComboBox(org.compiere.grid.ed.VComboBox) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) MAttributeSet(org.compiere.model.MAttributeSet) VString(org.compiere.grid.ed.VString) ResultSet(java.sql.ResultSet) Component(java.awt.Component)

Example 19 with ALayoutConstraint

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

the class InfoInvoice method statInit.

/**
	 *	Static Setup - add fields to parameterPanel
	 */
private void statInit() {
    lDocumentNo.setLabelFor(fDocumentNo);
    fDocumentNo.setBackground(AdempierePLAF.getInfoBackground());
    fDocumentNo.addActionListener(this);
    lDescription.setLabelFor(fDescription);
    fDescription.setBackground(AdempierePLAF.getInfoBackground());
    fDescription.addActionListener(this);
    fIsPaid.setSelected(false);
    fIsPaid.addActionListener(this);
    fIsSOTrx.setSelected(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
    fIsSOTrx.addActionListener(this);
    //
    //	C_Invoice.C_BPartner_ID
    fBPartner_ID = new VLookup("C_BPartner_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MInvoice.Table_Name, MInvoice.COLUMNNAME_C_BPartner_ID), DisplayType.Search));
    lBPartner_ID.setLabelFor(fBPartner_ID);
    fBPartner_ID.setBackground(AdempierePLAF.getInfoBackground());
    fBPartner_ID.addActionListener(this);
    //	C_Invoice.C_Order_ID
    fOrder_ID = new VLookup("C_Order_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MInvoice.Table_Name, MInvoice.COLUMNNAME_C_Order_ID), DisplayType.Search));
    lOrder_ID.setLabelFor(fOrder_ID);
    fOrder_ID.setBackground(AdempierePLAF.getInfoBackground());
    fOrder_ID.addActionListener(this);
    //
    lDateFrom.setLabelFor(fDateFrom);
    fDateFrom.setBackground(AdempierePLAF.getInfoBackground());
    fDateFrom.setToolTipText(Msg.translate(Env.getCtx(), "DateFrom"));
    lDateTo.setLabelFor(fDateTo);
    fDateTo.setBackground(AdempierePLAF.getInfoBackground());
    fDateTo.setToolTipText(Msg.translate(Env.getCtx(), "DateTo"));
    lAmtFrom.setLabelFor(fAmtFrom);
    fAmtFrom.setBackground(AdempierePLAF.getInfoBackground());
    fAmtFrom.setToolTipText(Msg.translate(Env.getCtx(), "AmtFrom"));
    lAmtTo.setLabelFor(fAmtTo);
    fAmtTo.setBackground(AdempierePLAF.getInfoBackground());
    fAmtTo.setToolTipText(Msg.translate(Env.getCtx(), "AmtTo"));
    //
    CPanel amtPanel = new CPanel();
    CPanel datePanel = new CPanel();
    amtPanel.setLayout(new ALayout(0, 0, true));
    amtPanel.add(fAmtFrom, new ALayoutConstraint(0, 0));
    amtPanel.add(lAmtTo, null);
    amtPanel.add(fAmtTo, null);
    datePanel.setLayout(new ALayout(0, 0, true));
    datePanel.add(fDateFrom, new ALayoutConstraint(0, 0));
    datePanel.add(lDateTo, null);
    datePanel.add(fDateTo, null);
    //  First Row
    p_criteriaGrid.add(lDocumentNo, new ALayoutConstraint(0, 0));
    p_criteriaGrid.add(fDocumentNo, null);
    p_criteriaGrid.add(lBPartner_ID, null);
    p_criteriaGrid.add(fBPartner_ID, null);
    p_criteriaGrid.add(fIsSOTrx, new ALayoutConstraint(0, 5));
    //  2nd Row
    p_criteriaGrid.add(lDescription, new ALayoutConstraint(1, 0));
    p_criteriaGrid.add(fDescription, null);
    p_criteriaGrid.add(lDateFrom, null);
    p_criteriaGrid.add(datePanel, null);
    p_criteriaGrid.add(fIsPaid, new ALayoutConstraint(1, 5));
    //  3rd Row
    p_criteriaGrid.add(lOrder_ID, new ALayoutConstraint(2, 0));
    p_criteriaGrid.add(fOrder_ID, null);
    p_criteriaGrid.add(lAmtFrom, null);
    p_criteriaGrid.add(amtPanel, null);
    m_sqlSchedule = scheduleTbl.prepareTable(s_subLayout, s_subFrom, s_subWhere, false, "i");
    scheduleTbl.setRowSelectionAllowed(true);
    scheduleTbl.setMultiSelection(false);
    scheduleTbl.addMouseListener(this);
    scheduleTbl.setShowTotals(true);
    scheduleTbl.autoSize();
    tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110));
    tablePanel.setLayout(new BorderLayout());
    tablePanel.add(new JScrollPane(scheduleTbl), BorderLayout.CENTER);
    //  Add the details to the p_detailPanel
    p_detailTaskPane.setTitle(Msg.translate(Env.getCtx(), "C_InvoicePaySchedule_ID"));
    p_detailTaskPane.add(tablePanel, BorderLayout.CENTER);
    p_detailTaskPane.setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) BorderLayout(java.awt.BorderLayout) VLookup(org.compiere.grid.ed.VLookup) CPanel(org.compiere.swing.CPanel) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) Dimension(java.awt.Dimension) ALayout(org.compiere.apps.ALayout)

Example 20 with ALayoutConstraint

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

the class InfoAsset method statInit.

/**
	 *	Static Setup - add fields to parameterPanel
	 */
private void statInit() {
    labelValue.setText(Msg.getMsg(Env.getCtx(), "Value"));
    fieldValue.setBackground(AdempierePLAF.getInfoBackground());
    fieldValue.addActionListener(this);
    labelName.setText(Msg.getMsg(Env.getCtx(), "Name"));
    fieldName.setBackground(AdempierePLAF.getInfoBackground());
    fieldName.addActionListener(this);
    //	From A_Asset.
    fBPartner_ID = new VLookup("C_BPartner_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(I_A_Asset.Table_Name, I_A_Asset.COLUMNNAME_C_BPartner_ID), DisplayType.Search));
    lBPartner_ID.setLabelFor(fBPartner_ID);
    fBPartner_ID.setBackground(AdempierePLAF.getInfoBackground());
    fBPartner_ID.addActionListener(this);
    fProduct_ID = new VLookup("M_Product_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(I_A_Asset.Table_Name, I_A_Asset.COLUMNNAME_M_Product_ID), DisplayType.Search));
    lProduct_ID.setLabelFor(fProduct_ID);
    fProduct_ID.setBackground(AdempierePLAF.getInfoBackground());
    fProduct_ID.addActionListener(this);
    //
    p_criteriaGrid.add(labelValue, new ALayoutConstraint(0, 0));
    p_criteriaGrid.add(fieldValue, null);
    p_criteriaGrid.add(lBPartner_ID, null);
    p_criteriaGrid.add(fBPartner_ID, null);
    //		
    p_criteriaGrid.add(labelName, new ALayoutConstraint(1, 0));
    p_criteriaGrid.add(fieldName, null);
    p_criteriaGrid.add(lProduct_ID, null);
    p_criteriaGrid.add(fProduct_ID, null);
}
Also used : VLookup(org.compiere.grid.ed.VLookup) 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