38
38
package javax.swing.undo;
41
* UndoableEdit public interface
41
* An editing operation that supports undo/redoability.
42
43
* @author Andrew Selkirk
44
public interface UndoableEdit {
51
boolean addEdit(UndoableEdit anEdit);
74
String getPresentationName();
77
* getRedoPresentationName
80
String getRedoPresentationName();
83
* getUndoPresentationName
86
String getUndoPresentationName();
92
boolean isSignificant();
96
* @throws CannotRedoException TODO
98
void redo() throws CannotRedoException;
105
boolean replaceEdit(UndoableEdit anEdit);
109
* @throws CannotUndoException TODO
111
void undo() throws CannotUndoException;
45
public interface UndoableEdit
49
* Incorporates another editing action into this one, thus forming a
52
* @param edit the editing action to be incorporated.
54
* @return <code>true</code> if the edit was combined successfully, and
55
* <code>false</code> if it could not be combined.
57
boolean addEdit(UndoableEdit edit);
60
* Determines whether it would be possible to redo this editing
63
* @return <code>true</code> to indicate that this action can be
64
* redone, <code>false</code> otherwise.
72
* Determines whether it would be possible to undo this editing
75
* @return <code>true</code> to indicate that this action can be
76
* undone, <code>false</code> otherwise.
84
* Informs this edit action that it will no longer be used. Some
85
* actions might use this information to release resources, for
86
* example open files. Called by {@link UndoManager} before this
87
* action is removed from the edit queue.
92
* Returns a human-readable, localized name that describes this
93
* editing action and can be displayed to the user.
95
* @return The presentation name.
97
String getPresentationName();
100
* Returns the redo presentation name.
102
* @return The redo presentation name.
104
String getRedoPresentationName();
107
* Returns the undo presentation name.
109
* @return The undo presentation name.
111
String getUndoPresentationName();
114
* Determines whether this editing action is significant enough for
115
* being seperately undoable by the user. A typical significant
116
* action would be the resizing of an object. However, changing the
117
* selection in a text document would usually not be considered
120
* @return <code>true</code> to indicate that the action is
121
* significant enough for being separately undoable, or
122
* <code>false</code> otherwise.
124
boolean isSignificant();
127
* Redoes this editing action.
129
* @throws CannotRedoException if the edit cannot be undone.
134
void redo() throws CannotRedoException;
137
* Incorporates another editing action into this one, thus forming a
138
* combined action that replaces the argument action.
140
* @param edit the editing action to be replaced.
142
* @return <code>true</code> if the edit is successfully replaced, and
143
* <code>false</code> otherwise.
145
boolean replaceEdit(UndoableEdit edit);
148
* Undoes this editing action.
150
* @throws CannotUndoException if the edit cannot be undone.
155
void undo() throws CannotUndoException;