Search in sources :

Example 1 with CTabbedPane

use of org.compiere.swing.CTabbedPane 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 2 with CTabbedPane

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

the class InfoProduct method stateChanged.

//	isUnconfirmed
/**
	 * 	Tab Changed
	 * 	@param e event
	 */
public void stateChanged(ChangeEvent e) {
    if (e.getSource() instanceof CTabbedPane) {
        CTabbedPane tab = (CTabbedPane) e.getSource();
        if (tab.getSelectedIndex() == 5) {
            checkShowDetail.setEnabled(true);
        } else {
            checkShowDetail.setEnabled(false);
        }
        log.fine("Calling refresh(): " + e.toString());
        refresh();
    }
}
Also used : CTabbedPane(org.compiere.swing.CTabbedPane)

Example 3 with CTabbedPane

use of org.compiere.swing.CTabbedPane in project lar_361 by comitsrl.

the class InfoProduct method stateChanged.

// getProductLayout
/**
 * 	Tab Changed
 * 	@param e event
 */
public void stateChanged(ChangeEvent e) {
    if (e.getSource() instanceof CTabbedPane) {
        CTabbedPane tab = (CTabbedPane) e.getSource();
        if (tab.getSelectedIndex() == 4 & warehouseTbl.getRowCount() > 0) {
            // If no warehouse row is selected in the warehouse tab, use the first warehouse
            // row to prevent array index out of bounds. BF 3051361
            int selectedRow = warehouseTbl.getSelectedRow();
            if (selectedRow < 0)
                selectedRow = 0;
            String value = (String) warehouseTbl.getValueAt(selectedRow, 0);
            int M_Warehouse_ID = DB.getSQLValue(null, "SELECT M_Warehouse_ID FROM M_Warehouse WHERE UPPER(Name) = UPPER(?) AND AD_Client_ID=?", new Object[] { value, Env.getAD_Client_ID(Env.getCtx()) });
            initAtpTab(M_Warehouse_ID);
        }
    }
}
Also used : ALayoutConstraint(org.compiere.apps.ALayoutConstraint) CTabbedPane(org.compiere.swing.CTabbedPane)

Example 4 with CTabbedPane

use of org.compiere.swing.CTabbedPane in project lar_361 by comitsrl.

