01: package com.opensymphony.workflow.designer;
02:
03: import java.util.Map;
04: import java.util.HashMap;
05:
06: import org.jgraph.graph.*;
07: import com.opensymphony.workflow.designer.views.*;
08:
09: /**
10: * @author hani Date: Dec 30, 2004 Time: 2:36:23 PM
11: */
12: public class WorkflowCellViewFactory extends DefaultCellViewFactory {
13: private Map edgeMap = new HashMap();
14:
15: public CellView createView(GraphModel model, Object cell) {
16: if (model.isPort(cell)) {
17: WorkflowPort port = (WorkflowPort) cell;
18: if (port.getIndex() == 0)
19: return new CustomPortView(cell);
20: return new PortView(cell);
21: } else if (model.isEdge(cell)) {
22: //return new CustomEdgeView(cell);
23: CustomEdgeView view = (CustomEdgeView) edgeMap.get(cell);
24: if (view == null) {
25: view = new CustomEdgeView(cell);
26: edgeMap.put(cell, view);
27: }
28: return view;
29: } else if (cell instanceof StepCell)
30: return new StepView(cell);
31: else if (cell instanceof SplitCell)
32: return new SplitView(cell);
33: else if (cell instanceof JoinCell)
34: return new JoinView(cell);
35: else if (cell instanceof InitialActionCell)
36: return new InitialActionView(cell);
37: else
38: return super.createView(model, cell);
39: }
40:
41: }
|