KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* RecordType.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 RecordType extends XMLCollection {
22    private Package JavaDoc myPackage=null;
23
24    public RecordType (Package JavaDoc p) {
25       super(null);
26       setRequired(true);
27       myPackage=p;
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       Member m=new Member(myPackage);
38       m.setRequired(true);
39       return m;
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
Popular Tags