public abstract class AbstractIcyUndoableEdit extends java.lang.Object implements IcyUndoableEdit
UndoableEdit
class.Constructor and Description |
---|
AbstractIcyUndoableEdit(java.lang.Object source)
Creates an
UndoableAction which defaults hasBeenDone and
alive to true . |
AbstractIcyUndoableEdit(java.lang.Object source,
java.awt.Image icon)
Creates an
UndoableAction which defaults hasBeenDone and
alive to true . |
AbstractIcyUndoableEdit(java.lang.Object source,
java.lang.String name)
Creates an
UndoableAction which defaults hasBeenDone and
alive to true . |
AbstractIcyUndoableEdit(java.lang.Object source,
java.lang.String name,
java.awt.Image icon)
Creates an
UndoableAction which defaults hasBeenDone and
alive to true . |
Modifier and Type | Method and Description |
---|---|
boolean |
addEdit(javax.swing.undo.UndoableEdit anEdit) |
boolean |
canRedo() |
boolean |
canUndo() |
void |
die()
Sets
alive to false. |
IcyIcon |
getIcon() |
java.lang.String |
getPresentationName()
This default implementation returns "".
|
java.lang.String |
getRedoPresentationName()
Retrieves the value from the defaults table with key
AbstractUndoableEdit.redoText and returns
that value followed by a space, followed by getPresentationName . |
java.lang.Object |
getSource()
Retrieve source of this edit
|
java.lang.String |
getUndoPresentationName()
Retrieves the value from the defaults table with key
AbstractUndoableEdit.undoText and returns
that value followed by a space, followed by getPresentationName . |
boolean |
isMergeable() |
boolean |
isSignificant() |
void |
redo()
Throws
CannotRedoException if canRedo returns false. |
boolean |
replaceEdit(javax.swing.undo.UndoableEdit anEdit) |
void |
setMergeable(boolean value) |
java.lang.String |
toString()
Returns a string that displays and identifies this
object's properties.
|
void |
undo()
Throws
CannotUndoException if canUndo returns false . |
public AbstractIcyUndoableEdit(java.lang.Object source, java.lang.String name, java.awt.Image icon)
UndoableAction
which defaults hasBeenDone
and
alive
to true
.public AbstractIcyUndoableEdit(java.lang.Object source, java.lang.String name)
UndoableAction
which defaults hasBeenDone
and
alive
to true
.public AbstractIcyUndoableEdit(java.lang.Object source, java.awt.Image icon)
UndoableAction
which defaults hasBeenDone
and
alive
to true
.public AbstractIcyUndoableEdit(java.lang.Object source)
UndoableAction
which defaults hasBeenDone
and
alive
to true
.public java.lang.Object getSource()
IcyUndoableEdit
getSource
in interface IcyUndoableEdit
public IcyIcon getIcon()
getIcon
in interface IcyUndoableEdit
public void die()
alive
to false. Note that this is a one way operation; dead edits cannot be
resurrected.undo
or redo
to a dead edit results in an exception being
thrown.
Typically an edit is killed when it is consolidated by another edit's addEdit
or
replaceEdit
method, or when it is dequeued from an UndoManager
.
die
in interface javax.swing.undo.UndoableEdit
public void undo() throws javax.swing.undo.CannotUndoException
CannotUndoException
if canUndo
returns false
.
Sets hasBeenDone
to false
. Subclasses should override to undo the
operation represented by this edit. Override should begin with
a call to super.undo
in interface javax.swing.undo.UndoableEdit
javax.swing.undo.CannotUndoException
- if canUndo
returns false
canUndo()
public boolean canUndo()
canUndo
in interface javax.swing.undo.UndoableEdit
public void redo() throws javax.swing.undo.CannotRedoException
CannotRedoException
if canRedo
returns false. Sets
hasBeenDone
to true
.
Subclasses should override to redo the operation represented by
this edit. Override should begin with a call to super.redo
in interface javax.swing.undo.UndoableEdit
javax.swing.undo.CannotRedoException
- if canRedo
returns false
canRedo()
public boolean canRedo()
canRedo
in interface javax.swing.undo.UndoableEdit
public boolean addEdit(javax.swing.undo.UndoableEdit anEdit)
addEdit
in interface javax.swing.undo.UndoableEdit
public boolean replaceEdit(javax.swing.undo.UndoableEdit anEdit)
replaceEdit
in interface javax.swing.undo.UndoableEdit
public final boolean isSignificant()
isSignificant
in interface javax.swing.undo.UndoableEdit
public boolean isMergeable()
isMergeable
in interface IcyUndoableEdit
true
if this edit can be merged with a compatible editpublic void setMergeable(boolean value)
public java.lang.String getPresentationName()
getUndoPresentationName
and
getRedoPresentationName
to
construct the strings they return. Subclasses should override to
return an appropriate description of the operation this edit
represents.getPresentationName
in interface javax.swing.undo.UndoableEdit
getUndoPresentationName()
,
getRedoPresentationName()
public java.lang.String getUndoPresentationName()
AbstractUndoableEdit.undoText
and returns
that value followed by a space, followed by getPresentationName
.
If getPresentationName
returns "",
then the defaults value is returned alone.getUndoPresentationName
in interface javax.swing.undo.UndoableEdit
AbstractUndoableEdit.undoText
, followed
by a space, followed by getPresentationName
unless
getPresentationName
is "" in which
case, the defaults value is returned alone.getPresentationName()
public java.lang.String getRedoPresentationName()
AbstractUndoableEdit.redoText
and returns
that value followed by a space, followed by getPresentationName
.
If getPresentationName
returns "",
then the defaults value is returned alone.getRedoPresentationName
in interface javax.swing.undo.UndoableEdit
AbstractUndoableEdit.redoText
, followed
by a space, followed by getPresentationName
unless
getPresentationName
is "" in which
case, the defaults value is returned alone.getPresentationName()
public java.lang.String toString()
toString
in class java.lang.Object