javax.swing.undo
Class CompoundEdit
- Serializable, UndoableEdit
An editing action that consists of multiple
UndoableEdits
.
The use of a
CompoundEdit
is divided in two separate
phases.
- In the first phase, the
CompoundEdit
is
initialized. After a new instance of CompoundEdit
has
been created, addEdit(UndoableEdit)
is called for each
element of the compound. To terminate the initialization phase,
call end()
. - In the second phase, the the
CompoundEdit
can be
used, typically by invoking undo()
and
redo()
.
protected Vector | edits - The
UndoableEdit s being combined into a compound
editing action.
|
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.
|
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 message text for presenting the redo
action to the user.
|
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 .
|
String | toString() - Calculates a string that may be useful for debugging.
|
void | undo() - Undoes all edits that are part of of this
CompoundEdit .
|
addEdit , canRedo , canUndo , die , getPresentationName , getRedoPresentationName , getUndoPresentationName , isSignificant , redo , replaceEdit , toString , undo |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
edits
protected Vector edits
The UndoableEdit
s being combined into a compound
editing action.
CompoundEdit
public CompoundEdit()
Constructs a new CompoundEdit.
addEdit
public boolean addEdit(UndoableEdit edit)
Incorporates another editing action into this one, thus forming a
combined edit.
If this edit’s
end()
method has been called
before,
false
is returned immediately. Otherwise,
the
last added edit is given the
opportunity to
incorporate edit
. If this fails,
edit
is given the opportunity to
replace the last added
edit. If this fails as well,
edit
gets added as a
new compound to
edits
.
- addEdit in interface UndoableEdit
- addEdit in interface AbstractUndoableEdit
edit
- the editing action being added.
true
if edit
could somehow be
incorporated; false
if edit
has not
been incorporated because end()
was called before.
canRedo
public boolean canRedo()
Determines whether it would be possible to redo this editing
action. The result will be
true
if
end()
has been called on this
CompoundEdit
,
die()
has not yet been called, and the edit has not been redone
already.
- canRedo in interface UndoableEdit
- canRedo in interface AbstractUndoableEdit
true
to indicate that this action can be
redone; false
otherwise.
canUndo
public boolean canUndo()
Determines whether it would be possible to undo this editing
action. The result will be
true
if
end()
has been called on this
CompoundEdit
,
die()
has not yet been called, and the edit has not been undone
already.
- canUndo in interface UndoableEdit
- canUndo in interface AbstractUndoableEdit
true
to indicate that this action can be
undone; false
otherwise.
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
die
message in the reverse order of addition.
- die in interface UndoableEdit
- die in interface AbstractUndoableEdit
end
public void end()
Informs this
CompoundEdit
that its construction
phase has been completed. After this method has been called,
undo()
and
redo()
may be called,
isInProgress()
will return
false
, and all attempts
to
add further edits will
fail.
isInProgress
public boolean isInProgress()
Determines whether the initial construction phase of this
CompoundEdit
is still in progress. During this
phase, edits
may be
added. After initialization has been terminated by calling
end()
,
undo()
and
redo()
can be used.
true
if the initialization phase is still in
progress; false
if end()
has been called.
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
CompoundEdit
is significant if any of its
elements are significant.
- isSignificant in interface UndoableEdit
- isSignificant in interface AbstractUndoableEdit
lastEdit
protected UndoableEdit lastEdit()
Returns the the UndoableEdit
that was last added to
this compound.
CompoundEdit.java -- Combines multiple UndoableEdits.
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.