KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* Performer.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 import org.w3c.dom.*;
16
17 /**
18 * Represents a WfMC DTD element that has the similar name.
19 *
20 * @see XML
21 */

22 public class Performer extends XMLSimpleElement {
23    /**
24    * Overrides super-class method to realize this class specific
25    * writting to XML file.
26    *
27    * @return The string for a WfMC DTD Performer element tag.
28    */

29    public void toXML(Node parent) throws DOMException {
30       // the Participant object for the performer is held in
31
// it's value member - if it isn't, there is no performer
32
Object JavaDoc realValue=value;
33       if (value instanceof Participant) {
34          // prepearing participant ID
35
value=((Participant)value).getID();
36       } else {
37          if (value.toString().trim().length()==0) {
38             return;
39          }
40       }
41       super.toXML(parent);
42       value=realValue;
43    }
44
45    /**
46     * Returns the text panel, but do not allow it to update information
47     * on participant used as a performer, because this is done automatically.
48     */

49    public XMLPanel getPanel () {
50       return new XMLTextPanel(this) {
51          public void setElements () {
52             if (value instanceof Participant) {
53                return;
54             } else {
55                super.setElements();
56             }
57          }};
58    }
59
60    /**
61    * Used to create exact copy of instance of this class.
62    * The newly created instance will have all the properties
63    * same as the copied one.
64    *
65    * @return The newly created instance of this class.
66    */

67    public Object JavaDoc clone () {
68       Performer p=(Performer)super.clone();
69       // set the same Participant - (it was cloned to)
70
p.setValue(this.toValue());
71       return p;
72    }
73
74 }
75
Popular Tags