wicket.contrib.input.events
Class InputBehavior

java.lang.Object
  extended by org.apache.wicket.behavior.Behavior
      extended by wicket.contrib.input.events.InputBehavior
All Implemented Interfaces:
Serializable, IComponentAwareEventSink, IComponentAwareHeaderContributor, IClusterable

public class InputBehavior
extends Behavior

Add this to your button, link whatever to create a shortcut key.. WARNING:this behavior uses a special script for calling window.onload

Author:
Nino Martinez (nino.martinez.wael *at* gmail *dot* com remember no stars)
See Also:
Serialized Form

Constructor Summary
InputBehavior(KeyType[] keyCombo)
          if using auto hook be sure to add this behavior last, otherwise it might not pickup the event..
InputBehavior(KeyType[] keyCombo, EventType eventType)
           
 
Method Summary
 void afterRender(Component component)
           
 void bind(Component component)
           
protected  Boolean getDisable_in_input()
          If this is set to true, keyboard capture will be disabled in input and textarea fields.
protected  String getEscapedComponentMarkupId()
          Gets the escaped DOM id that the input will get attached to.
protected  Boolean getPropagate()
          Should the command be passed onto the browser afterwards?
protected  String getTarget()
          target - DOM Node The element that should be watched for the keyboard event.
protected  KeyHookOn getType()
          The event type - can be 'keydown','keyup','keypress'.
 void onComponentTag(Component component, ComponentTag tag)
           
 void renderHead(Component c, org.apache.wicket.markup.head.IHeaderResponse response)
           
 
Methods inherited from class org.apache.wicket.behavior.Behavior
beforeRender, canCallListenerInterface, detach, getStatelessHint, isEnabled, isTemporary, onConfigure, onEvent, onException, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputBehavior

public InputBehavior(KeyType[] keyCombo,
                     EventType eventType)

InputBehavior

public InputBehavior(KeyType[] keyCombo)
if using auto hook be sure to add this behavior last, otherwise it might not pickup the event.. Also it will only hook up to the last event if more are present (use other constructor to specify manually) Note on keyCombo The shortcut keys should be specified in this format ... Modifier[+Modifier..]+Key Meaning that you should specify in this order, modifier keys first like 'ctrl' and then normal keys like 'a'

Parameters:
keyCombo -
autoHook -
Method Detail

bind

public void bind(Component component)
Overrides:
bind in class Behavior

getEscapedComponentMarkupId

protected final String getEscapedComponentMarkupId()
Gets the escaped DOM id that the input will get attached to. All non word characters (\W) will be removed from the string.

Returns:
The DOM id of the input - same as the component's markup id}

renderHead

public void renderHead(Component c,
                       org.apache.wicket.markup.head.IHeaderResponse response)
Specified by:
renderHead in interface IComponentAwareHeaderContributor
Overrides:
renderHead in class Behavior

onComponentTag

public void onComponentTag(Component component,
                           ComponentTag tag)
Overrides:
onComponentTag in class Behavior

afterRender

public void afterRender(Component component)
Overrides:
afterRender in class Behavior

getDisable_in_input

protected Boolean getDisable_in_input()
If this is set to true, keyboard capture will be disabled in input and textarea fields. If these elements have focus, the keyboard shortcut will not work. This is very useful for single key shortcuts. Default: false

Returns:

getType

protected KeyHookOn getType()
The event type - can be 'keydown','keyup','keypress'. Default: 'keydown'

Returns:

getPropagate

protected Boolean getPropagate()
Should the command be passed onto the browser afterwards?

Returns:

getTarget

protected String getTarget()
target - DOM Node The element that should be watched for the keyboard event. Default : document

Returns:


Copyright © 2012. All Rights Reserved.