Class SliderItem

All Implemented Interfaces:
HasHandlers, HasBlurHandlers, HasCanEditChangedHandlers, HasChangedHandlers, HasChangeHandlers, HasClickHandlers, HasDoubleClickHandlers, HasEditorEnterHandlers, HasEditorExitHandlers, HasFocusHandlers, HasIconClickHandlers, HasIconKeyPressHandlers, HasItemHoverHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasPendingStatusChangedHandlers, HasPickerIconClickHandlers, HasReadOnlyDisplayChangedHandlers, HasShowContextMenuHandlers, HasShowValueHandlers, HasTitleClickHandlers, HasTitleDoubleClickHandlers, HasTitleHoverHandlers, HasValueHoverHandlers, HasValueIconClickHandlers

public class SliderItem extends CanvasItem
FormItem that uses a Slider component to present an interface for picking from either a continuous range or a range with a small number of discrete values.
  • Constructor Details

    • SliderItem

      public SliderItem()
    • SliderItem

      public SliderItem(JavaScriptObject jsObj)
    • SliderItem

      public SliderItem(String name)
    • SliderItem

      public SliderItem(String name, String title)
  • Method Details

    • getOrCreateRef

      public static SliderItem getOrCreateRef(JavaScriptObject jsObj)
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, Canvas defaults)
      Changes the defaults for Canvas AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - Canvas defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, FormItem defaults)
      Changes the defaults for FormItem AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - FormItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • changePickerIconDefaults

      public static void changePickerIconDefaults(FormItemIcon defaults)
    • setChangeOnDrag

      public SliderItem setChangeOnDrag(Boolean changeOnDrag)
      Should this sliderItem update its value and fire change handlers while the user is actively dragging the slider. Setting this attribute value to false will suppress any change notifications from the user dragging the slider thumb until the user releases the mouse at the final position. This can be useful to avoid repeatedly firing expensive operations such as server fetches while the user drags through a range of values.
      Parameters:
      changeOnDrag - New changeOnDrag value. Default value is true
      Returns:
      SliderItem instance, for chaining setter calls
    • getChangeOnDrag

      public Boolean getChangeOnDrag()
      Should this sliderItem update its value and fire change handlers while the user is actively dragging the slider. Setting this attribute value to false will suppress any change notifications from the user dragging the slider thumb until the user releases the mouse at the final position. This can be useful to avoid repeatedly firing expensive operations such as server fetches while the user drags through a range of values.
      Returns:
      Current changeOnDrag value. Default value is true
    • setMaxValue

      public SliderItem setMaxValue(float maxValue)
      Deprecated.
      The maximum slider value. The slider value is equal to maxValue when the thumb is at the top or right of the slider (unless flipValues is true, in which case the maximum value is at the bottom/left of the slider)

      If this method is called after the component has been drawn/initialized: Sets the maximum value of the slider
      Parameters:
      maxValue - the new maximum value Note:Use Doubles rather Floats when manipulating decimal values. See GwtFloatVsDouble for details. Default value is 100
      Returns:
      SliderItem instance, for chaining setter calls
      See Also:
    • getMaxValue

      public float getMaxValue()
      Deprecated.
      The maximum slider value. The slider value is equal to maxValue when the thumb is at the top or right of the slider (unless flipValues is true, in which case the maximum value is at the bottom/left of the slider)
      Returns:
      Current maxValue value. Default value is 100
      See Also:
    • setMaxValue

      public SliderItem setMaxValue(double maxValue)
      The maximum slider value. The slider value is equal to maxValue when the thumb is at the top or right of the slider (unless flipValues is true, in which case the maximum value is at the bottom/left of the slider)

      If this method is called after the component has been drawn/initialized: Sets the maximum value of the slider
      Parameters:
      maxValue - the new maximum value Note:Use Doubles rather Floats when manipulating decimal values. See GwtFloatVsDouble for details. Default value is 100
      Returns:
      SliderItem instance, for chaining setter calls
      See Also:
    • getMaxValueAsDouble

      public double getMaxValueAsDouble()
      The maximum slider value. The slider value is equal to maxValue when the thumb is at the top or right of the slider (unless flipValues is true, in which case the maximum value is at the bottom/left of the slider)
      Returns:
      Current maxValue value. Default value is 100
      See Also:
    • setMinValue

      public SliderItem setMinValue(float minValue)
      Deprecated.
      The minimum slider value. The slider value is equal to minValue when the thumb is at the bottom or left of the slider (unless flipValues is true, in which case the minimum value is at the top/right of the slider)

      If this method is called after the component has been drawn/initialized: Sets the minimum value of the slider
      Parameters:
      minValue - the new minimum value Note:Use Doubles rather Floats when manipulating decimal values. See GwtFloatVsDouble for details. Default value is 1
      Returns:
      SliderItem instance, for chaining setter calls
      See Also:
    • getMinValue

      public float getMinValue()
      Deprecated.
      The minimum slider value. The slider value is equal to minValue when the thumb is at the bottom or left of the slider (unless flipValues is true, in which case the minimum value is at the top/right of the slider)
      Returns:
      Current minValue value. Default value is 1
      See Also:
    • setMinValue

      public SliderItem setMinValue(double minValue)
      The minimum slider value. The slider value is equal to minValue when the thumb is at the bottom or left of the slider (unless flipValues is true, in which case the minimum value is at the top/right of the slider)

      If this method is called after the component has been drawn/initialized: Sets the minimum value of the slider
      Parameters:
      minValue - the new minimum value Note:Use Doubles rather Floats when manipulating decimal values. See GwtFloatVsDouble for details. Default value is 1
      Returns:
      SliderItem instance, for chaining setter calls
      See Also:
    • getMinValueAsDouble

      public double getMinValueAsDouble()
      The minimum slider value. The slider value is equal to minValue when the thumb is at the bottom or left of the slider (unless flipValues is true, in which case the minimum value is at the top/right of the slider)
      Returns:
      Current minValue value. Default value is 1
      See Also:
    • setNumValues

      public SliderItem setNumValues(Integer numValues)
      The number of discrete values represented by slider. If specified, the range of valid values (between minValue and maxValue) will be divided into this many steps. As the thumb is moved along the track it will only select these values and appear to jump between the steps.

      If this method is called after the component has been drawn/initialized: Sets the number of values for the slider
      Parameters:
      numValues - the new number of values Note:Use Doubles rather Floats when manipulating decimal values. See GwtFloatVsDouble for details. Default value is null
      Returns:
      SliderItem instance, for chaining setter calls
      See Also:
    • getNumValues

      public Integer getNumValues()
      The number of discrete values represented by slider. If specified, the range of valid values (between minValue and maxValue) will be divided into this many steps. As the thumb is moved along the track it will only select these values and appear to jump between the steps.
      Returns:
      Current numValues value. Default value is null
      See Also:
    • setRoundPrecision

      public SliderItem setRoundPrecision(int roundPrecision)
      If Slider.roundValues is false, the slider value will be rounded to this number of decimal places. If set to null the value will not be rounded
      Parameters:
      roundPrecision - New roundPrecision value. Default value is 1
      Returns:
      SliderItem instance, for chaining setter calls
      See Also:
    • getRoundPrecision

      public int getRoundPrecision()
      If Slider.roundValues is false, the slider value will be rounded to this number of decimal places. If set to null the value will not be rounded
      Returns:
      Current roundPrecision value. Default value is 1
      See Also:
    • setRoundValues

      public SliderItem setRoundValues(Boolean roundValues)
      Specifies whether the slider value should be rounded to the nearest integer. If set to false, values will be rounded to a fixed number of decimal places controlled by roundPrecision.
      Parameters:
      roundValues - New roundValues value. Default value is true
      Returns:
      SliderItem instance, for chaining setter calls
      See Also:
    • getRoundValues

      public Boolean getRoundValues()
      Specifies whether the slider value should be rounded to the nearest integer. If set to false, values will be rounded to a fixed number of decimal places controlled by roundPrecision.
      Returns:
      Current roundValues value. Default value is true
      See Also:
    • setShouldSaveValue

      public SliderItem setShouldSaveValue(Boolean shouldSaveValue)
      Should this item's value be saved in the form's values and hence returned from form.getValues()?

      shouldSaveValue:false is used to mark formItems which do not correspond to the underlying data model and should not save a value into the form's values. Example includes visual separators, password re-type fields, or checkboxes used to show/hide other form items.

      A shouldSaveValue:false item should be given a value either via FormItem.defaultValue or by calling form.setValue(item, value) or formItem.setValue(value). Providing a value via form.values or form.setValues() will automatically switch the item to shouldSaveValue:true.

      Note that

      • if an item is shouldSaveValue true, but has no name, a warning is logged, and shouldSaveValue will be set to false.
      Overrides:
      setShouldSaveValue in class CanvasItem
      Parameters:
      shouldSaveValue - New shouldSaveValue value. Default value is true
      Returns:
      SliderItem instance, for chaining setter calls
    • getShouldSaveValue

      public Boolean getShouldSaveValue()
      Should this item's value be saved in the form's values and hence returned from form.getValues()?

      shouldSaveValue:false is used to mark formItems which do not correspond to the underlying data model and should not save a value into the form's values. Example includes visual separators, password re-type fields, or checkboxes used to show/hide other form items.

      A shouldSaveValue:false item should be given a value either via FormItem.defaultValue or by calling form.setValue(item, value) or formItem.setValue(value). Providing a value via form.values or form.setValues() will automatically switch the item to shouldSaveValue:true.

      Note that

      • if an item is shouldSaveValue true, but has no name, a warning is logged, and shouldSaveValue will be set to false.
      Overrides:
      getShouldSaveValue in class CanvasItem
      Returns:
      Current shouldSaveValue value. Default value is true
    • getSlider

      public Canvas getSlider()
      This item is an autoChild generated Canvas displayed by the SliderItem and is an instance of Slider by default. It is customizable via the standard com.smartgwt.client.types.AutoChild pattern, by customizing sliderProperties and sliderConstructor.

      This component is an AutoChild named "slider". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current slider value. Default value is null
    • setVertical

      public SliderItem setVertical(Boolean vertical)
      Indicates whether this is a vertical or horizontal slider.
      Parameters:
      vertical - New vertical value. Default value is false
      Returns:
      SliderItem instance, for chaining setter calls
      See Also:
    • getVertical

      public Boolean getVertical()
      Indicates whether this is a vertical or horizontal slider.
      Returns:
      Current vertical value. Default value is false
      See Also:
    • setWidth

      public SliderItem setWidth(int width)
      Default width of this item.
      Overrides:
      setWidth in class FormItem
      Parameters:
      width - New width value. Default value is 150
      Returns:
      SliderItem instance, for chaining setter calls
      See Also:
    • getWidth

      public int getWidth()
      Default width of this item.
      Overrides:
      getWidth in class FormItem
      Returns:
      Current width value. Default value is 150
      See Also:
    • pendingStatusChanged

      public boolean pendingStatusChanged(DynamicForm form, FormItem item, boolean pendingStatus, Object newValue, Object value)
      Notification method called when showPending is enabled and this SliderItem should either clear or show its pending visual state.

      The default behavior is that the titleStyle and cellStyle are updated to include/exclude the "Pending" suffix. In addition, when displayed in the pending state the value label changes color. Returning false will cancel this default behavior.

      Parameters:
      form - the managing DynamicForm instance.
      item - the form item itself (also available as "this").
      pendingStatus - true if the item should show its pending visual state; false otherwise.
      newValue - the current form item value.
      value - the value that would be restored by a call to DynamicForm.resetValues().
      Returns:
      false to cancel the default behavior.
    • setDefaultProperties

      public static void setDefaultProperties(SliderItem sliderItemProperties)
      Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties of the class instance passed to this function. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.

      Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.

      Parameters:
      sliderItemProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • getDefaultValue

      public Double getDefaultValue()
      Default value for this sliderItems is 1.
      Overrides:
      getDefaultValue in class FormItem
      Returns:
      Current defaultValue value. Default value is 1
      See Also: