Search in sources :

Example 6 with CLabel

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

the class PreviewPanel method setupPreview.

/**
	 * Create the preview UI components 
	 */
private void setupPreview() {
    JRootPane rootPane = new JRootPane();
    previewPanel.setLayout(new BorderLayout());
    previewPanel.add(rootPane, BorderLayout.CENTER);
    previewPanel.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
    GridLayout gridLayout = new GridLayout(1, 3);
    gridLayout.setHgap(4);
    rootPane.getContentPane().setLayout(gridLayout);
    rootPane.setGlassPane(new GlassPane());
    rootPane.getGlassPane().setVisible(true);
    CPanel column1 = new CPanel();
    rootPane.getContentPane().add(column1);
    CPanel column2 = new CPanel();
    rootPane.getContentPane().add(column2);
    CPanel column3 = new CPanel();
    rootPane.getContentPane().add(column3);
    column1.setLayout(new GridBagLayout());
    JTree jtree = new JTree();
    jtree.setFocusable(false);
    jtree.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
    column1.add(jtree, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 2), 0, 0));
    CTextField normal = new CTextField("Text Field");
    normal.setFocusable(false);
    column1.add(normal, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 5, 2), 0, 0));
    error.setBackground(true);
    error.setFocusable(false);
    column1.add(error, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
    column2.setLayout(new GridBagLayout());
    JTable jtable = new JTable(s_data, s_columns);
    JScrollPane scrollPane = new JScrollPane(jtable);
    jtable.setFocusable(false);
    scrollPane.setPreferredSize(jtable.getPreferredSize());
    column2.add(scrollPane, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 2), 0, 0));
    mandatory.setMandatory(true);
    mandatory.setFocusable(false);
    column2.add(mandatory, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
    CTextField inactive = new CTextField(s_res.getString("Inactive"));
    inactive.setEnabled(false);
    column2.add(inactive, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
    column3.setLayout(new GridBagLayout());
    CTabbedPane tab = new CTabbedPane();
    column3.add(tab, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 5), 0, 0));
    CComboBox editable = new CComboBox(new Object[] { "Editable" });
    editable.setEditable(true);
    editable.setFocusable(false);
    column3.add(editable, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
    CComboBox choice = new CComboBox(new Object[] { "Choice" });
    choice.setEditable(false);
    choice.setFocusable(false);
    column3.add(choice, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 5), 0, 0));
    tabPage1.setLayout(new BoxLayout(tabPage1, BoxLayout.Y_AXIS));
    JRadioButton radio = new JRadioButton("Radio");
    radio.setSelected(true);
    radio.setMargin(new Insets(5, 5, 5, 5));
    radio.setFocusable(false);
    radio.setOpaque(false);
    tabPage1.add(radio);
    CCheckBox checkBox = new CCheckBox("Checkbox");
    checkBox.setSelected(true);
    checkBox.setMargin(new Insets(5, 5, 5, 5));
    checkBox.setFocusable(false);
    tabPage1.add(checkBox);
    CLabel label = new CLabel("Label");
    label.setHorizontalAlignment(JLabel.LEFT);
    label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    tabPage1.add(label);
    button.setMargin(new Insets(5, 5, 5, 5));
    button.setFocusable(false);
    tabPage1.add(button);
    tab.add(tabPage1, "tab1");
    tab.add(new CPanel(), "tab2");
}
Also used : JScrollPane(javax.swing.JScrollPane) CLabel(org.compiere.swing.CLabel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JRadioButton(javax.swing.JRadioButton) GridBagLayout(java.awt.GridBagLayout) CComboBox(org.compiere.swing.CComboBox) CTextField(org.compiere.swing.CTextField) BoxLayout(javax.swing.BoxLayout) CPanel(org.compiere.swing.CPanel) CTabbedPane(org.compiere.swing.CTabbedPane) GridLayout(java.awt.GridLayout) JTree(javax.swing.JTree) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) CCheckBox(org.compiere.swing.CCheckBox) JRootPane(javax.swing.JRootPane)

Example 7 with CLabel

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

