KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > graph > Process


1 /* Process.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.graph;
12
13 import org.enhydra.jawe.xml.*;
14 import org.enhydra.jawe.xml.elements.*;
15
16 import org.jgraph.graph.*;
17
18 import java.util.*;
19 import java.awt.*;
20 import javax.swing.*;
21 import org.enhydra.jawe.*;
22
23 /**
24 * Used to define process object in graph and to modify it's
25 * properties.
26 */

27 public class Process extends Activity {
28
29    protected transient PackageEditor packageEditor;
30
31    /**
32    * Reference to the process editor that will be created the first
33    * time the showProcess method is called.
34    */

35    protected transient ProcessEditor pEditor=null;
36
37    /**
38    * Creates process.
39    */

40    public Process(PackageEditor pkgEd) {
41       this(null,pkgEd);
42    }
43
44    /**
45    * Creates Process with given userObject.
46    */

47    public Process(Object JavaDoc userObject,PackageEditor pkgEd) {
48       super(userObject);
49       packageEditor=pkgEd;
50    }
51
52    public ProcessEditor getImplementationEditor () {
53       return pEditor;
54    }
55
56    public PackageEditor getPackageEditor () {
57       return packageEditor;
58    }
59
60    public XMLElement getProcessProperties () {
61       return pEditor.getGraph().getPropertyObject();
62    }
63
64    /**
65    * Shows a process editor with it's toolbar.
66    */

67    public void showProcess (Window parentWindow) {
68       WorkflowProcess wp=(WorkflowProcess)userObject;
69       if (pEditor == null) {
70          pEditor=new ProcessEditor(parentWindow,(WorkflowProcess)userObject,packageEditor);
71          pEditor.getStatusBar().updateMessage();
72          pEditor.showWindow(parentWindow,pEditor.getTitle());
73       } else {
74          pEditor.getStatusBar().updateMessage();
75          pEditor.showWindow(parentWindow,pEditor.getTitle());
76       }
77    }
78
79    public void createWorkflowGraph (Window parentW) {
80       pEditor=new ProcessEditor(parentW,(WorkflowProcess)userObject,packageEditor);
81       pEditor.getGraph().createWorkflowGraph(parentW);
82    }
83
84    /**
85    * Shows a dialog for editing activity properties. This is a place
86    * where undoing of property changes is realized.
87    */

88    public void showPropertyDialog(Window parentWindow,AbstractGraph graph){
89       XMLElementDialog d;
90       if (parentWindow instanceof JFrame) {
91          d=new XMLElementDialog((JFrame)parentWindow,
92            ResourceManager.getLanguageDependentString("DialogProcessProperties")+
93            " - "+userObject.toString());
94       } else {
95          d=new XMLElementDialog((JDialog)parentWindow,
96             ResourceManager.getLanguageDependentString("DialogProcessProperties")+
97             " - "+userObject.toString());
98       }
99       d.editXMLElement(getPropertyObject().getPanel(),true,false);
100    }
101
102    /**
103    * Gets a tooltip text for activity.
104    */

105    public String JavaDoc getTooltip () {
106       try {
107          return ((WorkflowProcess)userObject).getTooltip();
108       } catch (Exception JavaDoc e) {
109          return null;
110       }
111    }
112
113 }
114
Popular Tags