Package wicket.contrib.input.events
Class InputBehavior
- java.lang.Object
-
- org.apache.wicket.behavior.Behavior
-
- 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
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterRender(Component component)voidbind(Component component)protected BooleangetDisable_in_input()If this is set to true, keyboard capture will be disabled in input and textarea fields.protected StringgetEscapedComponentMarkupId()Gets the escaped DOM id that the input will get attached to.protected BooleangetPropagate()Should the command be passed onto the browser afterwards?protected StringgetTarget()target - DOM Node The element that should be watched for the keyboard event.protected KeyHookOngetType()The event type - can be 'keydown','keyup','keypress'.voidonComponentTag(Component component, ComponentTag tag)voidrenderHead(Component c, IHeaderResponse response)-
Methods inherited from class org.apache.wicket.behavior.Behavior
beforeRender, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onConfigure, onEvent, onException, onRemove, onTag, unbind
-
-
-
-
Constructor Detail
-
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-
-
-
Method Detail
-
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, IHeaderResponse response)
- Specified by:
renderHeadin interfaceIComponentAwareHeaderContributor- Overrides:
renderHeadin classBehavior
-
onComponentTag
public void onComponentTag(Component component, ComponentTag tag)
- Overrides:
onComponentTagin classBehavior
-
afterRender
public void afterRender(Component component)
- Overrides:
afterRenderin classBehavior
-
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:
-
-