javax.swing.undo
public interface StateEditable
The following example shows how to write a class that implements this interface.
class Foo implements StateEditable { private String name; public void setName(String n) { name = n; } public void restoreState(Hashtable h) { if (h.containsKey("name")) setName((String) h.get("name")); } public void storeState(Hashtable s) { s.put("name", name); } }
Field Summary | |
---|---|
String | RCSID
The ID of the Java source file in Sun’s Revision Control
System (RCS). |
Method Summary | |
---|---|
void | restoreState(Hashtable<?,?> state)
Performs an edit action, taking any editable state information
from the specified hash table.
|
void | storeState(Hashtable<Object,Object> state)
Stores any editable state information into the specified hash
table.
|
Note to implementors of this interface: To increase
efficiency, the StateEdit
class {@link
StateEdit#removeRedundantState()} removes redundant state
information. Therefore, implementations of this interface must be
prepared for the case where certain keys were stored into the
table by {@link #storeState}, but are not present anymore
when the restoreState
method gets called.
Parameters: state a hash table containing the relevant state information.
Parameters: state a hash table for storing relevant state information.