Search in sources :

Example 46 with CPanel

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

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

the class VCollectDetail method loadCreditMemo.

/**
	 * Load for Credit Memo
	 * @return void
	 */
private void loadCreditMemo() {
    creditMemoPanel = new CPanel(layout);
    //	Add label credit note
    labelCreditMemo = new CLabel(Msg.translate(Env.getCtx(), "CreditMemo") + ":");
    labelCreditMemo.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT));
    //	For Credit Memo
    MLookup cardNotelookup = getCreditMemoLockup(parentCollect.getC_BPartner_ID());
    fieldCreditMemo = new VLookup("CreditMemo", false, false, true, cardNotelookup);
    //	For Credit Memo Type
    //		((VComboBox)fieldCreditMemo.getCombo()).setRenderer(new POSLookupListCellRenderer(font));
    fieldCreditMemo.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT));
    //		((VComboBox)fieldCreditMemo.getCombo()).setFont(font);
    fieldCreditMemo.addVetoableChangeListener(this);
    //	Add to Panel
    creditMemoPanel.add(labelCreditMemo, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    creditMemoPanel.add(fieldCreditMemo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    //	Default visible false
    creditMemoPanel.setVisible(false);
}
Also used : CLabel(org.compiere.swing.CLabel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MLookup(org.compiere.model.MLookup) CPanel(org.compiere.swing.CPanel) VLookup(org.compiere.grid.ed.VLookup) Dimension(java.awt.Dimension)

Example 48 with CPanel

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

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

the class VCollectDetail method init.

/**
	 * Init Main Panel
	 * @return void
	 */
private void init() {
    font = parentCollect.getPOS().getFont();
    layout = new GridBagLayout();
    mainPanel = new CPanel(layout);
    //	Set Border
    //titleBorder = BorderFactory.createTitledBorder("Credit Card");
    //titleBorder.setTitleColor(AdempierePLAF.getTextColor_Label());
    //mainPanel.setBorder(titleBorder);
    //	Load Standard Panel
    loadStandardPanel();
    //	Load Check Panel
    loadCheckPanel();
    //	Load Debit Panel
    loadDebitPanel();
    //	Load Credit Panel
    loadCreditPanel();
    //	Load Credit Note Panel
    loadCreditMemo();
    //	Add to Main Panel
    mainPanel.add(standardPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    mainPanel.add(buttonMinus, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    mainPanel.add(checkPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    mainPanel.add(debitPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    mainPanel.add(creditPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    mainPanel.add(creditMemoPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    //	Change View
    fieldTenderType.setValue(getTenderType());
    fieldCreditCardType.setValue(getCreditCardType());
    fieldPayAmt.setValue(getPayAmt());
    changeViewPanel();
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) CPanel(org.compiere.swing.CPanel)

Example 50 with CPanel

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

the class VCollectDetail method loadDebitPanel.

/**
	 * Load for Debit Panel
	 * @return void
	 */
private void loadDebitPanel() {
    debitPanel = new CPanel(layout);
    //	For Route
    String routingNo = Msg.translate(ctx, "RoutingNo");
    fieldDebitRoutingNo = new POSTextField(routingNo, keyboard);
    fieldDebitRoutingNo.setPlaceholder(routingNo);
    fieldDebitRoutingNo.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT));
    fieldDebitRoutingNo.setFont(font);
    fieldDebitRoutingNo.addKeyListener(this);
    fieldDebitRoutingNo.addActionListener(this);
    //	For CVC
    String cvv2Match = Msg.translate(ctx, "R_CVV2Match");
    fieldDebitCVC = new POSTextField(cvv2Match, keyboard);
    fieldDebitCVC.setPlaceholder(cvv2Match);
    fieldDebitCVC.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT));
    fieldDebitCVC.setFont(font);
    fieldDebitCVC.addKeyListener(this);
    fieldDebitCVC.addActionListener(this);
    //	For Country
    String country = Msg.translate(ctx, "A_Country");
    fieldDebitCountry = new POSTextField(country, keyboard);
    fieldDebitCountry.setPlaceholder(country);
    fieldDebitCountry.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT));
    fieldDebitCountry.setFont(font);
    fieldDebitCountry.addKeyListener(this);
    fieldDebitCountry.addActionListener(this);
    //	Add to Panel
    debitPanel.add(fieldDebitRoutingNo, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    debitPanel.add(fieldDebitCountry, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    debitPanel.add(fieldDebitCVC, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    //	Default visible false
    debitPanel.setVisible(false);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) 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