home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / TRIAL / JBUILDER / JREFRNCE.Z / CustomerFindFrame.java < prev    next >
Encoding:
Java Source  |  1998-05-08  |  3.9 KB  |  110 lines

  1. /*
  2.  * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
  3.  * 
  4.  * This SOURCE CODE FILE, which has been provided by Borland as part
  5.  * of a Borland product for use ONLY by licensed users of the product,
  6.  * includes CONFIDENTIAL and PROPRIETARY information of Borland.  
  7.  *
  8.  * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
  9.  * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
  10.  * THE PRODUCT.
  11.  *
  12.  * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
  13.  * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
  14.  * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
  15.  * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
  16.  * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
  17.  * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
  18.  * CODE FILE.
  19.  */
  20.  
  21. //Title:        Cliffhanger Adventure Gear
  22. //Version:      
  23. //Copyright:    Copyright (c) 1997 Borland International, Inc.
  24. //Author:       Application Methods, Inc.
  25. //Description:  Cliffhanger Adventure Gear order entry system
  26.  
  27. package borland.reference.cliffhanger;
  28.  
  29. import java.awt.*;
  30. import java.awt.event.*;
  31. import borland.jbcl.layout.*;
  32. import borland.jbcl.control.*;
  33. import borland.sql.dataset.*;
  34. import borland.jbcl.dataset.*;
  35. import java.util.*;
  36.  
  37. /**
  38.  * CustomerFindFrame is inherited from FindFrame which is the base form for
  39.  * all Find windows in the Cliffhanger application.
  40.  * This find forms allows users to lookup customers by searching on a value for
  41.  * a single column in the customer dataset. A grid displays all the records
  42.  * for the datasets, and the grid will try to find the closet
  43.  * matching record as the user types in the search value.
  44.  */
  45. public class CustomerFindFrame extends FindFrame {
  46.   private static DataModule1 dm = DataModule1.getDataModule();
  47.   private static CustomerFindFrame myCustomerFindFrame;
  48. //  private QueryDataSet qdsCustomer;
  49.   ResourceBundle res = Res.getBundle("borland.reference.cliffhanger.Res");
  50.  
  51.   /**
  52.    * The constructor is protected. Use the getCustomerFindFrame method to get
  53.    * an instance of the class.
  54.    */
  55.   protected CustomerFindFrame() {
  56.     try {
  57.       jbInit();   // initialize frame's controls (JBuilder designer)
  58.     }
  59.     catch (Exception e) {
  60.       e.printStackTrace();
  61.     }
  62.   }
  63.  
  64.   private void jbInit() throws Exception{
  65.     this.setTitle(res.getString("CFF_Find_Customer"));
  66.     statusBar1.setDataSet(dm.getCustomerDataSet());
  67.     locatorControl1.setDataSet(dm.getCustomerDataSet());
  68.     gridControl1.setDataSet(dm.getCustomerDataSet());
  69.     choiceControl1.setItems(new String [] { res.getString("DM_CustomerDS_LASTNAME"), res.getString("DM_CustomerDS_FIRSTNAME"), res.getString("DM_CustomerDS_PHONE"), res.getString("DM_CustomerDS_ID") });
  70.   }
  71.  
  72.   /**
  73.    * Class method to access the singleton instance of the class.
  74.    */
  75.   public static CustomerFindFrame getCustomerFindFrame() {
  76.     if (myCustomerFindFrame == null)
  77.       myCustomerFindFrame = new CustomerFindFrame();
  78.  
  79.     return myCustomerFindFrame;
  80.   }
  81.  
  82.   /**
  83.    * When the Go To button is clicked, override this event handler
  84.    * to show the appropriate form for the record selected, then
  85.    * close this form.
  86.    */
  87.   void btnGoto_actionPerformed(ActionEvent e) {
  88.     // Show the Customer form and show it centered in the screen
  89.     DecoratedFrame frame = CustomerFrame.getCustomerFrame();
  90.     CliffhangerApplication.showCenteredFrame(frame, false);
  91.  
  92.     // Hide this frame ...
  93.     this.setVisible(false);
  94.     this.dispose();
  95.   }
  96.  
  97. }
  98.  
  99. class CustomerFindFrame_btnGoto_actionAdapter implements java.awt.event.ActionListener{
  100.   CustomerFindFrame adaptee;
  101.  
  102.   CustomerFindFrame_btnGoto_actionAdapter(CustomerFindFrame adaptee) {
  103.     this.adaptee = adaptee;
  104.   }
  105.  
  106.   public void actionPerformed(ActionEvent e) {
  107.     adaptee.btnGoto_actionPerformed(e);
  108.   }
  109. }
  110.