|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.undo.AbstractUndoableEdit
public class AbstractUndoableEdit
A default implementation of UndoableEdit that can be
used as a base for implementing editing operations.
| Field Summary | |
|---|---|
protected static String |
RedoName
The constant string “Redo”, which was returned by getRedoPresentationName() on early versions of the
platform. |
protected static String |
UndoName
The constant string “Undo”, which was returned by getUndoPresentationName() on early versions of the
platform. |
| Constructor Summary | |
|---|---|
AbstractUndoableEdit()
Constructs a new AbstractUndoableEdit. |
|
| Method Summary | |
|---|---|
boolean |
addEdit(UndoableEdit edit)
Incorporates another editing action into this one, thus forming a combined action. |
boolean |
canRedo()
Determines whether it would be possible to redo this editing action. |
boolean |
canUndo()
Determines whether it would be possible to undo this editing action. |
void |
die()
Informs this edit action that it will no longer be used. |
String |
getPresentationName()
Returns a human-readable, localized name that describes this editing action and can be displayed to the user. |
String |
getRedoPresentationName()
Calculates a localized name for presenting the redo action to the user. |
String |
getUndoPresentationName()
Calculates a localized name for presenting the undo action to the user. |
boolean |
isSignificant()
Determines whether this editing action is significant enough for being seperately undoable by the user. |
void |
redo()
Redoes this editing action. |
boolean |
replaceEdit(UndoableEdit edit)
Incorporates another editing action into this one, thus forming a combined action that replaces the argument action. |
String |
toString()
Convert this Object to a human-readable String. |
void |
undo()
Undoes this editing action. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final String UndoName
getUndoPresentationName() on early versions of the
platform. However, this field has become obsolete with version
1.3.1. That method now retrieves a localized string from the
UIManager, using the key
“AbstractUndoableEdit.undoText”.
protected static final String RedoName
getRedoPresentationName() on early versions of the
platform. However, this field has become obsolete with version
1.3.1. That method now retrieves a localized string from the
UIManager, using the key
“AbstractUndoableEdit.redoText”.
| Constructor Detail |
|---|
public AbstractUndoableEdit()
AbstractUndoableEdit. The initial
state is that the editing action is alive, and
hasBeenDone is true.
| Method Detail |
|---|
public void undo()
throws CannotUndoException
undo in interface UndoableEditCannotUndoException - if canUndo() returns
false, for example because this action has already
been undone.canUndo(),
redo()public boolean canUndo()
canUndo in interface UndoableEdittrue to indicate that this action can be
undone, false otherwise.undo(),
canRedo()
public void redo()
throws CannotRedoException
redo in interface UndoableEditCannotRedoException - if canRedo() returns
false, for example because this action has not
yet been undone.canRedo(),
undo()public boolean canRedo()
canRedo in interface UndoableEdittrue to indicate that this action can be
redone, false otherwise.redo(),
canUndo()public void die()
UndoManager before this
action is removed from the edit queue.
die in interface UndoableEditpublic boolean addEdit(UndoableEdit edit)
The default implementation always returns false,
indicating that the editing action could not be incorporated.
addEdit in interface UndoableEditedit - the editing action to be incorporated.
true if the edit was combined successfully, and
false if it could not be combined.public boolean replaceEdit(UndoableEdit edit)
The default implementation always returns false,
indicating that the argument action should not be replaced.
replaceEdit in interface UndoableEditedit - the editing action to be replaced.
true if the edit is successfully replaced, and
false otherwise.public boolean isSignificant()
The default implementation returns true.
isSignificant in interface UndoableEdittrue to indicate that the action is
significant enough for being separately undoable, or
false otherwise.public String getPresentationName()
The default implementation returns an empty string.
getPresentationName in interface UndoableEditpublic String getUndoPresentationName()
The default implementation returns the concatenation of the
string “Undo” and the action name, which is
determined by calling getPresentationName().
The string “Undo” is retrieved from the UIManager, using the key
“AbstractUndoableEdit.undoText”. This
allows the text to be localized.
getUndoPresentationName in interface UndoableEditpublic String getRedoPresentationName()
The default implementation returns the concatenation of the
string “Redo” and the action name, which is
determined by calling getPresentationName().
The string “Redo” is retrieved from the UIManager, using the key
“AbstractUndoableEdit.redoText”. This
allows the text to be localized.
getRedoPresentationName in interface UndoableEditpublic String toString()
ObjectSystem.out.println()
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a RuntimeException.
This method will be called when performing string
concatenation with this object. If the result is
null, string concatenation will instead
use "null".
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode()).
toString in class ObjectObject.getClass(),
Object.hashCode(),
Class.getName(),
Integer.toHexString(int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||