|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.borland.primetime.editor.JBUndoManager
This is the Undo Manager. It handles UndoSegments and UndoGroups, so that blocks of edits can be undone and redone as a group.
Inner Class Summary | |
protected class |
JBUndoManager.UndoGroup
An UndoGroup is a collection of zero or more edits that are treated as one unit in terms of undo and redo support. |
protected class |
JBUndoManager.UndoSegment
An UndoSegment is a special subclass of UndoGroup which is able to coalesce subsequent edits of the same type. |
Field Summary | |
protected JBUndoManager.UndoGroup |
activeUndoGroup
|
static int |
INSERT
|
static int |
OVERWRITE
|
static int |
REMOVE
|
protected java.util.Stack |
undoGroupStack
|
static int |
UNKNOWN
|
Constructor Summary | |
JBUndoManager()
|
Method Summary | |
boolean |
addEdit(javax.swing.undo.UndoableEdit anEdit)
Insert anEdit at indexOfNextAdd, and remove any old edits that were at indexOfNextAdd or later. |
boolean |
canRedo()
Check whether or not redo is valid in the current state. |
boolean |
canUndo()
Check whether or not undo is valid in the current state. |
void |
discardAllEdits()
Clear the entire undo stack, calling die on all the edits in reverse order. |
void |
endUndoGroup(int point,
int mark)
End the current undo group. |
void |
endUndoSegment(int point,
int mark)
End the current undo group. |
protected JBUndoManager.UndoGroup |
getCurrentRedoEdit()
Get the current edit to redo, if redo is performed. |
protected JBUndoManager.UndoGroup |
getCurrentUndoEdit()
Get the current edit to undo, if undo is performed. |
int |
getCurrentUndoHashCode()
Get the hashcode of the current undo object. |
protected JBUndoManager.UndoGroup |
getLastEdit()
Get the last edit in the list. |
int |
getRedoEndMark()
Return the offset of the caret mark after the current edit to redo. |
int |
getRedoEndPoint()
Return the offset of the caret point after the current edit to redo. |
int |
getRedoStartMark()
Return the offset of the caret mark before the current edit to redo. |
int |
getRedoStartPoint()
Return the offset of the caret point before the current edit to redo. |
int |
getUndoEndMark()
Return the offset of the caret mark after the current edit to undo. |
int |
getUndoEndPoint()
Return the offset of the caret point after the current edit to undo. |
int |
getUndoStartMark()
Return the offset of the caret mark before the current edit to undo. |
int |
getUndoStartPoint()
Return the offset of the caret point before the current edit to undo. |
void |
redo()
Redo the edit at indexOfNextAdd. |
void |
startUndoGroup(int point,
int mark)
Start a new undo group. |
void |
startUndoSegment(int point,
int mark,
int type)
Start a new UndoSegment. |
protected void |
trimEdits(int index)
Trim the list of edits from the end of the list to index. |
protected void |
trimForLimit()
Ensure that the list of edits is under MAXEDITSIZE. |
void |
undo()
Undo the edit just before indexOfNextAdd. |
void |
undoableEditHappened(javax.swing.event.UndoableEditEvent e)
Called by the UndoabledEdit sources this UndoManager listens to. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int UNKNOWN
public static final int INSERT
public static final int REMOVE
public static final int OVERWRITE
protected JBUndoManager.UndoGroup activeUndoGroup
protected java.util.Stack undoGroupStack
Constructor Detail |
public JBUndoManager()
Method Detail |
public int getCurrentUndoHashCode()
-1
if there are no edits to be undone.public boolean canUndo()
public boolean canRedo()
public void undo() throws javax.swing.undo.CannotUndoException
public void redo() throws javax.swing.undo.CannotRedoException
public boolean addEdit(javax.swing.undo.UndoableEdit anEdit)
anEdit
- the UndoableEdit to add.public void discardAllEdits()
public void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
addEdit(javax.swing.undo.UndoableEdit)
public int getUndoStartPoint()
-1
is returned.public int getUndoStartMark()
-1
is returned.public int getUndoEndPoint()
-1
is returned.public int getUndoEndMark()
-1
is returned.public int getRedoStartPoint()
-1
is returned.public int getRedoStartMark()
-1
is returned.public int getRedoEndPoint()
-1
is returned.public int getRedoEndMark()
-1
is returned.protected JBUndoManager.UndoGroup getLastEdit()
protected JBUndoManager.UndoGroup getCurrentUndoEdit()
protected JBUndoManager.UndoGroup getCurrentRedoEdit()
protected void trimEdits(int index)
index
- Trim from this point forward in the list.protected void trimForLimit()
0
and calling die on them.public void startUndoSegment(int point, int mark, int type)
point
- The position of the caret point to be recorded at the start
of this UndoSegment.mark
- The position of the caret mark to be recorded at the start
of this UndoSegment.type
- The type of edit this UndoSegment represents.public void endUndoSegment(int point, int mark)
point
- The position of the caret point to be recorded at the end
of this undo group.mark
- The position of the caret mark to be recorded at the end
of this undo group.public void startUndoGroup(int point, int mark)
point
- The position of the caret point to be recorded at the start
of this undo group.mark
- The position of the caret mark to be recorded at the start
of this undo group.public void endUndoGroup(int point, int mark)
point
- The position of the caret point to be recorded at the end
of this undo group.mark
- The position of the caret mark to be recorded at the end
of this undo group.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |