01: package net.xoetrope.samples.travel;
02:
03: import java.awt.Color;
04:
05: import net.xoetrope.awt.XButton;
06: import net.xoetrope.awt.XComboBox;
07: import net.xoetrope.awt.XImage;
08: import net.xoetrope.xui.XPage;
09: import net.xoetrope.xui.XProjectManager;
10: import net.xoetrope.xui.data.XListBinding;
11: import net.xoetrope.xui.helper.BuddyHelper;
12: import net.xoetrope.xui.style.XStyleFactory;
13:
14: //import net.xoetrope.sql.XTableModelNode;
15: /**
16: * <p>Title: Xui</p>
17: * <p>Description: </p>
18: * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
19: * <p>Company: Xoetrope Ltd.</p>
20: * @author not attributable
21: * @version 1.0
22: */
23:
24: public class FlightSearch extends XPage {
25: XComboBox lstDestinations, lstAirlines;
26: XButton btnSearch;
27: BuddyHelper buddy;
28: XImage imgBack;
29:
30: public FlightSearch() {
31: this .setBackground(Color.white);
32: imgBack = (XImage) componentFactory.addComponent(XPage.IMAGE,
33: 220, 10, 18, 14, "home.gif");
34: buddy = new BuddyHelper((XStyleFactory) componentFactory);
35: componentFactory
36: .addComponent(
37: XPage.LABEL,
38: 10,
39: 10,
40: 210,
41: 50,
42: "Please select a combination of airline or destination!",
43: "prompt");
44: lstDestinations = (XComboBox) buddy.addComponent(XPage.COMBO,
45: 10, 70, 210, 25, "Destinations:", "", null);
46: lstAirlines = (XComboBox) buddy.addComponent(XPage.COMBO, 10,
47: 100, 210, 25, "Airlines:", "", null);
48: btnSearch = (XButton) componentFactory.addComponent(
49: XPage.BUTTON, 100, 150, 50, 25, "Search");
50: // test();
51: addMouseHandler(imgBack, "goHome");
52: addMouseHandler(btnSearch, "search");
53: addBinding(new XListBinding(lstDestinations,
54: "flightdata/destinations"));
55: addBinding(new XListBinding(lstAirlines, "flightdata/airlines"));
56: }
57:
58: public void search() {
59: if (wasMouseClicked())
60: XProjectManager.getPageManager().showPage("FlightResults");
61: }
62:
63: public void goHome() {
64: if (wasMouseClicked())
65: XProjectManager.getPageManager().showPage("Services");
66: }
67:
68: private void test() {
69: /*XTableModelNode airlines = XTableModelNode.getTable( "AirlineData" );
70: airlines.retrieve();
71: lstAirlines.add("<Any>");
72: for ( int row=0; row<airlines.getNumChildren(); row++ ){
73: System.out.println( airlines.getFieldValue(row, 0) );
74: lstAirlines.add(airlines.getFieldValue(row, 0));
75: }
76:
77: XTableModelNode destinations = XTableModelNode.getTable( "DestinationData" );
78: destinations.retrieve();
79: lstDestinations.add("<Any>");
80: for ( int row=0; row<destinations.getNumChildren(); row++ ){
81: System.out.println( destinations.getFieldValue(row, 0) );
82: lstDestinations.add(destinations.getFieldValue(row, 0));
83: }
84: */
85: }
86: }
|