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.
|
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEventField.ValueChangeEventBuffered.SourceExceptionProperty.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.ViewerComponent.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 that only allows integer values.
|
Slider(String caption)
Create a new slider with the caption given as parameter.
|
Slider(String caption,
int min,
int max)
Create a new slider with the given caption and range that only allows
integer values.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the value of the field.
|
protected Collection<String> |
getCustomAttributes()
Returns a collection of attributes that should not be handled by the
basic implementation of the
readDesign and writeDesign
methods. |
double |
getMax()
Gets the maximum slider value
|
double |
getMin()
Gets the minimum slider value
|
SliderOrientation |
getOrientation()
Get the current orientation of the slider (horizontal or vertical).
|
int |
getResolution()
Get the current 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.
|
Class<Double> |
getType()
Returns the type of the Field.
|
boolean |
isEmpty()
Is the field empty?
In general, "empty" state is same as null.
|
void |
readDesign(org.jsoup.nodes.Element design,
DesignContext context)
Reads the component state from the given design.
|
protected void |
setInternalValue(Double newValue)
Sets the internal field value.
|
void |
setMax(double max)
Set the maximum slider value.
|
void |
setMin(double min)
Set the minimum slider value.
|
void |
setOrientation(SliderOrientation orientation)
Set the orientation of the slider.
|
void |
setResolution(int resolution)
Set a new resolution for the slider.
|
void |
setValue(Double newFieldValue)
Sets the value of the field.
|
protected void |
setValue(Double value,
boolean repaintIsNotNeeded)
Sets the value of the slider.
|
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext context)
Writes the component state to the given design.
|
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, attach, beforeClientResponse, commit, detach, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getTabIndex, getValidators, getValue, isBuffered, isImmediate, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInvalidAllowed, setInvalidCommitted, setLocale, setPropertyDataSource, setReadOnly, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, shouldHideErrors, toString, validate, validate, valueChangeaddContextClickListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getExplicitImmediateValue, 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, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setImmediate, 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, setResourceclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddListener, addStyleName, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setVisibleaddAttachListener, addDetachListener, 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, setWidthUndefinedaddShortcutListener, removeShortcutListenerpublic Slider()
public Slider(String caption)
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 - IllegalArgumentException - if resolution is negative.protected void setValue(Double value, boolean repaintIsNotNeeded)
setValue in class AbstractField<Double>value - The new value of the slider.repaintIsNotNeeded - If true, client-side is not requested to repaint itself.Slider.ValueOutOfBoundsException - If the given value is not inside the range of the slider.{@link #setMax(double)}public void setValue(Double newFieldValue)
AbstractFieldprotected void setInternalValue(Double newValue)
AbstractFieldAbstractField.getInternalValue() if necessary.setInternalValue in class AbstractField<Double>newValue - the new value to be set.public Class<Double> getType()
AbstractFieldgetValue and
setValue must be compatible with this type: one must be able
to safely cast the value returned from getValue to the given
type and pass any variable assignable to this type as an argument to
setValue.public void clear()
Field
The field value is typically reset to the initial value of the field.
Calling Field.isEmpty() on a cleared field must always returns true.
public boolean isEmpty()
Fieldpublic 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()
AbstractComponentreadDesign and writeDesign
methods. Typically these are handled in a custom way in the overridden
versions of the above methodsgetCustomAttributes in class AbstractField<Double>Copyright © 2019 Vaadin Ltd. All rights reserved.