the class ProcessPanel method formatEditor.

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 {
        int currentWidth = label.getPreferredSize().width;
        labelMinWidth = currentWidth > labelMinWidth ? currentWidth : labelMinWidth;
        //			label.setSize(label.getPreferredSize());
        //			label.setMinimumSize(label.getPreferredSize());
        //			label.putClientProperty("LabelUI.truncationString", ">");
        centerPanel.add(label, new ALayoutConstraint(row, cols++));
    }
    //	
    Component component = (Component) editor;
    fieldMinWidth = component.getPreferredSize().width > fieldMinWidth ? component.getPreferredSize().width : fieldMinWidth;
    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) VEditor(org.compiere.grid.ed.VEditor) Component(java.awt.Component)

Example 8 with CLabel

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

the class ProcessPanel method initComponents.

@Override
public void initComponents() {
    mainLayout = new BorderLayout();
    centerPanel = new CPanel();
    parameterScrollPane = new CScrollPane(centerPanel);
    //	
    southPanel = new CPanel();
    southLayout = new FlowLayout();
    //	Buttons
    bOK = ConfirmPanel.createOKButton(true);
    bCancel = ConfirmPanel.createCancelButton(true);
    bPrint = ConfirmPanel.createPrintButton(true);
    bOK.addActionListener(this);
    bCancel.addActionListener(this);
    bPrint.addActionListener(this);
    //	
    mainPanel.setLayout(mainLayout);
    mainPanel.setMinimumSize(new Dimension(500, 100));
    //	South Panel
    southPanel.setLayout(southLayout);
    southLayout.setAlignment(FlowLayout.RIGHT);
    southPanel.add(bPrint, null);
    southPanel.add(bCancel, null);
    southPanel.add(bOK, null);
    //	Editors
    m_separators = new ArrayList<CLabel>();
    //	
    message.setContentType("text/html");
    message.setEditable(false);
    message.setBackground(Color.white);
    message.setFocusable(true);
    //	
    centerPanel.setLayout(new ALayout());
    centerPanel.setBorder(null);
    if (isShowDescription()) {
        mainPanel.add(messagePane, BorderLayout.NORTH);
        messagePane.setMaximumSize(new Dimension(600, 300));
    }
    //	Add Center Panel with scroll bar
    parameterScrollPane.setAutoscrolls(true);
    parameterScrollPane.createVerticalScrollBar();
    parameterScrollPane.createHorizontalScrollBar();
    //	
    mainPanel.add(parameterScrollPane, BorderLayout.CENTER);
    //	Add buttons
    if (isShowButtons()) {
        mainPanel.add(southPanel, BorderLayout.SOUTH);
    }
    //	
    mainLayout.setVgap(2);
    //	Set Text
    message.setText(getTextMsg());
}
Also used : CLabel(org.compiere.swing.CLabel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) CScrollPane(org.compiere.swing.CScrollPane) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension)

Example 9 with CLabel

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

the class VBOMDrop 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, String feature, BigDecimal lineQty) {
    log.fine("M_Product_ID=" + M_Product_ID + ",Type=" + bomType + ",Name=" + name + ",feature=" + feature + ",Qty=" + lineQty);
    //
    boolean selected = true;
    if (MPPProductBOMLine.COMPONENTTYPE_Component.equals(bomType)) {
        String title = "";
        JCheckBox cb = new JCheckBox(title);
        cb.setSelected(true);
        cb.setEnabled(false);
        //	cb.addActionListener(this);		//	will not change
        m_selectionList.add(cb);
        this.add(cb, new ALayoutConstraint(m_bomLine++, 0));
    } else if (MPPProductBOMLine.COMPONENTTYPE_Option.equals(bomType)) {
        //String title = Msg.getMsg(Env.getCtx(), "Optional");
        JCheckBox cb = new JCheckBox(feature);
        cb.setSelected(false);
        selected = false;
        cb.addActionListener(this);
        m_selectionList.add(cb);
        this.add(cb, new ALayoutConstraint(m_bomLine++, 0));
    } else if (MPPProductBOMLine.COMPONENTTYPE_Variant.equals(bomType)) {
        //String title = Msg.getMsg(Env.getCtx(), "Variant") + " " + bomType;
        JRadioButton b = new JRadioButton(feature);
        String groupName = feature + "_" + String.valueOf(parentM_Product_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));
    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) VNumber(org.compiere.grid.ed.VNumber)

