KickJava   Java API By Example, From Geeks To Geeks.

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


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

4 package org.oddjob.designer.components;
5
6 import org.oddjob.designer.factory.SimpleHierarchy;
7 import org.oddjob.designer.model.ComponentAction;
8 import org.oddjob.designer.model.DesignComponent;
9 import org.oddjob.designer.model.FormDefinition;
10 import org.oddjob.designer.model.TextInput;
11
12 /**
13  *
14  */

15 public class UnknownDC implements DesignComponent {
16
17     private String JavaDoc xml;
18     
19     private String JavaDoc name;
20     private String JavaDoc tag;
21         
22     public String JavaDoc tag() {
23         return tag;
24     }
25     
26     public void tag(String JavaDoc tag) {
27         this.tag = tag;
28     }
29     
30     public String JavaDoc name() {
31         return name == null ? tag : name;
32     }
33
34     public void setTag(String JavaDoc tag) {
35         this.tag = tag;
36     }
37     
38     public void setName(String JavaDoc name) {
39         this.name = name;
40     }
41
42     public void name(String JavaDoc name) {
43         this.name = name;
44     }
45     
46     public void unknown(String JavaDoc xml) {
47         this.xml = xml;
48     }
49
50     public String JavaDoc unknown() {
51         return this.xml;
52     }
53     
54     public FormDefinition form() {
55         return new TextInput("XML") {
56             public String JavaDoc getText() {
57                 return xml;
58             }
59             /* (non-Javadoc)
60              * @see org.oddjob.designer.model.TextInput#setText(java.lang.String)
61              */

62             public void setText(String JavaDoc text) {
63                 xml = text;
64                 this.setChanged();
65                 this.notifyObservers();
66             }
67         };
68     }
69     
70     public SimpleHierarchy availableActions() {
71         return new SimpleHierarchy(ComponentAction.class);
72     }
73 }
74
Popular Tags