home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / TRIAL / JBUILDER / JREFRNCE.Z / OrderFindFrame.java < prev    next >
Encoding:
Java Source  |  1998-05-08  |  3.8 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.  * OrderFindFrame 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 orders by searching on a value for
  41.  * a single column in the order 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 OrderFindFrame extends FindFrame {
  46.   private static DataModule1 dm = DataModule1.getDataModule();
  47.   private static OrderFindFrame myOrderFindFrame;
  48. //  private QueryDataSet qdsOrder;
  49.   ResourceBundle res = Res.getBundle("borland.reference.cliffhanger.Res");
  50.  
  51.   /**
  52.    * The constructor is protected. Use the getOrderFindFrame method to get
  53.    * an instance of the class.
  54.    */
  55.   protected OrderFindFrame() {  
  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("OFF_Find_Order"));
  66.     statusBar1.setDataSet(dm.getOrderDataSet());
  67.     locatorControl1.setDataSet(dm.getOrderDataSet());
  68.     gridControl1.setDataSet(dm.getOrderDataSet());
  69.     choiceControl1.setItems(new String [] { res.getString("DM_OrderDS_ORDERTRACKNUM"), res.getString("DM_OrderDS_CUSTOMERPONUM"), res.getString("DM_OrderDS_ID") });
  70.   }
  71.  
  72.   /**
  73.    * Class method to access the singleton instance of the class.
  74.    */
  75.   public static OrderFindFrame getOrderFindFrame() {
  76.     if (myOrderFindFrame == null)
  77.       myOrderFindFrame = new OrderFindFrame();
  78.  
  79.     return myOrderFindFrame;
  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 = OrderEntryFrame.getOrderEntryFrame();
  90.     CliffhangerApplication.showCenteredFrame(frame, false);
  91.  
  92.     // Hide this frame ...
  93.     this.setVisible(false);
  94.     this.dispose();
  95.   }
  96. }
  97.  
  98. class OrderFindFrame_btnGoto_actionAdapter implements java.awt.event.ActionListener{
  99.   OrderFindFrame adaptee;
  100.  
  101.   OrderFindFrame_btnGoto_actionAdapter(OrderFindFrame adaptee) {
  102.     this.adaptee = adaptee;
  103.   }
  104.  
  105.   public void actionPerformed(ActionEvent e) {
  106.     adaptee.btnGoto_actionPerformed(e);
  107.   }
  108. }
  109.  
  110.