Search in sources :

Example 16 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 17 with CLabel

use of org.compiere.swing.CLabel 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 18 with CLabel

use of org.compiere.swing.CLabel 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)

Example 19 with CLabel

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

the class VPanel method addField.

/**
	 *	Add the previous Field and Label to Panel
	 *  @param editor editor
	 *  @param mField field model
	 *  @param wrap move to next line after this field
	 */
public void addField(VEditor editor, GridField mField) {
    //[ 1757088 ]
    int AD_Tab_ID = mField.getIncluded_Tab_ID();
    if (AD_Tab_ID != 0) {
        CollapsiblePanel m_tab = new CollapsiblePanel("");
        m_tabincludelist.put(AD_Tab_ID, m_tab);
        m_main.add(m_tab, "newline, spanx, growx");
        m_tab.setName("IncludedTab#" + AD_Tab_ID);
        if (includedTabList.containsKey(AD_Tab_ID)) {
            includeTab(includedTabList.get(AD_Tab_ID));
        }
        return;
    }
    CLabel label = VEditorFactory.getLabel(mField);
    if (label == null && editor == null)
        return;
    boolean sameLine = mField.isSameLine();
    //[ 1757088 ]              		//	sets top
    String fieldGroup = mField.getFieldGroup();
    String fieldGroupType = mField.getFieldGroupType();
    if (Util.isEmpty(fieldGroup)) {
        fieldGroup = m_oldFieldGroup;
        fieldGroupType = m_oldFieldGroupType;
    }
    if (//	sets top			
    addGroup(fieldGroup, fieldGroupType)) {
        if (X_AD_FieldGroup.FIELDGROUPTYPE_Collapse.equals(fieldGroupType)) {
            CollapsiblePanel panel = (CollapsiblePanel) m_tablist.get(fieldGroup);
            panel.getCollapsiblePane().setCollapsed(mField.getIsCollapsedByDefault());
        }
        sameLine = false;
    } else {
        fieldGroup = m_oldFieldGroup;
        fieldGroupType = m_oldFieldGroupType;
    }
    // label constraints
    String constraints = "align trailing";
    if (!sameLine) {
        constraints += ", newline";
    }
    //	*** The Label ***
    if (label == null) {
        label = new CLabel("");
        label.setName(mField.getColumnName());
    }
    //
    if (mField.isCreateMnemonic())
        setMnemonic(label, mField.getMnemonic());
    if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Tab)) {
        CPanel m_tab = (CPanel) m_tablist.get(fieldGroup);
        m_tab.add(label, constraints);
    } else if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Collapse)) {
        CollapsiblePanel m_tab = (CollapsiblePanel) m_tablist.get(fieldGroup);
        m_tab.getCollapsiblePane().getContentPane().add(label, constraints);
    } else // Label
    {
        m_main.add(label, constraints);
    }
    int currentWidth = label.getPreferredSize().width;
    labelMinWidth = currentWidth > labelMinWidth ? currentWidth : labelMinWidth;
    //	*** The Field ***
    if (editor != null) {
        Component field = (Component) editor;
        //	field constraints
        //  long fields span all remaining columns
        constraints = "growx, pushx";
        if (mField.isLongField()) {
            constraints += mField.isLongField() ? ",spanx" : "";
        }
        if (wrap) {
            //   Vertical Spacing in Swing Client
            // - https://sourceforge.net/tracker/?func=detail&aid=3073406&group_id=176962&atid=883808
            constraints += ", wrap 0";
        }
        //[ 1757088 ]
        if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Tab)) {
            CPanel m_tab = (CPanel) m_tablist.get(fieldGroup);
            m_tab.add(field, constraints);
        } else if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Collapse)) {
            CollapsiblePanel m_tab = (CollapsiblePanel) m_tablist.get(fieldGroup);
            Component comp = (Component) editor;
            comp.setMinimumSize(comp.getPreferredSize());
            if (mField.getDisplayType() == DisplayType.Text || mField.getDisplayType() == DisplayType.Memo || mField.getDisplayType() == DisplayType.TextLong) {
                Component component = (Component) editor;
                component.setMinimumSize(component.getPreferredSize());
            }
            if (!mField.isLongField())
                fieldMinWidth = field.getPreferredSize().width > fieldMinWidth ? field.getPreferredSize().width : fieldMinWidth;
            m_tab.getCollapsiblePane().getContentPane().add(field, constraints);
        } else // Label or null
        {
            m_main.add(field, constraints);
            if (!mField.isLongField())
                fieldMinWidth = field.getPreferredSize().width > fieldMinWidth ? field.getPreferredSize().width : fieldMinWidth;
        }
        //	Link Label to Field
        if (label != null)
            label.setLabelFor(field);
        else if (mField.isCreateMnemonic())
            setMnemonic(editor, mField.getMnemonic());
    }
}
Also used : CLabel(org.compiere.swing.CLabel) CPanel(org.compiere.swing.CPanel) Component(java.awt.Component) CollapsiblePanel(org.compiere.swing.CollapsiblePanel)

Example 20 with CLabel

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

the class QueryDocType method init.

/**
	 * 	Set up Panel
	 */
protected void init() {
    setTitle(Msg.translate(Env.getCtx(), "C_DocType_ID"));
    //	North
    parameterPanel.setLayout(new MigLayout("fill", "", "[50][50][]"));
    parameterPanel.setBorder(new TitledBorder(Msg.getMsg(ctx, "Query")));
    //
    CLabel lname = new CLabel(Msg.translate(ctx, "Name"));
    parameterPanel.add(lname, " growy");
    f_Name = new POSTextField("", posPanel.getKeyboard());
    lname.setLabelFor(f_Name);
    parameterPanel.add(f_Name, "h 30, w 200");
    f_Name.addActionListener(this);
    CLabel ldescription = new CLabel(Msg.translate(ctx, "Description"));
    parameterPanel.add(ldescription, " growy");
    f_Description = new POSTextField("", posPanel.getKeyboard());
    lname.setLabelFor(f_Description);
    parameterPanel.add(f_Description, "h 30, w 200");
    f_Description.addActionListener(this);
    //	Center
    posTable.prepareTable(s_layout, s_sqlFrom, s_sqlWhere, false, "C_DocType");
    //	
    posTable.growScrollbars();
    SwingUtilities.invokeLater(new Runnable() {

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

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