Search in sources :

Example 36 with CPanel

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

the class PreviewPanel method setupUI.

/**
	 * Create and layout UI components
	 */
private void setupUI() {
    this.setLayout(new BorderLayout());
    CPanel selectionPanel = new CPanel();
    CPanel previewPart = new CPanel();
    add(selectionPanel, BorderLayout.CENTER);
    add(previewPart, BorderLayout.SOUTH);
    //setup look and theme selection component 
    selectionPanel.setLayout(new GridBagLayout());
    CLabel label = new CLabel(s_res.getString("LookAndFeel"));
    label.setForeground(AdempierePLAF.getPrimary1());
    label.setFont(label.getFont().deriveFont(Font.BOLD));
    selectionPanel.add(label, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
    label = new CLabel(s_res.getString("Theme"));
    label.setForeground(AdempierePLAF.getPrimary1());
    label.setFont(label.getFont().deriveFont(Font.BOLD));
    selectionPanel.add(label, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
    lookList.setVisibleRowCount(12);
    JScrollPane scrollPane = new JScrollPane(lookList);
    scrollPane.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
    selectionPanel.add(scrollPane, new GridBagConstraints(0, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.VERTICAL, new Insets(0, 5, 2, 2), 100, 0));
    themeList.setVisibleRowCount(12);
    scrollPane = new JScrollPane(themeList);
    scrollPane.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
    selectionPanel.add(scrollPane, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 2, 2, 5), 0, 0));
    previewPart.setBorder(BorderFactory.createEmptyBorder());
    previewPart.setLayout(new GridBagLayout());
    label = new CLabel(s_res.getString("Preview"));
    label.setForeground(AdempierePLAF.getPrimary1());
    label.setFont(label.getFont().deriveFont(Font.BOLD));
    previewPart.add(label, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
    previewPart.add(previewPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
    lookList.addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            lookAndFeelSelectionChanged(e);
        }
    });
    themeList.addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            themeSelectionChanged(e);
        }
    });
}
Also used : CLabel(org.compiere.swing.CLabel) JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) CPanel(org.compiere.swing.CPanel) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 37 with CPanel

use of org.compiere.swing.CPanel 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 38 with CPanel

use of org.compiere.swing.CPanel 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 39 with CPanel

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

the class VCRPDetail method jbInit.

private void jbInit() {
    dateFrom = new VDate("DateFrom", true, false, true, DisplayType.Date, "DateFrom");
    dateTo = new VDate("DateTo", true, false, true, DisplayType.Date, "DateTo");
    CPanel northPanel = new CPanel();
    northPanel.setLayout(new java.awt.GridBagLayout());
    northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "S_Resource_ID")), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    northPanel.add(resource, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
    northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "DateFrom")), new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    northPanel.add(dateFrom, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
    northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "DateTo")), new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    northPanel.add(dateTo, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
    ConfirmPanel confirmPanel = new ConfirmPanel(true);
    confirmPanel.addActionListener(new ActionHandler());
    contentPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    contentPanel.setPreferredSize(new Dimension(800, 600));
    m_form.getWindow().getContentPane().add(northPanel, BorderLayout.NORTH);
    m_form.getWindow().getContentPane().add(contentPanel, BorderLayout.CENTER);
    m_form.getWindow().getContentPane().add(confirmPanel, BorderLayout.SOUTH);
}
Also used : CLabel(org.compiere.swing.CLabel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) ConfirmPanel(org.compiere.apps.ConfirmPanel) VDate(org.compiere.grid.ed.VDate) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension) JSplitPane(javax.swing.JSplitPane)

Example 40 with CPanel

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

the class APanel method jbInit.

/**
	 * Initializes the state of this instance.
	 * @throws Exception
	 */
private void jbInit() throws Exception {
    this.setLocale(Language.getLoginLanguage().getLocale());
    this.setLayout(mainLayout);
    //	tabPanel
    mainLayout.setHgap(2);
    mainLayout.setVgap(2);
    if (isNested)
        this.add(m_curGC, BorderLayout.CENTER);
    else {
        CPanel dummy = new CPanel();
        dummy.setLayout(new BorderLayout());
        dummy.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
        dummy.add(tabPanel, BorderLayout.CENTER);
        this.add(dummy, BorderLayout.CENTER);
    }
    //	southPanel
    this.add(statusBar, BorderLayout.SOUTH);
    //	northPanel
    this.add(northPanel, BorderLayout.NORTH);
    northPanel.setLayout(northLayout);
    northLayout.setAlignment(FlowLayout.LEFT);
    toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
    toolBar.setBorderPainted(false);
    // teo_sarca, [ 1666591 ] Toolbar should not be floatable
    toolBar.setFloatable(false);
    northPanel.add(toolBar, null);
}
Also used : BorderLayout(java.awt.BorderLayout) CPanel(org.compiere.swing.CPanel)

Aggregations

CPanel (org.compiere.swing.CPanel)64 Dimension (java.awt.Dimension)29 GridBagConstraints (java.awt.GridBagConstraints)28 Insets (java.awt.Insets)28 BorderLayout (java.awt.BorderLayout)24 GridBagLayout (java.awt.GridBagLayout)21 CLabel (org.compiere.swing.CLabel)20 MigLayout (net.miginfocom.swing.MigLayout)10 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)10 TitledBorder (javax.swing.border.TitledBorder)9 ALayout (org.compiere.apps.ALayout)9 VLookup (org.compiere.grid.ed.VLookup)9 CScrollPane (org.compiere.swing.CScrollPane)9 JScrollPane (javax.swing.JScrollPane)8 FlowLayout (java.awt.FlowLayout)7 Component (java.awt.Component)6 AppsAction (org.compiere.apps.AppsAction)6 VNumber (org.compiere.grid.ed.VNumber)5 MLookup (org.compiere.model.MLookup)5 CButton (org.compiere.swing.CButton)5