- java.lang.Object
-
- javax.swing.undo.AbstractUndoableEdit
-
- javax.swing.undo.CompoundEdit
-
- All Implemented Interfaces:
-
Serializable,UndoableEdit
public class CompoundEdit extends AbstractUndoableEdit
AbstractUndoableEdit的一个具体子类,用于将小的UndoableEdits组合成大型的。- 另请参见:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field 描述 protected Vector<UndoableEdit>edits收集UndoableEdits撤销/重新CompoundEdit由这CompoundEdit。-
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
-
-
构造方法摘要
构造方法 Constructor 描述 CompoundEdit()构造一个CompoundEdit。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 booleanaddEdit(UndoableEdit anEdit)如果此编辑是inProgress,请接受anEdit并返回true。booleancanRedo()如果isInProgress返回false,或者超级返回false。booleancanUndo()如果是isInProgress或者超级返回false,则返回false。voiddie()向每个子编辑器发送die,与添加的顺序相反。voidend()将inProgress设为false。StringgetPresentationName()从最后UndoableEdit返回getPresentationName加到edits。StringgetRedoPresentationName()从最后UndoableEdit返回getRedoPresentationName加到了edits。StringgetUndoPresentationName()从最后UndoableEdit返回getUndoPresentationName加到edits。booleanisInProgress()如果此编辑正在进行,则返回true - 也就是说,它没有收到结束。booleanisSignificant()如果在edits有任何UndoableEdit则返回true。protected UndoableEditlastEdit()返回最后UndoableEdit在edits,或null如果edits是空的。voidredo()发送redo所有包含UndoableEdits的添加顺序。StringtoString()返回显示和标识此对象属性的字符串。voidundo()发送undo全部包含UndoableEdits,与添加顺序相反。-
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
-
-
-
-
字段详细信息
-
edits
protected Vector<UndoableEdit> edits
收集UndoableEdits撤销/重新CompoundEdit由这CompoundEdit。
-
-
方法详细信息
-
undo
public void undo() throws CannotUndoException发送undo全部包含UndoableEdits,与添加的顺序相反。- Specified by:
-
undo在接口UndoableEdit - 重写:
-
undo在AbstractUndoableEdit - 异常
-
CannotUndoException- 如果canUndo返回false - 另请参见:
-
AbstractUndoableEdit.canUndo()
-
redo
public void redo() throws CannotRedoException发送redo,其中包含UndoableEdits的添加顺序。- Specified by:
-
redo在接口UndoableEdit - 重写:
-
redo在AbstractUndoableEdit - 异常
-
CannotRedoException- 如果canRedo返回false - 另请参见:
-
AbstractUndoableEdit.canRedo()
-
lastEdit
protected UndoableEdit lastEdit()
如果edits为空,则返回UndoableEdit的edits或null。- 结果
-
最后
UndoableEdit在edits,或null如果edits是空的。
-
die
public void die()
向每个子编辑器发送die,与添加的顺序相反。- Specified by:
-
die在接口UndoableEdit - 重写:
-
die在AbstractUndoableEdit - 另请参见:
-
die()
-
addEdit
public boolean addEdit(UndoableEdit anEdit)
如果此编辑是inProgress,请接受anEdit并返回true。最后编辑添加到这个
CompoundEdit有机会addEdit(anEdit)。 如果拒绝(返回假),anEdit给予机会replaceEdit最后一次编辑。 如果anEdit在这里返回false,则添加到edits。- Specified by:
-
addEdit在接口UndoableEdit - 重写:
-
addEdit在AbstractUndoableEdit - 参数
-
anEdit- 要添加的编辑 - 结果
-
如果编辑是
inProgress,则为inProgress; 否则返回false - 另请参见:
-
UndoableEdit.addEdit(javax.swing.undo.UndoableEdit)
-
canUndo
public boolean canUndo()
如果isInProgress返回false,或者超级返回false。- Specified by:
-
canUndo在接口UndoableEdit - 重写:
-
canUndo在AbstractUndoableEdit - 结果
-
如果此编辑是
alive和hasBeenDone是true,hasBeenDonetrue - 另请参见:
-
isInProgress()
-
canRedo
public boolean canRedo()
如果是isInProgress或者超级返回false,则返回false。- Specified by:
-
canRedo在接口UndoableEdit - 重写:
-
canRedo在AbstractUndoableEdit - 结果
-
true如果此编辑是alive和hasBeenDone是false - 另请参见:
-
isInProgress()
-
isInProgress
public boolean isInProgress()
如果此编辑正在进行,则返回true - 也就是说,它没有收到结束。 这通常意味着编辑仍在添加。- 结果
- 该编辑是否在进行中
- 另请参见:
-
end()
-
isSignificant
public boolean isSignificant()
如果UndoableEdit的任何edits都可以返回true。 如果它们都返回false,则返回false。- Specified by:
-
isSignificant在接口UndoableEdit - 重写:
-
isSignificant在AbstractUndoableEdit - 结果
- 真正
- 另请参见:
-
UndoableEdit.isSignificant()
-
getPresentationName
public String getPresentationName()
从最后UndoableEdit返回getPresentationName加到edits。 如果edits为空,则调用super。- Specified by:
-
getPresentationName在接口UndoableEdit - 重写:
-
getPresentationName在AbstractUndoableEdit - 结果
- 空字符串“”
- 另请参见:
-
AbstractUndoableEdit.getUndoPresentationName(),AbstractUndoableEdit.getRedoPresentationName()
-
getUndoPresentationName
public String getUndoPresentationName()
从最后UndoableEdit返回getUndoPresentationName加到edits。 如果edits为空,则调用super。- Specified by:
-
getUndoPresentationName在接口UndoableEdit - 重写:
-
getUndoPresentationName在AbstractUndoableEdit - 结果
-
来自默认值的值为
AbstractUndoableEdit.undoText,后跟一个空格,后跟getPresentationName除非getPresentationName是“”,在这种情况下,默认值是单独返回的。 - 另请参见:
-
AbstractUndoableEdit.getPresentationName()
-
getRedoPresentationName
public String getRedoPresentationName()
从最后UndoableEdit返回getRedoPresentationName加到edits。 如果edits为空,则调用超级。- Specified by:
-
getRedoPresentationName在接口UndoableEdit - 重写:
-
getRedoPresentationName在AbstractUndoableEdit - 结果
-
来自默认值的值为
AbstractUndoableEdit.redoText,后跟一个空格,后跟getPresentationName除非getPresentationName为“”,在这种情况下,默认值是单独返回的。 - 另请参见:
-
AbstractUndoableEdit.getPresentationName()
-
toString
public String toString()
返回显示和标识此对象属性的字符串。- 重写:
-
toString在AbstractUndoableEdit - 结果
- 该对象的字符串表示形式
-
-