Search in sources :

Example 41 with CPanel

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

the class ConfirmPanel method addComponent.

/**
	 *  Add Button to left side of confirmPanel
	 *  @param button button
	 */
public void addComponent(Component button) {
    if (m_addlButtons == null) {
        m_addlButtons = new CPanel(new FlowLayout(FlowLayout.LEFT));
        this.add(m_addlButtons, BorderLayout.WEST);
    }
    m_addlButtons.add(button);
}
Also used : FlowLayout(java.awt.FlowLayout) CPanel(org.compiere.swing.CPanel)

Example 42 with CPanel

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

the class Info method jbInit.

/**
	 *	Static Init
	 *  @throws Exception
	 */
protected void jbInit() throws Exception {
    this.getContentPane().add(parameterPanel, BorderLayout.NORTH);
    this.getContentPane().add(scrollPane, BorderLayout.CENTER);
    this.getContentPane().add(southPanel, BorderLayout.SOUTH);
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    //
    AppsAction aa = new AppsAction(ConfirmPanel.A_RESET, null, "reset");
    bReset = (CButton) aa.getButton();
    bReset.setMargin(ConfirmPanel.s_insets);
    bReset.setSize(bReset.getHeight(), bReset.getHeight());
    Dimension bSize = bReset.getSize();
    bSize.height = bReset.getHeight();
    bSize.width = bReset.getHeight();
    // Make it square
    bReset.setMaximumSize(bSize);
    bReset.addActionListener(this);
    //
    buttonPanel = new CPanel(new FlowLayout(FlowLayout.LEFT));
    buttonPanel.add(bReset, FlowLayout.LEFT);
    //
    // p_criteriaGrid is filled by the subordinate class
    p_criteriaGrid.setLayout(new ALayout());
    //
    parameterPanel.setLayout(new BorderLayout());
    parameterPanel.add(buttonPanel, BorderLayout.WEST);
    parameterPanel.add(p_criteriaGrid, BorderLayout.CENTER);
    //
    // Setup the detail panel if used
    p_detailTaskPane.setVisible(false);
    p_detailTaskPane.setCollapsed(true);
    p_detailTaskPane.setLayout(new BorderLayout());
    p_detailTaskPane.setUI(new AdempiereTaskPaneUI());
    p_detailTaskPane.getContentPane().setBackground(new ColorUIResource(251, 248, 241));
    p_detailTaskPane.getContentPane().setForeground(new ColorUIResource(251, 0, 0));
    addonPanel.setLayout(new BorderLayout());
    // Allow auto resizing of the panel
    addonPanel.add(p_detailTaskPane, BorderLayout.CENTER);
    southPanel.setLayout(southLayout);
    southPanel.add(addonPanel, BorderLayout.NORTH);
    southPanel.add(confirmPanel, BorderLayout.CENTER);
    southPanel.add(statusBar, BorderLayout.SOUTH);
    scrollPane.getViewport().add(p_table, null);
    //
    confirmPanel.addActionListener(this);
    confirmPanel.getResetButton().setVisible(hasReset());
    confirmPanel.getCustomizeButton().setVisible(hasCustomize());
    confirmPanel.getHistoryButton().setVisible(hasHistory());
    confirmPanel.getZoomButton().setVisible(hasZoom());
    //  Only show the OK button if we intend to save
    confirmPanel.setOKVisible(p_saveResults);
    //
    JButton print = ConfirmPanel.createPrintButton(true);
    print.addActionListener(this);
    confirmPanel.addButton(print);
    //
    checkAutoQuery.setText(Msg.getMsg(Env.getCtx(), "AutoRefresh"));
    checkAutoQuery.setToolTipText(Msg.getMsg(Env.getCtx(), "AutoRefresh"));
    checkAutoQuery.setName("AutoQuery");
    checkAutoQuery.setSelected(MSysConfig.getValue(SYSCONFIG_INFO_AUTO_QUERY, "Y", Env.getAD_Client_ID(Env.getCtx())).equals("Y"));
    checkAutoQuery.addActionListener(this);
    // Index 0 is OK-Cancel on the right
    CPanel leftButtons = (CPanel) confirmPanel.getComponent(1);
    // Add the check box on the very left before the refresh icon
    leftButtons.add(checkAutoQuery, 0);
    //
    popup.add(zoomMenu);
    zoomMenu.setText(Msg.getMsg(Env.getCtx(), "Zoom"));
    zoomMenu.setIcon(new ImageIcon(org.compiere.Adempiere.class.getResource("images/Zoom16.gif")));
    zoomMenu.addActionListener(this);
    //
    popup.add(calcMenu);
    calcMenu.setText(Msg.getMsg(Env.getCtx(), "Calculator"));
    calcMenu.setIcon(new ImageIcon(org.compiere.Adempiere.class.getResource("images/Calculator16.gif")));
    calcMenu.addActionListener(this);
    //
    //  Table Selection (Invoked before setting column class so that row selection is enabled)
    p_table.setKeyColumnIndex(-1);
    p_table.setCellSelectionEnabled(false);
    p_table.setColumnSelectionAllowed(false);
    p_table.setRowSelectionAllowed(true);
    //  Override the Enter key input and action map
    if (p_saveResults) {
        p_table.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "doDispose");
    } else {
        p_table.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "doNothing");
    }
    p_table.getActionMap().put("doDispose", doDispose);
    // To enable buttons
    ((ListSelectionModel) p_table.getSelectionModel()).addListSelectionListener(this);
    p_table.addMouseListener(this);
    // Listen to changes in the table
    p_table.addPropertyChangeListener("p_table_update", this);
    ((ListSelectionModel) p_table.getSelectionModel()).addListSelectionListener(this);
    //
    //  Set default location where focus will go. See property change listener.
    m_parentPanel = p_criteriaGrid;
    //
    enableButtons();
}
Also used : AdempiereTaskPaneUI(org.adempiere.plaf.AdempiereTaskPaneUI) ImageIcon(javax.swing.ImageIcon) AppsAction(org.compiere.apps.AppsAction) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) CPanel(org.compiere.swing.CPanel) JButton(javax.swing.JButton) ListSelectionModel(javax.swing.ListSelectionModel) Dimension(java.awt.Dimension) ColorUIResource(javax.swing.plaf.ColorUIResource) ALayout(org.compiere.apps.ALayout)

