Package org.dwcj.controls.slider
Class Slider
java.lang.Object
org.dwcj.controls.AbstractControl
org.dwcj.controls.AbstractDwcControl
org.dwcj.controls.slider.Slider
- All Implemented Interfaces:
Control,Enableable,Focusable,HasAttribute,HasClassName,HasComputedStyle,HasControlText,HasDestroy,HasMouseWheelCondition,HasStyle,HasTooltip,HasVisibility,TabTraversable
public final class Slider
extends AbstractDwcControl
implements Focusable, HasMouseWheelCondition, TabTraversable
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.dwcj.interfaces.HasMouseWheelCondition
HasMouseWheelCondition.MouseWheelCondition -
Field Summary
Fields inherited from class org.dwcj.controls.AbstractDwcControl
BASISNUMBER_1, BASISNUMBER_25, BASISNUMBER_250, focusable, horizontalScrollBarPosition, mouseWheelCondition, readOnly, STR_EXPANSE, STR_THEME, tabTraversable, textAlignment, textHighlight, verticalScrollBarPositionFields inherited from class org.dwcj.controls.AbstractControl
ctrl, destroyed, elementId, userData -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddClassName(String selector) Adds a CSS class to the list of CSS classes for the control.protected voidcatchUp()The catchUp method is used to replay attributes and settings that the API user might have added to a control before its creation.protected voidCreate the object on a panel p.This method returns the labels from a ProgressBar control.This method queries the slider's major tick spacing.This method returns the maximum value of the ProgressBar control.This method returns the minimum value of the ProgressBar control.This method queries the minor tick spacing of the ProgressBar control.This method returns the orientation of the ProgressBar control.getScrollWheelBehavior returns a constant indicating under what situations the control will respond to the mouse scroll wheel.getValue()This method returns the current value of the ProgressBar control.isFocusable returns a value indicating whether or not the user can focus the control.This method gets the orientation of the ProgressBar control.This method queries whether to paint labels on the ProgressBar control.This method queries whether to paint ticks on the ProgressBar control.This method queries whether a ProgressBar control should snap to the nearest tick when the user drags the thumb.Returns a boolean indicating whether or not the user can navigate to the control using the tab key.onScroll(Consumer<SliderOnControlScrollEvent> callback) Sets a callback to fire when the slider control is scrolled.removeClassName(String selector) Removes a CSS class from the list of CSS classes for the control.setAttribute(String attribute, String value) set the value for an attribute in the controlsetEnabled(Boolean enabled) Set whether the control is to be enabledsetFocusable(Boolean focusable) setFocusable sets whether a control can be focused.Assigns the ID of a controlsetInverted(Boolean inverted) This method sets the orientation of the ProgressBar control.This method sets the custom labels for a ProgressBar control.setMajorTickSpacing(Integer tick) This method sets the major tick spacing for a ProgressBar control.setMaximum(Integer maximum) This method sets the maximum value of the ProgressBar control.setMinimum(Integer minimum) This method sets the minimum value of the ProgressBar control.setMinorTickSpacing(Integer tick) This method sets the minor tick spacing of a ProgressBar control.setOrientation(Slider.Orientation orientation) Will set the slider to vertical if the string "vertical" is passed.setPaintLabels(Boolean paint) This method sets whether labels are painted on a ProgressBar control.setPaintTicks(Boolean paint) This method sets whether ticks are painted on a ProgressBar control.setScrollWheelBehavior configures under what situations the control will respond to the mouse scroll wheel.setSnapToTicks(Boolean snap) This method sets whether a ProgressBar control should snap to the nearest tick when the user drags the thumb.Assigns specified value to the specified CSS propertysetTabTraversable(Boolean traverse) Sets whether or not the user can navigate to the control using the tab key.set the text of the control Each control implementing this interface has a text property, which might be visible in different ways (caption, title, contents of edit) or sometimes not visible at allsetTheme(Slider.Theme theme) setTooltipText(String text) Set the tooltip text of the controlThis method sets the value of the ProgressBar control.setVisible(Boolean visible) Set whether the control is visible or invisibleMethods inherited from class org.dwcj.controls.AbstractDwcControl
destroy, getAttribute, getComputedStyle, getText, getTooltipText, isEnabled, isVisible, setControlExpanse, setControlThemeMethods inherited from class org.dwcj.controls.AbstractControl
getCaughtUp, getId, getUserData, isDestroyed, setUserData
-
Constructor Details
-
Slider
public Slider()
-
-
Method Details
-
create
Description copied from class:AbstractControlCreate the object on a panel p. The preferred way of creating an object is using the Panel::add(Control) method, instead of this- Overrides:
createin classAbstractControl- Parameters:
p- the panel to add this control on
-
onScroll
Sets a callback to fire when the slider control is scrolled.- Parameters:
callback- Function written with behavior to be executed when the event is fired- Returns:
- The object itself
-
isInverted
This method gets the orientation of the ProgressBar control. By default, the minimum value of a vertical slider is at the bottom and the maximum value is at the top. For a horizontal slider, the minimum value is to the left and the maximum value is to the right. The orientation reverses for inverted sliders.- Returns:
- Returns whether the control orientation is inverted.
-
getLabels
This method returns the labels from a ProgressBar control.- Returns:
- Returns a Java Map<Integer,String> structure, where each Integer key is the slider position of the corresponding String label.
-
getMajorTickSpacing
This method queries the slider's major tick spacing.- Returns:
- Returns the slider's major tick spacing.
-
getMaximum
This method returns the maximum value of the ProgressBar control.- Returns:
- Returns the maximum value of the control.
-
getMinimum
This method returns the minimum value of the ProgressBar control.- Returns:
- Returns the minimum value of the control.
-
getMinorTickSpacing
This method queries the minor tick spacing of the ProgressBar control.- Returns:
- Returns the slider's minor tick spacing.
-
getOrientation
This method returns the orientation of the ProgressBar control.- Returns:
- Returns the orientation of the control (0 = HORIZONTAL, 1 = VERTICAL).
-
isPaintLabels
This method queries whether to paint labels on the ProgressBar control.- Returns:
- Returns whether labels are painted on this slider.
-
isPaintTicks
This method queries whether to paint ticks on the ProgressBar control.- Returns:
- Returns whether ticks are painted on this slider.
-
isSnapToTicks
This method queries whether a ProgressBar control should snap to the nearest tick when the user drags the thumb.- Returns:
- Returns whether the BBjSlider should snap to the nearest tick when the user drags the thumb.
-
getValue
This method returns the current value of the ProgressBar control.- Returns:
- Returns the current value of the control.
-
setInverted
This method sets the orientation of the ProgressBar control. By default, the minimum value of a vertical slider is at the bottom and the maximum value is at the top. For a horizontal slider, the minimum value is to the left and the maximum value is to the right. The orientation reverses for inverted sliders.- Parameters:
inverted- - Specifies whether the slider orientation is inverted.- Returns:
- Returns this
-
setLabels
This method sets the custom labels for a ProgressBar control.- Parameters:
labels- - A Java Map<Integer,String> structure, where the Integer key is the slider position of the corresponding String label.- Returns:
- Returns this
-
setMajorTickSpacing
This method sets the major tick spacing for a ProgressBar control.- Parameters:
prop- - Specifies the major tick spacing.- Returns:
- Returns this
-
setMaximum
This method sets the maximum value of the ProgressBar control.- Parameters:
value- - Specifies the maximum value.- Returns:
- Returns this
-
setMinimum
This method sets the minimum value of the ProgressBar control.- Parameters:
value- - Specifies the minimum value.- Returns:
- Returns this
-
setMinorTickSpacing
This method sets the minor tick spacing of a ProgressBar control.- Parameters:
tick- - Specifies the minor tick spacing.- Returns:
- Returns this
-
setOrientation
Will set the slider to vertical if the string "vertical" is passed. Defaults to horizontal for any other string.- Parameters:
orientation- String "vertical" to set the slider's orientation to vertical, "horizontal" for horizontal(default)- Returns:
- The object itself
-
setPaintLabels
This method sets whether labels are painted on a ProgressBar control.- Parameters:
paint- - Specifies whether labels are painted on the- Returns:
- Returns this
-
setPaintTicks
This method sets whether ticks are painted on a ProgressBar control.- Parameters:
paint- - Specifies whether ticks are painted on the control.- Returns:
- Returns this
-
setSnapToTicks
This method sets whether a ProgressBar control should snap to the nearest tick when the user drags the thumb.- Parameters:
snap- - Specifies whether the control should snap to the nearest tick when the user drags the thumb.- Returns:
- Returns this
-
setValue
This method sets the value of the ProgressBar control.- Parameters:
value- - Specifies the slider value.- Returns:
- Returns this
-
isFocusable
Description copied from interface:FocusableisFocusable returns a value indicating whether or not the user can focus the control. Note: A focused control is the control to which keyboard interaction is directed. Typically, the focused control is indicated visually, often via a dotted grey border. A control which is not focusable, therefore, cannot be manipulated via the keyboard. It is still possible to interact with a non-focusable control via the mouse.- Specified by:
isFocusablein interfaceFocusable- Returns:
- True if object can be focused, False if not.
-
setFocusable
Description copied from interface:FocusablesetFocusable sets whether a control can be focused. Note: A focused control is the control to which keyboard interaction is directed. Typically, the focused control is indicated visually, often via a dotted grey border. A control which is not focusable, therefore, cannot be manipulated via the keyboard. It is still possible to interact with a non-focusable control via the mouse. To disable all interaction, including the mouse, see setEnabled() and setReadOnly().- Specified by:
setFocusablein interfaceFocusable- Parameters:
focusable- Boolean True for allowing focusing, False to disable focus- Returns:
- Object itself
-
isTabTraversable
Description copied from interface:TabTraversableReturns a boolean indicating whether or not the user can navigate to the control using the tab key.- Specified by:
isTabTraversablein interfaceTabTraversable- Returns:
- True if user can navigate to control with Tab key, False if not
-
setTabTraversable
Description copied from interface:TabTraversableSets whether or not the user can navigate to the control using the tab key.- Specified by:
setTabTraversablein interfaceTabTraversable- Parameters:
traverse- Boolean dictating tab traversal. True if control can be navigated to with Tab, False if not.- Returns:
- The control itself
-
getScrollWheelBehavior
Description copied from interface:HasMouseWheelConditiongetScrollWheelBehavior returns a constant indicating under what situations the control will respond to the mouse scroll wheel.- Specified by:
getScrollWheelBehaviorin interfaceHasMouseWheelCondition- Returns:
- Enum value of scroll behavior
-
setScrollWheelBehavior
Description copied from interface:HasMouseWheelConditionsetScrollWheelBehavior configures under what situations the control will respond to the mouse scroll wheel.- Specified by:
setScrollWheelBehaviorin interfaceHasMouseWheelCondition- Parameters:
condition- Enum value for desired behavior- Returns:
- The control itself
-
setText
Description copied from interface:HasControlTextset the text of the control Each control implementing this interface has a text property, which might be visible in different ways (caption, title, contents of edit) or sometimes not visible at all- Specified by:
setTextin interfaceHasControlText- Overrides:
setTextin classAbstractDwcControl- Returns:
- the control itself
-
setVisible
Description copied from interface:HasVisibilitySet whether the control is visible or invisible- Specified by:
setVisiblein interfaceHasVisibility- Overrides:
setVisiblein classAbstractDwcControl- Returns:
- the control itself
-
setEnabled
Description copied from interface:EnableableSet whether the control is to be enabled- Specified by:
setEnabledin interfaceEnableable- Overrides:
setEnabledin classAbstractDwcControl- Returns:
- the control itself
-
setTooltipText
Description copied from interface:HasTooltipSet the tooltip text of the control- Specified by:
setTooltipTextin interfaceHasTooltip- Overrides:
setTooltipTextin classAbstractDwcControl- Returns:
- the control itself
-
setAttribute
Description copied from class:AbstractDwcControlset the value for an attribute in the control- Specified by:
setAttributein interfaceHasAttribute- Overrides:
setAttributein classAbstractDwcControl- Parameters:
attribute- the name of the attributevalue- the value to be set- Returns:
- the control itself
-
setId
Description copied from interface:ControlAssigns the ID of a control- Specified by:
setIdin interfaceControl- Overrides:
setIdin classAbstractControl- Parameters:
elementId- Desired ID designation- Returns:
- The control itself
-
setStyle
Description copied from interface:HasStyleAssigns specified value to the specified CSS property- Specified by:
setStylein interfaceHasStyle- Overrides:
setStylein classAbstractDwcControl- Parameters:
property- The CSS property to be changedvalue- The value of the selected CSS property- Returns:
- The control itself
-
addClassName
Description copied from interface:HasClassNameAdds a CSS class to the list of CSS classes for the control.- Specified by:
addClassNamein interfaceHasClassName- Overrides:
addClassNamein classAbstractDwcControl- Returns:
- The control itself
-
removeClassName
Description copied from interface:HasClassNameRemoves a CSS class from the list of CSS classes for the control.- Specified by:
removeClassNamein interfaceHasClassName- Overrides:
removeClassNamein classAbstractDwcControl- Returns:
- The control itself
-
setTheme
-
catchUp
Description copied from class:AbstractDwcControlThe catchUp method is used to replay attributes and settings that the API user might have added to a control before its creation. A control is not created before it's added to a panel. Anything that is added between instantiation of a control and its addition to a panel has to be recorded and replayed in this method- Overrides:
catchUpin classAbstractDwcControl- Throws:
IllegalAccessException- - thrown if an attempt is made to call this method more than once
-