home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java 1.2 How-To
/
JavaHowTo.iso
/
3rdParty
/
jbuilder
/
TRIAL
/
JBUILDER
/
JREFRNCE.Z
/
OrderEntryFrame.java
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
UTF-8
Wrap
Java Source
|
1998-05-08
|
45.7 KB
|
1,028 lines
/*
* Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
*
* This SOURCE CODE FILE, which has been provided by Borland as part
* of a Borland product for use ONLY by licensed users of the product,
* includes CONFIDENTIAL and PROPRIETARY information of Borland.
*
* USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
* OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
* THE PRODUCT.
*
* IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
* COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
* OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
* OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
* OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
* OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
* CODE FILE.
*/
//Title: Cliffhanger Adventure Gear
//Version:
//Copyright: Copyright (c) 1997 Borland International, Inc.
//Author: Application Methods, Inc.
//Description: Cliffhanger Adventure Gear order entry system
package borland.reference.cliffhanger;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import borland.jbcl.layout.*;
import borland.jbcl.control.*;
import borland.sql.dataset.*;
import borland.jbcl.dataset.*;
import borland.jbcl.util.*;
import java.lang.Exception;
/**
* OrderEntryFrame is the Frame subclass that is used to view, insert, and
* update Order records.
*
*/
public class OrderEntryFrame extends DecoratedFrame {
private static DataModule1 dm = DataModule1.getDataModule();
private static OrderEntryFrame myOrderEntryFrame;
private QueryDataSet qdsOrder;
private QueryDataSet qdsOrderItem;
private QueryDataSet qdsPayMethod;
private QueryDataSet qdsShipMethod;
private QueryDataSet qdsStatus;
private QueryDataSet qdsCustomer;
private QueryDataSet qdsProduct;
BevelPanel pnlTop = new BevelPanel();
BevelPanel pnlNavigator = new BevelPanel();
BevelPanel pnlDate = new BevelPanel();
BevelPanel pnlOrder = new BevelPanel();
BevelPanel pnlBillTo = new BevelPanel();
BevelPanel pnlShipTo = new BevelPanel();
BevelPanel pnlMiddle = new BevelPanel();
BevelPanel pnlOrderInfo = new BevelPanel();
BevelPanel pnlOrderItems = new BevelPanel();
BevelPanel pnlBottom = new BevelPanel();
BevelPanel pnlButtons = new BevelPanel();
LabelControl txtID = new LabelControl();
FieldControl txtOrderTrackNum = new FieldControl();
FieldControl txtCustomerPONum = new FieldControl();
FieldControl txtOrderDate = new FieldControl();
FieldControl txtCustomerName = new FieldControl();
FieldControl txtCustomerID = new FieldControl();
FieldControl txtBillAddr1 = new FieldControl();
FieldControl txtBillAddr2 = new FieldControl();
FieldControl txtBillCity = new FieldControl();
FieldControl txtBillState = new FieldControl();
FieldControl txtBillPostalCode = new FieldControl();
FieldControl txtBillCountry = new FieldControl();
FieldControl txtShipName = new FieldControl();
FieldControl txtShipAddr1 = new FieldControl();
FieldControl txtShipAddr2 = new FieldControl();
FieldControl txtShipCity = new FieldControl();
FieldControl txtShipState = new FieldControl();
FieldControl txtShipPostalCode = new FieldControl();
FieldControl txtShipCountry = new FieldControl();
FieldControl txtCreditCardNum= new FieldControl();
ChoiceControl cboPayMethod = new ChoiceControl();
ChoiceControl cboShipMethod = new ChoiceControl();
ChoiceControl cboStatus = new ChoiceControl();
FieldControl txtShipDate = new FieldControl();
LabelControl lblID = new LabelControl();
LabelControl lblDate = new LabelControl();
LabelControl lblOrderTrackNum = new LabelControl();
LabelControl lblCustomerPONum = new LabelControl();
LabelControl lblShipDate = new LabelControl();
LabelControl lblBillTo = new LabelControl();
LabelControl lblShipTo = new LabelControl();
LabelControl lblCreditCardNum = new LabelControl();
LabelControl lblPayMethod = new LabelControl();
LabelControl lblShipMethod = new LabelControl();
LabelControl lblStatus = new LabelControl();
GridBagLayout gridBagLayout3 = new GridBagLayout();
GridBagLayout gridBagLayout2 = new GridBagLayout();
GridBagLayout gridBagLayout5 = new GridBagLayout();
GridBagLayout gridBagLayout6 = new GridBagLayout();
BorderLayout borderLayout1 = new BorderLayout();
BorderLayout borderLayout2 = new BorderLayout();
BorderLayout borderLayout3 = new BorderLayout();
GridControl grdOrderItems = new GridControl();
ButtonControl btnSave = new ButtonControl();
ButtonControl btnCancel = new ButtonControl();
ButtonControl btnClose = new ButtonControl();
GridBagLayout gridBagLayout9 = new GridBagLayout();
GridBagLayout gridBagLayout4 = new GridBagLayout();
BevelPanel pnlTotals = new BevelPanel();
LabelControl lblSubTotal = new LabelControl();
LabelControl lblTax = new LabelControl();
LabelControl lblShipping = new LabelControl();
LabelControl lblAmtPaid = new LabelControl();
LabelControl lblAmtDue = new LabelControl();
FieldControl txtSubTotal = new FieldControl();
FieldControl txtTax = new FieldControl();
FieldControl txtTaxPercent = new FieldControl();
FieldControl txtShipping = new FieldControl();
FieldControl txtShipPercent = new FieldControl();
FieldControl txtAmtPaid = new FieldControl();
FieldControl txtAmtDue = new FieldControl();
NavigatorControl navigatorControl1 = new NavigatorControl();
StatusBar statusBarOrder = new StatusBar();
StatusBar statusBarOrderItem = new StatusBar();
ImageControl imgLogo = new ImageControl();
ButtonControl btnFindCustomer = new ButtonControl();
ButtonControl btnNewCustomer = new ButtonControl();
GridBagLayout gridBagLayout7 = new GridBagLayout();
BevelPanel pnlBillToButtons = new BevelPanel();
GridBagLayout gridBagLayout8 = new GridBagLayout();
GridBagLayout gridBagLayout10 = new GridBagLayout();
ButtonControl btnSaveShipTo = new ButtonControl();
BevelPanel pnlOrderItemStatus = new BevelPanel();
ButtonControl btnAddOrderItem = new ButtonControl();
ButtonControl btnRemoveOrderItem = new ButtonControl();
GridBagLayout gridBagLayout11 = new GridBagLayout();
BevelPanel pnlOrderItemButtons = new BevelPanel();
LabelControl lblOrderItemStatus = new LabelControl();
ResourceBundle res = Res.getBundle("borland.reference.cliffhanger.Res");
GridBagLayout gridBagLayout12 = new GridBagLayout();
GridBagLayout gridBagLayout13 = new GridBagLayout();
GridLayout gridLayout1 = new GridLayout();
/**
* The constructor is protected. Use the getOrderEntryFrame method to get an
* instance of this class.
*/
protected OrderEntryFrame() {
try {
jbInit(); // initialize frame's controls (JBuilder designer)
initData(); // initialize default data-aware component values.
}
catch (Exception e) {
e.printStackTrace();
};
}
/**
* Method generated and maintained by JBuilder designer to initialize
* control properties.
*/
private void jbInit() throws Exception{
this.setSize(new Dimension(600, 600));
this.setTitle(res.getString("OEF_Orders"));
this.addWindowListener(new OrderEntryFrame_this_windowAdapter(this));
this.setExitOnClose(false);
pnlShipTo.setLayout(gridBagLayout6);
pnlOrder.setLayout(gridBagLayout5);
pnlBillTo.setLayout(gridBagLayout3);
pnlOrder.setBevelInner(BevelPanel.FLAT);
pnlOrder.setBevelOuter(BevelPanel.FLAT);
pnlBillTo.setMargins(new Insets(5, 0, 5, 0));
pnlShipTo.setMargins(new Insets(5, 0, 5, 0));
pnlMiddle.setBevelOuter(BevelPanel.FLAT);
pnlOrderInfo.setBevelInner(BevelPanel.FLAT);
pnlOrderInfo.setMargins(new Insets(0, 0, 4, 0));
pnlOrderItems.setBevelOuter(BevelPanel.LOWERED);
pnlBottom.setBevelInner(BevelPanel.FLAT);
pnlOrderInfo.setLayout(gridBagLayout4);
pnlBottom.setLayout(gridBagLayout10);
pnlOrderItems.setLayout(borderLayout3);
pnlMiddle.setLayout(borderLayout2);
pnlNavigator.setBevelInner(BevelPanel.FLAT);
pnlNavigator.setBevelOuter(BevelPanel.FLAT);
pnlNavigator.setMargins(new Insets(0, 4, 0, 0));
pnlDate.setBevelInner(BevelPanel.FLAT);
pnlDate.setBevelOuter(BevelPanel.FLAT);
pnlDate.setMargins(new Insets(4, 0, 4, 0));
pnlTop.setLayout(gridBagLayout2);
pnlDate.setLayout(gridLayout1);
pnlNavigator.setLayout(gridBagLayout8);
lblBillTo.setText(res.getString("OEF_Bill_To"));
lblShipTo.setText(res.getString("OEF_Ship_To"));
lblDate.setText(res.getString("OEF_Date"));
lblCreditCardNum.setText(res.getString("OEF_Credit_Card_No"));
lblPayMethod.setText(res.getString("OEF_Payment_Method"));
lblShipMethod.setText(res.getString("OEF_Ship_Via"));
lblStatus.setText(res.getString("OEF_Status"));
grdOrderItems.setDataSet(dm.getOrderItemDataSet());
pnlButtons.setBevelInner(BevelPanel.FLAT);
pnlButtons.setBevelOuter(borland.jbcl.control.BevelPanel.FLAT);
txtCustomerName.setAutoEdit(false);
txtCustomerName.setColumnName("CUSTOMERNAME");
txtCustomerName.setBackground(SystemColor.control);
txtCustomerName.setDataSet(dm.getOrderDataSet());
txtCustomerName.setEditInPlace(false);
txtCustomerName.setReadOnly(true);
txtCustomerID.setAutoEdit(false);
txtCustomerID.setColumnName("CUSTOMERID");
txtCustomerID.setBackground(SystemColor.control);
txtCustomerID.setDataSet(dm.getOrderDataSet());
txtCustomerID.setEditInPlace(false);
txtCustomerID.setReadOnly(true);
txtBillAddr1.setAutoEdit(false);
txtBillAddr1.setColumnName("BILLADDR1");
txtBillAddr1.setBackground(SystemColor.control);
txtBillAddr1.setDataSet(dm.getOrderDataSet());
txtBillAddr1.setEditInPlace(false);
txtBillAddr1.setReadOnly(true);
txtBillAddr2.setAutoEdit(false);
txtBillAddr2.setColumnName("BILLADDR2");
txtBillAddr2.setBackground(SystemColor.control);
txtBillAddr2.setDataSet(dm.getOrderDataSet());
txtBillAddr2.setEditInPlace(false);
txtBillAddr2.setReadOnly(true);
txtBillCity.setAutoEdit(false);
txtBillCity.setColumnName("BILLCITY");
txtBillCity.setBackground(SystemColor.control);
txtBillCity.setDataSet(dm.getOrderDataSet());
txtBillCity.setEditInPlace(false);
txtBillCity.setReadOnly(true);
txtBillState.setAutoEdit(false);
txtBillState.setColumnName("BILLSTATE");
txtBillState.setBackground(SystemColor.control);
txtBillState.setDataSet(dm.getOrderDataSet());
txtBillState.setEditInPlace(false);
txtBillState.setReadOnly(true);
txtBillPostalCode.setAutoEdit(false);
txtBillPostalCode.setColumnName("BILLPOSTALCODE");
txtBillPostalCode.setBackground(SystemColor.control);
txtBillPostalCode.setDataSet(dm.getOrderDataSet());
txtBillPostalCode.setEditInPlace(false);
txtBillPostalCode.setReadOnly(true);
txtBillCountry.setAutoEdit(false);
txtBillCountry.setColumnName("BILLCOUNTRY");
txtBillCountry.setBackground(SystemColor.control);
txtBillCountry.setDataSet(dm.getOrderDataSet());
txtBillCountry.setEditInPlace(false);
txtBillCountry.setReadOnly(true);
txtShipName.setColumnName("SHIPNAME");
txtShipName.setDataSet(dm.getOrderDataSet());
txtShipAddr1.setColumnName("SHIPADDR1");
txtShipAddr1.setDataSet(dm.getOrderDataSet());
txtShipAddr2.setColumnName("SHIPADDR2");
txtShipAddr2.setDataSet(dm.getOrderDataSet());
txtShipCity.setColumnName("SHIPCITY");
txtShipCity.setDataSet(dm.getOrderDataSet());
txtShipState.setColumnName("SHIPSTATE");
txtShipState.setDataSet(dm.getOrderDataSet());
txtShipPostalCode.setColumnName("SHIPPOSTALCODE");
txtShipPostalCode.setDataSet(dm.getOrderDataSet());
txtShipCountry.setColumnName("SHIPCOUNTRY");
txtShipCountry.setDataSet(dm.getOrderDataSet());
txtCreditCardNum.setColumnName("CREDITCARDNUM");
txtCreditCardNum.setDataSet(dm.getOrderDataSet());
cboPayMethod.setColumnName("PAYMETHOD");
cboPayMethod.setDataSet(dm.getOrderDataSet());
cboShipMethod.setColumnName("SHIPMETHOD");
cboShipMethod.setDataSet(dm.getOrderDataSet());
cboStatus.setColumnName("STATUS");
cboStatus.setDataSet(dm.getOrderDataSet());
txtShipDate.setColumnName("SHIPDATE");
txtShipDate.setDataSet(dm.getOrderDataSet());
cboPayMethod.addItemListener(new OrderEntryFrame_cboPayMethod_itemAdapter(this));
pnlButtons.setLayout(gridBagLayout9);
btnSave.setActionCommand("");
btnSave.setLabel(res.getString("OEF_Save"));
btnSave.addActionListener(new OrderEntryFrame_btnSave_actionAdapter(this));
btnCancel.setActionCommand("");
btnCancel.setLabel(res.getString("OEF_Cancel"));
btnCancel.addActionListener(new OrderEntryFrame_btnCancel_actionAdapter(this));
btnClose.setActionCommand("");
btnClose.setLabel(res.getString("OEF_Close"));
btnClose.addActionListener(new OrderEntryFrame_btnClose_actionAdapter(this));
pnlTotals.setBevelInner(BevelPanel.FLAT);
pnlTotals.setBevelOuter(borland.jbcl.control.BevelPanel.FLAT);
pnlTotals.setMargins(new Insets(4, 0, 4, 0));
pnlTotals.setLayout(gridBagLayout7);
lblSubTotal.setText(res.getString("OEF_SubTotal"));
lblTax.setText(res.getString("OEF_Tax"));
lblShipping.setText(res.getString("OEF_Shipping"));
lblAmtPaid.setText(res.getString("OEF_Paid"));
lblAmtDue.setText(res.getString("OEF_Due"));
txtSubTotal.setAlignment(borland.jbcl.util.Alignment.RIGHT | borland.jbcl.util.Alignment.MIDDLE);
txtSubTotal.setColumnName("SUBTOTAL");
txtSubTotal.setDataSet(dm.getOrderItemDataSet());
txtTax.setAlignment(borland.jbcl.util.Alignment.RIGHT | borland.jbcl.util.Alignment.MIDDLE);
txtTax.setColumnName("TAX");
txtTax.setDataSet(dm.getOrderItemDataSet());
txtTaxPercent.setText(String.valueOf(dm.TAXPERCENT));
txtTaxPercent.setBackground(SystemColor.control);
txtTaxPercent.setReadOnly(true);
txtTaxPercent.setAlignment(borland.jbcl.util.Alignment.RIGHT | borland.jbcl.util.Alignment.MIDDLE);
txtShipping.setAlignment(borland.jbcl.util.Alignment.RIGHT | borland.jbcl.util.Alignment.MIDDLE);
txtShipping.setColumnName("SHIPPING");
txtShipping.setDataSet(dm.getOrderItemDataSet());
txtShipPercent.setText(String.valueOf(dm.SHIPPERCENT));
txtShipPercent.setBackground(SystemColor.control);
txtShipPercent.setReadOnly(true);
txtShipPercent.setAlignment(borland.jbcl.util.Alignment.RIGHT | borland.jbcl.util.Alignment.MIDDLE);
txtAmtPaid.setAlignment(borland.jbcl.util.Alignment.RIGHT | borland.jbcl.util.Alignment.MIDDLE);
txtAmtPaid.setColumnName("AMTPAID");
txtAmtPaid.setDataSet(dm.getOrderDataSet());
txtAmtDue.setAlignment(borland.jbcl.util.Alignment.RIGHT | borland.jbcl.util.Alignment.MIDDLE);
txtAmtDue.setColumnName("AMTDUE");
txtAmtDue.setDataSet(dm.getOrderItemDataSet());
txtAmtDue.setFont(new Font("Dialog", 1, 12));
navigatorControl1.setDataSet(dm.getOrderDataSet());
lblID.setFont(new Font("Dialog", 1, 12));
lblID.setText(res.getString("OEF_Order_No"));
txtID.setColumnName("ID");
txtID.setBackground(SystemColor.control);
txtID.setDataSet(dm.getOrderDataSet());
txtID.setForeground(Color.red);
txtOrderTrackNum.setColumnName("ORDERTRACKNUM");
txtOrderTrackNum.setDataSet(dm.getOrderDataSet());
txtCustomerPONum.setColumnName("CUSTOMERPONUM");
txtCustomerPONum.setDataSet(dm.getOrderDataSet());
txtOrderDate.setColumnName("ORDERDATE");
txtOrderDate.setDataSet(dm.getOrderDataSet());
txtID.setReadOnly(true);
txtID.setFont(new Font("Dialog", 1, 14));
lblOrderTrackNum.setText(res.getString("OEF_OrderTrack_No"));
lblCustomerPONum.setText(res.getString("OEF_PO_No"));
pnlBillToButtons.setBevelInner(BevelPanel.FLAT);
pnlBillToButtons.setBevelOuter(borland.jbcl.control.BevelPanel.FLAT);
btnSaveShipTo.setLabel(res.getString("OEF_Save_as_Default"));
pnlOrderItemStatus.setBevelInner(BevelPanel.FLAT);
pnlOrderItemButtons.setLayout(gridBagLayout12);
pnlOrderItemStatus.setLayout(gridBagLayout11);
btnAddOrderItem.setForeground(Color.blue);
btnAddOrderItem.setLabel(res.getString("OEF_Add_Item"));
btnAddOrderItem.addActionListener(new OrderEntryFrame_btnAddOrderItem_actionAdapter(this));
btnRemoveOrderItem.setForeground(Color.red);
btnRemoveOrderItem.setLabel(res.getString("OEF_Remove_Item"));
statusBarOrder.setDataSet(dm.getOrderDataSet());
statusBarOrder.setBevelOuter(BevelPanel.LOWERED);
statusBarOrder.setFont(new Font("Dialog", 0, 10));
statusBarOrderItem.setBevelInner(BevelPanel.FLAT);
statusBarOrderItem.setDataSet(dm.getOrderItemDataSet());
statusBarOrderItem.setFont(new Font("Dialog", 0, 10));
pnlOrderItemButtons.setBevelInner(BevelPanel.FLAT);
lblOrderItemStatus.setFont(new Font("Dialog", 0, 10));
lblOrderItemStatus.setText(res.getString("OEF_Order_Item"));
gridLayout1.setRows(3);
gridLayout1.setColumns(2);
btnRemoveOrderItem.addActionListener(new OrderEntryFrame_btnRemoveOrderItem_actionAdapter(this));
btnSaveShipTo.addActionListener(new OrderEntryFrame_btnSaveShipTo_actionAdapter(this));
lblShipDate.setText(res.getString("OEF_Ship_Date"));
pnlBillToButtons.setLayout(gridBagLayout13);
btnFindCustomer.setLabel(res.getString("OEF_Find_"));
btnFindCustomer.addActionListener(new OrderEntryFrame_btnFindCustomer_actionAdapter(this));
btnNewCustomer.setActionCommand("");
btnNewCustomer.setLabel(res.getString("OEF_New_"));
btnNewCustomer.addActionListener(new OrderEntryFrame_btnNewCustomer_actionAdapter(this));
imgLogo.setBackground(SystemColor.control);
imgLogo.setAlignment(borland.jbcl.util.Alignment.CENTER | borland.jbcl.util.Alignment.MIDDLE);
imgLogo.setImageName(".\\Graphics\\Logo_sml.gif");
this.setLayout(borderLayout1);
this.add(pnlOrder, BorderLayout.NORTH);
pnlOrder.add(pnlBillTo, new GridBagConstraints2(0, 1, 1, 2, 100.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
pnlBillTo.add(txtCustomerName, new GridBagConstraints2(0, 1, 2, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 0), 0, 0));
pnlBillTo.add(txtCustomerID, new GridBagConstraints2(2, 1, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 8), 0, 0));
pnlBillTo.add(txtBillAddr1, new GridBagConstraints2(0, 2, 3, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 8), 0, 0));
pnlBillTo.add(txtBillAddr2, new GridBagConstraints2(0, 3, 3, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 8), 0, 0));
pnlBillTo.add(txtBillCity, new GridBagConstraints2(0, 4, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 0), 0, 0));
pnlBillTo.add(txtBillState, new GridBagConstraints2(1, 4, 1, 2, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 8, 0), 0, 0));
pnlBillTo.add(txtBillPostalCode, new GridBagConstraints2(2, 4, 1, 2, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 8, 8), 0, 0));
pnlBillTo.add(txtBillCountry, new GridBagConstraints2(0, 5, 3, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 8), 0, 0));
pnlBillTo.add(lblBillTo, new GridBagConstraints2(0, 0, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 8, 0, 0), 0, 0));
pnlBillTo.add(pnlBillToButtons, new GridBagConstraints2(1, 0, 2, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 8), 20, 0));
pnlBillToButtons.add(btnNewCustomer, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 50, 0));
pnlBillToButtons.add(btnFindCustomer, new GridBagConstraints2(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 0, 0), 50, 0));
pnlOrder.add(pnlShipTo, new GridBagConstraints2(1, 1, 1, 2, 100.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
pnlShipTo.add(txtShipName, new GridBagConstraints2(0, 1, 3, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 8), 0, 0));
pnlShipTo.add(txtShipAddr1, new GridBagConstraints2(0, 2, 3, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 8), 0, 0));
pnlShipTo.add(txtShipAddr2, new GridBagConstraints2(0, 3, 3, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 8), 0, 0));
pnlShipTo.add(txtShipCity, new GridBagConstraints2(0, 4, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 0), 0, 0));
pnlShipTo.add(txtShipState, new GridBagConstraints2(1, 4, 1, 2, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 8, 0), 0, 0));
pnlShipTo.add(txtShipPostalCode, new GridBagConstraints2(2, 4, 1, 2, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 8, 8), 0, 0));
pnlShipTo.add(txtShipCountry, new GridBagConstraints2(0, 5, 3, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 8), 0, 0));
pnlShipTo.add(lblShipTo, new GridBagConstraints2(0, 0, 2, 1, 100.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 8, 0, 0), 0, 0));
pnlShipTo.add(btnSaveShipTo, new GridBagConstraints2(2, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, -8, 0, 8), 0, 0));
pnlOrder.add(pnlTop, new GridBagConstraints2(0, 0, 2, 1, 100.0, 100.0
,GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
pnlTop.add(pnlNavigator, new GridBagConstraints2(0, 0, 1, 1, 100.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
pnlNavigator.add(navigatorControl1, new GridBagConstraints2(0, 0, 2, 1, 100.0, 100.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 40, 1));
pnlNavigator.add(lblID, new GridBagConstraints2(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
pnlNavigator.add(txtID, new GridBagConstraints2(1, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
pnlTop.add(pnlDate, new GridBagConstraints2(1, 0, 1, 3, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 0), 14, 0));
pnlDate.add(lblDate, null);
pnlDate.add(txtOrderDate, null);
pnlDate.add(lblOrderTrackNum, null);
pnlDate.add(txtOrderTrackNum, null);
pnlDate.add(lblCustomerPONum, null);
pnlDate.add(txtCustomerPONum, null);
this.add(pnlMiddle, BorderLayout.CENTER);
pnlMiddle.add(pnlOrderInfo, BorderLayout.NORTH);
pnlOrderInfo.add(txtCreditCardNum, new GridBagConstraints2(2, 1, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 0), 0, 0));
pnlOrderInfo.add(cboPayMethod, new GridBagConstraints2(1, 1, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 0), 0, 0));
pnlOrderInfo.add(cboShipMethod, new GridBagConstraints2(4, 1, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 0), 0, 0));
pnlOrderInfo.add(cboStatus, new GridBagConstraints2(5, 1, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 0), 0, 0));
pnlOrderInfo.add(lblCreditCardNum, new GridBagConstraints2(2, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 0), 0, 0));
pnlOrderInfo.add(lblPayMethod, new GridBagConstraints2(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 0), 0, 0));
pnlOrderInfo.add(lblShipMethod, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 0), 0, 0));
pnlOrderInfo.add(lblStatus, new GridBagConstraints2(5, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 0), 0, 0));
pnlOrderInfo.add(txtShipDate, new GridBagConstraints2(6, 1, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 8), 0, 0));
pnlOrderInfo.add(lblShipDate, new GridBagConstraints2(6, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 8, 0, 8), 0, 0));
pnlMiddle.add(pnlOrderItems, BorderLayout.CENTER);
pnlOrderItems.add(grdOrderItems, BorderLayout.CENTER);
pnlOrderItems.add(pnlOrderItemStatus, BorderLayout.SOUTH);
pnlOrderItemStatus.add(statusBarOrderItem, new GridBagConstraints2(1, 0, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
pnlOrderItemStatus.add(pnlOrderItemButtons, new GridBagConstraints2(3, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
pnlOrderItemButtons.add(btnAddOrderItem, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 25, 0));
pnlOrderItemButtons.add(btnRemoveOrderItem, new GridBagConstraints2(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
pnlMiddle.add(pnlBottom, BorderLayout.SOUTH);
pnlBottom.add(pnlButtons, new GridBagConstraints2(3, 0, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
pnlButtons.add(btnSave, new GridBagConstraints2(0, 0, 1, 1, 100.0, 100.0
,GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 40, 0));
pnlButtons.add(btnCancel, new GridBagConstraints2(0, 1, 1, 1, 100.0, 100.0
,GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
pnlButtons.add(btnClose, new GridBagConstraints2(0, 2, 1, 1, 100.0, 100.0
,GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
pnlBottom.add(pnlTotals, new GridBagConstraints2(1, 0, 2, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
pnlTotals.add(lblSubTotal, new GridBagConstraints2(0, 0, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 8, 0, 0), 0, 0));
pnlTotals.add(lblTax, new GridBagConstraints2(0, 1, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 8, 0, 0), 0, 0));
pnlTotals.add(txtSubTotal, new GridBagConstraints2(4, 0, 2, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 0), 0, 0));
pnlTotals.add(txtTax, new GridBagConstraints2(5, 1, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
pnlTotals.add(txtTaxPercent, new GridBagConstraints2(4, 1, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 0), 0, 0));
pnlTotals.add(txtShipping, new GridBagConstraints2(5, 2, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
pnlTotals.add(lblShipping, new GridBagConstraints2(0, 2, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 8, 0, 0), 0, 0));
pnlTotals.add(txtAmtPaid, new GridBagConstraints2(4, 3, 2, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 0), 0, 0));
pnlTotals.add(txtAmtDue, new GridBagConstraints2(4, 4, 2, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 0), 0, 0));
pnlTotals.add(lblAmtPaid, new GridBagConstraints2(0, 3, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 8, 0, 0), 0, 0));
pnlTotals.add(lblAmtDue, new GridBagConstraints2(0, 4, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 8, 0, 0), 0, 0));
pnlTotals.add(txtShipPercent, new GridBagConstraints2(4, 2, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 0), 0, 0));
pnlBottom.add(imgLogo, new GridBagConstraints2(0, 0, 1, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
this.add(statusBarOrder, BorderLayout.SOUTH);
pnlOrderItemStatus.add(lblOrderItemStatus, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), -40, 0));
}
/**
* We created this method to separate code to initialize database and
* data-aware controls, which otherwise would go in the jbInit() method.
* Note that by doing so, the properties set here are not visible to the
* property inspector. And setting any properties via the inspector will
* add code to jbInit() instead of here.
*/
private void initData() throws Exception {
qdsOrder = dm.getOrderDataSet();
qdsOrderItem = dm.getOrderItemDataSet();
qdsPayMethod = dm.getPayMethodDataSet();
qdsShipMethod = dm.getShipMethodDataSet();
qdsStatus = dm.getStatusDataSet();
qdsCustomer = dm.getCustomerDataSet();
qdsProduct = dm.getProductDataSet();
qdsOrder.open();
qdsOrderItem.open();
qdsPayMethod.open();
qdsShipMethod.open();
qdsStatus.open();
qdsCustomer.open();
qdsProduct.open();
// Fill lookup list for ChoiceControls
cboPayMethod.setItems(qdsPayMethod, "PAYMETHOD");
cboShipMethod.setItems(qdsShipMethod, "SHIPMETHOD");
cboStatus.setItems(qdsStatus, "STATUS");
// Display the Tax percent and Shipping percent
txtTaxPercent.setText((DataModule1.TAXPERCENT * 100) + "%" );
txtShipPercent.setText((DataModule1.SHIPPERCENT * 100) + "%");
}
/**
* Class method to access the singleton instance of the class.
*/
public static OrderEntryFrame getOrderEntryFrame() {
if (myOrderEntryFrame == null)
myOrderEntryFrame = new OrderEntryFrame();
return myOrderEntryFrame;
}
/**
* Method to insert a new customer order record.
* Useful for inserting a new order from other forms in
* the application.
*/
public void newOrder() {
try {
// Open the dataset if not already opened.
qdsOrder.open();
qdsOrderItem.open();
// Insert a new Order record at the end of the
// dataset
qdsOrder.insertRow(false);
}
catch (Exception e) {
e.printStackTrace();
}
}
/**
* Method to insert a new customer order record
* and setting the customer ID that is passed as
* the parameter customerID.
* Useful for inserting a new order from other forms in
* the application.
*/
public void newOrder(int customerID) {
try {
// Open the dataset if not already opened.
qdsOrder.open();
qdsOrderItem.open();
// Insert a new Order record at the end of the
// dataset
qdsOrder.insertRow(false);
qdsOrder.setInt("CUSTOMERID", customerID);
}
catch (Exception e) {
e.printStackTrace();
}
}
/**
* Method to locate an order given the order ID.
* If matching record is found, the dataset cursor is positioned
* on the matching record, and returns true boolean result.
* Useful for locating order record from other forms in the application.
*/
public boolean locateOrder(int orderID) {
boolean found = false;
try {
// Define a DataRow to hold the orderID to look for
// the Order Dataset. Open the dataset if not opened.
qdsOrder.open();
DataRow locateRow = new DataRow(qdsOrder, "ID");
locateRow.setInt("ID", orderID);
found = qdsOrder.locate(locateRow, Locate.FIRST);
}
catch (Exception e) {
e.printStackTrace();
}
return found;
}
/**
* Initialize form controls when the form is activated.
*/
void this_windowActivated(WindowEvent e) {
// determine which navigator buttons to enable
// Note that we set the buttons here instead of in
// windowOpened because when the NavigatorControl rebuilds
// itself, the Save and Refresh buttons get re-enabled
int[] enabledFlags = {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0};
for (int i = 0; i < enabledFlags.length; i++)
navigatorControl1.setButtonEnabled(i, enabledFlags[i] == 1);
}
/**
* Before closing the window, check for any pending changes,
* and prompt user if there are changes pending.
* Note that we need to both check if there is anything to Post,
* and to check if there is anything to resolve.
*/
void this_windowClosing(WindowEvent e) {
try {
int orderStatus = qdsOrder.getStatus();
int orderItemStatus = qdsOrderItem.getStatus();
// determine if datasets are in edit or insert mode and
// needs to be posted.
boolean needsPosting = (qdsOrder.isEditing() ||
qdsOrder.isEditingNewRow() ||
qdsOrderItem.isEditing() ||
qdsOrderItem.isEditingNewRow());
// determine if datasets have pending inserts or updates and
// need to be resolved.
boolean needsResolving = (((orderStatus & RowStatus.UPDATED) != 0) ||
((orderStatus & RowStatus.INSERTED) != 0) ||
((orderItemStatus & RowStatus.UPDATED) != 0) ||
((orderItemStatus & RowStatus.INSERTED) != 0));
if (needsPosting || needsResolving) {
int answer = CliffhangerApplication.messageDlg(res.getString("OEF_Save_Pending_Changes"),
res.getString("OEF_Save_pending_changes?"),
Message.YES_NO_CANCEL);
// Post changes and resolve them back to DB
if (answer == Message.YES) {
saveUpdates();
}
// If user chooses no, then cancel any inserts or edits
// and refresh the dataset.
else if (answer == Message.NO) {
cancelUpdates();
}
// If user cancels, just return
else //if (answer == Message.CANCEL)
return;
}
setVisible(false);
dispose();
}
catch (Exception ex) {
ex.printStackTrace();
new ExceptionDialog(this, res.getString("OEF_Error"), ex, true).show();
}
}
/**
* Method to save the inserts or changes made to the order and order item
* dataset.
*/
private void saveUpdates() {
try {
if (qdsOrder.isEditing() || qdsOrder.isEditingNewRow()) {
qdsOrder.post();
}
if (qdsOrderItem.isEditing() || qdsOrderItem.isEditingNewRow()) {
qdsOrderItem.post();
}
qdsOrder.getDatabase().saveChanges(new DataSet[] {qdsOrder, qdsOrderItem, qdsProduct}, true);
// Refresh the Product dataset to get the latest StockQty for products.
qdsProduct.refresh();
}
catch (Exception ex) {
ex.printStackTrace();
new ExceptionDialog(this, res.getString("OEF_Error"), ex, true).show();
}
}
/**
* Method to cancel the inserts or changes made to the order and order item
* dataset.
*/
private void cancelUpdates() {
try {
// Cancel any edits or inserts
qdsOrderItem.cancel();
qdsOrder.cancel();
int orderStatus = qdsOrder.getStatus();
if ((orderStatus & RowStatus.UPDATED) != 0) {
// refetch this row if it was an update
qdsOrder.refetchRow(qdsOrder);
}
else if ((orderStatus & RowStatus.INSERTED) != 0) {
// refresh the whole dataset if it was an insert
qdsOrder.refresh();
qdsOrder.last();
}
int orderItemStatus = qdsOrderItem.getStatus();
if (((orderItemStatus & RowStatus.UPDATED) != 0) ||
((orderItemStatus & RowStatus.INSERTED) != 0)) {
// refetch the orderItem dataset if modified
qdsOrderItem.refresh();
}
}
catch (Exception ex) {
ex.printStackTrace();
}
}
/**
* When the Save button is clicked, save the changes in the master-detail
* relationship between Orders and OrderItem datasets.
* Post edits before calling resolving changes to the database.
*/
void btnSave_actionPerformed(ActionEvent e) {
saveUpdates();
}
/**
* When the Cancel button is clicked, cancel any pending changes made to both
* Orders and OrderItem datasets.
*/
void btnCancel_actionPerformed(ActionEvent e) {
cancelUpdates();
}
/**
* When Close button is clicked, call this frame's windowClosing
* event handler to properly handle all dataset pending updates.
*/
void btnClose_actionPerformed(ActionEvent e) {
// close this Window
this.this_windowClosing(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
}
/**
* When the Save Ship To button is clicked, save the Ship To information
* of the current order to the current Customer record.
*/
void btnSaveShipTo_actionPerformed(ActionEvent e) {
saveShipToInfo();
}
/**
* Save the Ship To information of the current order record to the
* Customer record.
* Note: This method also resolves the changes to the database.
*/
void saveShipToInfo() {
try {
int customerID = qdsOrder.getInt("CUSTOMERID");
DataRow locateRow = new DataRow(qdsCustomer, "ID");
locateRow.setInt("ID", customerID);
if (qdsCustomer.locate(locateRow, Locate.FIRST)) {
qdsCustomer.editRow();
qdsCustomer.setString("SHIPNAME", qdsOrder.getString("SHIPNAME"));
qdsCustomer.setString("SHIPADDR1", qdsOrder.getString("SHIPADDR1"));
qdsCustomer.setString("SHIPADDR2", qdsOrder.getString("SHIPADDR2"));
qdsCustomer.setString("SHIPCITY", qdsOrder.getString("SHIPCITY"));
qdsCustomer.setString("SHIPSTATE", qdsOrder.getString("SHIPSTATE"));
qdsCustomer.setString("SHIPPOSTALCODE", qdsOrder.getString("SHIPPOSTALCODE"));
qdsCustomer.setString("SHIPCOUNTRY", qdsOrder.getString("SHIPCOUNTRY"));
qdsCustomer.post();
//qdsCustomer.saveChanges(qdsCustomer);
}
}
catch (Exception ex) {
ex.printStackTrace();
new ExceptionDialog(this, res.getString("OEF_Error"), ex, true).show();
}
}
/**
* When the Find Customer button is clicked, Use the FindOrderCustomer dialog
* to find a customer for this Order record.
*/
void btnFindCustomer_actionPerformed(ActionEvent e) {
FindOrderCustomer dialog = new FindOrderCustomer((Frame)this, res.getString("OEF_Find_Customer"), true);
try {
//Center the dialog
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension dialogSize = dialog.getSize();
if (dialogSize.height > screenSize.height)
dialogSize.height = screenSize.height;
if (dialogSize.width > screenSize.width)
dialogSize.width = screenSize.width;
dialog.setLocation((screenSize.width - dialogSize.width) / 2, (screenSize.height - dialogSize.height) / 2);
dialog.show();
if (dialog.getResult() == FindOrderCustomer.OK) {
// use the selected customer for the order
qdsOrder.editRow();
qdsOrder.setInt("CUSTOMERID", dialog.getCustomerID());
}
}
catch (Exception ex) {
ex.printStackTrace();
}
finally {
dialog.dispose();
}
}
/**
* When the New Customer button is clicked, Use the AddCustomerDlg dialog
* to create a new customer for this Order record.
*/
void btnNewCustomer_actionPerformed(ActionEvent e) {
AddCustomerDlg dialog = new AddCustomerDlg((Frame)this, res.getString("OEF_Add_Customer"), true);
try {
//Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension dialogSize = dialog.getSize();
if (dialogSize.height > screenSize.height)
dialogSize.height = screenSize.height;
if (dialogSize.width > screenSize.width)
dialogSize.width = screenSize.width;
dialog.setLocation((screenSize.width - dialogSize.width) / 2, (screenSize.height - dialogSize.height) / 2);
dialog.show();
if (dialog.getResult() == AddCustomerDlg.OK) {
// use the selected customer
qdsOrder.editRow();
qdsOrder.setInt("CUSTOMERID", dialog.getCustomerID());
}
}
catch (Exception ex) {
ex.printStackTrace();
}
finally {
dialog.dispose();
}
}
/**
* When the Add Item button is clicked, insert a new OrderItem record.
*/
void btnAddOrderItem_actionPerformed(ActionEvent e) {
try {
qdsOrderItem.insertRow(false);
}
catch (DataSetException ex) {
ex.printStackTrace();
}
}
/**
* When the Delete Item button is clicked, delete the current OrderItem record.
*/
void btnRemoveOrderItem_actionPerformed(ActionEvent e) {
try {
qdsOrderItem.deleteRow();
}
catch (DataSetException ex) {
ex.printStackTrace();
}
}
/* If the payment method is COD, blank out the CC Num field */
void cboPayMethod_itemStateChanged(ItemEvent e) {
if(cboPayMethod.getSelectedItem().compareTo(res.getString("OEF_COD")) == 0)
txtCreditCardNum.setText("");
}
}
class OrderEntryFrame_this_windowAdapter extends java.awt.event.WindowAdapter {
OrderEntryFrame adaptee;
OrderEntryFrame_this_windowAdapter(OrderEntryFrame adaptee) {
this.adaptee = adaptee;
}
public void windowClosing(WindowEvent e) {
adaptee.this_windowClosing(e);
}
public void windowActivated(WindowEvent e) {
adaptee.this_windowActivated(e);
}
}
class OrderEntryFrame_btnSave_actionAdapter implements java.awt.event.ActionListener {
OrderEntryFrame adaptee;
OrderEntryFrame_btnSave_actionAdapter(OrderEntryFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnSave_actionPerformed(e);
}
}
class OrderEntryFrame_btnCancel_actionAdapter implements java.awt.event.ActionListener {
OrderEntryFrame adaptee;
OrderEntryFrame_btnCancel_actionAdapter(OrderEntryFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnCancel_actionPerformed(e);
}
}
class OrderEntryFrame_btnClose_actionAdapter implements java.awt.event.ActionListener {
OrderEntryFrame adaptee;
OrderEntryFrame_btnClose_actionAdapter(OrderEntryFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnClose_actionPerformed(e);
}
}
class OrderEntryFrame_btnSaveShipTo_actionAdapter implements java.awt.event.ActionListener {
OrderEntryFrame adaptee;
OrderEntryFrame_btnSaveShipTo_actionAdapter(OrderEntryFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnSaveShipTo_actionPerformed(e);
}
}
class OrderEntryFrame_btnFindCustomer_actionAdapter implements java.awt.event.ActionListener {
OrderEntryFrame adaptee;
OrderEntryFrame_btnFindCustomer_actionAdapter(OrderEntryFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnFindCustomer_actionPerformed(e);
}
}
class OrderEntryFrame_btnNewCustomer_actionAdapter implements java.awt.event.ActionListener {
OrderEntryFrame adaptee;
OrderEntryFrame_btnNewCustomer_actionAdapter(OrderEntryFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnNewCustomer_actionPerformed(e);
}
}
class OrderEntryFrame_btnAddOrderItem_actionAdapter implements java.awt.event.ActionListener {
OrderEntryFrame adaptee;
OrderEntryFrame_btnAddOrderItem_actionAdapter(OrderEntryFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnAddOrderItem_actionPerformed(e);
}
}
class OrderEntryFrame_btnRemoveOrderItem_actionAdapter implements java.awt.event.ActionListener {
OrderEntryFrame adaptee;
OrderEntryFrame_btnRemoveOrderItem_actionAdapter(OrderEntryFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnRemoveOrderItem_actionPerformed(e);
}
}
class OrderEntryFrame_cboPayMethod_itemAdapter implements java.awt.event.ItemListener {
OrderEntryFrame adaptee;
OrderEntryFrame_cboPayMethod_itemAdapter(OrderEntryFrame adaptee) {
this.adaptee = adaptee;
}
public void itemStateChanged(ItemEvent e) {
adaptee.cboPayMethod_itemStateChanged(e);
}
}