bibliothek.gui.dock.control
Class KeyboardController

java.lang.Object
  extended by bibliothek.gui.dock.control.KeyboardController
Direct Known Subclasses:
DefaultKeyboardController, SecureKeyboardController

public abstract class KeyboardController
extends Object

An observer of all KeyEvents, forwarding them to registered listeners. The listeners are only informed about events that occurred in a part of the dock-tree below them.

Author:
Benjamin Sigg

Constructor Summary
KeyboardController(DockController controller)
          Creates a new KeyboardController.
 
Method Summary
 void addGlobalListener(KeyListener listener)
          Adds a global key listener to this controller.
 void addListener(KeyboardListener listener)
          Adds a listener to this controller.
protected  void fireKeyPressed(KeyEvent event)
          Forwards event to all listeners whose DockElement is above the component on which the event occurred.
protected  void fireKeyReleased(KeyEvent event)
          Forwards event to all listeners whose DockElement is above the component on which the event occurred.
protected  void fireKeyTyped(KeyEvent event)
          Forwards event to all listeners whose DockElement is above the component on which the event occurred.
 DockController getController()
          Gets the DockController in whose realm this KeyboardController works.
abstract  void kill()
          Stops this controller.
 void removeGlobalListener(KeyListener listener)
          Removes a listener from this controller.
 void removeListener(KeyboardListener listener)
          Removes a listener from this controller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyboardController

public KeyboardController(DockController controller)
Creates a new KeyboardController.

Parameters:
controller - the controller in whose realm this KeyBoardController will work.
Method Detail

addGlobalListener

public void addGlobalListener(KeyListener listener)
Adds a global key listener to this controller. Global KeyListeners will receive a notification for every event that this controller handles. The listeners will also be informed about events that are consumed.

Parameters:
listener - the new listener

removeGlobalListener

public void removeGlobalListener(KeyListener listener)
Removes a listener from this controller.

Parameters:
listener - the listener to remove

addListener

public void addListener(KeyboardListener listener)
Adds a listener to this controller. The listener will be invoked when a KeyEvent occurs in the subtree below the listeners DockElement.

Parameters:
listener - the new listener

removeListener

public void removeListener(KeyboardListener listener)
Removes a listener from this controller.

Parameters:
listener - the listener to remove

getController

public DockController getController()
Gets the DockController in whose realm this KeyboardController works.

Returns:
the owner of this controller

kill

public abstract void kill()
Stops this controller. This controller has to remove any resources it uses and has not to be useful any further.


fireKeyPressed

protected void fireKeyPressed(KeyEvent event)
Forwards event to all listeners whose DockElement is above the component on which the event occurred.

Parameters:
event - the event to send

fireKeyReleased

protected void fireKeyReleased(KeyEvent event)
Forwards event to all listeners whose DockElement is above the component on which the event occurred.

Parameters:
event - the event to send

fireKeyTyped

protected void fireKeyTyped(KeyEvent event)
Forwards event to all listeners whose DockElement is above the component on which the event occurred.

Parameters:
event - the event to send