org.xnap.gui.shortcut
Class ShortcutManager

java.lang.Object
  extended by org.xnap.gui.shortcut.ShortcutManager

public class ShortcutManager
extends java.lang.Object

Manages Shortcut objects.


Method Summary
 ActionShortcut add(javax.swing.Action action)
          A convenience wrapper for add(Action, JComponent).
 ActionShortcut add(javax.swing.Action action, javax.swing.JComponent c)
          A convenience wrapper for add(Action, JComponent, PreferencesProvider).
 ActionShortcut add(javax.swing.Action action, javax.swing.JComponent c, PreferencesProvider prefs)
          Creates a new ActionShortcut for the action if there isn't already one and returns it.
 void add(Shortcut shortcut)
          Adds a shortcut.
static ShortcutManager getInstance()
          Returns the instance of ShortcutManager.
 Shortcut[] getShortcuts()
          Returns the array of currently registered shorcuts.
 void remove(ActionShortcut shortcut, javax.swing.JComponent c)
          Removes a component from a currently registered action shortcut.
 void remove(Shortcut shortcut)
          Removes a currently registered shortcut.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ShortcutManager getInstance()
Returns the instance of ShortcutManager.


add

public void add(Shortcut shortcut)
Adds a shortcut.


add

public ActionShortcut add(javax.swing.Action action,
                          javax.swing.JComponent c,
                          PreferencesProvider prefs)
Creates a new ActionShortcut for the action if there isn't already one and returns it. Only one action shortcut object can exist for the same preferences key. Additional components are all managed by the same action shortcut object.

Parameters:
action - the action which should be performed when the shortcut is typed in the respective component
c - the component for which the shortcut and the action are registered
prefs - the preferences provider used for permantly storing the actual key stroke value of the shortcut

add

public ActionShortcut add(javax.swing.Action action,
                          javax.swing.JComponent c)
A convenience wrapper for add(Action, JComponent, PreferencesProvider). The PreferencesProvider defaults to Preferences.getInstance()


add

public ActionShortcut add(javax.swing.Action action)
A convenience wrapper for add(Action, JComponent). The JComponent defaults to XNapFrame.getInstance().getContentPane()


getShortcuts

public Shortcut[] getShortcuts()
Returns the array of currently registered shorcuts.


remove

public void remove(Shortcut shortcut)
Removes a currently registered shortcut.


remove

public void remove(ActionShortcut shortcut,
                   javax.swing.JComponent c)
Removes a component from a currently registered action shortcut. If the action shortcut's component count ActionShortcut.getNumberOfComponents() drops to 0, it is removed from the shortcut manager.



Copyright © 2001-2005 XNap Team. All Rights Reserved.