org.odlabs.wiquery.ui.slider
Class Slider

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.odlabs.wiquery.ui.slider.Slider
All Implemented Interfaces:
Serializable, Iterable<org.apache.wicket.Component>, org.apache.wicket.event.IEventSink, org.apache.wicket.event.IEventSource, org.apache.wicket.IClusterable, org.apache.wicket.IConverterLocator, org.apache.wicket.markup.html.IHeaderContributor, org.apache.wicket.request.component.IRequestableComponent, org.apache.wicket.util.IHierarchical<org.apache.wicket.Component>, IWiQueryPlugin
Direct Known Subclasses:
AjaxSlider

public class Slider
extends org.apache.wicket.markup.html.WebMarkupContainer
implements IWiQueryPlugin

$Id: Slider.java

Creates a slider UI component from this WebMarkupContainer's HTML markup.

Since:
1.0
Author:
Lionel Armanet
See Also:
Serialized Form

Nested Class Summary
static class Slider.Orientation
          Enumeration for the orientation option
 
Field Summary
static String UI_HANDLE
          Properties on the ui parameter (use it into callback functions) : DOMElement - the current focused handle
static String UI_VALUE
          Properties on the ui parameter (use it into callback functions) : Integer - the current handle's value
static String UI_VALUES
          Properties on the ui parameter (use it into callback functions) : Integers - all handlers' values
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
Slider(String id, Number min, Number max)
          Constructor
 
Method Summary
 JsStatement destroy()
          Method to destroy the slider This will return the element back to its pre-init state.
 void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to destroy the slider within the ajax request
protected  void detachModel()
           
 JsStatement disable()
          Method to disable the slider
 void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to disable the slider within the ajax request
 JsStatement enable()
          Method to enable the slider
 void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to enable the slider within the ajax request
 SliderAnimate getAnimate()
           
 Number getMax()
           
 Number getMin()
           
