01: package org.enhydra.jawe.base.controller.actions;
02:
03: import java.awt.event.ActionEvent;
04: import java.util.ArrayList;
05: import java.util.HashSet;
06: import java.util.Iterator;
07: import java.util.List;
08:
09: import org.enhydra.jawe.ActionBase;
10: import org.enhydra.jawe.JaWEComponent;
11: import org.enhydra.jawe.JaWEManager;
12: import org.enhydra.jawe.base.xpdlhandler.XPDLHandler;
13: import org.enhydra.shark.xpdl.XMLUtil;
14: import org.enhydra.shark.xpdl.elements.Package;
15:
16: public class ExternalProcesses extends ActionBase {
17: public ExternalProcesses(JaWEComponent jawecomponent) {
18: super (jawecomponent);
19: }
20:
21: public void enableDisableAction() {
22: if (getPackage() != null
23: && getPackage().getExternalPackageIds().size() != 0)
24: setEnabled(true);
25: else
26: setEnabled(false);
27: }
28:
29: public void actionPerformed(ActionEvent e) {
30: Package p = getPackage();
31:
32: List toShow = new ArrayList();
33: XPDLHandler xpdlh = JaWEManager.getInstance().getXPDLHandler();
34: Iterator it = XMLUtil.getAllExternalPackageIds(xpdlh, p,
35: new HashSet()).iterator();
36: while (it.hasNext()) {
37: Package pkg = xpdlh.getPackageById((String) it.next());
38: if (pkg != p) {
39: toShow.addAll(pkg.getWorkflowProcesses().toElements());
40: }
41: }
42:
43: List columnsToShow = new ArrayList();
44: columnsToShow.add("Id");
45: columnsToShow.add("Name");
46: columnsToShow.add("AccessLevel");
47:
48: String title = JaWEManager.getInstance().getLabelGenerator()
49: .getLabel(p.getExternalPackages())
50: + " - "
51: + JaWEManager.getInstance().getLabelGenerator()
52: .getLabel(p.getWorkflowProcesses());
53: JaWEManager.getInstance().getTableEditor().showTable(title,
54: p.getWorkflowProcesses(), toShow, columnsToShow);
55: }
56: }
|