KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > actions > ImportExternalProcess


1 /*
2  * Authors:
3  * Stefanovic Nenad chupo@iis.ns.ac.yu
4  * Bojanic Sasa sasaboy@neobee.net
5  * Puskas Vladimir vpuskas@eunet.yu
6  * Pilipovic Goran zboniek@uns.ac.yu
7  *
8  */

9
10 package org.enhydra.jawe.actions;
11
12 import org.enhydra.jawe.*;
13
14 import org.enhydra.jawe.misc.*;
15 import org.enhydra.jawe.xml.*;
16 import org.enhydra.jawe.xml.elements.WorkflowProcess;
17 import org.enhydra.jawe.xml.elements.WorkflowProcesses;
18 import org.enhydra.jawe.xml.panels.*;
19
20 import javax.swing.*;
21 import java.awt.event.ActionEvent JavaDoc;
22
23 /**
24  * Class that realizes <B>import external process</B> action.
25  */

26 public class ImportExternalProcess extends ActionBase {
27
28    public ImportExternalProcess (PackageEditor editor) {
29       super(editor);
30    }
31
32    public void actionPerformed(ActionEvent JavaDoc e) {
33       PackageEditor pe=(PackageEditor)editor;
34       if (!pe.isInitialized()) {
35          pe.enterPackageID();
36       }
37
38       ExternalProcesses ews=new ExternalProcesses(pe.getXMLPackage());
39
40       XMLElementDialog d=new XMLElementDialog((JFrame)pe.getWindow(),
41          ResourceManager.getLanguageDependentString("PackageKey")+" '"+
42          pe.getXMLPackage().get("Id").toString()+"' - "+
43          ResourceManager.getLanguageDependentString("ImportExternalProcessLabel"));
44       d.editXMLElement(ews.getPanel(),true,false);
45       if (!d.isCanceled()) {
46          org.enhydra.jawe.xml.elements.WorkflowProcess wp=
47             (org.enhydra.jawe.xml.elements.WorkflowProcess)
48             ((XMLComplexChoice)ews.get("Process")).getChoosen();
49          if (wp!=null) {
50             org.enhydra.jawe.xml.elements.WorkflowProcesses wps=
51                (org.enhydra.jawe.xml.elements.WorkflowProcesses)
52                pe.getXMLPackage().get("WorkflowProcesses");
53             org.enhydra.jawe.xml.elements.WorkflowProcess wpCopy=
54                wps.createCopyOfWorkflowProcess(wp,false);
55
56             // if something went wrong
57
if (wpCopy==null) return;
58
59             ((PackageGraph)pe.getGraph()).createWorkflowObject(pe.getWindow(),wpCopy);
60             wps.decrementID();
61             editor.requestFocus();
62          }
63       }
64    }
65 }
66
Popular Tags