1 Clazz.declarePackage ("javax.swing.undo");
\r
2 Clazz.load (["javax.swing.undo.AbstractUndoableEdit"], "javax.swing.undo.CompoundEdit", ["java.util.Vector"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
4 this.inProgress = false;
\r
6 Clazz.instantialize (this, arguments);
\r
7 }, javax.swing.undo, "CompoundEdit", javax.swing.undo.AbstractUndoableEdit);
\r
8 Clazz.makeConstructor (c$,
\r
10 Clazz.superConstructor (this, javax.swing.undo.CompoundEdit);
\r
11 this.inProgress = true;
\r
12 this.edits = new java.util.Vector ();
\r
14 Clazz.defineMethod (c$, "undo",
\r
16 Clazz.superCall (this, javax.swing.undo.CompoundEdit, "undo", []);
\r
17 var i = this.edits.size ();
\r
19 var e = this.edits.elementAt (i);
\r
23 Clazz.defineMethod (c$, "redo",
\r
25 Clazz.superCall (this, javax.swing.undo.CompoundEdit, "redo", []);
\r
26 var cursor = this.edits.elements ();
\r
27 while (cursor.hasMoreElements ()) {
\r
28 (cursor.nextElement ()).redo ();
\r
31 Clazz.defineMethod (c$, "lastEdit",
\r
33 var count = this.edits.size ();
\r
34 if (count > 0) return this.edits.elementAt (count - 1);
\r
37 Clazz.defineMethod (c$, "die",
\r
39 var size = this.edits.size ();
\r
40 for (var i = size - 1; i >= 0; i--) {
\r
41 var e = this.edits.elementAt (i);
\r
44 Clazz.superCall (this, javax.swing.undo.CompoundEdit, "die", []);
\r
46 Clazz.overrideMethod (c$, "addEdit",
\r
48 if (!this.inProgress) {
\r
51 var last = this.lastEdit ();
\r
53 this.edits.addElement (anEdit);
\r
54 } else if (!last.addEdit (anEdit)) {
\r
55 if (anEdit.replaceEdit (last)) {
\r
56 this.edits.removeElementAt (this.edits.size () - 1);
\r
57 }this.edits.addElement (anEdit);
\r
59 }}, "javax.swing.undo.UndoableEdit");
\r
60 Clazz.defineMethod (c$, "end",
\r
62 this.inProgress = false;
\r
64 Clazz.defineMethod (c$, "canUndo",
\r
66 return !this.isInProgress () && Clazz.superCall (this, javax.swing.undo.CompoundEdit, "canUndo", []);
\r
68 Clazz.defineMethod (c$, "canRedo",
\r
70 return !this.isInProgress () && Clazz.superCall (this, javax.swing.undo.CompoundEdit, "canRedo", []);
\r
72 Clazz.defineMethod (c$, "isInProgress",
\r
74 return this.inProgress;
\r
76 Clazz.overrideMethod (c$, "isSignificant",
\r
78 var cursor = this.edits.elements ();
\r
79 while (cursor.hasMoreElements ()) {
\r
80 if ((cursor.nextElement ()).isSignificant ()) {
\r
85 Clazz.defineMethod (c$, "getPresentationName",
\r
87 var last = this.lastEdit ();
\r
89 return last.getPresentationName ();
\r
91 return Clazz.superCall (this, javax.swing.undo.CompoundEdit, "getPresentationName", []);
\r
93 Clazz.defineMethod (c$, "getUndoPresentationName",
\r
95 var last = this.lastEdit ();
\r
97 return last.getUndoPresentationName ();
\r
99 return Clazz.superCall (this, javax.swing.undo.CompoundEdit, "getUndoPresentationName", []);
\r
101 Clazz.defineMethod (c$, "getRedoPresentationName",
\r
103 var last = this.lastEdit ();
\r
104 if (last != null) {
\r
105 return last.getRedoPresentationName ();
\r
107 return Clazz.superCall (this, javax.swing.undo.CompoundEdit, "getRedoPresentationName", []);
\r
109 Clazz.defineMethod (c$, "toString",
\r
111 return Clazz.superCall (this, javax.swing.undo.CompoundEdit, "toString", []) + " inProgress: " + this.inProgress + " edits: " + this.edits;
\r