Search in sources :

Example 6 with AppsAction

use of org.compiere.apps.AppsAction in project adempiere by adempiere.

the class VCollect method jbInit.

// init
/**
	 * Instance Frame and fill fields
	 * @throws Exception
	 * @return void
	 */
private void jbInit() throws Exception {
    screenSize = pos.getSize();
    widthSize = (screenSize.width * 40) / 100;
    heightSize = (screenSize.height * 50) / 100;
    //	Instance Dialog
    //dialog = new CDialog(Env.getWindow(pos.getWindowNo()), Msg.translate(ctx, "Payment"), true);
    dialog = new CPanel();
    dialog.setName(Msg.translate(ctx, "Payment"));
    //
    mainLayout = new BorderLayout();
    parameterLayout = new GridBagLayout();
    mainPanel = new CPanel();
    parameterPanel = new CPanel();
    centerPanel = new CPanel();
    scrollPane = new JScrollPane();
    scrollPane.setPreferredSize(new Dimension(widthSize, heightSize));
    mainPanel.setLayout(mainLayout);
    parameterPanel.setLayout(parameterLayout);
    centerPanel.setLayout(parameterLayout);
    mainPanel.add(scrollPane);
    scrollPane.getViewport().add(centerPanel);
    //	Add Payment Amount
    labelPayAmt = new CLabel(Msg.translate(ctx, "PayAmt") + ":");
    labelPayAmt.setFont(pos.getBigFont());
    //
    fieldPayAmt = new CLabel();
    fieldPayAmt.setFont(pos.getBigFont());
    //	Add Payment Amount
    labelOpenAmt = new CLabel(Msg.translate(ctx, "OpenAmt") + ":");
    labelOpenAmt.setFont(pos.getBigFont());
    //	
    fieldOpenAmt = new CLabel();
    fieldOpenAmt.setFont(pos.getBigFont());
    //	For Returned Amount
    labelReturnAmt = new CLabel(Msg.translate(ctx, "AmountReturned") + ":");
    labelReturnAmt.setFont(pos.getBigFont());
    //	
    fieldReturnAmt = new CLabel();
    fieldReturnAmt.setFont(pos.getBigFont());
    labelPaidAmt = new CLabel(Msg.translate(ctx, "PaidAmt") + ":");
    labelPaidAmt.setFont(pos.getBigFont());
    labelPaidAmt.setVisible(false);
    fieldPaidAmt = new CLabel();
    fieldPaidAmt.setFont(pos.getBigFont());
    fieldPaidAmt.setVisible(false);
    //	Add Plus Button
    AppsAction action = new AppsAction("Plus", KeyStroke.getKeyStroke(KeyEvent.VK_F2, Event.F2), false);
    action.setDelegate(this);
    buttonPlus = (CButton) action.getButton();
    buttonPlus.setPreferredSize(new Dimension(pos.getButtonSize(), pos.getButtonSize()));
    buttonPlus.setFocusable(false);
    //	For Confirm Panel Button
    buttonCancel = ConfirmPanel.createCancelButton(true);
    buttonCancel.setPreferredSize(new Dimension(pos.getButtonSize(), pos.getButtonSize()));
    buttonOk = ConfirmPanel.createOKButton(true);
    buttonOk.setPreferredSize(new Dimension(pos.getButtonSize(), pos.getButtonSize()));
    parameterPanel.add(labelPayAmt, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(fieldPayAmt, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(labelOpenAmt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(fieldOpenAmt, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(labelReturnAmt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(fieldReturnAmt, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(labelPaidAmt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(fieldPaidAmt, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(buttonPlus, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(buttonCancel, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(buttonOk, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    //	Add Fields to Main Panel
    mainPanel.add(parameterPanel, BorderLayout.NORTH);
    buttonOk.addActionListener(this);
    buttonCancel.addActionListener(this);
    //	Add to Dialog
    dialog.add(mainPanel, BorderLayout.CENTER);
}
Also used : JScrollPane(javax.swing.JScrollPane) CLabel(org.compiere.swing.CLabel) AppsAction(org.compiere.apps.AppsAction) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension)

Example 7 with AppsAction

use of org.compiere.apps.AppsAction in project adempiere by adempiere.

the class VCollectDetail method loadStandardPanel.

/**
	 * Load Standard Fields for Collect
	 * @return void
	 */
private void loadStandardPanel() {
    standardPanel = new CPanel(layout);
    //	For Tender Type
    //  C_Payment_v.TenderType
    int columnId = 8416;
    MLookup lookup = MLookupFactory.get(Env.getCtx(), 0, 0, columnId, DisplayType.List);
    fieldTenderType = new VLookup("TenderType", true, false, true, lookup);
    ((VComboBox) fieldTenderType.getCombo()).setRenderer(new POSLookupListCellRenderer(font));
    fieldTenderType.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT));
    ((VComboBox) fieldTenderType.getCombo()).setFont(font);
    fieldTenderType.addVetoableChangeListener(this);
    //	For Amount
    fieldPayAmt = new VNumber("PayAmt", true, false, true, DisplayType.Amount, "");
    fieldPayAmt.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT));
    fieldPayAmt.setFont(font);
    fieldPayAmt.setValue(Env.ZERO);
    fieldPayAmt.addVetoableChangeListener(this);
    fieldPayAmt.addKeyListener(this);
    //	Button
    AppsAction action = new AppsAction("Minus", KeyStroke.getKeyStroke(KeyEvent.VK_F2, Event.F2), false);
    action.setDelegate(this);
    buttonMinus = (CButton) action.getButton();
    buttonMinus.setPreferredSize(new Dimension(FIELD_HEIGHT, FIELD_HEIGHT));
    buttonMinus.setFocusable(false);
    //	Add Tender Type
    standardPanel.add(fieldTenderType, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    standardPanel.add(fieldPayAmt, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
}
Also used : AppsAction(org.compiere.apps.AppsAction) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MLookup(org.compiere.model.MLookup) CPanel(org.compiere.swing.CPanel) VLookup(org.compiere.grid.ed.VLookup) VNumber(org.compiere.grid.ed.VNumber) VComboBox(org.compiere.grid.ed.VComboBox) Dimension(java.awt.Dimension)

Example 8 with AppsAction

use of org.compiere.apps.AppsAction in project adempiere by adempiere.

the class POSScalesPanel method dynInit.

private boolean dynInit() {
    labelWeight = new CLabel("0.000", CLabel.CENTER);
    labelWeight.setFont(new Font("Arial", Font.BOLD, 50));
    centerPanel.setLayout(parameterLayout);
    centerPanel.add(labelWeight);
    AppsAction action = new AppsAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), false);
    action.setDelegate(pos.getScalesListener());
    buttonCaptureWeight = (CButton) action.getButton();
    buttonCaptureWeight.setPreferredSize(new Dimension(pos.getButtonSize(), pos.getButtonSize()));
    buttonCaptureWeight.setFocusable(true);
    buttonCaptureWeight.addKeyListener(pos.getScalesListener());
    parameterPanel.add(buttonCaptureWeight, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    mainPanel.add(parameterPanel, BorderLayout.SOUTH);
    return true;
}
Also used : CLabel(org.compiere.swing.CLabel) AppsAction(org.compiere.apps.AppsAction) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) Dimension(java.awt.Dimension) Font(java.awt.Font)

Example 9 with AppsAction

use of org.compiere.apps.AppsAction in project adempiere by adempiere.

the class POSLogin method init.

private void init() {
    CPanel panel = new CPanel();
    panel.setLayout(new MigLayout());
    getContentPane().add(panel);
    panel.add(new CLabel(Msg.translate(posPanel.getCtx(), "SalesRep_ID")));
    username = new POSTextField(Msg.translate(posPanel.getCtx(), "SalesRep_ID"), posPanel.getKeyboard());
    panel.add(username, "wrap");
    panel.add(new CLabel(Msg.translate(posPanel.getCtx(), "UserPIN")));
    pin = new POSTextField(Msg.translate(posPanel.getCtx(), "UserPIN"), posPanel.getKeyboard());
    panel.add(pin, "");
    AppsAction act = new AppsAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), false);
    act.setDelegate(this);
    bProcess = (CButton) act.getButton();
    bProcess.setFocusable(false);
    panel.add(bProcess, "h 50!, w 50!");
    pack();
}
Also used : CLabel(org.compiere.swing.CLabel) AppsAction(org.compiere.apps.AppsAction) MigLayout(net.miginfocom.swing.MigLayout) CPanel(org.compiere.swing.CPanel)

Example 10 with AppsAction

use of org.compiere.apps.AppsAction 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)

Aggregations

AppsAction (org.compiere.apps.AppsAction)10 Dimension (java.awt.Dimension)6 CPanel (org.compiere.swing.CPanel)6 Insets (java.awt.Insets)5 BorderLayout (java.awt.BorderLayout)4 CButton (org.compiere.swing.CButton)4 GridBagConstraints (java.awt.GridBagConstraints)3 JScrollPane (javax.swing.JScrollPane)3 CLabel (org.compiere.swing.CLabel)3 FlowLayout (java.awt.FlowLayout)1 Font (java.awt.Font)1 GridBagLayout (java.awt.GridBagLayout)1 ImageIcon (javax.swing.ImageIcon)1 JButton (javax.swing.JButton)1 ListSelectionModel (javax.swing.ListSelectionModel)1 ColorUIResource (javax.swing.plaf.ColorUIResource)1 MigLayout (net.miginfocom.swing.MigLayout)1 AdempiereTaskPaneUI (org.adempiere.plaf.AdempiereTaskPaneUI)1 ALayout (org.compiere.apps.ALayout)1 VComboBox (org.compiere.grid.ed.VComboBox)1