public class StateEdit extends AbstractUndoableEdit
StateEdit是更改状态的对象的一般编辑。 被编辑的对象必须符合StateEditable界面。
这个编辑类通过在编辑之前和之后询问对象来存储它在Hashtables中的状态。 撤消或重做时,对象被告知要从这些Hashtables恢复它的状态。
使用状态编辑如下: // Create the edit during the "before" state of the object
StateEdit newEdit = new StateEdit(myObject);
// Modify the object
myObject.someStateModifyingMethod();
// "end" the edit when you are done modifying the object
newEdit.end();
请注意,当StateEdit结束时,它会从Hashtables中删除冗余状态 - 状态Hashtable不保证在存储状态时包含放入其中的所有键/值!
StateEditable
| Modifier and Type | Field and Description |
|---|---|
protected StateEditable |
object
正在编辑的对象
|
protected Hashtable<Object,Object> |
postState
编辑后的状态信息
|
protected Hashtable<Object,Object> |
preState
编辑前的状态信息
|
protected static String |
RCSID |
protected String |
undoRedoName
撤消/重做演示文稿名称
|
RedoName, UndoName| Constructor and Description |
|---|
StateEdit(StateEditable anObject)
创建并返回一个新的StateEdit。
|
StateEdit(StateEditable anObject, String name)
创建并返回一个新的StateEdit与演示名称。
|
| Modifier and Type | Method and Description |
|---|---|
void |
end()
获取StateEditable对象的后编辑状态,并结束编辑。
|
String |
getPresentationName()
获取此编辑的演示文稿名称
|
protected void |
init(StateEditable anObject, String name) |
void |
redo()
告知编辑对象在编辑后应用状态
|
protected void |
removeRedundantState()
删除状态哈希表中的冗余密钥/值。
|
void |
undo()
告知编辑对象在编辑之前应用状态
|
addEdit, canRedo, canUndo, die, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, toStringprotected static final String RCSID
protected StateEditable object
protected String undoRedoName
public StateEdit(StateEditable anObject)
anObject - 要注意改变状态的对象
StateEdit
public StateEdit(StateEditable anObject, String name)
anObject - 要观察状态改变的对象
name - 要用于此编辑的演示文稿名称
StateEdit
protected void init(StateEditable anObject, String name)
public void end()
public void undo()
undo在接口
UndoableEdit
undo在
AbstractUndoableEdit
AbstractUndoableEdit.canUndo()
public void redo()
redo在界面
UndoableEdit
redo在类
AbstractUndoableEdit
AbstractUndoableEdit.canRedo()
public String getPresentationName()
getPresentationName在界面
UndoableEdit
getPresentationName在
AbstractUndoableEdit
AbstractUndoableEdit.getUndoPresentationName() ,
AbstractUndoableEdit.getRedoPresentationName()
protected void removeRedundantState()
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.