java.util.Observable
Observable is used to notify a group of Observer objects when a change
occurs.
Known Direct Subclasses
ContentQueryMap |
Caches the contents of a cursor into a Map of String->ContentValues and optionally
keeps the cache fresh by registering for updates on the content backing the cursor. |
Summary
Public Constructors
Public Methods
Protected Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
public
Observable()
Constructs a new Observable object.
Public Methods
public
synchronized
void
addObserver(Observer observer)
Adds the specified Observer to the list of observers.
Parameters
observer
| the Observer to add
|
public
synchronized
int
countObservers()
Returns the number of Observers in the list of observers.
public
synchronized
void
deleteObserver(Observer observer)
Removes the specified Observer from the list of observers.
Parameters
observer
| the Observer to remove
|
public
synchronized
void
deleteObservers()
Removes all Observers from the list of observers.
public
synchronized
boolean
hasChanged()
Returns the changed flag for this Observable.
Returns
- true when the changed flag for this Observable is set, false
otherwise
public
void
notifyObservers()
If hasChanged()
returns true, calls the update()
method for
every Observer in the list of observers using null as the argument.
Afterwards calls clearChanged()
.
Equivalent to calling notifyObservers(null)
public
void
notifyObservers(Object data)
If
hasChanged()
returns true, calls the
update()
method for
every Observer in the list of observers using the specified argument.
Afterwards calls
clearChanged()
.
Parameters
data
| the argument passed to update()
|
Protected Methods
protected
synchronized
void
clearChanged()
Clears the changed flag for this Observable. After calling clearChanged()
, hasChanged()
will return false.
protected
synchronized
void
setChanged()
Sets the changed flag for this Observable. After calling setChanged()
, hasChanged()
will return true.