KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* EnumerationType.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 EnumerationType extends XMLCollection {
22    /**
23    * Creates a new instance of the class.
24    */

25    public EnumerationType () {
26       super(null);
27       setRequired(true);
28    }
29
30    /**
31    * Generates a new element of the class which instances
32    * are members of collection of this class.
33    *
34    * return The generated instance of class that makes collection.
35    */

36    public XMLElement generateNewElement() {
37       EnumerationValue ev=new EnumerationValue();
38       ev.setRequired(true);
39       return ev;
40    }
41
42    /**
43    * Creates panel which allows user to manipulate with instances
44    * of classes that makes a collection that this class represents.
45    * The panel consists of two sections: XMLListPanel - shows
46    * collections' elements, and XMLListControlPanel - display buttons
47    * for manipulating with that elements.
48    * <p>NOTE: The order of creation is relevant, first, the controlled
49    * panel must be created, and then the control panel
50    *
51    * @return DTDPanel to be shown
52    */

53    public XMLPanel getPanel () {
54       controlledPanel=new XMLListPanel(this,"",false,true,false) {
55          public boolean checkRequired () {
56             if (isReadOnly || (refCollectionElements.size()>0)) {
57                return true;
58             } else {
59                XMLPanel.errorMessage(this.getDialog(),getOwner().toLabel(),"",
60                      XMLUtil.getLanguageDependentString("ErrorTheListMustContainAtLeastOneElement"));
61                controlPanel.getComponent(1).requestFocus();
62                return false;
63             }
64          }
65       };
66       controlPanel=new XMLListControlPanel(this,"",true,false,true);
67       return new XMLGroupPanel(this,new XMLPanel[]{
68          controlledPanel,controlPanel},toLabel(),XMLPanel.BOX_LAYOUT,
69          false,true);
70    }
71
72    /**
73    * Used to create exact copy of instance of this class.
74    * The newly created instance will have all the properties
75    * same as the copied one.
76    *
77    * @return The newly created instance of this class.
78    */

79    public Object JavaDoc clone () {
80       EnumerationType t=(EnumerationType)super.clone();
81       return t;
82    }
83
84 }
85
Popular Tags