public class AbstractUndoableEdit extends Object implements UndoableEdit, Serializable
UndoableEdit对该接口中所有布尔方法的简单响应。
| Modifier and Type | Field and Description |
|---|---|
protected static String |
RedoName
字符串返回 getRedoPresentationName ;
从Java 2平台v1.3.1开始,此字段不再使用。
|
protected static String |
UndoName
字符串返回 getUndoPresentationName ;
从Java 2平台v1.3.1开始,此字段不再使用。
|
| Constructor and Description |
|---|
AbstractUndoableEdit()
创建一个
AbstractUndoableEdit ,默认为
hasBeenDone和
alive到
true 。
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addEdit(UndoableEdit anEdit)
此默认实现返回false。
|
boolean |
canRedo()
返回
true如果此编辑为
alive和
hasBeenDone是
false 。
|
boolean |
canUndo()
如果此编辑是
alive和
hasBeenDone是
true则返回true。
|
void |
die()
将
alive设为false。
|
String |
getPresentationName()
此默认实现返回“”。
|
String |
getRedoPresentationName()
使用关键字
AbstractUndoableEdit.redoText从默认表中检索值,并返回该值后跟一个空格,后跟
getPresentationName 。
|
String |
getUndoPresentationName()
检索默认表项中的值
AbstractUndoableEdit.undoText并返回该值后跟一个空格,其次是
getPresentationName 。
|
boolean |
isSignificant()
此默认实现返回true。
|
void |
redo()
如果
canRedo返回false,则抛出
CannotRedoException 。
|
boolean |
replaceEdit(UndoableEdit anEdit)
此默认实现返回false。
|
String |
toString()
返回显示和标识此对象属性的字符串。
|
void |
undo()
抛出
CannotUndoException如果
canUndo回报
false 。
|
protected static final String UndoName
getUndoPresentationName ;
从Java 2平台v1.3.1开始,此字段不再使用。
此值现在已经本地化,并且来自带键AbstractUndoableEdit.undoText的默认值。
UIDefaults , Constant Field Values
protected static final String RedoName
getRedoPresentationName ;
从Java 2平台v1.3.1开始,此字段不再使用。
此值现在已经本地化,并且来自带键AbstractUndoableEdit.redoText的默认值。
UIDefaults , Constant Field Values
public AbstractUndoableEdit()
AbstractUndoableEdit ,默认为
hasBeenDone和
alive至
true 。
public void die()
alive设为false。
注意这是单向操作;
死亡编辑不能复活。
将undo或redo发送到死编辑会导致抛出异常。
通常,当编辑被另一个编辑的addEdit或replaceEdit方法replaceEdit时,或当它从UndoManager出队时,编辑被杀死。
die在接口
UndoableEdit
CompoundEdit.die()
public void undo()
throws CannotUndoException
CannotUndoException如果canUndo回报false 。
将hasBeenDone设为false 。
子类应该覆盖以撤销此编辑所表示的操作。
覆盖应该从调用超级开始。
undo在接口
UndoableEdit
CannotUndoException - 如果
canUndo返回
false
canUndo()
public boolean canUndo()
alive ,并且
hasBeenDone为
true则返回true。
canUndo在接口
UndoableEdit
alive和
hasBeenDone是
true
die() ,
undo() ,
redo()
public void redo()
throws CannotRedoException
canRedo返回false,则抛出CannotRedoException 。
将hasBeenDone设为true 。
子类应该覆盖以重做由此编辑表示的操作。
覆盖应该从调用超级开始。
redo在接口
UndoableEdit
CannotRedoException - 如果
canRedo返回
false
canRedo()
public boolean canRedo()
true如果此编辑为
alive和
hasBeenDone是
false 。
canRedo在接口
UndoableEdit
true如果这个编辑是
alive和
hasBeenDone是
false
die() ,
undo() ,
redo()
public boolean addEdit(UndoableEdit anEdit)
addEdit在接口
UndoableEdit
anEdit - 要添加的编辑
UndoableEdit.addEdit(javax.swing.undo.UndoableEdit)
public boolean replaceEdit(UndoableEdit anEdit)
replaceEdit在接口
UndoableEdit
anEdit - 要替换的编辑
UndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit)
public boolean isSignificant()
isSignificant在接口
UndoableEdit
UndoableEdit.isSignificant()
public String getPresentationName()
getUndoPresentationName和getRedoPresentationName来构造他们返回的字符串。
子类应该覆盖以返回该编辑表示的操作的适当描述。
getPresentationName在接口
UndoableEdit
getUndoPresentationName() ,
getRedoPresentationName()
public String getUndoPresentationName()
AbstractUndoableEdit.undoText从默认值表中检索值,并返回该值后跟空格,后跟getPresentationName 。
如果getPresentationName返回“”,则默认值将单独返回。
getUndoPresentationName在界面
UndoableEdit
AbstractUndoableEdit.undoText ,后跟一个空格,后跟
getPresentationName ,除非
getPresentationName是“”,在这种情况下,默认值是单独返回的。
getPresentationName()
public String getRedoPresentationName()
AbstractUndoableEdit.redoText从默认表中检索该值,并返回该值后跟一个空格,后跟getPresentationName 。
如果getPresentationName返回“”,则默认值将单独返回。
getRedoPresentationName在界面
UndoableEdit
AbstractUndoableEdit.redoText ,后跟一个空格,其次是
getPresentationName ,除非
getPresentationName是“”,在这种情况下,默认值是单独返回的。
getPresentationName()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.