bibliothek.gui.dock.control
Class DefaultGlobalMouseDispatcher

java.lang.Object
  extended by bibliothek.gui.dock.control.DefaultGlobalMouseDispatcher
All Implemented Interfaces:
GlobalMouseDispatcher

public class DefaultGlobalMouseDispatcher
extends Object
implements GlobalMouseDispatcher

This default implementation of a GlobalMouseDispatcher uses an AWTEventListener is possible, or just forwards events that are delivered to the dispatch(MouseEvent) method.

Author:
Benjamin Sigg

Constructor Summary
DefaultGlobalMouseDispatcher(DockController controller, ControllerSetupCollection setup)
          Creates a new dispatcher.
 
Method Summary
 void addMouseListener(MouseListener listener)
          Adds the observer listener to this dispatcher.
 void addMouseMotionListener(MouseMotionListener listener)
          Adds the observer listener to this dispatcher.
 void addMouseWheelListener(MouseWheelListener listener)
          Adds the observer listener to this dispatcher.
protected  AWTEventListener createListener()
          Creates a listener which will receive mouse-events.
 void dispatch(MouseEvent event)
          Called by various Components when they register a MouseEvent.
protected  MouseListener[] getMouseListeners()
          Gets all the MouseListeners that are currently registered.
protected  MouseMotionListener[] getMouseMotionListeners()
          Gets all the MouseMotionListeners that are currently registered.
protected  MouseWheelListener[] getMouseWheelListeners()
          Gets all the MouseWheelListeners that are currently registered.
 void kill()
          Releases any resources this dispatcher holds.
 void removeMouseListener(MouseListener listener)
          Removes the observer listener from this dispacher.
 void removeMouseMotionListener(MouseMotionListener listener)
          Removes the observer listener from this dispacher.
 void removeMouseWheelListener(MouseWheelListener listener)
          Removes the observer listener from this dispacher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGlobalMouseDispatcher

public DefaultGlobalMouseDispatcher(DockController controller,
                                    ControllerSetupCollection setup)
Creates a new dispatcher.

Parameters:
controller - the controller in whose realm this dispatcher works
setup - tells when the setup phase of controller is finished
Method Detail

dispatch

public void dispatch(MouseEvent event)
Description copied from interface: GlobalMouseDispatcher
Called by various Components when they register a MouseEvent. Calls to this method are only necessary when in a restricted environment. The GlobalMouseDispatcher may filter the events, but usually the event is forwarded to all registered MouseListeners.

Specified by:
dispatch in interface GlobalMouseDispatcher
Parameters:
event - the event to forward

addMouseListener

public void addMouseListener(MouseListener listener)
Description copied from interface: GlobalMouseDispatcher
Adds the observer listener to this dispatcher.

Specified by:
addMouseListener in interface GlobalMouseDispatcher
Parameters:
listener - the new listener, not null

removeMouseListener

public void removeMouseListener(MouseListener listener)
Description copied from interface: GlobalMouseDispatcher
Removes the observer listener from this dispacher.

Specified by:
removeMouseListener in interface GlobalMouseDispatcher
Parameters:
listener - the listener to remove

getMouseListeners

protected MouseListener[] getMouseListeners()
Gets all the MouseListeners that are currently registered.

Returns:
all the listeners

addMouseMotionListener

public void addMouseMotionListener(MouseMotionListener listener)
Description copied from interface: GlobalMouseDispatcher
Adds the observer listener to this dispatcher.

Specified by:
addMouseMotionListener in interface GlobalMouseDispatcher
Parameters:
listener - the new listener, not null

removeMouseMotionListener

public void removeMouseMotionListener(MouseMotionListener listener)
Description copied from interface: GlobalMouseDispatcher
Removes the observer listener from this dispacher.

Specified by:
removeMouseMotionListener in interface GlobalMouseDispatcher
Parameters:
listener - the listener to remove

getMouseMotionListeners

protected MouseMotionListener[] getMouseMotionListeners()
Gets all the MouseMotionListeners that are currently registered.

Returns:
all the listeners

addMouseWheelListener

public void addMouseWheelListener(MouseWheelListener listener)
Description copied from interface: GlobalMouseDispatcher
Adds the observer listener to this dispatcher.

Specified by:
addMouseWheelListener in interface GlobalMouseDispatcher
Parameters:
listener - the new listener, not null

removeMouseWheelListener

public void removeMouseWheelListener(MouseWheelListener listener)
Description copied from interface: GlobalMouseDispatcher
Removes the observer listener from this dispacher.

Specified by:
removeMouseWheelListener in interface GlobalMouseDispatcher
Parameters:
listener - the listener to remove

getMouseWheelListeners

protected MouseWheelListener[] getMouseWheelListeners()
Gets all the MouseWheelListeners that are currently registered.

Returns:
all the listeners

kill

public void kill()
Description copied from interface: GlobalMouseDispatcher
Releases any resources this dispatcher holds.

Specified by:
kill in interface GlobalMouseDispatcher

createListener

protected AWTEventListener createListener()
Creates a listener which will receive mouse-events.

Returns:
the listener