KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > actions > EditCell


1 /*
2  * Authors:
3  * Stefanovic Nenad chupo@iis.ns.ac.yu
4  * Bojanic Sasa sasaboy@neobee.net
5  * Puskas Vladimir vpuskas@eunet.yu
6  * Pilipovic Goran zboniek@uns.ac.yu
7  *
8  */

9
10 package org.enhydra.jawe.actions;
11
12 import org.enhydra.jawe.*;
13 import org.enhydra.jawe.graph.*;
14
15 import java.awt.event.ActionEvent JavaDoc;
16
17 import javax.swing.*;
18 import java.awt.*;
19
20 /**
21  * Class that realizes <B>edit</B> action.
22  * Starts editing the first selected cell.
23  */

24 public class EditCell extends ActionBase {
25
26    public EditCell (AbstractEditor editor) {
27       super(editor);
28    }
29
30    public void actionPerformed(ActionEvent JavaDoc e) {
31       AbstractGraph graph=editor.getGraph();
32       Object JavaDoc cell=graph.getSelectionCell();
33       if(!graph.isCellEditable(cell)) return;
34       Window parentW=graph.getEditor().getWindow();
35       if (cell instanceof org.enhydra.jawe.graph.Process) {
36          org.enhydra.jawe.graph.Process wf=(org.enhydra.jawe.graph.Process)cell;
37          // updating L&F if needed
38
if (wf.getImplementationEditor()!=null) {
39             AbstractEditor ae=wf.getImplementationEditor();
40             ae.refreshEditorConfiguration();
41          }
42          if (wf.getImplementationEditor()!=null && (wf.getImplementationEditor().getGraph().getXMLPackage()!=
43                JaWE.getInstance().getRealXMLPackage() ||
44                wf.getImplementationEditor().getGraph().getXMLPackage().isReadOnly())) {
45             wf.getImplementationEditor().setButtonsEnabled(false);
46          }
47          wf.showProcess(parentW);
48          graph.repaint();
49       }
50       if (cell instanceof Subflow) {
51          Subflow sf=(Subflow)cell;
52          sf.showSubflow(parentW,graph.getXMLPackage());
53          //graph.repaint();
54
}
55       if (cell instanceof BlockActivity) {
56          BlockActivity ba=(BlockActivity)cell;
57          if (ba.getImplementationEditor()!=null) {
58             AbstractEditor ae=ba.getImplementationEditor();
59             ae.refreshEditorConfiguration();
60          }
61          if (ba.getImplementationEditor()!=null && (ba.getImplementationEditor().getGraph().getXMLPackage()!=
62                JaWE.getInstance().getRealXMLPackage() ||
63                ba.getImplementationEditor().getGraph().getXMLPackage().isReadOnly())) {
64             ba.getImplementationEditor().setButtonsEnabled(false);
65          }
66          ba.showBlockActivity(parentW);
67          // after block activity graph is closed, set the proper workflow manager
68
graph.setPropertyObject(
69             (org.enhydra.jawe.xml.elements.WorkflowProcess)
70             graph.getPropertyObject());
71          graph.repaint();
72       }
73    }
74 }
75
Popular Tags