Class Spinner

    • Constructor Detail

      • Spinner

        public Spinner()
        Creates a spinner populated with an empty array list.

        The default contents is an ImmutableList so that if the default property (which is "spinnerData") is invoked in a BXML file, BXMLSerializer trying to add to this immutable sequence will catch an exception and will do a setSpinnerData(List) instead.

      • Spinner

        public Spinner​(List<?> spinnerData)
        Creates a spinner populated with the given spinner data.

        Note that the default renderer uses (as last option) the toString method on list elements, so override it to return whatever you want to display as text, or implement your own custom renderer.

        Parameters:
        spinnerData - The data to set.
        See Also:
        SpinnerItemRenderer
    • Method Detail

      • getSpinnerData

        public List<?> getSpinnerData()
        Returns:
        The data currently presented by the spinner.
      • setSpinnerData

        public void setSpinnerData​(List<?> spinnerData)
        Sets the spinner data. Clears any existing selection state.
        Parameters:
        spinnerData - The data to be presented by the spinner.
      • setSpinnerData

        public final void setSpinnerData​(java.lang.String spinnerData)
      • setSkin

        protected void setSkin​(Skin skin)
        Description copied from class: Component
        Sets the skin, replacing any previous skin.
        Overrides:
        setSkin in class Component
        Parameters:
        skin - The new skin.
      • getItemRenderer

        public Spinner.ItemRenderer getItemRenderer()
        Returns:
        The item renderer used for items in this list.
      • setItemRenderer

        public void setItemRenderer​(Spinner.ItemRenderer itemRenderer)
        Sets the item renderer to be used for items in this list.
        Parameters:
        itemRenderer - The new item renderer for the list.
      • isCircular

        public boolean isCircular()
        Returns:
        Whether or not this spinner's values are circular.
      • setCircular

        public void setCircular​(boolean circular)
        Set whether the values in this spinner wrap around from the end back to the beginning (and vice-versa).
        Parameters:
        circular - The new setting for this spinner.
      • getSelectedIndex

        public int getSelectedIndex()
        Returns:
        The currently selected index.
      • setSelectedIndex

        public void setSelectedIndex​(int selectedIndex)
        Sets the selection to the specified index.
        Parameters:
        selectedIndex - The index to select, or -1 to clear the selection.
      • getSelectedItem

        public java.lang.Object getSelectedItem()
      • setSelectedItem

        public void setSelectedItem​(java.lang.Object item)
      • getSpinnerDataKey

        public java.lang.String getSpinnerDataKey()
      • setSpinnerDataKey

        public void setSpinnerDataKey​(java.lang.String spinnerDataKey)
      • getSpinnerDataBindType

        public BindType getSpinnerDataBindType()
      • setSpinnerDataBindType

        public void setSpinnerDataBindType​(BindType spinnerDataBindType)
      • getSelectedItemKey

        public java.lang.String getSelectedItemKey()
      • setSelectedItemKey

        public void setSelectedItemKey​(java.lang.String selectedItemKey)
      • getSelectedItemBindType

        public BindType getSelectedItemBindType()
      • setSelectedItemBindType

        public void setSelectedItemBindType​(BindType selectedItemBindType)
      • setSelectedItemBindMapping

        public void setSelectedItemBindMapping​(Spinner.ItemBindMapping selectedItemBindMapping)
      • load

        public void load​(java.lang.Object context)
        Description copied from class: Container
        Propagates binding to subcomponents.
        Overrides:
        load in class Container
        Parameters:
        context - The object we're binding to.
      • store

        public void store​(java.lang.Object context)
        Description copied from class: Container
        Propagates binding to subcomponents.
        Overrides:
        store in class Container
        Parameters:
        context - The object we're binding to.
      • clear

        public void clear()
        Description copied from class: Container
        Propagates clear operation to subcomponents.
        Overrides:
        clear in class Container
      • clearSelection

        public void clearSelection()
        Clears the selection.
      • getContentBounds

        public Bounds getContentBounds()
        Gets the bounding area of the spinner content (the area in which the item renderer will render the content).
        Returns:
        The bounding area of the spinner content.