JIDE 3.5.15

com.jidesoft.grid
Class KeyStrokeSupport

java.lang.Object
  extended by com.jidesoft.grid.KeyStrokeSupport

public class KeyStrokeSupport
extends Object

Collection of static methods providing default implementations for KeyStroke-related tests.


Constructor Summary
KeyStrokeSupport()
           
 
Method Summary
static boolean canProcessKeyBinding(JComponent comp, KeyStroke ks, int condition)
          Is the specified keystroke/condition in the specified JComponent's input and action maps?
static boolean isModifierKey(KeyEvent e)
           
static boolean isTableNavigationKey(KeyStroke ks)
           
static boolean isValidKeyForDefaultTableEditor(KeyEvent e, KeyStroke ks)
           
static boolean lookAheadHierarchyMightProcess(JComponent comp, KeyStroke ks)
          Walk up the Swing Hierarchy starting at the specified JComponent and determine if any Container is likely to be able to process a key binding for the specified keystroke.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyStrokeSupport

public KeyStrokeSupport()
Method Detail

lookAheadHierarchyMightProcess

public static boolean lookAheadHierarchyMightProcess(JComponent comp,
                                                     KeyStroke ks)
Walk up the Swing Hierarchy starting at the specified JComponent and determine if any Container is likely to be able to process a key binding for the specified keystroke.

Modeled after part of JComponent's protected processKeyBindings method. Instead of asking each Container to processKeyBinding, just ask if the binding is in the input/action map.

Note that if nothing in the hierarchy is interested, we can't complete the process described in JComponent.processKeyBindings by asking a JInternalFrame or Window to processKeyBindingsForAllComponents. That method is protected and would be pretty complicated to work around.

Parameters:
comp - the component to start with and work upward from
ks - the specified keystroke
Returns:
Is it in an ancestor's input/action map?

canProcessKeyBinding

public static boolean canProcessKeyBinding(JComponent comp,
                                           KeyStroke ks,
                                           int condition)
Is the specified keystroke/condition in the specified JComponent's input and action maps?

Parameters:
comp - the specified JComponent
ks - the specified keystroke
condition - the specified condition (KeyEvent.WHEN_FOCUSED, KeyEvent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, KeyEvent.WHEN_IN_FOCUSED_WINDOW)
Returns:
Is it? Not necessarily the same as what will be returned by actually executing the action, which can fail.

isValidKeyForDefaultTableEditor

public static boolean isValidKeyForDefaultTableEditor(KeyEvent e,
                                                      KeyStroke ks)

isModifierKey

public static boolean isModifierKey(KeyEvent e)

isTableNavigationKey

public static boolean isTableNavigationKey(KeyStroke ks)

JIDE 3.5.15