KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* Responsible.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 import javax.swing.tree.*;
18
19 /**
20 * Represents a WfMC DTD element that has the similar name.
21 *
22 * @see XML
23 */

24 public class Responsible extends XMLSimpleElement {
25    /**
26    * Defined participants at Package or WorkflowProcess level,
27    * depending for which of them this instance of Responsible
28    * belongs. If it is a WorkflowProcess, the Package participants
29    * are also included.
30    */

31    private transient Participants definedParticipants=null;
32
33    /**
34    * Creates a new instance of the class.
35    *
36    * @param packageOrWProcess The class instance which member
37    * is this class instance. Can be
38    * Package or WorkflowProcess
39    */

40    public Responsible (XMLComplexElement packageOrWProcess) {
41       super();
42
43       try {
44          this.definedParticipants=(Participants)packageOrWProcess.get("Participants");
45       }
46       catch (NullPointerException JavaDoc npe) {
47          //
48
}
49    }
50
51    /**
52    * Prepares the panel with a combo box to choose the one of
53    * allowed participants.
54    *
55    * @return XMLPanel to be shown.
56    */

57    public XMLPanel getPanel () {
58       Object JavaDoc[] choices=null;
59       if (definedParticipants!=null) {
60          choices=definedParticipants.getChoosable().toArray();
61       }
62       else {
63          choices=new Object JavaDoc[]{new Object JavaDoc()};
64       }
65       return new XMLComboButtonPanel(this,choices,definedParticipants);
66    }
67
68    /**
69    * Overrides super-class method to realize this class specific
70    * writting to XML file.
71    *
72    * @return The string for a WfMC DTD Responsible element tag.
73    */

74    public void toXML (Node parent) throws DOMException {
75       // the Participant object for the responsible is held in
76
// it's value member - if it isn't, this there is no responsible
77
if (!(value instanceof Participant)) return;
78       // prepearing participant ID
79
Object JavaDoc realValue=value;
80       value=((Participant)value).getID();
81       super.toXML(parent);
82       value=realValue;
83    }
84
85   /**
86    * Used to create exact copy of instance of this class.
87    * The newly created instance will have all the properties
88    * same as the copied one.
89    *
90    * @return The newly created instance of this class.
91    */

92    public Object JavaDoc clone () {
93       Responsible r=(Responsible)super.clone();
94       // set the same participant
95
r.setValue(this.toValue());
96       r.definedParticipants=this.definedParticipants;
97       return r;
98    }
99
100
101 }
102
Popular Tags