|
|||||||||
| Home >> All >> javax >> swing >> [ undo overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.swing.undo
Class CompoundEdit

java.lang.Objectjavax.swing.undo.AbstractUndoableEdit
javax.swing.undo.CompoundEdit
- All Implemented Interfaces:
- java.io.Serializable, UndoableEdit
- Direct Known Subclasses:
- UndoManager
- public class CompoundEdit
- extends AbstractUndoableEdit
An editing action that consists of multiple
UndoableEdits.
The use of a CompoundEdit is divided in two separate
phases.
- In the first phase, the
CompoundEditis initialized. After a new instance ofCompoundEdithas been created,addEdit(UndoableEdit)55 is called for each element of the compound. To terminate the initialization phase, callend()55 . - In the second phase, the the
CompoundEditcan be used, typically by invokingundo()55 andredo()55 .
| Field Summary | |
protected java.util.Vector |
edits
The UndoableEdits being combined into a compound
editing action. |
private boolean |
inProgress
Indicates whether the creation of this CompoundEdit is still in progress. |
private static long |
serialVersionUID
The identifier of this class in object serialization. |
| Fields inherited from class javax.swing.undo.AbstractUndoableEdit |
RedoName, UndoName |
| Constructor Summary | |
CompoundEdit()
Constructs a new CompoundEdit. |
|
| Method Summary | |
boolean |
addEdit(UndoableEdit edit)
Incorporates another editing action into this one, thus forming a combined edit. |
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, and all compound edits, that they will no longer be used. |
void |
end()
Informs this CompoundEdit that its construction
phase has been completed. |
java.lang.String |
getPresentationName()
Returns a human-readable, localized name that describes this editing action and can be displayed to the user. |
java.lang.String |
getRedoPresentationName()
Calculates a localized message text for presenting the redo action to the user. |
java.lang.String |
getUndoPresentationName()
Calculates a localized message text for presenting the undo action to the user. |
boolean |
isInProgress()
Determines whether the initial construction phase of this CompoundEdit is still in progress. |
boolean |
isSignificant()
Determines whether this editing action is significant enough for being seperately undoable by the user. |
protected UndoableEdit |
lastEdit()
Returns the the UndoableEdit that was last added to
this compound. |
void |
redo()
Redoes all edits that are part of of this CompoundEdit. |
java.lang.String |
toString()
Calculates a string that may be useful for debugging. |
void |
undo()
Undoes all edits that are part of of this CompoundEdit. |
| Methods inherited from class javax.swing.undo.AbstractUndoableEdit |
replaceEdit |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
serialVersionUID
private static final long serialVersionUID
- The identifier of this class in object serialization. Determined
using the serialver tool of Sun J2SE 1.4.1_01.
- See Also:
- Constant Field Values
edits
protected java.util.Vector edits
- The
UndoableEdits being combined into a compound editing action.
inProgress
private boolean inProgress
- Indicates whether the creation of this CompoundEdit is still in
progress. Initially, the value of this flag is
true. Theend()55 method changes the flag tofalse.
| Constructor Detail |
CompoundEdit
public CompoundEdit()
- Constructs a new CompoundEdit.
| Method Detail |
undo
public void undo()
throws CannotUndoException
- Undoes all edits that are part of of this
CompoundEdit. The compound elements will receive theundomessage in the reverse order of addition.- Specified by:
undoin interfaceUndoableEdit- Overrides:
undoin classAbstractUndoableEdit
redo
public void redo()
throws CannotRedoException
- Redoes all edits that are part of of this
CompoundEdit. The compound elements will receive theundomessage in the same order as they were added.- Specified by:
redoin interfaceUndoableEdit- Overrides:
redoin classAbstractUndoableEdit
lastEdit
protected UndoableEdit lastEdit()
- Returns the the
UndoableEditthat was last added to this compound.
die
public void die()
- Informs this edit action, and all compound edits, that they will
no longer be used. Some actions might use this information to
release resources such as open files. Called by UndoManager before this action is removed from the edit queue.
The compound elements will receive the
diemessage in the reverse order of addition.- Specified by:
diein interfaceUndoableEdit- Overrides:
diein classAbstractUndoableEdit
addEdit
public boolean addEdit(UndoableEdit edit)
- Incorporates another editing action into this one, thus forming a
combined edit.
If this edit’s
end()55 method has been called before,falseis returned immediately. Otherwise, the last added edit 55 is given the opportunity to incorporate 55edit. If this fails,editis given the opportunity to replace 55 the last added edit. If this fails as well,editgets added as a new compound toedits55 .- Specified by:
addEditin interfaceUndoableEdit- Overrides:
addEditin classAbstractUndoableEdit
end
public void end()
- Informs this
CompoundEditthat its construction phase has been completed. After this method has been called,undo()55 andredo()55 may be called,isInProgress()55 will returnfalse, and all attempts to add further edits 55 will fail.
canUndo
public boolean canUndo()
- Determines whether it would be possible to undo this editing
action. The result will be
trueifend()55 has been called on thisCompoundEdit,die()55 has not yet been called, and the edit has not been undone already.- Specified by:
canUndoin interfaceUndoableEdit- Overrides:
canUndoin classAbstractUndoableEdit
canRedo
public boolean canRedo()
- Determines whether it would be possible to redo this editing
action. The result will be
trueifend()55 has been called on thisCompoundEdit,die()55 has not yet been called, and the edit has not been redone already.- Specified by:
canRedoin interfaceUndoableEdit- Overrides:
canRedoin classAbstractUndoableEdit
isInProgress
public boolean isInProgress()
- Determines whether the initial construction phase of this
CompoundEditis still in progress. During this phase, edits may be added 55 . After initialization has been terminated by callingend()55 ,undo()55 andredo()55 can be used.
isSignificant
public boolean isSignificant()
- Determines whether this editing action is significant enough for
being seperately undoable by the user. A typical significant
action would be the resizing of an object. However, changing the
selection in a text document would usually not be considered
significant.
A
CompoundEditis significant if any of its elements are significant.- Specified by:
isSignificantin interfaceUndoableEdit- Overrides:
isSignificantin classAbstractUndoableEdit
getPresentationName
public java.lang.String getPresentationName()
- Returns a human-readable, localized name that describes this
editing action and can be displayed to the user.
The implementation delegates the call to the last added edit action 55 . If no edit has been added yet, the inherited implementation will be invoked, which always returns an empty string.
- Specified by:
getPresentationNamein interfaceUndoableEdit- Overrides:
getPresentationNamein classAbstractUndoableEdit
getUndoPresentationName
public java.lang.String getUndoPresentationName()
- Calculates a localized message text for presenting the undo
action to the user.
The implementation delegates the call to the last added edit action 55 . If no edit has been added yet, the inherited implementation 55 will be invoked.
- Specified by:
getUndoPresentationNamein interfaceUndoableEdit- Overrides:
getUndoPresentationNamein classAbstractUndoableEdit
getRedoPresentationName
public java.lang.String getRedoPresentationName()
- Calculates a localized message text for presenting the redo
action to the user.
The implementation delegates the call to the last added edit action 55 . If no edit has been added yet, the inherited implementation 55 will be invoked.
- Specified by:
getRedoPresentationNamein interfaceUndoableEdit- Overrides:
getRedoPresentationNamein classAbstractUndoableEdit
toString
public java.lang.String toString()
- Calculates a string that may be useful for debugging.
- Overrides:
toStringin classAbstractUndoableEdit
|
|||||||||
| Home >> All >> javax >> swing >> [ undo overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC