com.extjs.gxt.ui.client.util
Class KeyNav<E extends ComponentEvent>

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.util.KeyNav<E>
All Implemented Interfaces:
Listener<E>, Observable, java.util.EventListener

public class KeyNav<E extends ComponentEvent>
extends BaseObservable
implements Listener<E>

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


Constructor Summary
KeyNav()
          Creates a new KeyNav without a target component.
KeyNav(Component target)
          Creates a new key nav for the specified target.
 
Method Summary
 void addKeyNavListener(KeyNavListener listener)
          Adds a key nav listener.
 void bind(Component target)
          Binds the key nav to the component.
 boolean getCancelBubble()
          Returns the cancel bubble state.
 Component getComponent()
          Returns the target component.
static EventType getKeyEvent()
          Returns the key event type.
 boolean getPreventDefault()
          Returns true if the default event action is being cancelled.
 void handleEvent(ComponentEvent ce)
          Sent when an event that the listener has registered for occurs.
 void onAlt(E ce)
           
 void onBackspace(E ce)
           
 void onControl(E ce)
           
 void onDelete(E ce)
           
 void onDown(E ce)
           
 void onEnd(E ce)
           
 void onEnter(E ce)
           
 void onEsc(E ce)
           
 void onHome(E ce)
           
 void onKeyPress(E ce)
           
 void onLeft(E ce)
           
 void onPageDown(E ce)
           
 void onPageUp(E ce)
           
 void onRight(E ce)
           
 void onShift(E ce)
           
 void onTab(E ce)
           
 void onUp(E ce)
           
 void removeKeyNavListener(KeyNavListener listener)
          Removes a key nav listener.
 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 com.extjs.gxt.ui.client.event.BaseObservable
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyNav

public KeyNav()
Creates a new KeyNav without a target component. Events must be passed to the Listener.handleEvent(BaseEvent) method.


KeyNav

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

Parameters:
target - the target component
Method Detail

getKeyEvent

public static EventType getKeyEvent()
Returns the key event type.

Returns:
the key event type

addKeyNavListener

public void addKeyNavListener(KeyNavListener listener)
Adds a key nav listener.

Parameters:
listener - the key nav listener to add

bind

public void bind(Component target)
Binds the key nav to the component.

Parameters:
target - the target component

getCancelBubble

public boolean getCancelBubble()
Returns the cancel bubble state.

Returns:
true if bubbling is cancelled

getComponent

public Component getComponent()
Returns the target component.

Returns:
the target component

getPreventDefault

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

Returns:
true if preventing default

handleEvent

public void handleEvent(ComponentEvent ce)
Description copied from interface: Listener
Sent when an event that the listener has registered for occurs.

Specified by:
handleEvent in interface Listener<E extends ComponentEvent>
Parameters:
ce - the event which occurred

onKeyPress

public void onKeyPress(E ce)

onAlt

public void onAlt(E ce)

onBackspace

public void onBackspace(E ce)

onControl

public void onControl(E ce)

onDelete

public void onDelete(E ce)

onDown

public void onDown(E ce)

onEnd

public void onEnd(E ce)

onEnter

public void onEnter(E ce)

onEsc

public void onEsc(E ce)

onHome

public void onHome(E ce)

onLeft

public void onLeft(E ce)

onPageDown

public void onPageDown(E ce)

onPageUp

public void onPageUp(E ce)

onRight

public void onRight(E ce)

onShift

public void onShift(E ce)

onTab

public void onTab(E ce)

onUp

public void onUp(E ce)

removeKeyNavListener

public void removeKeyNavListener(KeyNavListener listener)
Removes a key nav listener.

Parameters:
listener - the key nav listener to remove

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