KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > xml > elements > BasicType


1 /* BasicType.java
2  *
3  * Authors:
4  * Stefanovic Nenad chupo@iis.ns.ac.yu
5  * Bojanic Sasa sasaboy@neobee.net
6  * Puskas Vladimir vpuskas@eunet.yu
7  * Pilipovic Goran zboniek@uns.ac.yu
8  *
9  */

10
11 package org.enhydra.jawe.xml.elements;
12
13 import org.enhydra.jawe.xml.*;
14 import org.enhydra.jawe.xml.panels.*;
15
16 /**
17 * Represents a WfMC DTD element that has the similar name.
18 *
19 * @see XML
20 */

21 public class BasicType extends XMLComplexElement {
22    // must be one of following: STRING, FLOAT, INTEGER, REFERENCE, DATETIME,
23
// BOOLEAN OR PERFORMER
24
//required
25
private XMLAttribute attrType=new XMLAttribute("Type",
26       new String JavaDoc[] {
27          "STRING",
28          "FLOAT",
29          "INTEGER",
30          "REFERENCE",
31          "DATETIME",
32          "BOOLEAN",
33          "PERFORMER"
34       },0);
35
36    /**
37    * Creates a new instance of the class.
38    */

39    public BasicType () {
40       super();
41       attrType.setLabelName(XMLUtil.getLanguageDependentString("SubTypeKey"));
42
43       fillStructure();
44    }
45
46    /**
47    * Defines the super-class method. Read the explanation for
48    * this method within XMLComplexElement class.
49    */

50    protected void fillStructure () {
51       attrType.setRequired(true);
52       complexStructure.add(attrType);
53       attributes.add(attrType);
54    }
55
56    /**
57    * Returns the value of choosen type. The value is not the
58    * text displayed in combo box (this is a language dependent
59    * representation of value), but the text defined in WfMC DTD
60    * for this element "Type" attribute.
61    *
62    * @return The value of choosen type.
63    */

64    public Object JavaDoc toValue () {
65       return attrType.toValue();
66    }
67
68    /**
69    * Prepares the panel with a combo box to choose the one of
70    * allowed basic types.
71    *
72    * @return XMLPanel to be shown.
73    */

74    public XMLPanel getPanel () {
75       return attrType.getPanel();
76    }
77
78    /**
79    * Used to create exact copy of instance of this class.
80    * The newly created instance will have all the properties
81    * same as the copied one.
82    *
83    * @return The newly created instance of this class.
84    */

85    public Object JavaDoc clone () {
86       BasicType bt=(BasicType)super.clone();
87
88       bt.attrType=(XMLAttribute)this.attrType.clone();
89       bt.fillStructure();
90
91       return bt;
92    }
93
94    public void refreshLabelName () {
95       super.refreshLabelName();
96       attrType.setLabelName(XMLUtil.getLanguageDependentString("SubTypeKey"));
97    }
98
99 }
100
Popular Tags