Class Choice<T>

  • Type Parameters:
    T - The data type of the value help by this instance

    public class Choice<T>
    extends java.lang.Object
    This class represents a choice in some controls and has an associated label, tool tip, value and whether the choice is checked.
    • Constructor Summary

      Constructors 
      Constructor Description
      Choice()  
      Choice​(T value)
      Creates a choice object.
      Choice​(T value, java.lang.String label)
      Creates a choice object.
      Choice​(T value, java.lang.String label, java.lang.String toolTip)
      Creates a choice object.
      Choice​(T value, java.lang.String label, java.lang.String toolTip, boolean isSelected)
      Creates a choice object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getLabel()
      Gets the label used to display this choice.
      java.lang.String getToolTip()
      The tool tip which will be associated to this choice.
      T getValue()
      Gets the value associated to this choice.
      boolean isSelected()
      Whether this choice is currently selected
      void setLabel​(java.lang.String label)
      Sets the label used to display this choice.
      void setSelected​(boolean isSelected)
      Sets whether this choice is currently selected.
      void setToolTip​(java.lang.String toolTip)
      Sets the tool tip associated to this choice.
      void setValue​(T value)
      Sets the value associated to this choice.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Choice

        public Choice()
      • Choice

        public Choice​(T value)
        Creates a choice object. Label and tool tip will be based on calling toString on the value provided.
        Parameters:
        value - The value this choice object represents.
      • Choice

        public Choice​(T value,
                      java.lang.String label)
        Creates a choice object. Tool tip will be based on the provided label string.
        Parameters:
        value - The value this choice object represents.
        label - The displayed string for this choice.
      • Choice

        public Choice​(T value,
                      java.lang.String label,
                      java.lang.String toolTip)
        Creates a choice object.
        Parameters:
        value - The value this choice object represents.
        label - The displayed string for this choice.
        toolTip - The tool tip associated to this choice.
      • Choice

        public Choice​(T value,
                      java.lang.String label,
                      java.lang.String toolTip,
                      boolean isSelected)
        Creates a choice object.
        Parameters:
        value - The value this choice object represents.
        label - The displayed string for this choice.
        toolTip - The tool tip associated to this choice.
        isSelected - Whether this choice is checked by default.
    • Method Detail

      • isSelected

        public boolean isSelected()
        Whether this choice is currently selected
        Returns:
        True if this choice is selected.
      • setSelected

        public void setSelected​(boolean isSelected)
        Sets whether this choice is currently selected.
        Parameters:
        isSelected - Provide true to select this choice.
      • getToolTip

        public java.lang.String getToolTip()
        The tool tip which will be associated to this choice.
        Returns:
        The tool tip.
      • setToolTip

        public void setToolTip​(java.lang.String toolTip)
        Sets the tool tip associated to this choice.
        Parameters:
        toolTip - The tool tip.
      • getLabel

        public java.lang.String getLabel()
        Gets the label used to display this choice.
        Returns:
        The label string.
      • setLabel

        public void setLabel​(java.lang.String label)
        Sets the label used to display this choice.
        Parameters:
        label - The label string to use.
      • getValue

        public T getValue()
        Gets the value associated to this choice.
        Returns:
        The value associated.
      • setValue

        public void setValue​(T value)
        Sets the value associated to this choice.
        Parameters:
        value - The value to be associated.