Search in sources :

Example 11 with CPanel

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

Example 12 with CPanel

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

the class VPanel method findChildComponents.

//  setBackground
private void findChildComponents(CPanel container, List<Component> list) {
    Component[] comp = container.getComponents();
    for (int c = 0; c < comp.length; c++) {
        list.add(comp[c]);
        if (comp[c] instanceof CollapsiblePanel) {
            CollapsiblePanel collapsiblePanel = (CollapsiblePanel) comp[c];
            Component[] nestedComps = collapsiblePanel.getCollapsiblePane().getContentPane().getComponents();
            for (int y = 0; y < nestedComps.length; y++) {
                if (nestedComps[y] instanceof CPanel) {
                    CPanel nestedPanel = (CPanel) nestedComps[y];
                    Component[] nestedPanelComps = nestedPanel.getComponents();
                    for (int x = 0; x < nestedPanelComps.length; x++) {
                        list.add(nestedPanelComps[x]);
                    }
                } else {
                    list.add(nestedComps[y]);
                }
            }
        } else if (comp[c] instanceof CPanel) {
            findChildComponents((CPanel) comp[c], list);
        }
    }
}
Also used : CPanel(org.compiere.swing.CPanel) Component(java.awt.Component) CollapsiblePanel(org.compiere.swing.CollapsiblePanel)

Example 13 with CPanel

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

the class VCreateFromDialog method jbInit.

protected void jbInit() throws Exception {
    getContentPane().add(parameterPanel, BorderLayout.NORTH);
    JScrollPane dataPane = new JScrollPane();
    getContentPane().add(dataPane, BorderLayout.CENTER);
    dataPane.getViewport().add(dataTable, null);
    AppsAction selectAllAction = new AppsAction(SELECT_ALL, KeyStroke.getKeyStroke(KeyEvent.VK_A, java.awt.event.InputEvent.ALT_MASK), null);
    CButton selectAllButton = (CButton) selectAllAction.getButton();
    selectAllButton.setMargin(new Insets(0, 10, 0, 10));
    selectAllButton.setDefaultCapable(true);
    selectAllButton.addActionListener(this);
    confirmPanel.addButton(selectAllButton);
    CPanel southPanel = new CPanel();
    getContentPane().add(southPanel, BorderLayout.SOUTH);
    BorderLayout southLayout = new BorderLayout();
    southPanel.setLayout(southLayout);
    southPanel.add(confirmPanel, BorderLayout.CENTER);
    southPanel.add(statusBar, BorderLayout.SOUTH);
    dataTable.setMultiSelection(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) AppsAction(org.compiere.apps.AppsAction) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) CPanel(org.compiere.swing.CPanel) CButton(org.compiere.swing.CButton)

Example 14 with CPanel

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

the class POSActionPanel method init.

/**
	 * 	Initialize
	 */
