|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WWidget
eu.webtoolkit.jwt.WWebWidget
eu.webtoolkit.jwt.WInteractWidget
eu.webtoolkit.jwt.WFormWidget
eu.webtoolkit.jwt.WSlider
public class WSlider
A horizontal or vertical slider control.
A slider allows the user to specify an integer value within a particular range using a visual slider.
The slider must be sized explicitly using
resize() or by a layout
manager. The default size is 150 x 50 pixels for a horizontal slider, and 50
x 150 pixels for a vertical slider.
Horizontal slider with ticks on both sides.
The non-native slider (HTML4, see
setNativeControl())
is styled by the current CSS theme. The look can be overridden using the
Wt-slider-[hv] CSS class and the following selectors (shown here
for a horizontal slider, the vertical slider is equivalent but using
Wt-slider-v instead of Wt-slider-h:
.Wt-slider-h .Wt-slider-bg : A background sized with 5px left/right margin .Wt-slider-h .Wt-e : A west background image (5px width) .Wt-slider-h .Wt-w : An east background image (5px width) .Wt-slider-h .handle : The handle (20px width)
| Nested Class Summary | |
|---|---|
static class |
WSlider.TickPosition
Enumeration that specifies the location of ticks. |
| Field Summary | |
|---|---|
static java.util.EnumSet<WSlider.TickPosition> |
NoTicks
Do not render ticks. |
static java.util.EnumSet<WSlider.TickPosition> |
TicksBothSides
Render ticks on both sides. |
| Constructor Summary | |
|---|---|
WSlider()
Creates a default horizontal slider. |
|
WSlider(Orientation orientation)
Creates a default slider of the given orientation. |
|
WSlider(Orientation orientation,
WContainerWidget parent)
Creates a default slider of the given orientation. |
|
WSlider(WContainerWidget parent)
Creates a default horizontal slider. |
|
| Method Summary | |
|---|---|
int |
getMaximum()
Returns the maximum value. |
int |
getMinimum()
Returns the minimum value. |
Orientation |
getOrientation()
Returns the slider orientation. |
int |
getTickInterval()
Returns the tick interval. |
java.util.EnumSet<WSlider.TickPosition> |
getTickPosition()
Returns the tick position. |
int |
getValue()
Returns the current slider value. |
java.lang.String |
getValueText()
Returns the current value. |
boolean |
isNativeControl()
Returns whether a native HTML5 control is used. |
protected void |
layoutSizeChanged(int width,
int height)
Virtual method that indicates a size change. |
void |
remove()
Destructor. |
protected void |
render(java.util.EnumSet<RenderFlag> flags)
|
void |
resize(WLength width,
WLength height)
Resizes the widget. |
void |
setDisabled(boolean disabled)
Sets whether the widget is disabled. |
void |
setMaximum(int maximum)
Sets the maximum value. |
void |
setMinimum(int minimum)
Sets the minimum value. |
void |
setNativeControl(boolean nativeControl)
Configures whether a native HTML5 control should be used. |
void |
setOrientation(Orientation orientation)
Sets the slider orientation. |
void |
setRange(int minimum,
int maximum)
Sets the value range. |
void |
setTickInterval(int tickInterval)
Sets the tick interval. |
void |
setTickPosition(java.util.EnumSet<WSlider.TickPosition> tickPosition)
Sets the tick position. |
void |
setTickPosition(WSlider.TickPosition tickPositio,
WSlider.TickPosition... tickPosition)
Sets the tick position. |
void |
setValue(int value)
Sets the slider value. |
void |
setValueText(java.lang.String value)
Sets the value text. |
JSignal1<java.lang.Integer> |
sliderMoved()
Signal emitted while the user drags the slider. |
Signal1<java.lang.Integer> |
valueChanged()
Signal emitted when the user has changed the value of the slider. |
| Methods inherited from class eu.webtoolkit.jwt.WFormWidget |
|---|
blurred, changed, enableAjax, focussed, getEmptyText, getLabel, getTabIndex, getValidator, hasFocus, isReadOnly, propagateSetEnabled, refresh, selected, setEmptyText, setEnabled, setFocus, setFocus, setHidden, setReadOnly, setTabIndex, setValidator, validate, validated |
| Methods inherited from class eu.webtoolkit.jwt.WInteractWidget |
|---|
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, setDraggable, setDraggable, setDraggable, setDraggable, touchEnded, touchMoved, touchStarted |
| Methods inherited from class eu.webtoolkit.jwt.WWidget |
|---|
acceptDrops, acceptDrops, addCssRule, addCssRule, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, containsExposed, disable, dropEvent, enable, getDrop, getJsRef, getParent, hide, htmlText, isLayoutSizeAware, positionAt, positionAt, removeStyleClass, resize, setClearSides, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
addChild, getObjectName, setObjectName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.util.EnumSet<WSlider.TickPosition> NoTicks
public static final java.util.EnumSet<WSlider.TickPosition> TicksBothSides
| Constructor Detail |
|---|
public WSlider(WContainerWidget parent)
The slider shows no ticks, has a range from 0 to 99, and has tickInterval of 0 (defaulting to three ticks over the whole range).
The initial value is 0.
public WSlider()
Calls this((WContainerWidget)null)
public WSlider(Orientation orientation,
WContainerWidget parent)
The slider shows no ticks, has a range from 0 to 99, and has tickInterval of 0 (defaulting to three ticks over the whole range).
The initial value is 0.
public WSlider(Orientation orientation)
Calls this(orientation, (WContainerWidget)null)
| Method Detail |
|---|
public void remove()
remove in class WFormWidgetWContainerWidget.removeWidget(WWidget widget)public void setNativeControl(boolean nativeControl)
When native, the new "range" input element,
specified by HTML5 and when implemented by the browser, is used rather
than the built-in element. A native control is styled by the browser
(usually in sync with the OS) rather than through the theme chosen.
Settings like tick interval and tick position are ignored.
Note: Vertically oriented sliders are in theory supported by the HTML5 input element, but in practice are usually not rendered correctly by the browser.
public boolean isNativeControl()
Taking into account the preference for a native control, configured using
setNativeControl(), this method returns whether a native control is
actually being used.
public void setOrientation(Orientation orientation)
getOrientation()public Orientation getOrientation()
setOrientation(Orientation orientation)public void setTickInterval(int tickInterval)
The tick interval specifies the interval for placing ticks along the slider. The interval is specified in value units (not pixel units). A value of 0 specifies an automatic tick interval, which defaults to 3 ticks spanning the whole range.
getTickInterval(),
setTickPosition(EnumSet tickPosition)public int getTickInterval()
setTickInterval(int tickInterval)public void setTickPosition(java.util.EnumSet<WSlider.TickPosition> tickPosition)
The tick position indicates if and where ticks are placed around the slider groove.
getTickPosition(),
setTickInterval(int tickInterval)
public final void setTickPosition(WSlider.TickPosition tickPositio,
WSlider.TickPosition... tickPosition)
Calls setTickPosition(EnumSet.of(tickPositio, tickPosition))
public java.util.EnumSet<WSlider.TickPosition> getTickPosition()
setTickPosition(EnumSet tickPosition),
setTickInterval(int tickInterval)public void setValue(int value)
The value is automatically trimmed to the valid range (
getMinimum() to getMaximum()).
getValue()public int getValue()
setValue(int value)public void setMaximum(int maximum)
The maximum value defines the upper limit of the valid range. The lower limit and current value are automatically adjusted to remain valid.
getMaximum(),
setMinimum(int minimum),
setRange(int minimum, int maximum)public int getMaximum()
setMaximum(int maximum)public void setMinimum(int minimum)
The minimum value defines the lower limit of the valid range. The upper limit and current value are automatically adjusted to remain valid.
getMinimum(),
setMaximum(int maximum),
setRange(int minimum, int maximum)public int getMinimum()
setMinimum(int minimum)
public void setRange(int minimum,
int maximum)
setMinimum(int minimum),
setMaximum(int maximum)public Signal1<java.lang.Integer> valueChanged()
The new value is passed as the argument.
sliderMoved()public JSignal1<java.lang.Integer> sliderMoved()
The current dragged position is passed as the argument. Note that the slider value is not changed while dragging the slider, but only after the slider has been released.
valueChanged()public void setDisabled(boolean disabled)
WWidgetEnables or disables the widget (including all its descendant widgets). setDisabled(false) will enable this widget and all descendant widgets that are not disabled. A widget is only enabled if it and all its ancestors in the widget tree are disabled.
Typically, a disabled form widget will not allow changing the value, and disabled widgets will not react to mouse click events.
setDisabled in class WWebWidgetWWidget.disable(),
WWidget.enable()
public void resize(WLength width,
WLength height)
WWidget
Specify a new size for this widget, by specifying width and height. By
default a widget has automatic width and height, see
WLength#isAuto().
This applies to CSS-based layout, and only
block widgets can be given a
size reliably.
When inserted in a layout manager, the widget may be informed about its
current size using setLayoutSizeAware(). If you have defined a
"wtResize()" JavaScript method for the widget,
then this method will also be called. operation.
resize in class WWebWidgetWWidget.getWidth(),
WWidget.getHeight()public java.lang.String getValueText()
WFormWidgetThis returns the current value as a string.
getValueText in class WFormWidgetpublic void setValueText(java.lang.String value)
WFormWidgetThis sets the current value from a string value.
setValueText in class WFormWidget
protected void layoutSizeChanged(int width,
int height)
WWidgetThis method propagates the client-side width and height of the widget when the widget is contained by a layout manager and setLayoutSizeAware(true) was called.
layoutSizeChanged in class WWidgetWWidget.setLayoutSizeAware(boolean aware)protected void render(java.util.EnumSet<RenderFlag> flags)
render in class WFormWidget
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||