adc153e4e860a7894995828e01acd9157fa09f4c
[jalviewjs.git] / site / j2s / javax / swing / undo / AbstractUndoableEdit.js
1 Clazz.declarePackage ("javax.swing.undo");
2 Clazz.load (["javax.swing.undo.UndoableEdit"], "javax.swing.undo.AbstractUndoableEdit", ["javax.swing.UIManager", "javax.swing.undo.CannotRedoException", "$.CannotUndoException"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.hasBeenDone = false;
5 this.alive = false;
6 Clazz.instantialize (this, arguments);
7 }, javax.swing.undo, "AbstractUndoableEdit", null, javax.swing.undo.UndoableEdit);
8 Clazz.makeConstructor (c$, 
9 function () {
10 this.hasBeenDone = true;
11 this.alive = true;
12 });
13 Clazz.overrideMethod (c$, "die", 
14 function () {
15 this.alive = false;
16 });
17 Clazz.overrideMethod (c$, "undo", 
18 function () {
19 if (!this.canUndo ()) {
20 throw  new javax.swing.undo.CannotUndoException ();
21 }this.hasBeenDone = false;
22 });
23 Clazz.overrideMethod (c$, "canUndo", 
24 function () {
25 return this.alive && this.hasBeenDone;
26 });
27 Clazz.overrideMethod (c$, "redo", 
28 function () {
29 if (!this.canRedo ()) {
30 throw  new javax.swing.undo.CannotRedoException ();
31 }this.hasBeenDone = true;
32 });
33 Clazz.overrideMethod (c$, "canRedo", 
34 function () {
35 return this.alive && !this.hasBeenDone;
36 });
37 Clazz.overrideMethod (c$, "addEdit", 
38 function (anEdit) {
39 return false;
40 }, "javax.swing.undo.UndoableEdit");
41 Clazz.overrideMethod (c$, "replaceEdit", 
42 function (anEdit) {
43 return false;
44 }, "javax.swing.undo.UndoableEdit");
45 Clazz.overrideMethod (c$, "isSignificant", 
46 function () {
47 return true;
48 });
49 Clazz.overrideMethod (c$, "getPresentationName", 
50 function () {
51 return "";
52 });
53 Clazz.overrideMethod (c$, "getUndoPresentationName", 
54 function () {
55 var name = this.getPresentationName ();
56 if (!"".equals (name)) {
57 name = javax.swing.UIManager.getString ("AbstractUndoableEdit.undoText") + " " + name;
58 } else {
59 name = javax.swing.UIManager.getString ("AbstractUndoableEdit.undoText");
60 }return name;
61 });
62 Clazz.overrideMethod (c$, "getRedoPresentationName", 
63 function () {
64 var name = this.getPresentationName ();
65 if (!"".equals (name)) {
66 name = javax.swing.UIManager.getString ("AbstractUndoableEdit.redoText") + " " + name;
67 } else {
68 name = javax.swing.UIManager.getString ("AbstractUndoableEdit.redoText");
69 }return name;
70 });
71 Clazz.defineMethod (c$, "toString", 
72 function () {
73 return Clazz.superCall (this, javax.swing.undo.AbstractUndoableEdit, "toString", []) + " hasBeenDone: " + this.hasBeenDone + " alive: " + this.alive;
74 });
75 Clazz.defineStatics (c$,
76 "UndoName", "Undo",
77 "RedoName", "Redo");
78 });