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
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:
-
Constructor Summary
ConstructorsConstructorDescriptionInputBehavior(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
Modifier and TypeMethodDescriptionvoidafterRender(Component component) voidprotected BooleanIf this is set to true, keyboard capture will be disabled in input and textarea fields.protected final StringGets the escaped DOM id that the input will get attached to.protected BooleanShould the command be passed onto the browser afterwards?protected Stringtarget - 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 Details
-
InputBehavior
-
InputBehavior
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 Details
-
bind
-
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
- Specified by:
renderHeadin interfaceIComponentAwareHeaderContributor- Overrides:
renderHeadin classBehavior
-
onComponentTag
- Overrides:
onComponentTagin classBehavior
-
afterRender
- Overrides:
afterRenderin classBehavior
-
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
The event type - can be 'keydown','keyup','keypress'. Default: 'keydown'- Returns:
-
getPropagate
Should the command be passed onto the browser afterwards?- Returns:
-
getTarget
target - DOM Node The element that should be watched for the keyboard event. Default : document- Returns:
-