de.adom.jade.ui
Class KeyboardCommandProducer

java.lang.Object
  extended by java.awt.event.KeyAdapter
      extended by de.adom.jade.ui.KeyboardCommandProducer
All Implemented Interfaces:
java.util.EventListener, java.awt.event.KeyListener

public class KeyboardCommandProducer
extends java.awt.event.KeyAdapter

Works as a keyboard listener that interprets pressed keys in order to transform them into typed commands.

This class requires a ressource file with logical command names followed by an atomic string (specifically encoded) representing the key sequence to activate the command. The key sequence is encoded according to the rules of KeyUtils.getKeyString.

See Also:
KeyUtils, KeyUtils.getKeyString(java.awt.event.KeyEvent)

Constructor Summary
KeyboardCommandProducer(KeyboardCommandTarget target)
          Creates a key command producer that retrieves the mapping information between keys and commands from the standard ressource located at .
KeyboardCommandProducer(KeyboardCommandTarget target, java.lang.String location)
          Creates a key command producer that retrieves the mapping information between keys and commands from the given location.
 
Method Summary
 void keyPressed(java.awt.event.KeyEvent e)
          Reacts when a key command has been typed.
 
Methods inherited from class java.awt.event.KeyAdapter
keyReleased, keyTyped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyboardCommandProducer

public KeyboardCommandProducer(KeyboardCommandTarget target)
Creates a key command producer that retrieves the mapping information between keys and commands from the standard ressource located at ./data/kbd/commands.dat.

Parameters:
target - the target of the commands

KeyboardCommandProducer

public KeyboardCommandProducer(KeyboardCommandTarget target,
                               java.lang.String location)
Creates a key command producer that retrieves the mapping information between keys and commands from the given location.

Parameters:
target - the target of the commands
Method Detail

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Reacts when a key command has been typed.

Specified by:
keyPressed in interface java.awt.event.KeyListener
Overrides:
keyPressed in class java.awt.event.KeyAdapter
Parameters:
e - the responsibel key event