1 package org.catacomb.druid.blocks;
2
3
4 import org.catacomb.datalish.SColor;
5 import org.catacomb.druid.build.Context;
6 import org.catacomb.druid.build.GUIPath;
7 import org.catacomb.druid.build.Realizer;
8 import org.catacomb.druid.gui.base.DruAutonomousPanel;
9 import org.catacomb.druid.gui.base.DruPanel;
10 import org.catacomb.report.E;
11
12 import java.util.ArrayList;
13
14
15
16 public class AutonomousPanel extends SinglePanelContainer implements Realizer {
17
18 public String title;
19 public String name;
20 public String id;
21 public String controllerClass;
22
23 public ArrayList<Dialog> dialogs;
24
25 public SColor backgroundColor;
26
27
28
29 public void add(Object obj) {
30 if (obj instanceof Dialog) {
31 if (dialogs == null) {
32 dialogs = new ArrayList<Dialog>();
33 }
34 dialogs.add((Dialog)obj);
35 } else {
36 super.add(obj);
37 }
38 }
39
40
41 public Object realize(Context ctx, GUIPath gpathin) {
42 GUIPath gpath = gpathin;
43
44 gpath = gpath.extend(id);
45 DruAutonomousPanel druap = new DruAutonomousPanel();
46
47 if (backgroundColor != null) {
48 ctx.setBg(backgroundColor.getColor());
49 }
50
51
52
53 druap.setName(name);
54 druap.setControllerPath(controllerClass);
55
56 DruPanel druPanel = realizePanel(ctx, gpath);
57
58 if (druPanel != null) {
59 druap.setMainPanel(druPanel);
60 } else {
61 E.warning("no panel set in AutonomousPanel");
62 }
63
64
65 if (dialogs != null) {
66 for (Dialog dlg : dialogs) {
67 dlg.realize(null, ctx, gpath);
68 }
69 }
70
71 ctx.addComponent(druap, gpath);
72
73 return druap;
74 }
75
76
77
78 }