gui.event package


Package Contract

Classes that are included in this package provide communication between components in the GUI. This allows a GUI to component to register with another component as a listener. Listeners of a component are notified of important user activity that effects other areas of the engine.

Package-Level CRC

Collaborators:
in package gui: CloseUp, Overview, Dial

Responsibilities:

Class-Level CRC

The fingerprint package contains the following classes:
* Class CloseUpListener
* Class CloseUpMulticaster
* Class DialEvent
* Class DialEventMulticaster
* Class DialListener
* Class OverviewListener
* Class OverviewMulticaster

Class CloseUpListener

* Responsibilities:
CloseUpListener is an interface to be implemented by Objects that want to be notified when the center or zoom of the CloseUp changes.
* Variables and Methods:
public void centerChanged(Location newCenter);
public void zoomChanged(double zoomRatio);

Class CloseUpMulticaster

* Responsibilities:
The CloseUpMulticaster is used to notify multiple CloseUpListeners of a single event. It should not be instantiated directly. Instead, the static add() and remove() methods should be used to get a CloseUpListener. Treat a CloseUpMulticaster as you would a CloseUpListener, and events sent to it will be passed on to both CloseUpListeners that it's keeping track of.
* Constructor
protected CloseUpMulticaster(CloseUpListener a, CloseUpListener b)
The constructor -- note that it's protected.
* Variables and Methods:
public void centerChanged(Location newCenter)
From the CloseUpListener interface. Tell a and b about the event.
public void zoomChanged(double zoomRatio)
From the CloseUpListener interface. Tell a and b about the event.
public static CloseUpListener add(CloseUpListener a, CloseUpListener b)
Returns an Object that will send events to both a and b.
public static CloseUpListener remove(CloseUpListener a, CloseUpListener b)
Remove b from the set of CloseUpListeners in a.

Class DialEvent

* Responsibilities:
DialEvents are created by Dial objects when the setting of the Dial is changed.
* Constructor
DialEvent(Dial source, int value)
* Variables and Methods:
int getValue()

Class DialEventMulticaster

* Responsibilities:
The DialEventMulticaster is used to send a single DialEvent to multiple DialListeners. It should not be instantiated directly. Instead, the static add() and remove() methods should be used to get a DialListener.
Treat a DialEventMulticaster as you would a DialListener, and events sent to it will be passed on to both DialListeners that it's keeping track of.
* Constructor
protected DialEventMulticaster(DialListener a, DialListener b)
The constructor -- note that it's protected.
* Variables and Methods:
public void dialChanged(DialEvent event)
From the DialListener interface. Tell a and b about the event.
public static DialListener add(DialListener a, DialListener b)
Returns an Object that will send events to both a and b.
public static DialListener remove(DialListener a, DialListener b)
Remove b from the set of DialListeners in a.

Class DialListener

* Responsibilities:
Objects that want to be notified when the setting of a Dial changes should implement this interface.
* Variables and Methods:
public void dialChanged(DialEvent event);

Class OverviewListener

* Responsibilities:
OverviewListener is an interface to be implemented by Objects that want to be notified when the user changes the center of the interface in the Overview.
* Variables and Methods:
public void centerChanged(Location newCenter);

Class OverviewMulticaster

* Responsibilities:
The OverviewMulticaster is used to notify multiple OverviewListeners. It should not be instantiated directly. Instead, the static add() and remove() methods should be used to get a OverviewListener. Treat a OverviewMulticaster as you would a OverviewListener, and events sent to it will be passed on to both OverviewListeners that it's keeping track of.
* Constructor
protected OverviewMulticaster(OverviewListener a, OverviewListener b)
The constructor -- note that it's protected.
* Variables and Methods:
public void centerChanged(Location newCenter)
From the OverviewListener interface. Tell a and b about the event.
public static OverviewListener add(OverviewListener a, OverviewListener b)
Returns an Object that will send events to both a and b.
public static OverviewListener remove(OverviewListener a, OverviewListener b)
Remove b from the set of OverviewListeners in a.

Message Interactions

Message Interactions with other packages:
Message Interactions between classes in the package:
* CloseUp and Overview Classes
The Overview and CloseUp need to communicate with each other so their displays are always up-to-date. CloseUp implements the OverviewListener interface, and registers with the Overview so it will be notified when the user changes the center point in the Overview.
Overview is a CloseUpListener, registered with the CloseUp, so it will know when the zoom or center point change.
The CloseUp uses the add() and remove() methods of CloseUpMulticaster to manage its listeners. The Overview uses similar methods of OverviewMulticaster for the same purpose.
The CloseUp also uses an inner class DialListener so it will know when the zoom Dial has been changed.
* Dial Class
Dial objects create and send DialEvents to any registered DialListeners (the CloseUp) when the value on the Dial changes. They use the add() and remove() methods of DialEventMulticaster to manager their listeners.
last | | to sitemap | | up one level | | next