oracle.ide
Class IdeSubject
java.lang.Object
|
+--oracle.ide.IdeSubject
- All Implemented Interfaces:
- Subject
- Direct Known Subclasses:
- IdeVetoableSubject, JProjectLibraryList
- public class IdeSubject
- extends java.lang.Object
- implements Subject
The IdeSubject
class defines the API to register
Observer
s that are interested in receiving notifications
of Subject
changes.
Classes that can have multiple views in particular must implement
the Subject
interface so that all observing views can be
notified when changes have occurred.
- See Also:
Observer
,
UpdateMessage
Method Summary |
void |
attach(Observer observer)
Registers an Observer interested in being notified when the
internal state of the class implementing the Subject
interface changes. |
protected static void |
copy(IdeSubject src,
IdeSubject dst)
Copies the observer list from src to the
Observer list in dst . |
void |
detach(Observer observer)
Unregisters an observer that is not interested anymore in being notified
when the internal state of the class implementing the Subject
interface changes. |
protected java.util.List |
getObservers()
|
void |
notifyObservers(java.lang.Object observed,
UpdateMessage change)
Notifies all observers that the state of the subject has changed. |
protected void |
setObservers(java.util.List list)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IdeSubject
public IdeSubject()
- Contructor
IdeSubject
public IdeSubject(IdeSubject ideSubject)
- Copy constructor
copy
protected static void copy(IdeSubject src,
IdeSubject dst)
- Copies the observer list from
src
to the
Observer
list in dst
. The Observer
list in dst
is not cleared.
getObservers
protected java.util.List getObservers()
setObservers
protected void setObservers(java.util.List list)
attach
public void attach(Observer observer)
- Registers an
Observer
interested in being notified when the
internal state of the class implementing the Subject
interface changes. If the observer is already attached this method
does nothing.
- Specified by:
attach
in interface Subject
- Parameters:
observer
- the Observer
interested in change
notification messages.
detach
public void detach(Observer observer)
- Unregisters an observer that is not interested anymore in being notified
when the internal state of the class implementing the
Subject
interface changes.
- Specified by:
detach
in interface Subject
- Parameters:
observer
- the Observer
disinterested in change
notification messages.
notifyObservers
public void notifyObservers(java.lang.Object observed,
UpdateMessage change)
- Notifies all observers that the state of the subject has changed.
- Specified by:
notifyObservers
in interface Subject
- Parameters:
subject
- the subject whose state has changed.change
- what changed.