public class ModelObservable
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
ModelObservable.Listener
Interface implemented by objects that want to be notified when the model
changes.
|
Constructor and Description |
---|
ModelObservable()
Creates a new ModelObservable with no listeners.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ModelObservable.Listener l)
Adds the given listener to the observable.
|
void |
notifyListeners()
Notifies every listener that the model has changed.
|
void |
removeListener(ModelObservable.Listener l)
Removes the given listener.
|
public ModelObservable()
public void addListener(ModelObservable.Listener l)
l
- the listener to be added.public void notifyListeners()
Only models should call this method.
public void removeListener(ModelObservable.Listener l)
The listener will no longer be notified when the model changes. If the given listener is not subscrined to this observable, does nothing.
l
- the listener to be removed