public class Slider extends AbstractField<Double>
| Modifier and Type | Class and Description |
|---|---|
class |
Slider.ValueOutOfBoundsException
Thrown when the value of the slider is about to be set to a value that is
outside the valid range of the slider.
|
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<V>Component.ErrorEvent, Component.Event, Component.Focusable, Component.ListenerClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListenerSizeable.UnitDESIGN_ATTR_PLAIN_TEXTSIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS| Constructor and Description |
|---|
Slider()
Default slider constructor.
|
Slider(double min,
double max,
int resolution)
Create a new slider with the given range and resolution.
|
Slider(int min,
int max)
Create a new slider with the given range of integers.
|
Slider(String caption)
Create a new slider with the caption given as parameter.
|
Slider(String caption,
int min,
int max)
Creates a new slider with the given caption and integer range.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doSetValue(Double newValue)
Sets the value of this field.
|
protected Collection<String> |
getCustomAttributes()
Returns a collection of attributes that should not be handled by the
basic implementation of the
AbstractComponent.readDesign(Element, DesignContext)
and AbstractComponent.writeDesign(Element, DesignContext) methods. |
Double |
getEmptyValue()
Returns the value that represents an empty value.
|
double |
getMax()
Gets the maximum slider value.
|
double |
getMin()
Gets the minimum slider value.
|
SliderOrientation |
getOrientation()
Gets the current orientation of the slider (horizontal or vertical).
|
int |
getResolution()
Gets the resolution of the slider.
|
SliderState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
SliderState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
Double |
getValue()
Returns the current value of this object.
|
void |
readDesign(org.jsoup.nodes.Element design,
DesignContext context)
Reads the component state from the given design.
|
void |
setMax(double max)
Sets the maximum slider value.
|
void |
setMin(double min)
Sets the minimum slider value.
|
void |
setOrientation(SliderOrientation orientation)
Sets the orientation of the slider.
|
void |
setResolution(int resolution)
Set a new resolution for the slider.
|
void |
setValue(Double value)
Sets the value of this object.
|
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext context)
Writes the component state to the given design.
|
addValueChangeListener, createValueChange, focus, getTabIndex, isDifferentValue, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible, setTabIndex, setValueaddContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidth, setWidthUndefinedaddAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstateclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitclear, getOptionalValue, isEmptyaddListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setVisibleaddAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdgetHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefinedpublic Slider()
The range of the slider is set to 0-100 and only integer values are allowed.
public Slider(String caption)
The range of the slider is set to 0-100 and only integer values are allowed.
caption - the caption for this slider (e.g. "Volume")public Slider(double min,
double max,
int resolution)
min - The minimum value of the slidermax - The maximum value of the sliderresolution - The number of digits after the decimal point.public Slider(int min,
int max)
min - the minimum value of the slidermax - the maximum value of the sliderpublic Slider(String caption, int min, int max)
caption - the caption for the slidermin - the minimum value of the slidermax - the maximum value of the sliderpublic SliderState getState()
AbstractComponentgetState in class AbstractField<Double>public SliderState getState(boolean markAsDirty)
AbstractClientConnectorgetState in class AbstractField<Double>markAsDirty - true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()public double getMax()
public void setMax(double max)
max - The new maximum slider valuepublic double getMin()
public void setMin(double min)
min - The new minimum slider valuepublic SliderOrientation getOrientation()
public void setOrientation(SliderOrientation orientation)
orientation - the new orientation, either
SliderOrientation.HORIZONTAL or
SliderOrientation.VERTICALpublic int getResolution()
public void setResolution(int resolution)
resolution - the number of digits after the decimal pointIllegalArgumentException - if resolution is negative.protected void doSetValue(Double newValue)
AbstractFieldIllegalArgumentException if the value is invalid. Typically saves
the value to shared state.doSetValue in class AbstractField<Double>newValue - the new value of the fieldpublic void setValue(Double value)
getValue(), fires a ValueChangeEvent. Throws
NullPointerException if the value is null.setValue in interface HasValue<Double>setValue in class AbstractField<Double>value - the new value, not nullNullPointerException - if value is nullpublic Double getValue()
HasValueImplementation note: the implementing class should document whether null values may be returned or not.
public Double getEmptyValue()
HasValue
By default HasValue is expected to support null as empty
values. Specific implementations might not support this.
Binder.bind(HasValue, ValueProvider, Setter)public void readDesign(org.jsoup.nodes.Element design,
DesignContext context)
ComponentThe component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
readDesign in interface ComponentreadDesign in class AbstractField<Double>design - The element to obtain the state fromcontext - The DesignContext instance used for parsing the designpublic void writeDesign(org.jsoup.nodes.Element design,
DesignContext context)
ComponentThe component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
writeDesign in interface ComponentwriteDesign in class AbstractField<Double>design - The element to write the component state to. Any previous
attributes or child nodes are not cleared.context - The DesignContext instance used for writing the designprotected Collection<String> getCustomAttributes()
AbstractComponentAbstractComponent.readDesign(Element, DesignContext)
and AbstractComponent.writeDesign(Element, DesignContext) methods. Typically these
are handled in a custom way in the overridden versions of the above
methodsgetCustomAttributes in class AbstractField<Double>Copyright © 2017 Vaadin Ltd. All rights reserved.