public class State extends EventManager
A piece of state information that can be shared between objects, and might be persisted between sessions. This can be used for commands that toggle between two states and wish to pass this state information between different handlers.
This state object can either be used as a single state object shared between several commands, or one state object per command -- depending on the needs of the application.
Clients may instantiate or extend this class.
Constructor and Description |
---|
State() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(IStateListener listener)
Adds a listener to changes for this state.
|
void |
dispose()
Disposes of this state.
|
protected void |
fireStateChanged(Object oldValue)
Notifies listeners to this state that it has changed in some way.
|
String |
getId()
Returns the identifier for this state.
|
Object |
getValue()
The current value associated with this state.
|
void |
removeListener(IStateListener listener)
Removes a listener to changes from this state.
|
void |
setId(String id)
Sets the identifier for this object.
|
void |
setValue(Object value)
Sets the value for this state object.
|
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
public void addListener(IStateListener listener)
listener
- The listener to add; must not be null
.public void dispose()
protected final void fireStateChanged(Object oldValue)
oldValue
- The old value; may be anything.public final String getId()
null
.public Object getValue()
public void removeListener(IStateListener listener)
listener
- The listener to remove; must not be null
.public void setId(String id)
id
- The id; must not be null
.public void setValue(Object value)
value
- The value to set; may be anything.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.