KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* Member.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 import java.util.*;
17
18 /**
19 * Represents a WfMC DTD element that has the similar name.
20 *
21 * @see XML
22 */

23 public class Member extends XMLComplexElement {
24    private DataTypes refType;
25
26    /**
27    * Creates a new instance of the class.
28    */

29    public Member (Package JavaDoc p) {
30       super();
31
32       refType=new DataTypes(this,p,null,0);
33       fillStructure();
34    }
35
36    /**
37    * Defines the super-class method. Read the explanation for
38    * this method within XMLComplexElement class.
39    */

40    protected void fillStructure () {
41       refType.setRequired(true);
42       complexStructure.add(refType);
43    }
44
45    /**
46    * Returns the value of choosen type.
47    *
48    * @return The value of choosen member type.
49    */

50    public Object JavaDoc toValue () {
51       return refType.toValue();
52    }
53
54    /**
55    * Overrides parent method to display the choosen type. It displays data
56    * type details for BasicType and for DeclaredType.
57    */

58    public String JavaDoc toString () {
59       Object JavaDoc type=refType.toValue();
60       if (type instanceof BasicType) {
61          return refType.toString()+" - "+((XMLAttribute)((BasicType)type).
62                get("Type")).getChoosen().toString();
63       } else if (type instanceof DeclaredType) {
64          return refType.toString()+" - "+((XMLComplexChoice)((DeclaredType)type).
65                get("SubType")).getChoosen().toString();
66       } else {
67          return refType.toString();
68       }
69    }
70
71    /**
72    * Prepares the panel with a combo box to choose the one of
73    * allowed member types.
74    *
75    * @return XMLPanel to be shown.
76    */

77    public XMLPanel getPanel () {
78       return refType.getPanel();
79    }
80
81 }
82
Popular Tags