set = activeTransitions.get(state);
124 | if (set!=null) {
125 | for(Transition tr:set) {
126 | sendInactiveTransition(state,tr);
127 | }
128 | }
129 | }
130 | private void sendActiveTransition(TransitionTarget from, TransitionTarget to, Transition tr) throws InterruptedException {
131 | events.put("3 "+from.getId()+" -> "+to.getId());
132 | }
133 | private void sendInactiveTransition(TransitionTarget to,Transition tr) throws InterruptedException {
134 | events.put("2 "+tr.getParent().getId()+" -> "+to.getId());
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/extra/edge-editing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/edge-editing.png
--------------------------------------------------------------------------------
/extra/find-tool.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/find-tool.png
--------------------------------------------------------------------------------
/extra/fsm-editor.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/fsm-editor.jar
--------------------------------------------------------------------------------
/extra/legend.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/legend.png
--------------------------------------------------------------------------------
/extra/node-menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/node-menu.png
--------------------------------------------------------------------------------
/extra/restrictedStates.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | blue
5 | first test restriction
6 |
7 | documentation of possible_event1
8 |
9 |
10 | documentation of possible_event2
11 |
12 |
13 | documentation of eventA
14 |
15 |
16 | documentation of eventB
17 |
18 |
19 | documentation of eventC
20 |
21 |
22 | documentation of eventD
23 |
24 |
25 | documentation of eventE
26 |
27 |
28 | documentation of eventF
29 |
30 |
31 | start event aaaaaaaaaaaaaa aaaaaa aaaaaa aaaaaa aaaaaa aaaaabbb bbbbbb bbbb bbbbb bbbbb bbbbbb bbbbbbbb bbbbbb cccc cccccc ccc cccccc
32 |
33 |
34 | stop event
35 |
36 |
37 | resume event
38 |
39 |
40 | cancel event
41 |
42 |
43 | save event
44 |
45 |
46 | exit event
47 |
48 |
49 | undo event
50 |
51 |
52 | redo event
53 |
54 |
55 |
56 | blue
57 | second test restriction
58 |
59 | documentation of possible_event3
60 |
61 |
62 | documentation of possible_event4
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/extra/sample-restriction-config.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/extra/sample-restriction-config.png
--------------------------------------------------------------------------------
/extra/scxmlConstraints.xsd:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/fsm-editor/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | fsm-editor
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/fsm-editor/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | ]]>
91 |
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/fsm-editor/info.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmorbini/scxmlgui/1e092023635b21e1d5e22820075d736b46c537fb/fsm-editor/info.txt
--------------------------------------------------------------------------------
/fsm-editor/src/com/mxgraph/examples/config/ObjectFactory.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6
3 | // See http://java.sun.com/xml/jaxb
4 | // Any modifications to this file will be lost upon recompilation of the source schema.
5 | // Generated on: 2012.09.24 at 01:55:46 PM CEST
6 | //
7 |
8 |
9 | package com.mxgraph.examples.config;
10 |
11 | import javax.xml.bind.annotation.XmlRegistry;
12 |
13 |
14 | /**
15 | * This object contains factory methods for each
16 | * Java content interface and Java element interface
17 | * generated in the test package.
18 | * An ObjectFactory allows you to programatically
19 | * construct new instances of the Java representation
20 | * for XML content. The Java representation of XML
21 | * content can consist of schema derived interfaces
22 | * and classes representing the binding of schema
23 | * type definitions, element declarations and model
24 | * groups. Factory methods for each of these are
25 | * provided in this class.
26 | *
27 | */
28 | @XmlRegistry
29 | public class ObjectFactory {
30 |
31 |
32 | /**
33 | * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: test
34 | *
35 | */
36 | public ObjectFactory() {
37 | }
38 |
39 | /**
40 | * Create an instance of {@link SCXMLConstraints }
41 | *
42 | */
43 | public SCXMLConstraints createSCXMLConstraints() {
44 | return new SCXMLConstraints();
45 | }
46 |
47 | /**
48 | * Create an instance of {@link SCXMLConstraints.RestrictedState }
49 | *
50 | */
51 | public SCXMLConstraints.RestrictedState createSCXMLConstraintsRestrictedState() {
52 | return new SCXMLConstraints.RestrictedState();
53 | }
54 |
55 | /**
56 | * Create an instance of {@link SCXMLConstraints.RestrictedState.PossibleEvent }
57 | *
58 | */
59 | public SCXMLConstraints.RestrictedState.PossibleEvent createSCXMLConstraintsRestrictedStatePossibleEvent() {
60 | return new SCXMLConstraints.RestrictedState.PossibleEvent();
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/DOTImportExport.java:
--------------------------------------------------------------------------------
1 | package com.mxgraph.examples.swing.editor.fileimportexport;
2 |
3 | import java.io.IOException;
4 | import java.util.LinkedList;
5 | import java.util.Queue;
6 |
7 | import javax.swing.JFileChooser;
8 |
9 | import com.mxgraph.examples.config.SCXMLConstraints;
10 | import com.mxgraph.examples.swing.editor.scxml.SCXMLGraph;
11 | import com.mxgraph.model.mxCell;
12 | import com.mxgraph.model.mxIGraphModel;
13 | import com.mxgraph.swing.mxGraphComponent;
14 | import com.mxgraph.util.mxUtils;
15 | import com.mxgraph.view.mxGraph;
16 | import com.mxgraph.view.mxGraphView;
17 |
18 | public class DOTImportExport implements IImportExport {
19 |
20 | @Override
21 | public Object buildEdgeValue() {
22 | // TODO Auto-generated method stub
23 | return null;
24 | }
25 |
26 | @Override
27 | public Object buildNodeValue() {
28 | // TODO Auto-generated method stub
29 | return null;
30 | }
31 |
32 | @Override
33 | public Boolean canExport() {
34 | return true;
35 | }
36 |
37 | @Override
38 | public Boolean canImport() {
39 | return false;
40 | }
41 |
42 | @Override
43 | public Object cloneValue(Object value) {
44 | // TODO Auto-generated method stub
45 | return null;
46 | }
47 |
48 | @Override
49 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws IOException {
50 | // TODO Auto-generated method stub
51 |
52 | }
53 |
54 | @Override
55 | public void write(mxGraphComponent from, String into) throws IOException {
56 | mxGraph graph = from.getGraph();
57 | mxGraphView view = graph.getView();
58 | mxIGraphModel model = graph.getModel();
59 | mxCell root=(mxCell) model.getRoot();
60 | if ((root!=null) && (root.getChildCount()==1)) root=(mxCell) root.getChildAt(0);
61 | if (root!=null) {
62 | String dot=mxVertex2DOTString(view,root,new StringBuffer(),true);
63 | System.out.println(dot);
64 | mxUtils.writeFile(dot, into);
65 | }
66 | }
67 |
68 | public mxCell getSimpleChildOf(mxCell n) {
69 | Queue list=new LinkedList();
70 | list.add(n);
71 | while(!list.isEmpty()) {
72 | mxCell x=list.poll();
73 | int l=x.getChildCount();
74 | for (int i=0;i "+realEnd+" ["+((ltail!=null)?ltail+",":"")+((lhead!=null)?lhead+",":"")+" label=\""+edgeLabel+"\"];");
125 | }
126 | }
127 | if (isRoot) ret+=transitions.toString();
128 | ret+=close;
129 | return ret;
130 | }
131 |
132 | @Override
133 | public void clearInternalID2NodesAndSCXMLID2Nodes() {
134 | // TODO Auto-generated method stub
135 |
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/HTMLImportExport.java:
--------------------------------------------------------------------------------
1 | package com.mxgraph.examples.swing.editor.fileimportexport;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.swing.JFileChooser;
6 |
7 | import com.mxgraph.examples.config.SCXMLConstraints;
8 | import com.mxgraph.swing.mxGraphComponent;
9 | import com.mxgraph.util.mxCellRenderer;
10 | import com.mxgraph.util.mxUtils;
11 | import com.mxgraph.view.mxGraph;
12 |
13 | public class HTMLImportExport implements IImportExport {
14 |
15 | @Override
16 | public Boolean canExport() {
17 | return true;
18 | }
19 |
20 | @Override
21 | public Boolean canImport() {
22 | return false;
23 | }
24 |
25 | @Override
26 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws IOException {
27 | }
28 |
29 | @Override
30 | public void write(mxGraphComponent from, String into) throws IOException {
31 | mxGraph graph=from.getGraph();
32 | mxUtils.writeFile(mxUtils.getXml(mxCellRenderer.createHtmlDocument(graph, null, 1, null, null).getDocumentElement()), into);
33 | }
34 |
35 | @Override
36 | public Object buildNodeValue() {
37 | return null;
38 | }
39 |
40 | @Override
41 | public Object cloneValue(Object value) {
42 | return null;
43 | }
44 |
45 | @Override
46 | public Object buildEdgeValue() {
47 | return null;
48 | }
49 |
50 | @Override
51 | public void clearInternalID2NodesAndSCXMLID2Nodes() {
52 | // TODO Auto-generated method stub
53 |
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/IImportExport.java:
--------------------------------------------------------------------------------
1 | package com.mxgraph.examples.swing.editor.fileimportexport;
2 |
3 | import javax.swing.JFileChooser;
4 |
5 | import com.mxgraph.examples.config.SCXMLConstraints;
6 | import com.mxgraph.swing.mxGraphComponent;
7 |
8 | public interface IImportExport {
9 | public abstract Boolean canImport();
10 | public abstract Boolean canExport();
11 | public abstract void read(String from,mxGraphComponent graphComponent, JFileChooser fc, SCXMLConstraints restrictedConstraints) throws Exception;
12 | public abstract void write(mxGraphComponent graphComponent,String into) throws Exception;
13 | public abstract Object buildNodeValue();
14 | public abstract Object buildEdgeValue();
15 | public abstract Object cloneValue(Object value);
16 | public void clearInternalID2NodesAndSCXMLID2Nodes();
17 | }
18 |
--------------------------------------------------------------------------------
/fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/IMGImportExport.java:
--------------------------------------------------------------------------------
1 | package com.mxgraph.examples.swing.editor.fileimportexport;
2 |
3 | import java.awt.Color;
4 | import java.awt.image.BufferedImage;
5 | import java.io.File;
6 |
7 | import javax.imageio.ImageIO;
8 | import javax.swing.JFileChooser;
9 | import javax.swing.JOptionPane;
10 |
11 | import com.mxgraph.examples.config.SCXMLConstraints;
12 | import com.mxgraph.swing.mxGraphComponent;
13 | import com.mxgraph.util.mxCellRenderer;
14 | import com.mxgraph.util.mxResources;
15 | import com.mxgraph.view.mxGraph;
16 |
17 | public class IMGImportExport implements IImportExport {
18 |
19 | @Override
20 | public Boolean canExport() {
21 | return true;
22 | }
23 |
24 | @Override
25 | public Boolean canImport() {
26 | return false;
27 | }
28 |
29 | @Override
30 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws Exception {
31 | }
32 |
33 | @Override
34 | public void write(mxGraphComponent graphComponent, String into) throws Exception {
35 | Color bg = null;
36 | String ext = into.substring(into.lastIndexOf('.') + 1);
37 | if ((!ext.equalsIgnoreCase("gif") && !ext.equalsIgnoreCase("png"))
38 | || JOptionPane.showConfirmDialog(
39 | graphComponent, mxResources
40 | .get("transparentBackground")) != JOptionPane.YES_OPTION)
41 | {
42 | bg = graphComponent.getBackground();
43 | }
44 | write(graphComponent,into,ext,bg);
45 | }
46 | public void write(mxGraphComponent graphComponent,String into,String format,Color bg) throws Exception {
47 | mxGraph graph = graphComponent.getGraph();
48 | BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, bg,
49 | graphComponent.isAntiAlias(), null,
50 | graphComponent.getCanvas());
51 |
52 | if (image != null)
53 | {
54 | if (!ImageIO.write(image,format,new File(into))) {
55 | throw new Exception(mxResources.get("invalidImageFormat"+": '"+format+"'"));
56 | }
57 | }
58 | else
59 | {
60 | throw new Exception(mxResources.get("noImageData"));
61 | }
62 | }
63 |
64 | @Override
65 | public Object buildNodeValue() {
66 | return null;
67 | }
68 |
69 | @Override
70 | public Object buildEdgeValue() {
71 | // TODO Auto-generated method stub
72 | return null;
73 | }
74 |
75 | @Override
76 | public Object cloneValue(Object value) {
77 | return null;
78 | }
79 |
80 | @Override
81 | public void clearInternalID2NodesAndSCXMLID2Nodes() {
82 | // TODO Auto-generated method stub
83 |
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/MXEImportExport.java:
--------------------------------------------------------------------------------
1 | package com.mxgraph.examples.swing.editor.fileimportexport;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.swing.JFileChooser;
6 |
7 | import org.w3c.dom.Document;
8 |
9 | import com.mxgraph.examples.config.SCXMLConstraints;
10 | import com.mxgraph.io.mxCodec;
11 | import com.mxgraph.swing.mxGraphComponent;
12 | import com.mxgraph.util.mxUtils;
13 | import com.mxgraph.view.mxGraph;
14 |
15 | public class MXEImportExport implements IImportExport {
16 |
17 | @Override
18 | public Boolean canExport() {
19 | return true;
20 | }
21 |
22 | @Override
23 | public Boolean canImport() {
24 | return true;
25 | }
26 |
27 | @Override
28 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws Exception {
29 | Document document = mxUtils.parseXMLString(mxUtils.readFile(from),false,false);
30 | mxCodec codec = new mxCodec(document);
31 | codec.decode(document.getDocumentElement(),graphComponent.getGraph().getModel());
32 | }
33 |
34 | @Override
35 | public void write(mxGraphComponent from, String into) throws IOException {
36 | mxGraph graph=from.getGraph();
37 | mxCodec codec = new mxCodec();
38 | String xml = mxUtils.getXml(codec.encode(graph.getModel()));
39 | mxUtils.writeFile(xml, into);
40 | }
41 |
42 | @Override
43 | public Object buildNodeValue() {
44 | return null;
45 | }
46 |
47 | @Override
48 | public Object buildEdgeValue() {
49 | return null;
50 | }
51 |
52 | @Override
53 | public Object cloneValue(Object value) {
54 | return value;
55 | }
56 |
57 | @Override
58 | public void clearInternalID2NodesAndSCXMLID2Nodes() {
59 | // TODO Auto-generated method stub
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/OutSource.java:
--------------------------------------------------------------------------------
1 | package com.mxgraph.examples.swing.editor.fileimportexport;
2 |
3 | import java.io.Serializable;
4 |
5 | public class OutSource implements Serializable {
6 |
7 | private static final long serialVersionUID = 1L;
8 | public enum OUTSOURCETYPE {SRC,XINC};
9 |
10 | private OUTSOURCETYPE type;
11 | private String location;
12 | public OutSource(OUTSOURCETYPE t,String l) {
13 | setLocation(l);
14 | setType(t);
15 | }
16 | public OUTSOURCETYPE getType() {
17 | return type;
18 | }
19 | public String getLocation() {
20 | return location;
21 | }
22 | public void setLocation(String location) {
23 | this.location = location;
24 | }
25 | public void setType(OUTSOURCETYPE type) {
26 | this.type = type;
27 | }
28 | @Override
29 | public boolean equals(Object obj) {
30 | if (obj instanceof OutSource) {
31 | OutSource objOutSource=(OutSource)obj;
32 | return (obj!=null && ((objOutSource.location!=null && objOutSource.location.equals(location)) ||
33 | (objOutSource.location==null))
34 | && ((objOutSource.type!=null && objOutSource.type.equals(type)) ||
35 | (objOutSource.type==null)));
36 | } else return super.equals(obj);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/SVGImportExport.java:
--------------------------------------------------------------------------------
1 | package com.mxgraph.examples.swing.editor.fileimportexport;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.swing.JFileChooser;
6 |
7 | import com.mxgraph.examples.config.SCXMLConstraints;
8 | import com.mxgraph.swing.mxGraphComponent;
9 | import com.mxgraph.util.mxCellRenderer;
10 | import com.mxgraph.util.mxUtils;
11 | import com.mxgraph.view.mxGraph;
12 |
13 | public class SVGImportExport implements IImportExport {
14 |
15 | @Override
16 | public Boolean canExport() {
17 | return true;
18 | }
19 |
20 | @Override
21 | public Boolean canImport() {
22 | return false;
23 | }
24 |
25 | @Override
26 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws IOException {
27 | }
28 |
29 | @Override
30 | public void write(mxGraphComponent from, String into) throws IOException {
31 | mxGraph graph=from.getGraph();
32 | mxUtils.writeFile(mxUtils.getXml(mxCellRenderer.createSvgDocument(graph, null, 1, null, null).getDocumentElement()), into);
33 | }
34 |
35 | @Override
36 | public Object buildNodeValue() {
37 | return null;
38 | }
39 |
40 | @Override
41 | public Object buildEdgeValue() {
42 | return null;
43 | }
44 |
45 | @Override
46 | public Object cloneValue(Object value) {
47 | return null;
48 | }
49 |
50 | @Override
51 | public void clearInternalID2NodesAndSCXMLID2Nodes() {
52 | // TODO Auto-generated method stub
53 |
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/fsm-editor/src/com/mxgraph/examples/swing/editor/fileimportexport/VMLImportExport.java:
--------------------------------------------------------------------------------
1 | package com.mxgraph.examples.swing.editor.fileimportexport;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.swing.JFileChooser;
6 |
7 | import com.mxgraph.examples.config.SCXMLConstraints;
8 | import com.mxgraph.swing.mxGraphComponent;
9 | import com.mxgraph.util.mxCellRenderer;
10 | import com.mxgraph.util.mxUtils;
11 | import com.mxgraph.view.mxGraph;
12 |
13 | public class VMLImportExport implements IImportExport {
14 |
15 | @Override
16 | public Boolean canExport() {
17 | return true;
18 | }
19 |
20 | @Override
21 | public Boolean canImport() {
22 | return false;
23 | }
24 |
25 | @Override
26 | public void read(String from, mxGraphComponent graphComponent,JFileChooser fc, SCXMLConstraints restrictedConstraints) throws IOException {
27 | }
28 |
29 | @Override
30 | public void write(mxGraphComponent from, String into) throws IOException {
31 | mxGraph graph=from.getGraph();
32 | mxUtils.writeFile(mxUtils.getXml(mxCellRenderer.createVmlDocument(graph, null, 1, null, null).getDocumentElement()), into);
33 | }
34 |
35 | @Override
36 | public Object buildNodeValue() {
37 | return null;
38 | }
39 |
40 | @Override
41 | public Object buildEdgeValue() {
42 | return null;
43 | }
44 |
45 | @Override
46 | public Object cloneValue(Object value) {
47 | return null;
48 | }
49 |
50 | @Override
51 | public void clearInternalID2NodesAndSCXMLID2Nodes() {
52 | // TODO Auto-generated method stub
53 |
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/fsm-editor/src/com/mxgraph/examples/swing/editor/scxml/MyUndoManager.java:
--------------------------------------------------------------------------------
1 | package com.mxgraph.examples.swing.editor.scxml;
2 |
3 | import java.util.Vector;
4 |
5 | import javax.swing.undo.CannotUndoException;
6 | import javax.swing.undo.UndoManager;
7 | import javax.swing.undo.UndoableEdit;
8 |
9 | public class MyUndoManager extends UndoManager {
10 |
11 | private static final long serialVersionUID = 1L;
12 |
13 | public Vector getEdits() {
14 | return edits;
15 | }
16 | protected UndoableEdit getNextUndoableEdit() {
17 | int size = edits.size( );
18 | for (int i=size-1;i>=0;i--) {
19 | UndoableEdit u = (UndoableEdit)edits.elementAt(i);
20 | if (u.canUndo( ) && u.isSignificant( ))
21 | return u;
22 | }
23 | return null;
24 | }
25 | protected UndoableEdit getInitialEdit() {
26 | return (edits.isEmpty())?null:edits.elementAt(0);
27 | }
28 |
29 | public synchronized void undoTo(UndoableEdit to, boolean excludeTo) {
30 | int size = edits.size( );
31 | for (int i=size-1;i>=0;i--) {
32 | UndoableEdit u = (UndoableEdit)edits.elementAt(i);
33 | if (canUndo()) {
34 | if ((u==to) && excludeTo) return;
35 | else undo();
36 | }
37 | if (u==to) return;
38 | }
39 | }
40 | public synchronized void redoTo(UndoableEdit to, boolean excludeTo) {
41 | int size = edits.size( );
42 | for (int i=0;i localHashSetOfCells=new HashSet