artofillusion.keystroke
Class KeystrokeManager

java.lang.Object
  extended by artofillusion.keystroke.KeystrokeManager

public class KeystrokeManager
extends java.lang.Object

This class maintains the list of keystrokes, and executes them in response to KeyEvents.


Constructor Summary
KeystrokeManager()
           
 
Method Summary
static void addRecord(KeystrokeRecord record)
          Add a new KeystrokeRecord.
static void addRecordsFromXML(java.io.InputStream in)
          Read an XML file from an InputStream and add all the keystrokes it contains.
static void executeKeystrokes(java.awt.event.KeyEvent event, EditingWindow window)
          Given a key event, find any matching KeystrokeRecords and execute them.
static KeystrokeRecord[] getAllRecords()
          Get a list of all defined KeystrokeRecords.
static void loadRecords()
          Locate the file containing keystroke definitions and load them.
static void recordModified()
          This should be called whenever a KeystrokeRecord has been modified.
static void removeRecord(KeystrokeRecord record)
          Remove a KeystrokeRecord.
static void saveRecords()
          Save the list of keystrokes to an XML file.
static void setAllRecords(KeystrokeRecord[] allRecords)
          Set the list of all defined KeystrokeRecords, completely replacing the existing ones.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeystrokeManager

public KeystrokeManager()
Method Detail

getAllRecords

public static KeystrokeRecord[] getAllRecords()
Get a list of all defined KeystrokeRecords.


setAllRecords

public static void setAllRecords(KeystrokeRecord[] allRecords)
Set the list of all defined KeystrokeRecords, completely replacing the existing ones.


addRecord

public static void addRecord(KeystrokeRecord record)
Add a new KeystrokeRecord.


removeRecord

public static void removeRecord(KeystrokeRecord record)
Remove a KeystrokeRecord.


recordModified

public static void recordModified()
This should be called whenever a KeystrokeRecord has been modified.


executeKeystrokes

public static void executeKeystrokes(java.awt.event.KeyEvent event,
                                     EditingWindow window)
Given a key event, find any matching KeystrokeRecords and execute them.

Parameters:
event - the KeyEvent which has occurred
window - the EditingWindow in which the event occurred

loadRecords

public static void loadRecords()
Locate the file containing keystroke definitions and load them.


addRecordsFromXML

public static void addRecordsFromXML(java.io.InputStream in)
                              throws java.lang.Exception
Read an XML file from an InputStream and add all the keystrokes it contains. For each one, it checks whether there was already an existing keystroke with the same name. If so, the new keystroke replaces the old one. If not, the new keystroke is simply added.

Throws:
java.lang.Exception

saveRecords

public static void saveRecords()
                        throws java.lang.Exception
Save the list of keystrokes to an XML file.

Throws:
java.lang.Exception


Copyright © 1999-2011 by Peter Eastman.