@Override
public void init() {
    //	Content
    setLayout(new GridBagLayout());
    //	Button Panel
    buttonPanel = new CPanel(new GridBagLayout());
    topPadding = 0;
    leftPadding = 1;
    bottonPadding = 0;
    rightPadding = 1;
    // NEW
    buttonNew = createButtonAction(ACTION_NEW, KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0));
    buttonNew.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonNew.setToolTipText("F2-" + Msg.translate(ctx, "new.order"));
    buttonPanel.add(buttonNew, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // Print
    buttonPrint = createButtonAction(ACTION_PRINT, KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0));
    buttonPrint.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonPrint.setToolTipText("F12-" + Msg.translate(ctx, "Print"));
    buttonPanel.add(buttonPrint, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // DOCTYPE
    buttonDocType = createButtonAction(ACTION_DOCTYPE, KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0));
    buttonDocType.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonDocType.setToolTipText("F10-" + Msg.translate(ctx, "C_DocType_ID"));
    buttonPanel.add(buttonDocType, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // PRODUCT
    buttonProduct = createButtonAction(ACTION_PRODUCT, KeyStroke.getKeyStroke(KeyEvent.VK_I, Event.ALT_MASK));
    buttonProduct.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonProduct.setToolTipText("ALT+I-" + Msg.translate(ctx, "InfoProduct"));
    buttonPanel.add(buttonProduct, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // BPARTNER
    buttonBPartner = createButtonAction(ACTION_BPARTNER, KeyStroke.getKeyStroke(KeyEvent.VK_I, Event.CTRL_MASK + Event.ALT_MASK));
    buttonBPartner.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonBPartner.setToolTipText("CTL+ALT+I-" + Msg.translate(ctx, "C_BPartner_ID"));
    buttonPanel.add(buttonBPartner, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // PROCESS
    buttonProcess = createButtonAction(ACTION_PROCESS, KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.ALT_MASK));
    buttonProcess.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonProcess.setToolTipText("ALT+P-" + Msg.translate(ctx, "Process"));
    buttonPanel.add(buttonProcess, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // HISTORY
    buttonHistory = createButtonAction(ACTION_HISTORY, KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0));
    buttonHistory.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonHistory.setToolTipText("F9-" + Msg.translate(ctx, "smenu.order.history"));
    buttonPanel.add(buttonHistory, new GridBagConstraints(6, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // 	BACK
    buttonBack = createButtonAction(ACTION_BACK, KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.ALT_MASK));
    buttonBack.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonBack.setToolTipText("ALT-LEFT-" + Msg.translate(ctx, "prev"));
    buttonPanel.add(buttonBack, new GridBagConstraints(7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    buttonBack.setEnabled(true);
    //	NEXT
    buttonNext = createButtonAction(ACTION_NEXT, KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.ALT_MASK));
    buttonNext.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonNext.setToolTipText("ALT-RIGHT-" + Msg.translate(ctx, "next"));
    buttonPanel.add(buttonNext, new GridBagConstraints(8, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    buttonNext.setEnabled(true);
    // PAYMENT
    buttonCollect = createButtonAction(ACTION_PAYMENT, KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0));
    buttonCollect.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonCollect.setToolTipText("F4-" + Msg.translate(ctx, "Payment"));
    buttonPanel.add(buttonCollect, new GridBagConstraints(9, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    buttonCollect.setEnabled(false);
    // CANCEL
    buttonCancel = createButtonAction(ACTION_CANCEL, KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));
    buttonCancel.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonCancel.setToolTipText("F3-" + Msg.translate(ctx, "POS.IsCancel"));
    buttonPanel.add(buttonCancel, new GridBagConstraints(10, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // Logout
    buttonLogout = createButtonAction(ACTION_LOGOUT, KeyStroke.getKeyStroke(KeyEvent.VK_L, Event.ALT_MASK));
    buttonLogout.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonLogout.setToolTipText("ALT+L-" + Msg.translate(ctx, "LogOut"));
    buttonPanel.add(buttonLogout, new GridBagConstraints(11, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // BP
    String labelName = Msg.translate(Env.getCtx(), I_M_Product.COLUMNNAME_M_Product_ID);
    fieldProductName = new POSTextField(labelName, posPanel.getKeyboard());
    fieldProductName.setPlaceholder(labelName);
    fieldProductName.addActionListener(this);
    fieldProductName.setFont(posPanel.getFont());
    fieldProductName.setPreferredSize(new Dimension(250, posPanel.getFieldHeight()));
    fieldProductName.setMinimumSize(new Dimension(250, posPanel.getFieldHeight()));
    fieldProductName.setFocusable(true);
    fieldProductName.setFocusTraversalKeysEnabled(false);
    lookupProduct = new POSLookupProduct(this, fieldProductName, 0);
    fieldProductName.addKeyListener(lookupProduct);
    //	Add Button Panel
    add(buttonPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 0));
    add(fieldProductName, new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 0));
    if (posPanel.isEnableProductLookup() && !posPanel.isVirtualKeyboard()) {
        JComboBox<KeyNamePair> fillingComponent = new JComboBox<KeyNamePair>();
        Font font = new Font("monospaced", Font.PLAIN, 14);
        fillingComponent.setFont(font);
        findProductTimer = new javax.swing.Timer(500, lookupProduct);
        lookupProduct.setFillingComponent(fillingComponent);
        lookupProduct.setPriceListId(posPanel.getM_PriceList_ID());
        lookupProduct.setPartnerId(posPanel.getC_BPartner_ID());
        lookupProduct.setWarehouseId(posPanel.getM_Warehouse_ID());
        findProductTimer.start();
        add(fillingComponent, new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 20), 0, 0));
    }
    enableButton();
    actionProcessMenu = new POSActionMenu(posPanel);
    //	List Orders
    posPanel.listOrder();
    getMainFocus();
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension) Font(java.awt.Font) KeyNamePair(org.compiere.util.KeyNamePair)

Example 15 with CPanel

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

the class POSDocumentPanel method init.

/**
	 * 	Initialize
	 */
public void init() {
    int posKeyLayoutId = posPanel.getC_POSKeyLayout_ID();
    //	Set Layout
    setLayout(new GridBagLayout());
    //	Set Right Padding
    int rightPadding = 0;
    //	Document Panel
    //	Set Font and Format
    headerPanel = new CPanel(new GridBagLayout());
    documentInfoPanel = new CPanel(new GridBagLayout());
    totalPanel = new CPanel(new GridBagLayout());
    //	For Doc Title Border
    documentTitle = BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "InfoOrder"));
    documentTitle.setTitleFont(posPanel.getFont());
    documentTitle.setTitleColor(AdempierePLAF.getTextColor_Label());
    documentInfoPanel.setBorder(documentTitle);
    //	For Total Title Border
    totalTitle = BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "Totals"));
    totalTitle.setTitleFont(posPanel.getFont());
    totalTitle.setTitleColor(AdempierePLAF.getTextColor_Label());
    totalPanel.setBorder(totalTitle);
    //	For Document Info
    labelDocumentNo = new CLabel(Msg.translate(Env.getCtx(), I_C_Order.COLUMNNAME_DocumentNo) + ":");
    labelDocumentNo.setFont(posPanel.getPlainFont());
    //	Add
    documentInfoPanel.add(labelDocumentNo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //
    fieldDocumentNo = new CLabel();
    fieldDocumentNo.setFont(posPanel.getFont());
    labelDocumentNo.setLabelFor(fieldDocumentNo);
    //	Change Size
    //	Add
    documentInfoPanel.add(fieldDocumentNo, new GridBagConstraints(3, 0, 1, 1, 1, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, rightPadding), 0, 0));
    //	For Tax Amount
    labelDocumentType = new CLabel(Msg.translate(Env.getCtx(), I_C_Order.COLUMNNAME_C_DocType_ID) + ":");
    labelDocumentType.setFont(posPanel.getPlainFont());
    //	Add
    documentInfoPanel.add(labelDocumentType, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //
    fieldDocumentType = new CLabel();
    fieldDocumentType.setFont(posPanel.getFont());
    labelDocumentType.setLabelFor(fieldDocumentType);
    //	Add
    documentInfoPanel.add(fieldDocumentType, new GridBagConstraints(3, 1, 1, 1, 1, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, rightPadding), 0, 0));
    //	Document status
    labelDocumentStatus = new CLabel(Msg.translate(Env.getCtx(), I_C_Order.COLUMNNAME_DocStatus) + ":");
    labelDocumentStatus.setFont(posPanel.getPlainFont());
    //	Add
    documentInfoPanel.add(labelDocumentStatus, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //
    fieldDocumentStatus = new CLabel();
    fieldDocumentStatus.setFont(posPanel.getFont());
    labelDocumentStatus.setLabelFor(fieldDocumentStatus);
    //	Add
    documentInfoPanel.add(fieldDocumentStatus, new GridBagConstraints(3, 3, 1, 1, 1, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, rightPadding), 0, 0));
    //	For Sales Representative
    labelSalesRep = new CLabel(Msg.translate(Env.getCtx(), I_C_Order.COLUMNNAME_SalesRep_ID) + ":");
    labelSalesRep.setFont(posPanel.getPlainFont());
    //	Add
    documentInfoPanel.add(labelSalesRep, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //
    fieldSalesRep = new CLabel();
    fieldSalesRep.setFont(posPanel.getFont());
    labelSalesRep.setLabelFor(fieldSalesRep);
    //	Add
    documentInfoPanel.add(fieldSalesRep, new GridBagConstraints(3, 4, 1, 1, 1, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, rightPadding), 0, 0));
    //	For Grand Total
    //	For Totals
    //	For Total Lines
    labelDocumentDate = new CLabel(Msg.translate(Env.getCtx(), "Date") + ":");
    labelDocumentDate.setFont(posPanel.getPlainFont());
    //	Add
    totalPanel.add(labelDocumentDate, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //
    fieldDocumentDate = new CLabel();
    fieldDocumentDate.setFont(posPanel.getFont());
    labelDocumentDate.setLabelFor(fieldDocumentDate);
    //	Add
    totalPanel.add(fieldDocumentDate, new GridBagConstraints(3, 0, 1, 1, 1, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, rightPadding), 0, 0));
    labelTotalLines = new CLabel(Msg.getMsg(Env.getCtx(), "SubTotal") + ":");
    labelTotalLines.setFont(posPanel.getPlainFont());
    //	Add
    totalPanel.add(labelTotalLines, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //
    fieldTotalLines = new CLabel();
    fieldTotalLines.setFont(posPanel.getFont());
    labelTotalLines.setLabelFor(fieldTotalLines);
    //	Add
    totalPanel.add(fieldTotalLines, new GridBagConstraints(3, 1, 1, 1, 1, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, rightPadding), 0, 0));
    //	For Tax Amount
    labelTaxAmount = new CLabel(Msg.translate(Env.getCtx(), I_C_OrderLine.COLUMNNAME_C_Tax_ID) + ":");
    labelTaxAmount.setFont(posPanel.getPlainFont());
    //	Add
    totalPanel.add(labelTaxAmount, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //
    fieldTaxAmount = new CLabel();
    fieldTaxAmount.setFont(posPanel.getFont());
    labelTaxAmount.setLabelFor(fieldTaxAmount);
    //	Add
    totalPanel.add(fieldTaxAmount, new GridBagConstraints(3, 2, 1, 1, 1, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, rightPadding), 0, 0));
    //	For Grand Total
    labelGrandTotal = new CLabel(Msg.getMsg(posPanel.getCtx(), "Total") + ":");
    labelGrandTotal.setFont(posPanel.getFont());
    //	Add
    totalPanel.add(labelGrandTotal, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //
    fieldGrandTotal = new CLabel();
    fieldGrandTotal.setFont(posPanel.getBigFont());
    labelGrandTotal.setLabelFor(fieldGrandTotal);
    //	Change Size
    //	Add
    totalPanel.add(fieldGrandTotal, new GridBagConstraints(3, 4, 1, 1, 1, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, rightPadding), 0, 0));
    //	Add Doc Info
    headerPanel.add(documentInfoPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
    //	Add to Header
    headerPanel.add(totalPanel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
    //	For Product
    String labelName = Msg.translate(Env.getCtx(), I_C_BPartner.COLUMNNAME_IsCustomer);
    //	
    fieldPartnerName = new POSTextField(labelName, posPanel.getKeyboard());
    fieldPartnerName.setName(labelName);
    fieldPartnerName.setPlaceholder(labelName);
    fieldPartnerName.addActionListener(this);
    fieldPartnerName.setFocusable(true);
    fieldPartnerName.setFont(posPanel.getFont());
    fieldPartnerName.setPreferredSize(new Dimension(530, 50));
    fieldPartnerName.setMinimumSize(new Dimension(530, 50));
    //	Add Header
    GridBagConstraints headerConstraint = new GridBagConstraints();
    headerConstraint.fill = GridBagConstraints.BOTH;
    headerConstraint.weightx = 1;
    headerConstraint.gridy = 0;
    add(headerPanel, headerConstraint);
    //	Add Product Name
    GridBagConstraints partnerConstraint = new GridBagConstraints();
    partnerConstraint.fill = GridBagConstraints.HORIZONTAL;
    partnerConstraint.weightx = 0;
    partnerConstraint.gridy = 1;
    partnerConstraint.gridwidth = 2;
    headerPanel.add(fieldPartnerName, partnerConstraint);
    //	Add Keyboard
    GridBagConstraints keyboardConstraint = new GridBagConstraints();
    keyboardConstraint.fill = GridBagConstraints.BOTH;
    keyboardConstraint.weightx = 1;
    keyboardConstraint.weighty = 1;
    keyboardConstraint.gridy = 2;
    //	For Key Panel
    keyboardPanel = new POSKeyPanel(posKeyLayoutId, this);
    add(keyboardPanel, keyboardConstraint);
    GridBagConstraints collectPaymentConstraint = new GridBagConstraints();
    collectPaymentConstraint.fill = GridBagConstraints.BOTH;
    collectPaymentConstraint.fill = GridBagConstraints.BOTH;
    collectPaymentConstraint.weightx = 1;
    collectPaymentConstraint.weighty = 1;
    collectPaymentConstraint.gridy = 2;
    collectPayment = new VCollect(posPanel);
    collectPayment.hidePanel();
    add(collectPayment.getPanel(), collectPaymentConstraint);
    GridBagConstraints scalesConstraint = new GridBagConstraints();
    scalesConstraint.fill = GridBagConstraints.BOTH;
    scalesConstraint.fill = GridBagConstraints.BOTH;
    scalesConstraint.weightx = 1;
    scalesConstraint.weighty = 1;
    scalesConstraint.gridy = 2;
    scalesPanel = new POSScalesPanel(posPanel);
    scalesPanel.hidePanel();
    add(scalesPanel.getPanel(), scalesConstraint);
    //	Refresh
    refreshPanel();
}
Also used : CLabel(org.compiere.swing.CLabel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension)

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