org.xnap.gui.shortcut
Class ActionShortcut

java.lang.Object
  extended by org.xnap.gui.shortcut.ActionShortcut
All Implemented Interfaces:
Shortcut

public class ActionShortcut
extends java.lang.Object
implements Shortcut

Provides an action based shortcut. The action has to provide several values to make use of the shortcut. It must provide the following values: Action.ACTION_COMMAND_KEY, the preferences key It should provide values for the following keys: AbstractXNapAction.DEFAULT_KEYSTROKE, the default KeyStroke AbstractXNapAction.SHORTCUT_CATEGORY, category used in the ShortcutsPrefsPanel


Constructor Summary
ActionShortcut(javax.swing.Action action, javax.swing.JComponent c, PreferencesProvider prefs)
           
 
Method Summary
 void addComponent(javax.swing.JComponent c, javax.swing.Action a)
          Installs the action into the action map of the component and sets up the shortcut mapping.
 java.lang.String getCategory()
          Returns the parent category.
 javax.swing.KeyStroke getDefaultKeyStroke()
          Returns a keystroke.
 java.lang.String getDescription()
           
 javax.swing.KeyStroke getKeyStroke()
          Returns a keystroke.
 int getNumberOfComponents()
           
 java.lang.String getPrefsKey()
           
 void removeComponent(javax.swing.JComponent c)
          Removes the action mapping from the given component and removes it from its list of components.
 void setKeyStroke(javax.swing.KeyStroke stroke)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionShortcut

public ActionShortcut(javax.swing.Action action,
                      javax.swing.JComponent c,
                      PreferencesProvider prefs)
Method Detail

addComponent

public void addComponent(javax.swing.JComponent c,
                         javax.swing.Action a)
Installs the action into the action map of the component and sets up the shortcut mapping.


removeComponent

public void removeComponent(javax.swing.JComponent c)
Removes the action mapping from the given component and removes it from its list of components.

Parameters:
c - the component this shortcuts is registered on

getPrefsKey

public java.lang.String getPrefsKey()

getNumberOfComponents

public int getNumberOfComponents()

getCategory

public java.lang.String getCategory()
Description copied from interface: Shortcut
Returns the parent category.

Specified by:
getCategory in interface Shortcut
See Also:
Shortcut.getCategory()

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface Shortcut
See Also:
Shortcut.getDescription()

getKeyStroke

public javax.swing.KeyStroke getKeyStroke()
Description copied from interface: Shortcut
Returns a keystroke.

Specified by:
getKeyStroke in interface Shortcut
See Also:
org.xnap.gui.shortcut.Shortcut#getKeystroke()

setKeyStroke

public void setKeyStroke(javax.swing.KeyStroke stroke)
Specified by:
setKeyStroke in interface Shortcut
See Also:
org.xnap.gui.shortcut.Shortcut#setKeystroke(javax.swing.KeyStroke)

getDefaultKeyStroke

public javax.swing.KeyStroke getDefaultKeyStroke()
Description copied from interface: Shortcut
Returns a keystroke.

Specified by:
getDefaultKeyStroke in interface Shortcut
See Also:
Shortcut.getDefaultKeyStroke()


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