1
2 package org.catacomb.druid.blocks;
3
4
5 import java.util.ArrayList;
6
7 import org.catacomb.druid.build.Context;
8 import org.catacomb.druid.build.GUIPath;
9 import org.catacomb.druid.gui.base.DruPanel;
10 import org.catacomb.druid.gui.edit.DruLabelledTextField;
11 import org.catacomb.interlish.structure.AddableTo;
12 import org.catacomb.report.E;
13
14
15 public class LabelledTextField extends Panel implements AddableTo {
16
17
18 public String label;
19 public String store;
20 public String action;
21 public String focusAction;
22
23 public int width;
24
25 public String report;
26
27
28 public String history;
29
30 public boolean able = true;
31
32 public ArrayList<BaseEffect> effects;
33
34
35 public LabelledTextField() {
36 }
37
38
39 public LabelledTextField(String slab) {
40 label = slab;
41 action = label;
42 }
43
44 public void add(Object obj) {
45 if (effects == null) {
46 effects = new ArrayList<BaseEffect>();
47 }
48 if (obj instanceof BaseEffect) {
49 effects.add((BaseEffect)obj);
50 } else {
51 E.error("cant add non effect " + obj);
52 }
53 }
54 public DruPanel instantiatePanel() {
55 return new DruLabelledTextField(label, action, width, (history != null));
56 }
57
58 public void populatePanel(DruPanel dp, Context ctx, GUIPath gpath) {
59
60 DruLabelledTextField dtf = (DruLabelledTextField)dp;
61
62 if (!able) {
63 dtf.able(false);
64 }
65
66
67 if (report != null) {
68 E.deprecate();
69 }
70
71 if (action != null) {
72 dtf.setReturnAction(action);
73 }
74
75 if (focusAction != null) {
76 dtf.setFocusAction(focusAction);
77 }
78
79 if (history != null) {
80
81 }
82
83
84 if (effects != null) {
85 dtf.setEffects(realizeEffects(effects, ctx, gpath));
86 }
87
88 }
89
90 }