|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface StateEditable
The interface for objects whose state can be undone or redone by a
StateEdit action.
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);
}
}
StateEdit| Field Summary | |
|---|---|
static 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. |
| Field Detail |
|---|
static final String RCSID
| Method Detail |
|---|
void restoreState(Hashtable<?,?> state)
Note to implementors of this interface: To increase
efficiency, the StateEdit class 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 storeState(java.util.Hashtable, but are not present anymore
when the restoreState method gets called.
state - a hash table containing the relevant state
information.void storeState(Hashtable<Object,Object> state)
state - a hash table for storing relevant state
information.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||