|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.gjt.universe.notification.Notification
The instances of this very simple class represent notifications that may be posted by generating for the consumption of interested listening objects via a NotificationCenter. This mechanism is a useful alternative to the GUI-based event mechanisms within java.awt and javax.swing. Instances of this class are immutable after creation, supplying only get and other non-state changing methods. The same notification object may be posted repeatedly if the information has not changed. This can be useful in reducing the number of objects that need to be created. This base class provides a generic notification container via which only the sender of the notification and the type of notification is transmitted. Specific subclases may be created to piggy-back any additional information that is deemed useful for observers. EXAMPLE OF POSTING aNotification = new Notification( "On Fire", this ) aNotification.post();
NotificationCenter
Field Summary | |
private java.lang.String |
myName
|
private java.lang.Object |
mySender
|
Constructor Summary | |
Notification(java.lang.String name,
java.lang.Object sender)
This is the designated constructor which should be used to create instances of this class. |
Method Summary | |
java.lang.String |
getName()
This method returns the name (i.e. |
java.lang.Object |
getSender()
This method returns the sender of the notification. |
void |
post()
This convenience method posts the notification to the the default NotificationCenter. |
void |
post(NotificationCenter aCenter)
This convenience method posts the notification to the given notification center. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.Object mySender
private java.lang.String myName
Constructor Detail |
public Notification(java.lang.String name, java.lang.Object sender)
name
- The name (i.e. type) of the notification.sender
- The object sending the notification (may be null).Method Detail |
public java.lang.String getName()
public java.lang.Object getSender()
public void post()
NotificationCenter
public void post(NotificationCenter aCenter)
aCenter
- A notification center through which the notification is to be posted.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |