01: package thinlet.drafts;
02:
03: import java.awt.*;
04: import thinlet.*;
05:
06: /**
07: *
08: */
09: public class Drafts extends Thinlet {
10:
11: /**
12: *
13: */
14: public Drafts() {
15: //setFont(new Font("Trebuchet MS", Font.PLAIN, 12));
16: try {
17: add(parse("drafts.xml"));
18: } catch (Exception exc) {
19: exc.printStackTrace();
20: }
21: }
22:
23: /**
24: *
25: */
26: public void loadDraft(Object splitpane, Object tree) {
27: if (getCount(splitpane) > 2) {
28: remove(getItem(splitpane, 1));
29: }
30: Object node = getSelectedItem(tree);
31: if (node != null) {
32: Object draft = getProperty(node, "draft");
33: if (draft == null) {
34: String ui = (String) getProperty(node, "ui");
35: String logic = (String) getProperty(node, "logic");
36: if ((ui != null) && (logic != null)) {
37: try {
38: Object handler = Class.forName(logic)
39: .getConstructor(null).newInstance(null);
40: draft = parse(ui, handler);
41: putProperty(node, "draft", draft);
42: } catch (Exception exc) {
43: exc.printStackTrace();
44: }
45: }
46: }
47: if (draft != null) {
48: add(splitpane, draft, 1);
49: }
50: }
51: }
52:
53: /**
54: *
55: */
56: public void paint(Graphics g) {
57: Utilities.getUtilities().initGraphics(g);
58: super .paint(g);
59: }
60:
61: /**
62: *
63: */
64: protected void handleException(Throwable throwable) {
65: new ExceptionDialog(this , throwable);
66: }
67:
68: /**
69: *
70: */
71: public static void main(String[] args) {
72: new FrameLauncher("Thinlet Drafts", new Drafts(), 580, 435);
73: }
74: }
|