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