View Javadoc

1   /*
2    * Copyright (c) 2005, The K-Wf Grid Consortium
3    * Fraunhofer Institute for Computer Architecture and Software Technology
4    * See http://www.kwfgrid.eu and http://www.first.fraunhofer.de for more details.
5    */
6   package net.kwfgrid.gwui.taskframework;
7   
8   import net.kwfgrid.gwui.Browser;
9   import net.kwfgrid.gwui.UAA;
10  import net.kwfgrid.gwui.graphview.WorkflowGraph;
11  import net.kwfgrid.gwui.graphview.PlaceNode;
12  import net.kwfgrid.gworkflowdl.structure.*;
13  import net.kwfgrid.gworkflowdl.protocol.structure.*;
14  
15  import de.fzi.wim.guibase.graphview.view.JGraphPane;
16  
17  import org.glassbox.executor.Executor;
18  
19  public class GraphInputTaskProducer4Decision extends InputTaskProducer4Decision {
20      private JGraphPane _view;
21  
22      public GraphInputTaskProducer4Decision(JGraphPane view, Executor executor, UAA uaa, Browser browser) {
23  	super(executor, uaa, browser);
24  	_view = view;
25      }				 
26  
27      ///
28      /// Protected API
29      /// ....................................................................................................
30  
31      protected void setTaskInvalid(InputTask4Decision task) {
32  	super.setTaskInvalid(task);
33  	repaintNode(task.getPlace());
34      }
35  
36      protected void setTaskDone(InputTask4Decision task) {
37  	super.setTaskDone(task);
38  	repaintNode(task.getPlace());
39      }
40  
41      protected InputTask4Decision createTaskForDecisionProperty(Workflow wf, Property prop) {
42  	InputTask4Decision task = super.createTaskForDecisionProperty(wf, prop);
43  	if (task != null) repaintNode(task.getPlace());
44  	return task;
45      }
46  
47      ///
48      /// private API
49      /// ....................................................................................................
50  
51      private void repaintNode(Place place) {
52  	WorkflowGraph graph = (WorkflowGraph)_view.getGraph();
53  	if (graph != null) {
54  	    PlaceNode node = graph.getPlaceNode(place);
55  	    if (node != null) {
56  		_view.repaintNode(node);
57  	    }
58  	}
59      }
60  }
61