Example 43 with CPanel

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

the class VCreateFromShipmentUI method jbInit.

//  dynInit
/**
	 *  Static Init.
	 *  <pre>
	 *  parameterPanel
	 *      parameterBankPanel
	 *      parameterStdPanel
	 *          bPartner/order/invoice/shopment/licator Label/Field
	 *  dataPane
	 *  southPanel
	 *      confirmPanel
	 *      statusBar
	 *  </pre>
	 *  @throws Exception
	 */
private void jbInit() throws Exception {
    //	Yamel Senih FR [ 114 ] remove hardcode
    //	2015-12-03
    boolean isRMAWindow = isRMA();
    bPartnerLabel.setText(Msg.getElement(Env.getCtx(), "C_BPartner_ID"));
    orderLabel.setText(Msg.getElement(Env.getCtx(), "C_Order_ID", false));
    locatorLabel.setText(Msg.translate(Env.getCtx(), "M_Locator_ID"));
    invoiceLabel.setText(Msg.getElement(Env.getCtx(), "C_Invoice_ID", false));
    sameWarehouseCb.setText(Msg.getMsg(Env.getCtx(), "FromSameWarehouseOnly", true));
    sameWarehouseCb.setToolTipText(Msg.getMsg(Env.getCtx(), "FromSameWarehouseOnly", false));
    rmaLabel.setText(Msg.translate(Env.getCtx(), "M_RMA_ID"));
    upcLabel.setText(Msg.getElement(Env.getCtx(), "UPC", false));
    //	Add to Main Form
    v_Container.getContentPane().add(v_CreateFromPanel);
    //	
    CPanel parameterPanel = v_CreateFromPanel.getParameterPanel();
    parameterPanel.setLayout(new BorderLayout());
    CPanel parameterStdPanel = new CPanel(new GridBagLayout());
    parameterPanel.add(parameterStdPanel, BorderLayout.CENTER);
    parameterStdPanel.add(bPartnerLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    if (bPartnerField != null)
        parameterStdPanel.add(bPartnerField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    if (!isRMAWindow) {
        parameterStdPanel.add(orderLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
        parameterStdPanel.add(orderField, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
        parameterStdPanel.add(invoiceLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
        parameterStdPanel.add(invoiceField, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    }
    parameterStdPanel.add(locatorLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    parameterStdPanel.add(locatorField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    parameterStdPanel.add(sameWarehouseCb, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    parameterStdPanel.add(upcLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    parameterStdPanel.add(upcField, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    if (isRMAWindow) {
        // Add RMA document selection to panel
        parameterStdPanel.add(rmaLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
        parameterStdPanel.add(rmaField, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    }
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) CPanel(org.compiere.swing.CPanel)

Example 44 with CPanel

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

the class VCreateFromPanel method jbInit.

/**
	 * Create UI
	 */
protected void jbInit() {
    //	Set Layout
    setLayout(new BorderLayout());
    //	Add Parameter
    JScrollPane dataPane = new JScrollPane();
    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();
    BorderLayout southLayout = new BorderLayout();
    southPanel.setLayout(southLayout);
    southPanel.add(confirmPanel, BorderLayout.CENTER);
    southPanel.add(statusBar, BorderLayout.SOUTH);
    dataTable.setMultiSelection(true);
    //	Add to Main
    add(parameterPanel, BorderLayout.NORTH);
    add(dataPane, BorderLayout.CENTER);
    add(southPanel, BorderLayout.SOUTH);
}
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 45 with CPanel

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

the class POSQuery method initMainPanel.

/**
	 * Init Main Panel
	 * @return void
	 */
private void initMainPanel() {
    statusBarInfo = "";
    //	Instance Panel
    setLayout(new GridBagLayout());
    //	For Table
    posTable = new POSTable();
    mainPanel = new CPanel(new GridBagLayout());
    mainPanel.setFocusCycleRoot(true);
    statusBar = new StatusBar();
    posTable.growScrollbars();
    parameterPanel = new CPanel(new GridBagLayout());
    centerScroll = new CScrollPane(posTable);
    confirmPanel = new CPanel(new GridBagLayout());
    //	
    centerScroll.setPreferredSize(new Dimension(800, 400));
    //	
    //	Create Buttons
    buttonNew = createButtonAction("New", KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0));
    buttonEdit = createButtonAction("Edit", KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));
    buttonReset = createButtonAction("Reset", KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0));
    buttonRefresh = createButtonAction("Refresh", KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
    buttonCancel = createButtonAction("Cancel", KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
    buttonOk = createButtonAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
    //	
    confirmPanel.add(buttonNew, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
    confirmPanel.add(buttonEdit, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
    confirmPanel.add(buttonReset, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
    confirmPanel.add(buttonRefresh, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
    confirmPanel.add(buttonOk, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
    confirmPanel.add(buttonCancel, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
    //	Add To Main Panel
    mainPanel.add(parameterPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
    mainPanel.add(centerScroll, new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    mainPanel.add(confirmPanel, new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    mainPanel.add(statusBar, new GridBagConstraints(0, 3, 1, 1, 1, 1, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    //	Add Main Panel to Content
    getContentPane().add(mainPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    //	Visible New and Edit
    buttonNew.setVisible(false);
    buttonEdit.setVisible(false);
    // Enable Button Edit
    buttonEdit.setEnabled(false);
    //	Add Listener
    posTable.addMouseListener(this);
    posTable.addKeyListener(this);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) POSTable(org.adempiere.pos.POSTable) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) CScrollPane(org.compiere.swing.CScrollPane) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension) StatusBar(org.compiere.apps.StatusBar)

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