com.vaadin.client.ui.

Class VSlider

  • All Implemented Interfaces:

    com.google.gwt.event.dom.client.HasBlurHandlers, com.google.gwt.event.dom.client.HasFocusHandlers, com.google.gwt.event.dom.client.HasKeyDownHandlers, com.google.gwt.event.dom.client.HasKeyPressHandlers, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasValueChangeHandlers<Double>, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.TakesValue<Double>, com.google.gwt.user.client.ui.AcceptsOneWidget, com.google.gwt.user.client.ui.Focusable, com.google.gwt.user.client.ui.HasOneWidget, com.google.gwt.user.client.ui.HasValue<Double>, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.HasWidgets.ForIsWidget, com.google.gwt.user.client.ui.IsWidget, Focusable, Field, SubPartAware, Iterable<com.google.gwt.user.client.ui.Widget>

    public class VSlider
    extends SimpleFocusablePanel
    implements Field, com.google.gwt.user.client.ui.HasValue<Double>, SubPartAware

    Widget class for the Slider component.

    Author:

    Vaadin Ltd

    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

        com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
      • Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets

        com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
    • Field Summary

      Fields
      Modifier and Type Field Description
      static String CLASSNAME

      Default classname for this widget.

      protected ApplicationConnection client

      Deprecated.

      this field is no longer used by the framework

      protected boolean disabled

      Is this widget disabled.

      protected String id

      Deprecated.

      this field is no longer used by the framework

      protected double max

      Maximum value of slider.

      protected double min

      Minimum value of slider.

      protected SliderOrientation orientation

      Current orientation (vertical/horizontal) of slider.

      protected boolean readonly

      Is this widget read-only.

      protected int resolution

      Resolution (precision level) of slider.

      protected Double value

      Current value of slider.

      • Fields inherited from class com.google.gwt.user.client.ui.UIObject

        DEBUG_ID_PREFIX
    • Constructor Summary

      Constructors
      Constructor Description
      VSlider()

      Constructs a widget for the Slider component.

    • Method Summary

      All Methods
      Modifier and Type Method Description
      com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler​(com.google.gwt.event.logical.shared.ValueChangeHandler<Double> handler)  
      void buildBase()

      For internal use only.

      protected int getEventPosition​(com.google.gwt.user.client.Event event)

      TODO consider extracting touches support to an impl class specific for webkit (only browser that really supports touches).

      protected int getNavigationDownKey()

      Get the key that decreases the vertical slider.

      protected int getNavigationLeftKey()

      Get the key that decreases the horizontal slider.

      protected int getNavigationRightKey()

      Get the key that increases the horizontal slider.

      protected int getNavigationUpKey()

      Get the key that increases the vertical slider.

      com.google.gwt.user.client.Element getSubPartElement​(String subPart)

      Locates an element inside a component using the identifier provided in subPart.

      String getSubPartName​(com.google.gwt.user.client.Element subElement)

      Provides an identifier that identifies the element within the component.

      Double getValue()  
      boolean handleNavigation​(int keycode, boolean ctrl, boolean shift)

      Handles the keyboard events handled by the Slider.

      void iLayout()

      Run internal layouting.

      void onBrowserEvent​(com.google.gwt.user.client.Event event)  
      void setConnection​(ApplicationConnection client)

      Deprecated.

      the updated field is no longer used by the framework

      void setDisabled​(boolean disabled)

      Disables or enables this slider.

      void setFeedbackValue​(double value)

      Updates the value shown in the feedback pop-up when the slider is moved.

      void setId​(String id)

      Deprecated.

      the updated field is no longer used by the framework

      void setMaxValue​(double value)

      Sets the maximum value for slider.

      void setMinValue​(double value)

      Sets the minimum value for slider.

      void setOrientation​(SliderOrientation orientation)

      Sets the slider orientation.

      void setReadOnly​(boolean readonly)

      Sets the read-only status of this slider.

      void setResolution​(int resolution)

      Sets the resolution (precision level) for slider as the number of fractional digits that are considered significant.

      void setStyleName​(String style)  
      void setStylePrimaryName​(String style)  
      void setUpdateValueOnClick​(boolean updateValueOnClick)

      Specifies whether or not click event should update the Slider's value.

      void setValue​(Double value)  
      void setValue​(Double value, boolean fireEvents)  
      protected void updateStyleNames​(String styleName, boolean isPrimaryStyleName)

      Updates the style names for this widget and the child elements.

      • Methods inherited from class com.google.gwt.user.client.ui.SimplePanel

        add, getContainerElement, getWidget, iterator, remove, setWidget, setWidget
      • Methods inherited from class com.google.gwt.user.client.ui.Panel

        add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
      • Methods inherited from class com.google.gwt.user.client.ui.Widget

        addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
      • Methods inherited from class com.google.gwt.user.client.ui.UIObject

        addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
      • Methods inherited from interface com.google.gwt.event.shared.HasHandlers

        fireEvent
    • Field Detail

      • client

        @Deprecated
        protected ApplicationConnection client
        Deprecated.
        this field is no longer used by the framework

        Current client-side communication engine.

      • id

        @Deprecated
        protected String id
        Deprecated.
        this field is no longer used by the framework

        Current connector id.

      • disabled

        protected boolean disabled

        Is this widget disabled.

      • readonly

        protected boolean readonly

        Is this widget read-only.

      • min

        protected double min

        Minimum value of slider.

      • max

        protected double max

        Maximum value of slider.

      • resolution

        protected int resolution

        Resolution (precision level) of slider.

      • value

        protected Double value

        Current value of slider.

      • orientation

        protected SliderOrientation orientation

        Current orientation (vertical/horizontal) of slider.

    • Constructor Detail

      • VSlider

        public VSlider()

        Constructs a widget for the Slider component.

    • Method Detail

      • setStyleName

        public void setStyleName​(String style)

        Overrides:

        setStyleName in class com.google.gwt.user.client.ui.UIObject

      • setStylePrimaryName

        public void setStylePrimaryName​(String style)

        Overrides:

        setStylePrimaryName in class com.google.gwt.user.client.ui.UIObject

      • updateStyleNames

        protected void updateStyleNames​(String styleName,
                                        boolean isPrimaryStyleName)

        Updates the style names for this widget and the child elements.

        Parameters:

        styleName - the new style name

        isPrimaryStyleName - true if the new style name is primary, false otherwise

      • setFeedbackValue

        public void setFeedbackValue​(double value)

        Updates the value shown in the feedback pop-up when the slider is moved. The value should match the current value of this widget.

        Parameters:

        value - the new value to show

      • buildBase

        public void buildBase()

        For internal use only. May be removed or replaced in the future.

      • onBrowserEvent

        public void onBrowserEvent​(com.google.gwt.user.client.Event event)

        Specified by:

        onBrowserEvent in interface com.google.gwt.user.client.EventListener

        Overrides:

        onBrowserEvent in class com.google.gwt.user.client.ui.Widget

      • getEventPosition

        protected int getEventPosition​(com.google.gwt.user.client.Event event)

        TODO consider extracting touches support to an impl class specific for webkit (only browser that really supports touches).

        Parameters:

        event - the event whose position to check

        Returns:

        the client position

      • iLayout

        public void iLayout()

        Run internal layouting.

      • handleNavigation

        public boolean handleNavigation​(int keycode,
                                        boolean ctrl,
                                        boolean shift)

        Handles the keyboard events handled by the Slider.

        Parameters:

        keycode - The key code received

        ctrl - Whether CTRL was pressed

        shift - Whether SHIFT was pressed

        Returns:

        true if the navigation event was handled

      • getNavigationUpKey

        protected int getNavigationUpKey()

        Get the key that increases the vertical slider. By default it is the up arrow key but by overriding this you can change the key to whatever you want.

        Returns:

        The keycode of the key

      • getNavigationDownKey

        protected int getNavigationDownKey()

        Get the key that decreases the vertical slider. By default it is the down arrow key but by overriding this you can change the key to whatever you want.

        Returns:

        The keycode of the key

      • getNavigationLeftKey

        protected int getNavigationLeftKey()

        Get the key that decreases the horizontal slider. By default it is the left arrow key but by overriding this you can change the key to whatever you want.

        Returns:

        The keycode of the key

      • getNavigationRightKey

        protected int getNavigationRightKey()

        Get the key that increases the horizontal slider. By default it is the right arrow key but by overriding this you can change the key to whatever you want.

        Returns:

        The keycode of the key

      • setConnection

        @Deprecated
        public void setConnection​(ApplicationConnection client)
        Deprecated.
        the updated field is no longer used by the framework

        Sets the current client-side communication engine.

        Parameters:

        client - the application connection that manages this component

      • setId

        @Deprecated
        public void setId​(String id)
        Deprecated.
        the updated field is no longer used by the framework

        Sets the id of this component's connector.

        Parameters:

        id - the connector id

      • setDisabled

        public void setDisabled​(boolean disabled)

        Disables or enables this slider. Users cannot interact with a disabled widget, and the default styles show it as grayed out (via opacity). The slider is enabled by default.

        Parameters:

        disabled - a boolean value specifying whether the slider should be disabled or not

        See Also:

        setReadOnly(boolean)

      • setReadOnly

        public void setReadOnly​(boolean readonly)

        Sets the read-only status of this slider. Users cannot interact with a read-only widget, but the default styles don't show it grayed out unless it's also disabled. The slider is not read-only by default.

        Parameters:

        readonly - a boolean value specifying whether the slider should be in read-only mode or not

        See Also:

        setDisabled(boolean)

      • setOrientation

        public void setOrientation​(SliderOrientation orientation)

        Sets the slider orientation. Updates the style names if the given orientation differs from previously set orientation.

        Parameters:

        orientation - the orientation to use

      • setMinValue

        public void setMinValue​(double value)

        Sets the minimum value for slider.

        Parameters:

        value - the minimum value to use

      • setMaxValue

        public void setMaxValue​(double value)

        Sets the maximum value for slider.

        Parameters:

        value - the maximum value to use

      • setResolution

        public void setResolution​(int resolution)

        Sets the resolution (precision level) for slider as the number of fractional digits that are considered significant. Determines how big change is used when increasing or decreasing the value, and where more precise values get rounded.

        Parameters:

        resolution - the number of digits after the decimal point

      • addValueChangeHandler

        public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler​(com.google.gwt.event.logical.shared.ValueChangeHandler<Double> handler)

        Specified by:

        addValueChangeHandler in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<Double>

      • getValue

        public Double getValue()

        Specified by:

        getValue in interface com.google.gwt.user.client.ui.HasValue<Double>

        Specified by:

        getValue in interface com.google.gwt.user.client.TakesValue<Double>

      • setValue

        public void setValue​(Double value)

        Specified by:

        setValue in interface com.google.gwt.user.client.ui.HasValue<Double>

        Specified by:

        setValue in interface com.google.gwt.user.client.TakesValue<Double>

      • setValue

        public void setValue​(Double value,
                             boolean fireEvents)

        Specified by:

        setValue in interface com.google.gwt.user.client.ui.HasValue<Double>

      • getSubPartElement

        public com.google.gwt.user.client.Element getSubPartElement​(String subPart)

        Description copied from interface: SubPartAware

        Locates an element inside a component using the identifier provided in subPart. The subPart identifier is component specific and may be any string of characters, numbers, space characters and brackets.

        Specified by:

        getSubPartElement in interface SubPartAware

        Parameters:

        subPart - The identifier for the element inside the component

        Returns:

        The element identified by subPart or null if the element could not be found.

      • getSubPartName

        public String getSubPartName​(com.google.gwt.user.client.Element subElement)

        Description copied from interface: SubPartAware

        Provides an identifier that identifies the element within the component. The subElement is a part of the component and must never be null.

        Note! getSubPartElement(getSubPartName(element)) == element is not always true. A component can choose to provide a more generic identifier for any given element if the results of all interactions with subElement are the same as interactions with the element identified by the return value. For example a button can return an identifier for the root element even though a DIV inside the button was passed as subElement because interactions with the DIV and the root button element produce the same result.

        Specified by:

        getSubPartName in interface SubPartAware

        Parameters:

        subElement - The element the identifier string should uniquely identify

        Returns:

        An identifier that uniquely identifies subElement or null if no identifier could be provided.

      • setUpdateValueOnClick

        public void setUpdateValueOnClick​(boolean updateValueOnClick)

        Specifies whether or not click event should update the Slider's value.

        Parameters:

        updateValueOnClick - true if a click should update slider's value, false otherwise