所有类


javax.swing.undo
类 StateEdit

java.lang.Object
  继承者 javax.swing.undo.AbstractUndoableEdit
      继承者 javax.swing.undo.StateEdit
所有已实现的接口:
Serializable, UndoableEdit

public class StateEdit
   
   
   
   
extends AbstractUndoableEdit

StateEdit 是更改状态的对象的通用编辑。被编辑的对象必须遵守 StateEditable 接口。

此编辑类的工作方式是,在编辑发生之前和发生之后,请求对象将其状态存储在 Hashtable 中。通过撤消或恢复操作,通知该对象从这些 Hashtable 中恢复其状态。

按如下方式使用状态编辑:
        // 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 结束时,它将从 Hashtable 中移除多余的状态 - 状态 Hashtable 并不保证包含在存储状态时放入其中的所有键/值!

另请参见:
StateEditable

字段摘要
protected  StateEditableobject
          被编辑的对象
protected  Hashtable<Object,Object>postState
          编辑之后的状态信息
protected  Hashtable<Object,Object>preState
          编辑之前的状态信息
protected static StringRCSID
           
protected  StringundoRedoName
          撤消/恢复的表示名称
 
从类 javax.swing.undo.AbstractUndoableEdit 继承的字段
RedoName, UndoName
 
构造方法摘要
StateEdit(StateEditable anObject)
          创建并返回新的 StateEdit。
StateEdit(StateEditable anObject, String name)
          创建并返回具有表示名称的新 StateEdit。
 
方法摘要
 voidend()
          获取 StateEditable 对象的后编辑状态,并结束编辑。
 StringgetPresentationName()
          获取此编辑的表示名称
protected  voidinit(StateEditable anObject, String name)
           
 voidredo()
          通知编辑对象应用编辑之后的状态
protected  voidremoveRedundantState()
          移除状态哈希表中多余的键/值。
 voidundo()
          通知被编辑的对象应用编辑之前的状态
 
从类 javax.swing.undo.AbstractUndoableEdit 继承的方法
addEdit, canRedo, canUndo, die, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, toString
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

RCSID

protected static final String RCSID
另请参见:
常量字段值

object

protected StateEditable object
被编辑的对象


preState

protected Hashtable<Object,Object> preState
编辑之前的状态信息


postState

protected Hashtable<Object,Object> postState
编辑之后的状态信息


undoRedoName

protected String undoRedoName
撤消/恢复的表示名称

构造方法详细信息

StateEdit

public StateEdit(StateEditable anObject)
创建并返回新的 StateEdit。

参数:
anObject - 监视更改状态的对象
另请参见:
StateEdit

StateEdit

public StateEdit(StateEditable anObject,
                 String name)
创建并返回具有表示名称的新 StateEdit。

参数:
anObject - 监视更改状态的对象
name - 将用于此编辑的表示名称
另请参见:
StateEdit
方法详细信息

init

protected void init(StateEditable anObject,
                    String name)

end

public void end()
获取 StateEditable 对象的后编辑状态,并结束编辑。