Module wicket.bootstrap.extensions
Class InputMaskBehavior
java.lang.Object
org.apache.wicket.behavior.Behavior
de.agilecoders.wicket.core.markup.html.bootstrap.behavior.BootstrapBaseBehavior
de.agilecoders.wicket.core.markup.html.bootstrap.behavior.BootstrapJavascriptBehavior
de.agilecoders.wicket.extensions.markup.html.bootstrap.inputmask.InputMaskBehavior
- All Implemented Interfaces:
Serializable,IComponentAwareEventSink,IComponentAwareHeaderContributor,IClusterable
public class InputMaskBehavior
extends de.agilecoders.wicket.core.markup.html.bootstrap.behavior.BootstrapJavascriptBehavior
Behavior that adds mask to input components.
- Author:
- Jan Ferko
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInputMaskBehavior(InputMaskConfig config) Constructs new behavior for given configuration.InputMaskBehavior(String mask) Constructs new behavior for given mask. -
Method Summary
Modifier and TypeMethodDescriptionautoUnmask(boolean autoUnmask) Automatically unmask the value when retrieved.clearIncomplete(boolean clearIncomplete) Clear the incomplete input on blur.clearMarkOnLostFocus(boolean clearMaskOnFocus) Remove the empty mask on blur or when not empty removes the optional trailing part.greedy(boolean greedy) Toggle to allocate as much possible or the opposite.insertMode(boolean insertMode) Toggle to insert or overwrite input.Set mask for the input.nullable(boolean nullable) Return nothing when the user hasn't entered anything.numericInput(boolean numericInput) Numeric input direction.placeholder(String placeholder) Sets mask placeholder.Positioning of the caret on click.positionCaretOnTab(boolean positionCaretOnTab) When enabled the caret position is set after the latest valid position on TAB.Sets regular expression to use as a mask.removeMaskOnSubmit(boolean removeMaskOnSubmit) Remove the mask before submitting the form.voidrenderHead(Component component, IHeaderResponse headerResponse) repeat(int repeat) Repeat the mask definition x-times.rightAlign(boolean rightAlign) Align the input to the right.showMaskOnFocus(boolean showMaskOnFocus) Shows the mask when the input gets focus.showMaskOnHover(boolean showMaskOnHover) Shows the mask when hovering the mouse.tabThrough(boolean tabThrough) Allows for tabbing through the different parts of the masked field.undoOnEscape(boolean undoOnEscape) Make escape behave like undo.Methods inherited from class de.agilecoders.wicket.core.markup.html.bootstrap.behavior.BootstrapJavascriptBehavior
renderHeadMethods inherited from class de.agilecoders.wicket.core.markup.html.bootstrap.behavior.BootstrapBaseBehavior
addTo, getBootstrapSettings, instance, removeFromMethods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, bind, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onComponentTag, onConfigure, onEvent, onException, onRemove, onTag, unbind
-
Constructor Details
-
InputMaskBehavior
Constructs new behavior for given mask.- Parameters:
mask- the mask used in component
-
InputMaskBehavior
Constructs new behavior for given configuration.- Parameters:
config- the input mask configuration
-
-
Method Details
-
renderHead
- Specified by:
renderHeadin interfaceIComponentAwareHeaderContributor- Overrides:
renderHeadin classde.agilecoders.wicket.core.markup.html.bootstrap.behavior.BootstrapBaseBehavior
-
mask
Set mask for the input.- Parameters:
mask- the mask for the input.- Returns:
- this instance
-
placeholder
Sets mask placeholder.- Parameters:
placeholder- The mask placeholder.- Returns:
- this instance
-
regex
Sets regular expression to use as a mask. When using shorthands be aware that you need to double escape them.- Parameters:
regex- The regular expression to use as a mask.- Returns:
- this config instance
-
repeat
Repeat the mask definition x-times.- Parameters:
repeat- the number of times mask is repeated.- Returns:
- this config instance
-
greedy
Toggle to allocate as much possible or the opposite.- Parameters:
greedy- Toggle to allocate as much possible or the opposite.- Returns:
- this instance
-
autoUnmask
Automatically unmask the value when retrieved.- Parameters:
autoUnmask- Toggle automatic unmasking when value is retrieved.- Returns:
- this instance
-
removeMaskOnSubmit
Remove the mask before submitting the form.- Parameters:
removeMaskOnSubmit- Toggle mask removing before form submitting- Returns:
- this instace
-
clearMarkOnLostFocus
Remove the empty mask on blur or when not empty removes the optional trailing part.- Parameters:
clearMaskOnFocus- Toggle to empty mask on blur or optional trailing part if mask is empty- Returns:
- this instance
-
insertMode
Toggle to insert or overwrite input. This option can be altered by pressing the Insert key.- Parameters:
insertMode- Toggle to insert or overwrite input- Returns:
- this instance
-
clearIncomplete
Clear the incomplete input on blur.- Parameters:
clearIncomplete- Toggle to clear the incomplete input on blur.- Returns:
- this instance
-
showMaskOnFocus
Shows the mask when the input gets focus.- Parameters:
showMaskOnFocus- Toggle to show the mask when inpus gets focus.- Returns:
- this instance
-
showMaskOnHover
Shows the mask when hovering the mouse.- Parameters:
showMaskOnHover- Toggle to show the mask when hovering the mouse.- Returns:
- this instance
-
numericInput
Numeric input direction. Keeps the caret at the end.- Parameters:
numericInput- Toggle to keep the caret at the end- Returns:
- this instance
-
rightAlign
Align the input to the right. This is only applied in combination op the numericInput option or the dir-attribute.- Parameters:
rightAlign- Toggle right input alignment- Returns:
- this instance
-
undoOnEscape
Make escape behave like undo. (ctrl-Z) Pressing escape reverts the value to the value before focus.- Parameters:
undoOnEscape- Toggle to make escape behave like undo- Returns:
- this instance
-
positionCaretOnTab
When enabled the caret position is set after the latest valid position on TAB.- Parameters:
positionCaretOnTab- Enable to set caret position after the latest valid position on TAB- Returns:
- this instance
-
tabThrough
Allows for tabbing through the different parts of the masked field.- Parameters:
tabThrough- Toggle to allow for tabbing through the different parts of the masked field.- Returns:
- this instance
-
nullable
Return nothing when the user hasn't entered anything.- Parameters:
nullable- Toggle to return nothing if user hasn't entered anything- Returns:
- this instance
-
positionCaretOnClick
Positioning of the caret on click.- Parameters:
position- position of caret on click- Returns:
- this instance
-