home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-05-08 | 26.3 KB | 545 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.
- */
- //--------------------------------------------------------------------------------------------------
- // CORBA Reference Application
- // Copyright (c) 1997 by Borland International, All Rights Reserved
- //
- // Panel containing Credit Card Application
- //--------------------------------------------------------------------------------------------------
-
- package borland.reference.creditapproval.client;
- import java.awt.*;
- import java.awt.event.*;
- import java.util.*;
- import java.text.*;
- import borland.jbcl.layout.*;
- import borland.jbcl.control.*;
- import borland.jbcl.dataset.*;
- import java.applet.*;
- import borland.reference.creditapproval.CORBAInterface.*;
-
- /**
- * ApplicationFormPanel allows a user to enter application information and
- * to submit this information for Credit Card Approval.
- */
- public class ApplicationFormPanel extends BevelPanel implements Observer{
- TableDataSet tableDataSetApplicantData = new TableDataSet();
- TextFieldControl TextFieldControl0 = new TextFieldControl();
- TextFieldControl TextFieldControl1 = new TextFieldControl();
- TextFieldControl TextFieldControl2 = new TextFieldControl();
- TextFieldControl TextFieldControl3 = new TextFieldControl();
- TextFieldControl TextFieldControl4 = new TextFieldControl();
- TextFieldControl TextFieldControl5 = new TextFieldControl();
- TextFieldControl TextFieldControl6 = new TextFieldControl();
- TextFieldControl TextFieldControl7 = new TextFieldControl();
- TextFieldControl TextFieldControl8 = new TextFieldControl();
- TextFieldControl TextFieldControl9 = new TextFieldControl();
- TextFieldControl TextFieldControl10 = new TextFieldControl();
- FieldControl FieldControl1 = new FieldControl();
- FieldControl FieldControl2 = new FieldControl();
- FieldControl FieldControl3 = new FieldControl();
- Label label1 = new Label();
- Label label2 = new Label();
- Label label3 = new Label();
- Label label4 = new Label();
- Label label5 = new Label();
- Label label6 = new Label();
- Label label7 = new Label();
- Label label8 = new Label();
- Label label9 = new Label();
- Label label10 = new Label();
- Label label11 = new Label();
- Label label12 = new Label();
- Label label13 = new Label();
- Label label14 = new Label();
- Label label15 = new Label();
- Column columnFirstName = new Column();
- Column columnLastName = new Column();
- Column columnMi = new Column();
- Column columnAddr1 = new Column();
- Column columnAddr2 = new Column();
- Column columnCity = new Column();
- Column columnState = new Column();
- Column columnPostalCode = new Column();
- Column columnCountry = new Column();
- Column columnPhone = new Column();
- Column columnIdentification = new Column();
- Column columnDob = new Column();
- Column columnMonthlyIncome = new Column();
- Column columnRentMortgagePayment = new Column();
- ImageControl imageControl1 = new ImageControl();
- ButtonControl buttonSubmit = new ButtonControl();
- ButtonControl buttonClear = new ButtonControl();
- Label label16 = new Label();
- private CreditApprovalApplet theApplet = null;
- Message messageRequiredFieldMissing = new Message();
- StatusBar statusBar = new StatusBar();
- BevelPanel bevelPanel1 = new BevelPanel();
- GridBagLayout gridBagLayout1 = new GridBagLayout();
- BevelPanel bevelPanel2 = new BevelPanel();
- BevelPanel bevelPanel3 = new BevelPanel();
- GridBagLayout gridBagLayout2 = new GridBagLayout();
- BevelPanel bevelPanel4 = new BevelPanel();
- GridBagLayout gridBagLayout3 = new GridBagLayout();
- GridBagLayout gridBagLayout4 = new GridBagLayout();
- GridBagLayout gridBagLayout5 = new GridBagLayout();
- BevelPanel bevelPanel5 = new BevelPanel();
- BevelPanel bevelPanel6 = new BevelPanel();
- GridBagLayout gridBagLayout6 = new GridBagLayout();
- BorderLayout borderLayout1 = new BorderLayout();
- BorderLayout borderLayout2 = new BorderLayout();
- BorderLayout borderLayout3 = new BorderLayout();
- private EmptyStringNullListener formColumnListener = new EmptyStringNullListener();
- ResourceBundle res = Res.getBundle("borland.reference.creditapproval.client.Res");
-
-
- /**
- /* Default constructor - placed here for the sake of JavaBean compliance
- */
- public ApplicationFormPanel() {
- try {
- jbInit();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Construct the Panel by invoking jbInit()
- */
- public ApplicationFormPanel( CreditApprovalApplet creditApp ) {
- theApplet = creditApp;
-
- // Register an interset in the Callback Class
- theApplet.callbackControlThread.getCallback().addObserver( this );
-
- // Register with the Column Listener so that this class is notified
- // whenever a column is changed
- formColumnListener.addObserver( this );
-
- try {
- jbInit();
- tableDataSetApplicantData.open();
- tableDataSetApplicantData.insertRow( true );
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- updateStatusWithNextRequired();
- }
-
- /**
- * Initialize the Panel
- */
- private void jbInit() throws Exception{
- this.setBevelInner(BevelPanel.FLAT);
- this.setLayout(borderLayout3);
- label1.setForeground(Color.red);
- label1.setFont(new Font("Dialog", 3, 18));
- label1.setAlignment(1);
- label1.setText(res.getString("Credit_Card"));
- label2.setFont(new Font("Dialog", 3, 14));
- label2.setAlignment(1);
- label2.setText(res.getString("Personal_Information"));
- tableDataSetApplicantData.setStoreName("");
- columnFirstName.setCaption(res.getString("First"));
- columnFirstName.setColumnName("firstName");
- columnFirstName.setEditMask("ccccccccccccccccccccccccc");
- columnFirstName.setExportDisplayMask("");
- columnFirstName.setDefault("");
- columnFirstName.setDataType(borland.jbcl.util.Variant.STRING);
- columnFirstName.setRequired(true);
- TextFieldControl0.setColumnName("firstName");
- TextFieldControl0.setDataSet(tableDataSetApplicantData);
- columnLastName.setCaption(res.getString("Last"));
- columnLastName.setColumnName("lastName");
- columnLastName.setEditMask("cccccccccccccccccccccccccccccccccccccccc");
- columnLastName.setRequired(true);
- columnLastName.setDataType(borland.jbcl.util.Variant.STRING);
- columnMi.setCaption(res.getString("MI"));
- columnMi.setColumnName("mi");
- columnMi.setDataType(borland.jbcl.util.Variant.STRING);
- columnMi.setEditMask("c");
- columnAddr2.setColumnName("addr2");
- columnAddr2.setCaption(res.getString("Address_2"));
- columnAddr2.setEditMask("cccccccccccccccccccccccccccccc");
- columnAddr2.setDataType(borland.jbcl.util.Variant.STRING);
- label3.setText(res.getString("Name") + ":" );
- TextFieldControl1.setColumnName("mi");
- TextFieldControl1.setDataSet(tableDataSetApplicantData);
- TextFieldControl2.setColumnName("lastName");
- TextFieldControl2.setDataSet(tableDataSetApplicantData);
- label4.setText(res.getString("First"));
- label5.setAlignment(1);
- label5.setText(res.getString("MI"));
- label6.setText(res.getString("Last"));
- label7.setText(res.getString("Address_1") + ":");
- label8.setText(res.getString("Address_2") + ":" );
- label9.setText(res.getString("City") + "/" + res.getString("State") + "/" +
- res.getString("Postal_Code") + ":");
- label10.setText(res.getString("Country") + ":");
- label11.setText(res.getString("Phone") + ":");
- label12.setText(res.getString("Personal_ID") + ":");
- label13.setText(res.getString("DOB") + ":" );
- label14.setText(res.getString("Monthly_Income") + ":");
- label15.setText(res.getString("Rent_Mortgage_Payment") + ":");
- TextFieldControl3.setColumnName("addr1");
- TextFieldControl3.setDataSet(tableDataSetApplicantData);
- TextFieldControl4.setColumnName("addr2");
- TextFieldControl4.setDataSet(tableDataSetApplicantData);
- TextFieldControl5.setColumnName("city");
- TextFieldControl5.setDataSet(tableDataSetApplicantData);
- TextFieldControl6.setColumnName("country");
- TextFieldControl6.setDataSet(tableDataSetApplicantData);
- TextFieldControl7.setColumnName("phone");
- TextFieldControl7.setDataSet(tableDataSetApplicantData);
- TextFieldControl8.setColumnName("identification");
- TextFieldControl8.setDataSet(tableDataSetApplicantData);
- FieldControl1.setColumnName("dob");
- FieldControl1.setDataSet(tableDataSetApplicantData);
- FieldControl2.setColumnName("monthlyIncome");
- FieldControl2.setDataSet(tableDataSetApplicantData);
- FieldControl3.setColumnName("rentMortgagePayment");
- FieldControl3.setDataSet(tableDataSetApplicantData);
- TextFieldControl9.setColumnName("state");
- TextFieldControl9.setDataSet(tableDataSetApplicantData);
- TextFieldControl10.setColumnName("postalCode");
- TextFieldControl10.setDataSet(tableDataSetApplicantData);
- columnCity.setColumnName("city");
- columnCity.setCaption(res.getString("City"));
- columnCity.setEditMask("cccccccccccccccccccccccccccccc");
- columnCity.setDataType(borland.jbcl.util.Variant.STRING);
- columnCity.setRequired(true);
- columnRentMortgagePayment.setColumnName("rentMortgagePayment");
- columnRentMortgagePayment.setCaption(res.getString("Rent_Mortgage_Payment"));
- columnRentMortgagePayment.setDataType(borland.jbcl.util.Variant.DOUBLE);
- columnRentMortgagePayment.setCurrency(true);
- columnRentMortgagePayment.setRequired(true);
- if (theApplet != null)
- imageControl1.setImageURL( new java.net.URL(theApplet.getImageLocation() + "logo.gif"));
- buttonClear.setLabel(res.getString("Clear"));
- buttonClear.addActionListener(new ApplicationFormPanel_buttonClear_actionAdapter(this));
- label16.setFont(new Font("Dialog", 3, 14));
- label16.setAlignment(1);
- label16.setText(res.getString("Financial_Information"));
- messageRequiredFieldMissing.setResult(Message.OK);
- messageRequiredFieldMissing.setTitle(res.getString("Required_Field"));
- statusBar.setBevelOuter(BevelPanel.LOWERED);
- bevelPanel4.setMargins(new Insets(2, 2, 2, 2));
- bevelPanel6.setBevelInner(BevelPanel.FLAT);
- bevelPanel6.setLayout(borderLayout1);
- bevelPanel5.setLayout(gridBagLayout6);
- bevelPanel2.setLayout(gridBagLayout5);
- bevelPanel4.setLayout(gridBagLayout4);
- bevelPanel3.setLayout(gridBagLayout2);
- bevelPanel1.setLayout(gridBagLayout1);
- statusBar.setBevelInner(BevelPanel.LOWERED);
- statusBar.setDataSet(tableDataSetApplicantData);
- buttonSubmit.setLabel(res.getString("Submit"));
- buttonSubmit.addActionListener(new ApplicationFormPanel_buttonSubmit_actionAdapter(this));
- columnMonthlyIncome.setColumnName("monthlyIncome");
- columnMonthlyIncome.setCaption(res.getString("Monthly_Income"));
- columnMonthlyIncome.setDataType(borland.jbcl.util.Variant.DOUBLE);
- columnMonthlyIncome.setCurrency(true);
- columnMonthlyIncome.setRequired(true);
- columnDob.setColumnName("dob");
- columnDob.setCaption(res.getString("DOB"));
- columnDob.setDataType(borland.jbcl.util.Variant.DATE);
- columnDob.setRequired(true);
-
- // Resourced, so a locale-specific edit mask is used
- columnDob.setEditMask(res.getString("DobEditMask"));
- // Not resourced, so US currency is alsways used
- columnMonthlyIncome.setEditMask("$##,###.##");
- columnRentMortgagePayment.setEditMask("$##,###.##");
-
- // Set to NULL so that LOCALE is used for edit mask
- // columnDob.setEditMask( null );
- // columnMonthlyIncome.setEditMask( null );
- // columnRentMortgagePayment.setEditMask( null );
-
- columnIdentification.setColumnName("identification");
- columnIdentification.setCaption(res.getString("Identification"));
- columnIdentification.setEditMask("cccccccccccccccccccccccccccccc");
- columnIdentification.setDataType(borland.jbcl.util.Variant.STRING);
- columnPhone.setColumnName("phone");
- columnPhone.setCaption(res.getString("Phone"));
- columnPhone.setEditMask("ccccccccccccccc");
- columnPhone.setRequired(true);
- columnPhone.setDataType(borland.jbcl.util.Variant.STRING);
- columnCountry.setColumnName("country");
- columnCountry.setCaption(res.getString("Country"));
- columnCountry.setEditMask("cccccccccccccccccccc");
- columnCountry.setDataType(borland.jbcl.util.Variant.STRING);
- columnCountry.setRequired(true);
- columnPostalCode.setColumnName("postalCode");
- columnPostalCode.setCaption(res.getString("Postal_Code"));
- columnPostalCode.setEditMask("cccccccccccc");
- columnPostalCode.setDataType(borland.jbcl.util.Variant.STRING);
- columnPostalCode.setRequired(true);
- columnState.setCaption(res.getString("State"));
- columnState.setColumnName("state");
- columnState.setEditMask("ccccccccccccccc");
- columnState.setDataType(borland.jbcl.util.Variant.STRING);
- columnState.setRequired(true);
- columnAddr1.setCaption(res.getString("Address_1"));
- columnAddr1.setColumnName("addr1");
- columnAddr1.setDataType(borland.jbcl.util.Variant.STRING);
- columnAddr1.setEditMask("cccccccccccccccccccccccccccccc");
- columnAddr1.setRequired(true);
- bevelPanel1.add(statusBar, new GridBagConstraints2(0, 1, 2, 1, 1.0, 1.0
- ,GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(8, 4, 4, 4), 0, -5));
- bevelPanel1.add(buttonSubmit, new GridBagConstraints2(0, 0, 1, 1, 1.0, 0.0
- ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(8, 0, 0, 11), 11, 0));
- bevelPanel1.add(buttonClear, new GridBagConstraints2(1, 0, 1, 1, 1.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(8, 0, 0, 0), 22, 0));
- this.add(bevelPanel1, BorderLayout.SOUTH);
- this.add(bevelPanel3, BorderLayout.NORTH);
- bevelPanel3.add(label1, new GridBagConstraints2(0, 0, 1, 1, 1.0, 1.0
- ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
- this.add(bevelPanel4, BorderLayout.CENTER);
- bevelPanel4.add(label2, new GridBagConstraints2(0, 0, 9, 1, 0.0, 0.0
- ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 0, 0, 0), 0, 0));
- bevelPanel4.add(TextFieldControl0, new GridBagConstraints2(4, 2, 1, 1, 1.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 0), 61, 0));
- bevelPanel4.add(TextFieldControl1, new GridBagConstraints2(5, 2, 2, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 4, 2), 0, 0));
- bevelPanel4.add(TextFieldControl2, new GridBagConstraints2(7, 2, 2, 1, 1.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 120, 0));
- bevelPanel4.add(TextFieldControl3, new GridBagConstraints2(4, 3, 5, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 0, 0));
- bevelPanel4.add(TextFieldControl4, new GridBagConstraints2(4, 4, 5, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 0, 0));
- bevelPanel4.add(TextFieldControl5, new GridBagConstraints2(4, 6, 1, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 0), 0, 0));
- bevelPanel4.add(TextFieldControl9, new GridBagConstraints2(5, 6, 2, 1, 1.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 4, 2), 54, 0));
- bevelPanel4.add(TextFieldControl10, new GridBagConstraints2(8, 6, 1, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 0, 0));
- bevelPanel4.add(TextFieldControl6, new GridBagConstraints2(4, 7, 4, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 0), 77, 0));
- bevelPanel4.add(TextFieldControl7, new GridBagConstraints2(4, 8, 4, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 0), 77, 0));
- bevelPanel4.add(TextFieldControl8, new GridBagConstraints2(4, 9, 4, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 0), 77, 0));
- bevelPanel4.add(FieldControl1, new GridBagConstraints2(4, 10, 1, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
- bevelPanel4.add(label3, new GridBagConstraints2(0, 2, 4, 1, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), 35, 0));
- bevelPanel4.add(label4, new GridBagConstraints2(4, 1, 2, 1, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 53, 0));
- bevelPanel4.add(label5, new GridBagConstraints2(5, 1, 2, 1, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
- bevelPanel4.add(label6, new GridBagConstraints2(7, 1, 2, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 59, 0));
- bevelPanel4.add(label7, new GridBagConstraints2(0, 3, 4, 1, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 14, 0, 0), 11, 0));
- bevelPanel4.add(label8, new GridBagConstraints2(0, 4, 2, 2, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), 0, 0));
- bevelPanel4.add(label9, new GridBagConstraints2(0, 6, 3, 1, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), -6, 0));
- bevelPanel4.add(label10, new GridBagConstraints2(0, 7, 2, 1, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), 18, 0));
- bevelPanel4.add(label11, new GridBagConstraints2(0, 8, 2, 1, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), 15, 0));
- bevelPanel4.add(label12, new GridBagConstraints2(0, 9, 4, 1, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), -3, 0));
- bevelPanel4.add(label13, new GridBagConstraints2(0, 10, 1, 1, 0.0, 0.0
- ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 11, 0), 0, 0));
- this.add(bevelPanel6, BorderLayout.EAST);
- bevelPanel6.add(bevelPanel2, BorderLayout.CENTER);
- bevelPanel2.add(label16, new GridBagConstraints2(0, 0, 3, 1, 1.0, 0.0
- ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(8, 0, 4, 0), 0, 0));
- bevelPanel2.add(FieldControl2, new GridBagConstraints2(2, 1, 1, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 0, 0));
- bevelPanel2.add(FieldControl3, new GridBagConstraints2(2, 2, 1, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 0, 0));
- bevelPanel2.add(label14, new GridBagConstraints2(0, 1, 2, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 7, 0, 0), -10, 0));
- bevelPanel2.add(label15, new GridBagConstraints2(0, 2, 1, 1, 0.0, 0.0
- ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 7, 1, 0), 0, 0));
- bevelPanel6.add(bevelPanel5, BorderLayout.NORTH);
- bevelPanel5.add(imageControl1, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
- ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
-
- // Add EmptyString = NULL Column Changed Listeners to all columns.
- columnFirstName.addColumnChangeListener( formColumnListener );
- columnLastName.addColumnChangeListener( formColumnListener );
- columnMi.addColumnChangeListener( formColumnListener );
- columnAddr1.addColumnChangeListener( formColumnListener );
- columnAddr2.addColumnChangeListener( formColumnListener );
- columnCity.addColumnChangeListener( formColumnListener );
- columnState.addColumnChangeListener( formColumnListener );
- columnPostalCode.addColumnChangeListener( formColumnListener );
- columnCountry.addColumnChangeListener( formColumnListener );
- columnPhone.addColumnChangeListener( formColumnListener );
- columnIdentification.addColumnChangeListener( formColumnListener );
- columnDob.addColumnChangeListener( formColumnListener );
- columnMonthlyIncome.addColumnChangeListener( formColumnListener );
- columnRentMortgagePayment.addColumnChangeListener( formColumnListener );
-
- tableDataSetApplicantData.setColumns(new Column[] {columnFirstName, columnLastName, columnMi, columnAddr1, columnAddr2, columnCity, columnState, columnPostalCode, columnCountry, columnPhone, columnIdentification, columnDob, columnMonthlyIncome, columnRentMortgagePayment});
-
- }
-
- /**
- * Validate the user input - Make sure required fields have been
- * completed.
- */
- boolean validateForm() {
-
- // Make sure the current control has processed Text back to
- // the dataset by issuing a Focus Lost event
- if (theApplet == null) return false;
-
- Component currentFocus = theApplet.browserFrame.getFocusOwner();
- if (currentFocus != null)
- if (currentFocus instanceof TextFieldControl)
- currentFocus.dispatchEvent(new FocusEvent( currentFocus, FocusEvent.FOCUS_LOST, true ) );
-
- // Check for missing Required Columns
- Column missingColumn = FindMissingRequired.missingColumn(tableDataSetApplicantData);
- if (missingColumn != null ) {
- messageRequiredFieldMissing.setMessage(res.getString("Please_enter_a_value") + " '" + missingColumn.getCaption() + "'");
- messageRequiredFieldMissing.setFrame( theApplet.browserFrame );
- messageRequiredFieldMissing.show();
-
- Component missing = FindMissingRequired.findColumnTextField( this, missingColumn.getColumnName());
- if (missing != null) missing.requestFocus();
- return false;
- }
- return true;
- }
-
- /**
- * The SUBMIT button was pressed:
- * Submit the entered data to the Applet for Credit Approvals
- */
- void buttonSubmit_actionPerformed(ActionEvent ae) {
-
- if (!validateForm()) return;
-
- // Display the WAIT_CURSOR since this operation could take a moment
- Cursor currentCursor = this.getCursor();
- this.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR) );
-
- try {
- applicantInfoStruct appInfo = new applicantInfoStruct();
- creditApprovalStruct creditCardInfo;
- appInfo.firstName = tableDataSetApplicantData.getString( "firstName" );
- appInfo.MI = tableDataSetApplicantData.getString( "mi" );
- appInfo.lastName = tableDataSetApplicantData.getString( "lastName" );
- appInfo.DOB = tableDataSetApplicantData.getDate( "dob" ).toString();
- appInfo.phone = tableDataSetApplicantData.getString( "phone" );
- appInfo.address1 = tableDataSetApplicantData.getString( "addr1" );
- appInfo.address2 = tableDataSetApplicantData.getString( "addr2" );
- appInfo.city = tableDataSetApplicantData.getString( "city" );
- appInfo.state = tableDataSetApplicantData.getString( "state" );
- appInfo.postalCode = tableDataSetApplicantData.getString( "postalCode" );
- appInfo.country = tableDataSetApplicantData.getString( "country" );
- appInfo.PID = tableDataSetApplicantData.getString( "identification" );
- appInfo.monthlyIncome = tableDataSetApplicantData.getDouble( "monthlyIncome" );
- appInfo.rentMortgagePayment = tableDataSetApplicantData.getDouble( "rentMortgagePayment" );
- theApplet.applyForCard( appInfo );
- } catch (Exception e) {
- System.err.println(e);
- }
-
- // Restore the Cursor
- this.setCursor( currentCursor );
- }
-
- /**
- * The Clear button was pressed. Reset all columns to NULL
- */
- void buttonClear_actionPerformed(ActionEvent ae) {
- try{
- tableDataSetApplicantData.clearValues();
- TextFieldControl0.requestFocus();
- } catch( Exception e ) {
- System.err.println(e);
- }
- }
-
- /**
- * Set the text in the status bar
- */
- private void setStatusText( String text ) {
- statusBar.setText( text );
- }
-
- /**
- * Find the next required column that does not contain a value and
- * notify the user using the status bar.
- */
- private void updateStatusWithNextRequired() {
- Column missingColumn = FindMissingRequired.missingColumn(tableDataSetApplicantData);
- if (missingColumn != null )
- setStatusText( res.getString("Please_enter_a_value") + " '" + missingColumn.getCaption() + "'");
- else setStatusText( "" );
- }
-
- /**
- * An obserable has changed. The only observables that this
- * class observes is: 1) formColumnListener and
- * 2) the ClientCallback class
- */
- public void update( Observable obs, Object arg ) {
- if ( obs instanceof ColumnChangeListener )
- updateStatusWithNextRequired();
- else if ( arg instanceof String )
- setStatusText( (String) arg );
- }
-
- }
-
- /**
- * ActionListner Class used for the Submit button
- */
- class ApplicationFormPanel_buttonSubmit_actionAdapter implements java.awt.event.ActionListener{
- ApplicationFormPanel adaptee;
-
- ApplicationFormPanel_buttonSubmit_actionAdapter(ApplicationFormPanel adaptee) {
- this.adaptee = adaptee;
- }
-
- public void actionPerformed(ActionEvent e) {
- adaptee.buttonSubmit_actionPerformed(e);
- }
- }
-
- /**
- * ActionListner Class used for the CLEAR button
- */
- class ApplicationFormPanel_buttonClear_actionAdapter implements java.awt.event.ActionListener{
- ApplicationFormPanel adaptee;
-
- ApplicationFormPanel_buttonClear_actionAdapter(ApplicationFormPanel adaptee) {
- this.adaptee = adaptee;
- }
-
- public void actionPerformed(ActionEvent e) {
- adaptee.buttonClear_actionPerformed(e);
- }
- }
-
-
-