01: /**
02: * Created on Dec 2, 2004
03: *
04: * @author karthikeyanr
05: *
06: */package wizard.ui;
07:
08: import javax.swing.JPanel;
09:
10: import wizard.layout.CardManagerLayout.CardWillShowIf;
11: import wizard.model.MagicCardHelper;
12:
13: public abstract class AbstractMagicPanel extends JPanel implements
14: CardWillShowIf {
15: public static final String SUCCESSOR = "successor";
16:
17: private String id;
18:
19: private boolean isFirstTime = true;
20:
21: private String previousCardID;
22:
23: public AbstractMagicPanel(String id) {
24: super ();
25: this .id = id;
26: }
27:
28: public abstract String getDescription();
29:
30: public String getID() {
31: return id;
32: }
33:
34: public String getNextID() {
35: return AbstractMagicPanel.SUCCESSOR;
36: }
37:
38: public String getPreviousCardID() {
39: return previousCardID;
40: }
41:
42: public AbstractMagicPanel getPreviousPanel() {
43: MagicCardHelper cardHelper = MagicCardHelper.getInstance();
44: return cardHelper.getCardReferenceAt(
45: cardHelper.getIndexOf(getPreviousCardID())).panel();
46: }
47:
48: public abstract String getTitle();
49:
50: public void initialise() {
51: if (isFirstTime) {
52: isFirstTime = false;
53: initComponents();
54: }
55: populatePanel();
56: }
57:
58: public void setPreviousCardID(String previousCardID) {
59: this .previousCardID = previousCardID;
60: }
61:
62: public abstract boolean validateEarly();
63:
64: public abstract boolean validatePanel();
65:
66: protected abstract void initComponents();
67:
68: protected abstract void populatePanel();
69:
70: }
|