T
- slider value typepublic abstract class SliderBase<T> extends Widget implements HasValue<T>, IsEditor<LeafValueEditor<T>>, HasEnabled, HasId, HasResponsiveness, HasAllSlideHandlers<T>
https://github.com/seiyria/bootstrap-slider
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
DEBUG_ID_PREFIX
SLIDE_CHANGE_EVENT, SLIDE_DISABLED_EVENT, SLIDE_ENABLED_EVENT, SLIDE_EVENT, SLIDE_START_EVENT, SLIDE_STOP_EVENT
Modifier | Constructor and Description |
---|---|
protected |
SliderBase() |
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addSlideDisabledHandler(SlideDisabledHandler handler)
Adds a
SlideDisabledEvent handler. |
HandlerRegistration |
addSlideEnabledHandler(SlideEnabledHandler handler)
Adds a
SlideEnabledEvent handler. |
HandlerRegistration |
addSlideHandler(SlideHandler<T> handler)
Adds a
SlideEvent handler. |
HandlerRegistration |
addSlideStartHandler(SlideStartHandler<T> handler)
Adds a
SlideStartEvent handler. |
HandlerRegistration |
addSlideStopHandler(SlideStopHandler<T> handler)
Adds a
SlideStopEvent handler. |
HandlerRegistration |
addValueChangeHandler(ValueChangeHandler<T> handler) |
LeafValueEditor<T> |
asEditor() |
protected abstract T |
convertValue(String value)
Converts the value of the
SliderOption.VALUE attribute to the
slider value. |
protected void |
fireChangeEvent(T value)
Fires a
ValueChangeEvent event. |
protected void |
fireSlideEvent(T value)
Fires a
SlideEvent event. |
protected void |
fireSlideStartEvent(T value)
Fires a
SlideStartEvent event. |
protected void |
fireSlideStopEvent(T value)
Fires a
SlideStopEvent event. |
protected abstract String |
format(T value)
Formats the slider value to string value to be displayed
as tool-tip text.
|
protected String |
formatTooltip(T value) |
boolean |
getFocusHandle() |
HandleType |
getHandle() |
String |
getId() |
double |
getMax() |
double |
getMin() |
OrientationType |
getOrientation() |
double |
getPrecision() |
ScaleType |
getScale() |
SelectionType |
getSelection() |
double |
getStep() |
Element |
getStyleElement() |
List<Double> |
getTicks() |
List<String> |
getTicksLabels() |
List<Double> |
getTicksPositions() |
double |
getTicksSnapBounds() |
TooltipType |
getTooltip() |
TooltipPosition |
getTooltipPosition() |
T |
getValue() |
protected abstract T |
getValue(Element e)
Returns the value by invoking the JSNI getValue command.
|
boolean |
isEnabled() |
boolean |
isNaturalArrowKeys() |
protected boolean |
isRange() |
boolean |
isReversed() |
protected boolean |
isSliderNamespaceAvailable() |
boolean |
isTooltipSplit() |
boolean |
isVisible() |
protected void |
onLoad() |
protected abstract void |
onSlide(Event event)
Called when a
SlideEvent is fired. |
protected abstract void |
onSlideChange(Event event)
Called when a
ValueChangeEvent is fired. |
protected abstract void |
onSlideStart(Event event)
Called when a
SlideStartEvent is fired. |
protected abstract void |
onSlideStop(Event event)
Called when a
SlideStopEvent is fired. |
protected void |
onUnload() |
void |
refresh()
Refreshes the current slider.
|
void |
relayout()
Renders the tool-tip again, after initialization.
|
void |
setEnabled(boolean enabled) |
void |
setFocusHandle(boolean focus)
Focus the appropriate slider handle after a value change.
|
protected abstract void |
setFormatter(Element element)
Sets the callback function of the
SliderOption.FORMATTER attribute. |
void |
setFormatter(FormatterCallback<T> formatterCallback)
Sets the formatter callback.
|
protected abstract void |
setFormatterOption(JavaScriptObject options)
Sets formatter option if defined when attaching to the DOM.
|
void |
setHandle(HandleType handle)
Sets the handle shape.
|
void |
setHiddenOn(DeviceSize deviceSize) |
void |
setId(String id)
Sets the id of the slider element when it's created.
|
void |
setMax(double max)
Sets the maximum possible value.
|
void |
setMin(double min)
Sets the minimum possible value.
|
void |
setNaturalArrowKeys(boolean naturalArrowKeys)
The natural order is used for the arrow keys.
|
void |
setOrientation(OrientationType orientation)
Sets the orientation.
|
void |
setPrecision(double precision)
Sets the number of digits shown after the decimal.
Defaults to the number of digits after the decimal of step value. |
protected void |
setRange(boolean range)
Make range slider if set to
true . |
void |
setReversed(boolean reversed)
Sets whether or not the slider should be reversed.
|
void |
setScale(ScaleType scale)
Sets the slider scale type.
|
void |
setSelection(SelectionType selection)
Sets the selection type.
|
void |
setStep(double step)
Sets the increment step.
|
void |
setTicks(List<Double> ticks)
Sets the values of ticks.
|
void |
setTicksLabels(List<String> ticksLabels)
Sets the labels below the tick marks.
Accepts HTML input. |
void |
setTicksPositions(List<Double> ticksPositions)
Defines the positions of the tick values in percentages.
The first value should always be 0, the last value should always be 100 percent. |
void |
setTicksSnapBounds(double ticksSnapBounds)
Sets the snap bounds of a tick.
|
void |
setTooltip(TooltipType tooltip)
Sets the tool-tip type.
|
void |
setTooltipPosition(TooltipPosition position)
Sets the tool-tip position.
|
void |
setTooltipSplit(boolean tooltipSplit)
Show one too-tip if set to
false , otherwise
show two tool-tips one for each handler. |
protected abstract void |
setValue(Element e,
T value)
Sets the given value to the slider.
|
void |
setValue(T value) |
void |
setValue(T value,
boolean fireEvents) |
void |
setVisible(boolean visible) |
void |
setVisibleOn(DeviceSize deviceSize) |
void |
toggle()
Toggles the slider between enabled and disabled.
|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setWidth, sinkBitlessEvent, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
protected SliderBase()
protected abstract void setFormatterOption(JavaScriptObject options)
options
- public void setId(String id)
setId
in interface HasId
public double getMin()
public void setMin(double min)
min
- public double getMax()
public void setMax(double max)
max
- public double getStep()
public void setStep(double step)
step
- public double getPrecision()
public void setPrecision(double precision)
precision
- public OrientationType getOrientation()
public void setOrientation(OrientationType orientation)
orientation
- OrientationType
protected boolean isRange()
protected void setRange(boolean range)
true
. If initial value is scalar,
max will be used for second value.range
- public SelectionType getSelection()
public void setSelection(SelectionType selection)
selection
- SelectionType
public TooltipType getTooltip()
public void setTooltip(TooltipType tooltip)
tooltip
- TooltipType
public boolean isTooltipSplit()
public void setTooltipSplit(boolean tooltipSplit)
false
, otherwise
show two tool-tips one for each handler.tooltipSplit
- public TooltipPosition getTooltipPosition()
public void setTooltipPosition(TooltipPosition position)
position
- TooltipPosition
public HandleType getHandle()
public void setHandle(HandleType handle)
handle
- HandleType
public boolean isReversed()
public void setReversed(boolean reversed)
reversed
- public boolean isEnabled()
isEnabled
in interface HasEnabled
public void setEnabled(boolean enabled)
setEnabled
in interface HasEnabled
public void setFormatter(FormatterCallback<T> formatterCallback)
formatterCallback
- protected abstract void setFormatter(Element element)
SliderOption.FORMATTER
attribute.element
- protected String formatTooltip(T value)
protected abstract String format(T value)
value
- public boolean isNaturalArrowKeys()
public void setNaturalArrowKeys(boolean naturalArrowKeys)
naturalArrowKeys
- public void setTicks(List<Double> ticks)
ticks
- public List<Double> getTicksPositions()
public void setTicksPositions(List<Double> ticksPositions)
ticksPositions
- public List<String> getTicksLabels()
public void setTicksLabels(List<String> ticksLabels)
ticksLabels
- public double getTicksSnapBounds()
public void setTicksSnapBounds(double ticksSnapBounds)
ticksSnapBounds
- public void setFocusHandle(boolean focus)
focus
- public boolean getFocusHandle()
public void setScale(ScaleType scale)
scale
- ScaleType
public void setVisible(boolean visible)
setVisible
in interface HasVisibility
setVisible
in class UIObject
public boolean isVisible()
isVisible
in interface HasVisibility
isVisible
in class UIObject
public void setVisibleOn(DeviceSize deviceSize)
setVisibleOn
in interface HasResponsiveness
public void setHiddenOn(DeviceSize deviceSize)
setHiddenOn
in interface HasResponsiveness
protected abstract void setValue(Element e, T value)
e
- value
- protected abstract T getValue(Element e)
e
- protected abstract T convertValue(String value)
SliderOption.VALUE
attribute to the
slider value.value
- public Element getStyleElement()
getStyleElement
in class UIObject
public void toggle()
public void refresh()
public void relayout()
public LeafValueEditor<T> asEditor()
asEditor
in interface IsEditor<LeafValueEditor<T>>
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler)
addValueChangeHandler
in interface HasValueChangeHandlers<T>
public HandlerRegistration addSlideHandler(SlideHandler<T> handler)
HasSlideHandlers
SlideEvent
handler.addSlideHandler
in interface HasSlideHandlers<T>
handler
- the handlerpublic HandlerRegistration addSlideStartHandler(SlideStartHandler<T> handler)
HasSlideStartHandlers
SlideStartEvent
handler.addSlideStartHandler
in interface HasSlideStartHandlers<T>
handler
- the handlerpublic HandlerRegistration addSlideStopHandler(SlideStopHandler<T> handler)
HasSlideStopHandlers
SlideStopEvent
handler.addSlideStopHandler
in interface HasSlideStopHandlers<T>
handler
- the handlerpublic HandlerRegistration addSlideEnabledHandler(SlideEnabledHandler handler)
HasSlideEnabledHandlers
SlideEnabledEvent
handler.addSlideEnabledHandler
in interface HasSlideEnabledHandlers
handler
- the handlerpublic HandlerRegistration addSlideDisabledHandler(SlideDisabledHandler handler)
HasSlideDisabledHandlers
SlideDisabledEvent
handler.addSlideDisabledHandler
in interface HasSlideDisabledHandlers
handler
- the handlerprotected boolean isSliderNamespaceAvailable()
protected abstract void onSlide(Event event)
SlideEvent
is fired.event
- the native eventprotected void fireSlideEvent(T value)
SlideEvent
event.value
- the new slide valueprotected abstract void onSlideStart(Event event)
SlideStartEvent
is fired.event
- the native eventprotected void fireSlideStartEvent(T value)
SlideStartEvent
event.value
- the new slide valueprotected abstract void onSlideStop(Event event)
SlideStopEvent
is fired.event
- the native eventprotected void fireSlideStopEvent(T value)
SlideStopEvent
event.value
- the new slide valueprotected abstract void onSlideChange(Event event)
ValueChangeEvent
is fired.event
- the native eventprotected void fireChangeEvent(T value)
ValueChangeEvent
event.value
- the new slide valueCopyright © 2017. All rights reserved.