- java.lang.Object
-
- javax.swing.undo.AbstractUndoableEdit
-
- 实现的所有接口
-
Serializable,UndoableEdit
- 已知直接子类:
-
AbstractDocument.ElementEdit,CompoundEdit,DefaultStyledDocument.AttributeUndoableEdit,StateEdit
public class AbstractUndoableEdit extends Object implements UndoableEdit, Serializable
UndoableEdit的抽象实现,实现对该接口中所有布尔方法的简单响应。- 另请参见:
- Serialized Form
-
-
构造方法摘要
构造方法 构造器 描述 AbstractUndoableEdit()创建AbstractUndoableEdit,默认hasBeenDonealive为true。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 booleanaddEdit(UndoableEdit anEdit)此默认实现返回false。booleancanRedo()返回true如果此编辑为alive和hasBeenDone是false。booleancanUndo()如果此编辑为alive且hasBeenDone为true则返回true。voiddie()将alive设置为false。StringgetPresentationName()此默认实现返回“”。StringgetRedoPresentationName()使用键AbstractUndoableEdit.redoText从默认值表中检索值,并返回该值,后跟空格,后跟getPresentationName。StringgetUndoPresentationName()使用键AbstractUndoableEdit.undoText从默认值表中检索值,并返回该值,后跟空格,后跟getPresentationName。booleanisSignificant()此默认实现返回true。voidredo()如果canRedo返回false,则抛出CannotRedoException。booleanreplaceEdit(UndoableEdit anEdit)此默认实现返回false。StringtoString()返回显示和标识此对象属性的字符串。voidundo()抛出CannotUndoException如果canUndo回报false。
-
-
-
字段详细信息
-
UndoName
protected static final String UndoName
由getUndoPresentationName返回的getUndoPresentationName; 从Java 2平台v1.3.1开始,不再使用此字段。 此值现已本地化,并来自默认值表AbstractUndoableEdit.undoText。- 另请参见:
-
UIDefaults, 常数字段值
-
RedoName
protected static final String RedoName
由getRedoPresentationName返回的getRedoPresentationName; 从Java 2平台v1.3.1开始,不再使用此字段。 此值现已本地化,并来自默认值表AbstractUndoableEdit.redoText。- 另请参见:
-
UIDefaults, 常数字段值
-
-
方法详细信息
-
die
public void die()
将alive设置为false。 请注意,这是一种单向操作; 死亡编辑无法复活。 将undo或redo发送到死亡编辑会导致抛出异常。通常,当编辑由另一个编辑的
addEdit或replaceEdit方法合并时,或者当它从UndoManager出列时,编辑将被UndoManager。- Specified by:
-
die在界面UndoableEdit - 另请参见:
-
CompoundEdit.die()
-
undo
public void undo() throws CannotUndoException抛出CannotUndoException如果canUndo回报false。 将hasBeenDone设为false。 子类应重写以撤消此编辑所表示的操作。 覆盖应该从调用super开始。- Specified by:
-
undo在界面UndoableEdit - 异常
-
CannotUndoException- 如果canUndo返回false - 另请参见:
-
canUndo()
-
canUndo
public boolean canUndo()
如果此编辑为alive且hasBeenDone为true则返回true。- Specified by:
-
canUndo在界面UndoableEdit - 结果
-
如果此编辑为
alive且hasBeenDone为true,hasBeenDonetrue - 另请参见:
-
die(),undo(),redo()
-
redo
public void redo() throws CannotRedoException如果canRedo返回false,则抛出CannotRedoException。 将hasBeenDone设为true。 子类应重写以重做此编辑所表示的操作。 覆盖应该从调用super开始。- Specified by:
-
redo在界面UndoableEdit - 异常
-
CannotRedoException- 如果canRedo返回false - 另请参见:
-
canRedo()
-
canRedo
public boolean canRedo()
返回true如果此编辑为alive和hasBeenDone是false。- Specified by:
-
canRedo在界面UndoableEdit - 结果
-
true如果这个编辑是alive而hasBeenDone是false - 另请参见:
-
die(),undo(),redo()
-
addEdit
public boolean addEdit(UndoableEdit anEdit)
此默认实现返回false。- Specified by:
-
addEdit在界面UndoableEdit - 参数
-
anEdit- 要添加的编辑 - 结果
- 假
- 另请参见:
-
UndoableEdit.addEdit(javax.swing.undo.UndoableEdit)
-
replaceEdit
public boolean replaceEdit(UndoableEdit anEdit)
此默认实现返回false。- Specified by:
-
replaceEdit在界面UndoableEdit - 参数
-
anEdit- 要替换的编辑 - 结果
- 假
- 另请参见:
-
UndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit)
-
isSignificant
public boolean isSignificant()
此默认实现返回true。- Specified by:
-
isSignificant在界面UndoableEdit - 结果
- 真正
- 另请参见:
-
UndoableEdit.isSignificant()
-
getPresentationName
public String getPresentationName()
此默认实现返回“”。 由getUndoPresentationName和getRedoPresentationName用于构造它们返回的字符串。 子类应重写以返回此编辑所代表的操作的适当描述。- Specified by:
-
getPresentationName在界面UndoableEdit - 结果
- 空字符串“”
- 另请参见:
-
getUndoPresentationName(),getRedoPresentationName()
-
getUndoPresentationName
public String getUndoPresentationName()
使用键AbstractUndoableEdit.undoText从默认值表中检索值,并返回该值,后跟空格,后跟getPresentationName。 如果getPresentationName返回“”,则单独返回默认值。- Specified by:
-
getUndoPresentationName在界面UndoableEdit - 结果
-
默认值表中的值为
AbstractUndoableEdit.undoText,后跟空格,后跟getPresentationName除非getPresentationName为“”,在这种情况下,将单独返回默认值。 - 另请参见:
-
getPresentationName()
-
getRedoPresentationName
public String getRedoPresentationName()
使用键AbstractUndoableEdit.redoText从默认值表中检索值,并返回该值,后跟空格,后跟getPresentationName。 如果getPresentationName返回“”,则单独返回默认值。- Specified by:
-
getRedoPresentationName在界面UndoableEdit - 结果
-
默认值表中的值为
AbstractUndoableEdit.redoText,后跟空格,后跟getPresentationName除非getPresentationName为“”,在这种情况下,将单独返回默认值。 - 另请参见:
-
getPresentationName()
-
-