KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > designer > components > BaseDC


1 /*
2  * (c) Rob Gordon 2005.
3  */

4 package org.oddjob.designer.components;
5
6 import org.oddjob.designer.elements.SimpleDE;
7 import org.oddjob.designer.factory.SimpleHierarchy;
8 import org.oddjob.designer.model.ComponentAction;
9 import org.oddjob.designer.model.DesignAdult;
10 import org.oddjob.designer.model.DesignComponent;
11 import org.oddjob.designer.model.ElementField;
12 import org.oddjob.designer.model.FieldGroup;
13
14 /**
15  * The base class which provides default implementation for
16  * a standard DesignComponent.
17  * <p>
18  * This class extends DesignAdult so that a component may have
19  * DesignElement children if required.
20  */

21 public abstract class BaseDC extends DesignAdult
22 implements DesignComponent {
23
24     protected SimpleDE idField = new SimpleDE();
25     protected SimpleDE nameField = new SimpleDE();
26     
27     private String JavaDoc tag;
28     
29     public SimpleHierarchy availableActions() {
30         return new SimpleHierarchy(ComponentAction.class);
31     }
32     
33     /**
34      * @return Returns the id.
35      */

36     public SimpleDE getId() {
37         return idField;
38     }
39     
40     /**
41      * @param id The id to set.
42      */

43     public void setId(SimpleDE id) {
44         idField = id;
45     }
46     
47     public SimpleDE getName() {
48         return nameField;
49     }
50     
51     public void setName(SimpleDE name) {
52         nameField = name;
53     }
54     
55     public String JavaDoc name() {
56         return nameField.attribute();
57     }
58     
59     public void name(String JavaDoc name) {
60         nameField.attribute(name);
61     }
62     
63     public String JavaDoc tag() {
64         return tag;
65     }
66     
67     public void tag(String JavaDoc tag) {
68         this.tag = tag;
69     }
70     
71     public FieldGroup basePanel() {
72         FieldGroup fg = new FieldGroup("General");
73         fg.add(new ElementField("Id", idField));
74         fg.add(new ElementField("Name", nameField));
75         return fg;
76     }
77
78 }
79
Popular Tags