org.gjt.universe.notification
Class Notification

java.lang.Object
  |
  +--org.gjt.universe.notification.Notification
Direct Known Subclasses:
FleetNotification, StationNotification, WormholeNotification

public class Notification
extends java.lang.Object

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();

Author:
Allan Noordvyk (noordvyk@home.com)
See Also:
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

mySender

private java.lang.Object mySender

myName

private java.lang.String myName
Constructor Detail

Notification

public Notification(java.lang.String name,
                    java.lang.Object sender)
This is the designated constructor which should be used to create instances of this class.

Parameters:
name - The name (i.e. type) of the notification.
sender - The object sending the notification (may be null).
Method Detail

getName

public java.lang.String getName()
This method returns the name (i.e. type) of the notification.


getSender

public java.lang.Object getSender()
This method returns the sender of the notification.


post

public void post()
This convenience method posts the notification to the the default NotificationCenter.

See Also:
NotificationCenter

post

public void post(NotificationCenter aCenter)
This convenience method posts the notification to the given notification center.

Parameters:
aCenter - A notification center through which the notification is to be posted.


Copyright © 2001 Universe Dev Team All Rights Reserved.