the class InfoProduct 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);
    labelUPC.setText(Msg.translate(Env.getCtx(), "UPC"));
    fieldUPC.setBackground(AdempierePLAF.getInfoBackground());
    fieldUPC.addActionListener(this);
    labelSKU.setText(Msg.translate(Env.getCtx(), "SKU"));
    fieldSKU.setBackground(AdempierePLAF.getInfoBackground());
    fieldSKU.addActionListener(this);
    labelWarehouse.setText(Msg.getMsg(Env.getCtx(), "Warehouse"));
    pickWarehouse.setBackground(AdempierePLAF.getInfoBackground());
    labelPriceList.setText(Msg.getMsg(Env.getCtx(), "PriceListVersion"));
    pickPriceList.setBackground(AdempierePLAF.getInfoBackground());
    labelProductCategory.setText(Msg.translate(Env.getCtx(), "M_Product_Category_ID"));
    pickProductCategory.setBackground(AdempierePLAF.getInfoBackground());
    // @Trifon
    labelAS.setText(Msg.translate(Env.getCtx(), "M_AttributeSet_ID"));
    pickAS.setBackground(AdempierePLAF.getInfoBackground());
    m_InfoPAttributeButton.setMargin(new Insets(2, 2, 2, 2));
    m_InfoPAttributeButton.setToolTipText(Msg.getMsg(Env.getCtx(), "InfoPAttribute"));
    m_InfoPAttributeButton.addActionListener(this);
    labelVendor.setText(Msg.translate(Env.getCtx(), "Vendor"));
    fieldVendor.setBackground(AdempierePLAF.getInfoBackground());
    fieldVendor.addActionListener(this);
    // Line 1
    parameterPanel.setLayout(new ALayout());
    parameterPanel.add(labelValue, new ALayoutConstraint(0, 0));
    parameterPanel.add(fieldValue, null);
    parameterPanel.add(labelUPC, null);
    parameterPanel.add(fieldUPC, null);
    parameterPanel.add(labelWarehouse, null);
    parameterPanel.add(pickWarehouse, null);
    parameterPanel.add(m_InfoPAttributeButton);
    // Line 2
    parameterPanel.add(labelName, new ALayoutConstraint(1, 0));
    parameterPanel.add(fieldName, null);
    parameterPanel.add(labelSKU, null);
    parameterPanel.add(fieldSKU, null);
    parameterPanel.add(labelVendor, null);
    parameterPanel.add(fieldVendor, null);
    // Line 3
    parameterPanel.add(labelPriceList, new ALayoutConstraint(2, 0));
    parameterPanel.add(pickPriceList, null);
    parameterPanel.add(labelProductCategory, null);
    parameterPanel.add(pickProductCategory, null);
    // @Trifon
    parameterPanel.add(labelAS, null);
    // @Trifon
    parameterPanel.add(pickAS, null);
    // Product Attribute Instance
    m_PAttributeButton = ConfirmPanel.createPAttributeButton(true);
    confirmPanel.addButton(m_PAttributeButton);
    m_PAttributeButton.addActionListener(this);
    m_PAttributeButton.setEnabled(false);
    // Begin - fer_luck @ centuryon
    // add taskpane
    fieldDescription.setBackground(AdempierePLAF.getInfoBackground());
    fieldDescription.setEditable(false);
    fieldDescription.setPreferredSize(new Dimension(INFO_WIDTH - 100, 100));
    warehouseStockPanel.setTitle(Msg.translate(Env.getCtx(), "WarehouseStock"));
    warehouseStockPanel.setUI(new AdempiereTaskPaneUI());
    warehouseStockPanel.getContentPane().setBackground(new ColorUIResource(251, 248, 241));
    warehouseStockPanel.getContentPane().setForeground(new ColorUIResource(251, 0, 0));
    ColumnInfo[] s_layoutWarehouse = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "sum(QtyOnHand)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "sum(QtyReserved)", Double.class) };
    /**
     *	From Clause
     */
    String s_sqlFrom = " M_PRODUCT_STOCK_V ";
    /**
     * Where Clause
     */
    String s_sqlWhere = "Value = ?";
    m_sqlWarehouse = warehouseTbl.prepareTable(s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
    m_sqlWarehouse += " Group By Warehouse, documentnote ";
    warehouseTbl.setRowSelectionAllowed(true);
    warehouseTbl.setMultiSelection(false);
    warehouseTbl.addMouseListener(this);
    warehouseTbl.getSelectionModel().addListSelectionListener(this);
    warehouseTbl.setShowTotals(true);
    warehouseTbl.autoSize();
    ColumnInfo[] s_layoutSubstitute = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class) };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'S'";
    m_sqlSubstitute = substituteTbl.prepareTable(s_layoutSubstitute, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    substituteTbl.setRowSelectionAllowed(false);
    substituteTbl.setMultiSelection(false);
    substituteTbl.addMouseListener(this);
    substituteTbl.getSelectionModel().addListSelectionListener(this);
    substituteTbl.autoSize();
    ColumnInfo[] s_layoutRelated = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class) };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'R'";
    m_sqlRelated = relatedTbl.prepareTable(s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    relatedTbl.setRowSelectionAllowed(false);
    relatedTbl.setMultiSelection(false);
    relatedTbl.addMouseListener(this);
    relatedTbl.getSelectionModel().addListSelectionListener(this);
    relatedTbl.autoSize();
    // Available to Promise Tab
    m_tableAtp.setRowSelectionAllowed(false);
    m_tableAtp.setMultiSelection(false);
    CTabbedPane jTab = new CTabbedPane();
    jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl));
    jTab.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 250 : 105));
    jTab.addTab(Msg.translate(Env.getCtx(), "Description"), new JScrollPane(fieldDescription));
    jTab.addTab(Msg.translate(Env.getCtx(), "Substitute_ID"), new JScrollPane(substituteTbl));
    jTab.addTab(Msg.translate(Env.getCtx(), "RelatedProduct_ID"), new JScrollPane(relatedTbl));
    jTab.addTab(Msg.getMsg(Env.getCtx(), "ATP"), new JScrollPane(m_tableAtp));
    jTab.addChangeListener(this);
    tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110));
    tablePanel.add(jTab);
    warehouseStockPanel.setCollapsed(true);
    warehouseStockPanel.add(tablePanel);
    this.addonPanel.add(warehouseStockPanel);
    this.p_table.addKeyListener(new KeyAdapter() {

        public void keyReleased(KeyEvent ke) {
            int row = ((MiniTable) ke.getSource()).getSelectedRow();
            refresh(((MiniTable) ke.getSource()).getValueAt(row, 2), new BigDecimal(pickWarehouse.getValue().toString()).intValue(), new BigDecimal(pickPriceList.getValue().toString()).intValue());
            warehouseStockPanel.setCollapsed(false);
        }
    });
    this.p_table.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent me) {
            int row = ((MiniTable) me.getSource()).getSelectedRow();
            refresh(((MiniTable) me.getSource()).getValueAt(row, 2), new BigDecimal(pickWarehouse.getValue().toString()).intValue(), new BigDecimal(pickPriceList.getValue().toString()).intValue());
            warehouseStockPanel.setCollapsed(false);
        }
    });
// End - fer_luck @ centuryon
}
Also used : JScrollPane(javax.swing.JScrollPane) AdempiereTaskPaneUI(org.adempiere.plaf.AdempiereTaskPaneUI) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) KeyAdapter(java.awt.event.KeyAdapter) MouseAdapter(java.awt.event.MouseAdapter) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) ColumnInfo(org.compiere.minigrid.ColumnInfo) Dimension(java.awt.Dimension) ColorUIResource(javax.swing.plaf.ColorUIResource) BigDecimal(java.math.BigDecimal) CTabbedPane(org.compiere.swing.CTabbedPane) MiniTable(org.compiere.minigrid.MiniTable) KeyEvent(java.awt.event.KeyEvent) ALayout(org.compiere.apps.ALayout)

Aggregations

CTabbedPane (org.compiere.swing.CTabbedPane)4 Insets (java.awt.Insets)2 JScrollPane (javax.swing.JScrollPane)2 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)2 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 GridLayout (java.awt.GridLayout)1 KeyAdapter (java.awt.event.KeyAdapter)1 KeyEvent (java.awt.event.KeyEvent)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 BigDecimal (java.math.BigDecimal)1 BoxLayout (javax.swing.BoxLayout)1 JRadioButton (javax.swing.JRadioButton)1 JRootPane (javax.swing.JRootPane)1 JTable (javax.swing.JTable)1 JTree (javax.swing.JTree)1 ColorUIResource (javax.swing.plaf.ColorUIResource)1