01: package net.xoetrope.samples.travel;
02:
03: import java.awt.event.MouseEvent;
04:
05: import net.xoetrope.awt.XImage;
06: import net.xoetrope.xui.XPage;
07: import net.xoetrope.xui.XProjectManager;
08:
09: /**
10: * <p>Title: Xui</p>
11: * <p>Description: </p>
12: * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
13: * <p>Company: Xoetrope Ltd.</p>
14: * @author not attributable
15: * @version 1.0
16: */
17:
18: public class ArrivalsMap extends XPage {
19: XMapViewer mapViewer;
20: XImage imgBack;
21:
22: public ArrivalsMap() {
23: imgBack = (XImage) componentFactory.addComponent(XPage.IMAGE,
24: 220, 10, 18, 14, "home.gif");
25: mapViewer = (XMapViewer) componentFactory.addComponent(
26: "net.xoetrope.samples.travel.XMapViewer", 0, 0, 250,
27: 300);
28: mapViewer.setMap("dubarrivalsmap.gif", 573, 210,
29: "dubarrivals.xml");
30: // mapViewer.setMapHotspotClickHandler( this );
31: addMouseHandler(mapViewer, "spotClicked");
32: addMouseHandler(imgBack, "goHome");
33: // remove( imgBack );
34: // add( imgBack );
35: }
36:
37: public void spotClicked() {
38: if (wasMouseClicked()) {
39: System.out.println("spotClicked");
40: String name = mapViewer.getName(mapViewer
41: .checkHotspot(((MouseEvent) getCurrentEvent())
42: .getPoint()));
43: if (name != null)
44: mapViewer.setStatus(getInfo(name));
45: }
46: // if ( ID!=null )
47: // mapViewer.setStatus( getInfo(ID) );
48: // else
49: // mapViewer.setStatus( "" );
50: }
51:
52: public void goHome() {
53: if (wasMouseClicked())
54: XProjectManager.getPageManager().showPage("Services");
55: }
56:
57: private String getInfo(String ID) {
58: int numID = Integer.parseInt(ID);
59: if (numID < 10)
60: return "Baggage Belt";
61: switch (numID) {
62: case 20:
63: return "Pre-booked car hire";
64: case 21:
65: return "Lifts";
66: case 44:
67: return "Chauffeur meeting point";
68: }
69: return null;
70: }
71: }
|