01: /**
02: * Miroslav Popov, Sep 21, 2005
03: * miroslav.popov@gmail.com
04: */package org.enhydra.jawe.components.graph.actions;
05:
06: import java.awt.event.ActionEvent;
07:
08: import org.enhydra.jawe.ActionBase;
09: import org.enhydra.jawe.JaWEComponent;
10: import org.enhydra.jawe.JaWEManager;
11: import org.enhydra.jawe.components.graph.GraphController;
12:
13: /**
14: * Removes selected participant from graph (does not delete it from the model),
15: * and deletes all of the elements it contains from the XPDL model.
16: * @author Miroslav Popov
17: * @author Sasa Bojanic
18: */
19: public class RemoveParticipant extends ActionBase {
20:
21: public RemoveParticipant(JaWEComponent jawecomponent) {
22: super (jawecomponent);
23: }
24:
25: public void enableDisableAction() {
26: GraphController gc = (GraphController) jawecomponent;
27:
28: boolean en = false;
29: if (gc.getSelectedGraph() != null) {
30: if (!gc.getSelectedGraph().getXPDLObject().isReadOnly()) {
31: en = true;
32: }
33: }
34: setEnabled(en);
35: }
36:
37: public void actionPerformed(ActionEvent e) {
38: GraphController gc = (GraphController) jawecomponent;
39: gc.getSelectedGraph().getGraphManager().removeCells(
40: gc.getSelectedGraph().getSelectionCells());
41: JaWEManager.getInstance().getJaWEController()
42: .getSelectionManager().setSelection(
43: gc.getSelectedGraph().getXPDLObject(), true);
44: }
45: }
|