01: package auction.controller;
02:
03: import net.xoetrope.swing.XDialog;
04: import net.xoetrope.swing.XLabel;
05: import net.xoetrope.swing.XEdit;
06: import net.xoetrope.xui.data.XModel;
07:
08: /**
09: * "Place a new bid" dialog controller.
10: */
11: public class NewBid extends XDialog {
12: public static int BUY_IT_NOW = 0;
13: public static int PLACE_BID = 1;
14:
15: private XEdit newBidAmountEdit;
16: private XLabel headerLabel;
17:
18: /**
19: * Creates a new instance of NewBid
20: */
21: public NewBid() {
22: super ();
23: }
24:
25: public void pageCreated() {
26: newBidAmountEdit = (XEdit) findComponent("newBidAmountEdit");
27: headerLabel = (XLabel) findComponent("headerLabel");
28: }
29:
30: /**
31: * Displays the "buy it now" or "place a new bid" dialog
32: * @param type the type of the dialog to be shown
33: * (either "place a new bid" or "buy it now")
34: */
35: public void show(Object owner, int type) {
36: if (type == BUY_IT_NOW) {
37: newBidAmountEdit.setEditable(false);
38: headerLabel.setText(" Buy it now");
39: setCaption("Buy it now");
40: showDialog(owner);
41: } else if (type == PLACE_BID) {
42: newBidAmountEdit.setEditable(true);
43: headerLabel.setText(" Place a new bid");
44: setCaption("Place a new bid");
45: showDialog(owner);
46: }
47: }
48:
49: }
|