1 package org.enhydra.shark.swingclient.workflowadmin; 2 3 import java.awt.*; 4 5 6 import org.enhydra.shark.api.client.wfmodel.*; 7 import org.enhydra.jawe.*; 8 import org.enhydra.jawe.graph.BlockActivity; 9 import org.enhydra.jawe.xml.elements.*; 10 import org.enhydra.jawe.xml.elements.Activity; 11 import org.enhydra.shark.swingclient.*; 12 13 17 public class BlockActivityViewer extends ProcessViewer { 22 private BlockActivity blockActivity; 23 private org.enhydra.jawe.xml.elements.Package pkg; 24 private WfProcessMgr wpm; 25 private WfProcess wpr; 26 27 private ActivitySet activitySet; 28 29 public BlockActivityViewer (Window parent,BlockActivity ba, 30 org.enhydra.jawe.xml.elements.Package pkg, 31 WfProcessMgr wpm,WfProcess wpr) { 32 super(parent); 33 34 this.blockActivity=ba; 35 this.pkg=pkg; 36 currentProcessMgr=wpm; 37 currentProcess=wpr; 38 39 WorkflowProcesses wps=(WorkflowProcesses)pkg.get("WorkflowProcesses"); 40 String pdId=""; 41 try {pdId=SharkAdmin.getAdminMiscUtilities().getProcessMgrProcDefId(wpm.name());}catch (Exception ex) {} 42 WorkflowProcess wp=wps.getWorkflowProcess(pdId); 43 String baId=blockActivity.getBlockID(); 44 activitySet=((ActivitySets)wp.get("ActivitySets")).getActivitySet(baId); 45 46 try { 47 ProcessEditor pe=blockActivity.getImplementationEditor(); 48 if (pe!=null) { 49 currentGraph=(ProcessGraph)pe.getGraph(); 50 } 51 currentGraph.setEditable(false); 52 currentGraph.setMoveable(false); 53 ((ProcessEditor)currentGraph.getEditor()).setButtonsEnabled(false); 54 graphScrollPane.setViewportView(currentGraph); 55 updateSelection(); 56 } catch (Exception ex) { 57 graphScrollPane.setViewportView(null); 58 } 59 60 } 61 62 63 protected void setDialogTitle () { 64 myDialog.setTitle(blockActivity.toString()); 65 } 66 67 public void displayProcess ( 68 org.enhydra.jawe.xml.elements.Package pkg, 69 WfProcessMgr wpm,WfProcess wpr) { 70 updateSelection(); 71 return; 72 } 73 74 78 public void updateSelection () { 79 if (currentGraph==null) return; 80 currentGraph.clearSelection(); 81 if (currentProcess==null) return; 82 83 try { 84 WfActivityIterator wai=SharkClient.getCommonExpressionBuilder().getOpenActivities(currentProcess.key()); 85 WfActivity[] allRunningActs=wai.get_next_n_sequence(0); 86 for (int i=0; i<allRunningActs.length; i++) { 87 Activities acts=(Activities)activitySet.get("Activities"); 88 Activity act=acts.getActivity( 89 SharkClient.getAdminMiscUtilities().getActivityDefinitionId(currentProcess.key(), 90 allRunningActs[i].key())); 91 try { 92 WorkflowManager wm=currentGraph.getWorkflowManager(); 93 Object go=wm.getActivity(act.getID()); 94 if (go!=null) { 95 currentGraph.addSelectionCell(go); 96 } 97 } catch (Exception ex) {} 98 } 99 } catch (Exception ex) { 101 System.err.println("Problems while updating selection"); 102 } 103 } 104 105 } 106 | Popular Tags |