protected  Options getOptions()
          Method retrieving the options of the component
 Slider.Orientation getOrientation()
           
 SliderRange getRange()
           
 int getStep()
           
 int getValue()
           
 ICollectionItemOptions getValues()
           
 boolean isAnimate()
           
 boolean isDisabled()
           
 void renderHead(org.apache.wicket.markup.html.IHeaderResponse response)
           
 Slider setAnimate(boolean animate)
          Whether to slide handle smoothly when user click outside handle on the bar.
 Slider setAnimate(Number number)
          Whether to slide handle smoothly when user click outside handle on the bar.
 Slider setAnimate(SliderAnimate.AnimateEnum animate)
          Whether to slide handle smoothly when user click outside handle on the bar.
 Slider setChangeEvent(JsScopeUiEvent change)
          This event is triggered on slide stop, or if the value is changed programmatically (by the value method).
 Slider setDisabled(boolean disabled)
          Disables (true) or enables (false) the slider.
 Slider setMax(Number max)
          Sets the maximum value of the slider.
 Slider setMin(Number min)
          Sets the minimum value of the slider.
 Slider setOrientation(Slider.Orientation orientation)
          Normally you don't need to set this option because the plugin detects the slider orientation automatically.
 Slider setRange(SliderRange range)
          If set to true, the slider will detect if you have two handles and create a stylable range element between these two.
 Slider setSlideEvent(JsScopeUiEvent slide)
          This event is triggered on every mouse move during slide.
 Slider setStartEvent(JsScopeUiEvent start)
          Set's the callback when when the user starts sliding.
 Slider setStep(int step)
          Sets the size or amount of each interval or step the slider takes between min and max.
 Slider setStopEvent(JsScopeUiEvent stop)
          Set's the callback when when the user stops sliding.
 Slider setValue(int value)
          Sets the current value of the slider (Determines the value of the slider, if there's only one handle.
 Slider setValues(ArrayItemOptions<IntegerItemOptions> values)
          This option can be used to specify multiple handles.
 Slider setValues(Integer value1, Integer value2)
          This option can be used to specify multiple handles.
 JsStatement statement()
          Returns the main JsStatement used to create the plugin.
 Slider unsetAnimate()
          Unsets the animate property.
 void value(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget, int value)
          Method to set the current value of the slider within the ajax request
 JsStatement value(int value)
          Method to set the current value of the slider
 JsStatement values()
          Method to get the values of the slider.
 void values(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to set the current values of the slider within the ajax request
 void values(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget, int index, int value)
          Method to set the current values of the slider within the ajax request
 JsStatement values(int index, int value)
          Method to set the values of the slider.
 JsStatement widget()
          Method to returns the .ui-slider element
 void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to returns the .ui-slider element within the ajax request
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onComponentTag, onConfigure, onDetach, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UI_HANDLE

public static final String UI_HANDLE
Properties on the ui parameter (use it into callback functions) : DOMElement - the current focused handle

See Also:
Constant Field Values

UI_VALUE

public static final String UI_VALUE
Properties on the ui parameter (use it into callback functions) : Integer - the current handle's value

See Also:
Constant Field Values

UI_VALUES

public static final String UI_VALUES
Properties on the ui parameter (use it into callback functions) : Integers - all handlers' values

See Also:
Constant Field Values
Constructor Detail

Slider

public Slider(String id,
              Number min,
              Number max)
Constructor

Parameters:
id - Markup identifiant
min - Minimum value
max - Maximum value
Method Detail

detachModel

protected void detachModel()
Overrides:
detachModel in class org.apache.wicket.Component

renderHead

public void renderHead(org.apache.wicket.markup.html.IHeaderResponse response)
Specified by:
renderHead in interface org.apache.wicket.markup.html.IHeaderContributor
Overrides:
renderHead in class org.apache.wicket.Component

statement

public JsStatement statement()
Description copied from interface: IWiQueryPlugin
Returns the main JsStatement used to create the plugin.

Specified by:
statement in interface IWiQueryPlugin
Returns:
The JsStatement corresponding to this component.

getOptions

protected Options getOptions()
Method retrieving the options of the component

Returns:
the options

setAnimate

public Slider setAnimate(boolean animate)
Whether to slide handle smoothly when user click outside handle on the bar. Sets the animate to true of false;

Parameters:
animate -
Returns:
instance of the current component

setAnimate

public Slider setAnimate(SliderAnimate.AnimateEnum animate)
Whether to slide handle smoothly when user click outside handle on the bar. Sets the animate using enum constants.

Parameters:
animate -
Returns:
instance of the current component

setAnimate

public Slider setAnimate(Number number)
Whether to slide handle smoothly when user click outside handle on the bar.

Parameters:
number - A number bigger than 0.
Returns:
instance of the current component

unsetAnimate

public Slider unsetAnimate()
Unsets the animate property.

Returns:
instance of the current component

getAnimate

public SliderAnimate getAnimate()
Returns:
The current animate.

isAnimate

public boolean isAnimate()
Returns:
the animate option value

setDisabled

public Slider setDisabled(boolean disabled)
Disables (true) or enables (false) the slider. Can be set when initialising (first creating) the slider.

Parameters:
disabled -
Returns:
instance of the current behavior

isDisabled

public boolean isDisabled()
Returns:
the disabled option

setMax

public Slider setMax(Number max)
Sets the maximum value of the slider.

Parameters:
max -
Returns:
instance of the current component

getMax

public Number getMax()
Returns:
the max option value

setMin

public Slider setMin(Number min)
Sets the minimum value of the slider.

Parameters:
min -
Returns:
instance of the current component

getMin

public Number getMin()
Returns:
the min option value

setOrientation

public Slider setOrientation(Slider.Orientation orientation)
Normally you don't need to set this option because the plugin detects the slider orientation automatically. If the orientation is not correctly detected you can set this option to 'horizontal' or 'vertical'.

Parameters:
orientation -
Returns:
instance of the current component

getOrientation

public Slider.Orientation getOrientation()
Returns:
the orientation option value

setRange

public Slider setRange(SliderRange range)
If set to true, the slider will detect if you have two handles and create a stylable range element between these two. Two other possible values are 'min' and 'max'. A min range goes from the slider min to one handle. A max range goes from one handle to the slider max.

Parameters:
range -
Returns:
instance of the current component

getRange

public SliderRange getRange()
Returns:
the range option value

setStep

public Slider setStep(int step)
Sets the size or amount of each interval or step the slider takes between min and max. The full specified value range of the slider (max - min) needs to be evenly divisible by the step.

Parameters:
step -
Returns:
instance of the current component

getStep

public int getStep()
Returns:
the value option value

setValue

public Slider setValue(int value)
Sets the current value of the slider (Determines the value of the slider, if there's only one handle. If there is more than one handle, determines the value of the first handle.)

Parameters:
value -
Returns:
instance of the current component

getValue

public int getValue()
Returns:
the value option value

setValues

public Slider setValues(ArrayItemOptions<IntegerItemOptions> values)
This option can be used to specify multiple handles. If range is set to true, the length of 'values' should be 2.

Parameters:
values -
Returns:
instance of the current component

setValues

public Slider setValues(Integer value1,
                        Integer value2)
This option can be used to specify multiple handles. If range is set to true, the length of 'values' should be 2.

Parameters:
value1 -
value2 -
Returns:
instance of the current component

getValues

public ICollectionItemOptions getValues()
Returns:
the values option value

setChangeEvent

public Slider setChangeEvent(JsScopeUiEvent change)
This event is triggered on slide stop, or if the value is changed programmatically (by the value method). Takes arguments event and ui. Use event.orginalEvent to detect whether the value changed by mouse, keyboard, or programmatically. Use ui.value (single-handled sliders) to obtain the value of the current handle, $(this).slider('values', index) to get another handle's value.

Parameters:
change -
Returns:
instance of the current component

setStartEvent

public Slider setStartEvent(JsScopeUiEvent start)
Set's the callback when when the user starts sliding.

Parameters:
start -
Returns:
instance of the current component

setSlideEvent

public Slider setSlideEvent(JsScopeUiEvent slide)
This event is triggered on every mouse move during slide. Use ui.value (single-handled sliders) to obtain the value of the current handle, $(..).slider('value', index) to get another handles' value.

Parameters:
slide -
Returns:
instance of the current component

setStopEvent

public Slider setStopEvent(JsScopeUiEvent stop)
Set's the callback when when the user stops sliding.

Parameters:
stop -
Returns:
instance of the current component

destroy

public JsStatement destroy()
Method to destroy the slider This will return the element back to its pre-init state.

Returns:
the associated JsStatement

destroy

public void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to destroy the slider within the ajax request

Parameters:
ajaxRequestTarget -

disable

public JsStatement disable()
Method to disable the slider

Returns:
the associated JsStatement

disable

public void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to disable the slider within the ajax request

Parameters:
ajaxRequestTarget -

enable

public JsStatement enable()
Method to enable the slider

Returns:
the associated JsStatement

enable

public void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to enable the slider within the ajax request

Parameters:
ajaxRequestTarget -

value

public JsStatement value(int value)
Method to set the current value of the slider

Parameters:
value -
Returns:
the associated JsStatement

value

public void value(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget,
                  int value)
Method to set the current value of the slider within the ajax request

Parameters:
ajaxRequestTarget -
value -

values

public JsStatement values()
Method to get the values of the slider.

Returns:
the associated JsStatement

values

public void values(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to set the current values of the slider within the ajax request

Parameters:
ajaxRequestTarget -

values

public JsStatement values(int index,
                          int value)
Method to set the values of the slider. For multiple handle or range sliders.

Parameters:
index -
value -
Returns:
the associated JsStatement

values

public void values(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget,
                   int index,
                   int value)
Method to set the current values of the slider within the ajax request

Parameters:
ajaxRequestTarget -
index -
value -

widget

public JsStatement widget()
Method to returns the .ui-slider element

Returns:
the associated JsStatement

widget

public void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to returns the .ui-slider element within the ajax request

Parameters:
ajaxRequestTarget -


Copyright © 2012. All Rights Reserved.