com.sencha.gxt.core.client.util
Class KeyNav

java.lang.Object
  extended by com.sencha.gxt.core.client.util.KeyNav

public class KeyNav
extends java.lang.Object

Provides a convenient wrapper for normalized keyboard navigation. Provides an easy way to implement custom navigation schemes for any UI widget.


Constructor Summary
KeyNav()
          Creates a new KeyNav without a target widget.
KeyNav(Widget target)
          Creates a new key nav for the specified target.
 
Method Summary
 void bind(Widget target)
          Binds the key nav to the widget.
 boolean getCancelBubble()
          Returns the cancel bubble state.
 Widget getComponent()
          Returns the target widget.
static int getKeyEvent()
          Returns the key event type which varies by browser.
 boolean getPreventDefault()
          Returns true if the default event action is being cancelled.
 void handleEvent(NativeEvent event)
           
 void onAlt(NativeEvent evt)
           
 void onBackspace(NativeEvent evt)
           
 void onControl(NativeEvent evt)
           
 void onDelete(NativeEvent evt)
           
 void onDown(NativeEvent evt)
           
 void onEnd(NativeEvent evt)
           
 void onEnter(NativeEvent evt)
           
 void onEsc(NativeEvent evt)
           
 void onHome(NativeEvent evt)
           
 void onKeyPress(NativeEvent evt)
           
 void onLeft(NativeEvent evt)
           
 void onPageDown(NativeEvent evt)
           
 void onPageUp(NativeEvent evt)
           
 void onRight(NativeEvent evt)
           
 void onShift(NativeEvent evt)
           
 void onTab(NativeEvent evt)
           
 void onUp(NativeEvent evt)
           
 void setCancelBubble(boolean cancelBubble)
          True to stop event bubbling when the key nav intercepts a key (defaults to false).
 void setPreventDefault(boolean preventDefault)
          True to prevent the default action of the key event when the key nav intercepts a key (defaults to false).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyNav

public KeyNav()
Creates a new KeyNav without a target widget. Events must be passed to the handleEvent(NativeEvent) method.


KeyNav

public KeyNav(Widget target)
Creates a new key nav for the specified target. The KeyNav will listen for the key events.

Parameters:
target - the target widget
Method Detail

getKeyEvent

public static int getKeyEvent()
Returns the key event type which varies by browser.

Returns:
the key event type

bind

public void bind(Widget target)
Binds the key nav to the widget.

Parameters:
target - the target widget

getCancelBubble

public boolean getCancelBubble()
Returns the cancel bubble state.

Returns:
true if bubbling is cancelled

getComponent

public Widget getComponent()
Returns the target widget.

Returns:
the target widget

getPreventDefault

public boolean getPreventDefault()
Returns true if the default event action is being cancelled.

Returns:
true if preventing default

handleEvent

public void handleEvent(NativeEvent event)

onAlt

public void onAlt(NativeEvent evt)

onBackspace

public void onBackspace(NativeEvent evt)

onControl

public void onControl(NativeEvent evt)

onDelete

public void onDelete(NativeEvent evt)

onDown

public void onDown(NativeEvent evt)

onEnd

public void onEnd(NativeEvent evt)

onEnter

public void onEnter(NativeEvent evt)

onEsc

public void onEsc(NativeEvent evt)

onHome

public void onHome(NativeEvent evt)

onKeyPress

public void onKeyPress(NativeEvent evt)

onLeft

public void onLeft(NativeEvent evt)

onPageDown

public void onPageDown(NativeEvent evt)

onPageUp

public void onPageUp(NativeEvent evt)

onRight

public void onRight(NativeEvent evt)

onShift

public void onShift(NativeEvent evt)

onTab

public void onTab(NativeEvent evt)

onUp

public void onUp(NativeEvent evt)

setCancelBubble

public void setCancelBubble(boolean cancelBubble)
True to stop event bubbling when the key nav intercepts a key (defaults to false).

Parameters:
cancelBubble - the cancel bubble state

setPreventDefault

public void setPreventDefault(boolean preventDefault)
True to prevent the default action of the key event when the key nav intercepts a key (defaults to false).

Parameters:
preventDefault - true to prevent the default


Copyright © 2012. All Rights Reserved.