Example 10 with CLabel

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

the class VPanel method addGroup.

//	addField
/**
	 *	Add Group
	 *  @param fieldGroup field group
	 *  @param fieldGroupType 
	 *  @return true if group added
	 */
private boolean addGroup(String fieldGroup, String fieldGroupType) {
    //	First time - add top
    if (m_oldFieldGroup == null) {
        m_oldFieldGroup = "";
        m_oldFieldGroupType = "";
    }
    if (fieldGroup == null || fieldGroup.length() == 0 || fieldGroup.equals(m_oldFieldGroup))
        return false;
    //[ 1757088 ]
    if (m_tablist.get(fieldGroup) != null) {
        return false;
    }
    //[ 1757088 ]
    if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Tab)) {
        CPanel m_tab = new CPanel();
        m_tab.setBackground(AdempierePLAF.getFormBackground());
        String tpConstraints = defaultLayoutConstraints;
        MigLayout layout = new MigLayout(tpConstraints);
        layout.addLayoutCallback(callback);
        m_tab.setLayout(layout);
        m_tab.setName(fieldGroup);
        CPanel dummy = new CPanel();
        dummy.setLayout(new BorderLayout());
        dummy.add(m_tab, BorderLayout.NORTH);
        dummy.setName(m_tab.getName());
        dummy.setBorder(BorderFactory.createEmptyBorder(10, 12, 0, 12));
        this.add(dummy);
        m_tablist.put(fieldGroup, m_tab);
    } else if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Collapse)) {
        CollapsiblePanel collapsibleSection = new CollapsiblePanel(fieldGroup);
        JXCollapsiblePane m_tab = collapsibleSection.getCollapsiblePane();
        m_tab.setAnimated(false);
        m_tab.getContentPane().setBackground(AdempierePLAF.getFormBackground());
        String cpConstraints = defaultLayoutConstraints;
        // 0 inset left and right as this is a nested panel
        // 0 inset top because of the struts added below
        cpConstraints += ", ins 0 0 n 0";
        MigLayout layout = new MigLayout(cpConstraints);
        layout.addLayoutCallback(callback);
        collapsibleSection.setName(fieldGroup);
        m_main.add(collapsibleSection, "newline, spanx, growx");
        m_tab.setLayout(layout);
        /* for compatibility with old layout, force collapsible field groups
			 *  to have a minimum of two columns by inserting invisible components
			 */
        Component strut1 = Box.createVerticalStrut(1);
        strut1.setName("vstrut1" + fieldGroup);
        Component strut2 = Box.createVerticalStrut(1);
        strut2.setName("vstrut2" + fieldGroup);
        m_tab.add(new CLabel(""), "gap 0 0 0 0");
        m_tab.add(strut1, "pushx, growx, gap 0 0 0 0");
        m_tab.add(new CLabel(""), "");
        m_tab.add(strut2, "pushx, growx, gap 0 0 0 0, wrap");
        m_tablist.put(fieldGroup, collapsibleSection);
    } else // Label or null
    {
        CLabel label = new CLabel(fieldGroup, CLabel.LEADING);
        label.setFont(AdempierePLAF.getFont_Label().deriveFont(Font.BOLDITALIC, AdempierePLAF.getFont_Label().getSize2D()));
        //	BR [ 359 ]
        //	Show label completely
        m_main.add(label, "newline, alignx leading, spanx, growx");
        m_main.add(new JSeparator(), "newline, spanx, growx");
    //	reset
    }
    m_oldFieldGroup = fieldGroup;
    m_oldFieldGroupType = fieldGroupType;
    return true;
}
Also used : CLabel(org.compiere.swing.CLabel) BorderLayout(java.awt.BorderLayout) MigLayout(net.miginfocom.swing.MigLayout) JXCollapsiblePane(org.jdesktop.swingx.JXCollapsiblePane) CPanel(org.compiere.swing.CPanel) Component(java.awt.Component) CollapsiblePanel(org.compiere.swing.CollapsiblePanel) JSeparator(javax.swing.JSeparator)

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