01: /**
02: * Miroslav Popov, Sep 20, 2005
03: * miroslav.popov@gmail.com
04: */package org.enhydra.jawe.components.graph.actions;
05:
06: import javax.swing.ImageIcon;
07:
08: import org.enhydra.jawe.JaWEManager;
09: import org.enhydra.jawe.components.graph.GraphController;
10: import org.enhydra.jawe.components.graph.GraphEAConstants;
11: import org.enhydra.jawe.components.graph.GraphSettings;
12: import org.enhydra.shark.xpdl.XMLUtil;
13:
14: /**
15: * @author Miroslav Popov
16: *
17: */
18: public class SetStartMode extends SetToolboxMode {
19:
20: public SetStartMode(GraphController jawecomponent) {
21: super (jawecomponent, GraphEAConstants.START_TYPE,
22: GraphEAConstants.START_TYPE_DEFAULT);
23: }
24:
25: public void enableDisableAction() {
26: GraphController gc = (GraphController) jawecomponent;
27:
28: if (gc.getGraphSettings().shouldUseBubbles()
29: && gc.getSelectedGraph() != null
30: && XMLUtil.getPackage(gc.getSelectedGraph()
31: .getXPDLObject()) == JaWEManager.getInstance()
32: .getJaWEController().getMainPackage()
33: && gc.getSelectedGraph().getRoots().length != 0)
34: setEnabled(true);
35: else
36: setEnabled(false);
37: }
38:
39: protected ImageIcon getIcon() {
40: return ((GraphSettings) jawecomponent.getSettings())
41: .getBubbleStartIcon();
42: }
43:
44: }
|