Class ChoiceProperty

    • Field Detail

      • maximum

        private int maximum
        The maximum size of possible values list.
      • UNLIMITED

        private static final int UNLIMITED
        The constant for unlimited values list size.
        See Also:
        Constant Field Values
      • appendValue

        private boolean appendValue
        If property is editable, entered value is appended to the choice.
      • index

        private int index
    • Constructor Detail

      • ChoiceProperty

        public ChoiceProperty()
        Default constructor. Value of the property will be null. ID will be empty string.
      • ChoiceProperty

        public ChoiceProperty​(java.lang.String id,
                              @CheckForNull
                              java.lang.Object value,
                              java.util.List choice)
        The constructor.
        Parameters:
        id - the ID of property.
        value - the value of the property.
        choice - the list of possible values.
      • ChoiceProperty

        public ChoiceProperty​(java.lang.String id,
                              @CheckForNull
                              java.lang.Object value,
                              java.util.List choice,
                              int max)
        The constructor.
        Parameters:
        id - the ID of property.
        value - the value of the property.
        choice - the list of possible values.
        max - the maximum size of possible values list.
      • ChoiceProperty

        public ChoiceProperty​(java.lang.String id,
                              int index,
                              java.util.List choice,
                              int max)
        The constructor.
        Parameters:
        id - the ID of property.
        index - the index in choice of selected value.
        choice - the list of possible values.
        max - the maximum size of possible values list.
      • ChoiceProperty

        public ChoiceProperty​(java.lang.String id,
                              int index,
                              java.util.List choice)
        The constructor.
        Parameters:
        id - the ID of property.
        index - the index in choice of selected value.
        choice - the list of possible values.
    • Method Detail

      • isAppendValue

        public boolean isAppendValue()
        Return append value flag.
        Returns:
        the appendValue flag.
      • setAppendValue

        public void setAppendValue​(boolean appendValue)
        Sets the append value flag. If property is editable, entered value is appended to the choice.
        Parameters:
        appendValue - the append state of the property.
      • getIndex

        public int getIndex()
        Returns the index of value in the choice list.
        Returns:
        index of value in the choice list; if value is not in the choice list, return -1.
      • setChoice

        public void setChoice​(java.util.List val)
        Sets the list of possible values for selecting. Sets only mMaximum number of values from the List's beginning.
        Overrides:
        setChoice in class AbstractChoiceProperty
        Parameters:
        val - a new possible values list.
      • setIndex

        public void setIndex​(int val)
        Sets index of selected value. The index in possible values' list of new property value.
        Parameters:
        val - a new index.
      • setValue

        public void setValue​(@CheckForNull
                             java.lang.Object value)
        Sets value of the property.
        Overrides:
        setValue in class Property
        Parameters:
        value - a new value.
      • toString

        public java.lang.String toString()
        The string representation of the property. Used for debugging purposes only.
        Overrides:
        toString in class Property
        Returns:
        the string representation.
      • clone

        public ChoiceProperty clone()
        Description copied from class: Property
        Clones the property. Clone is not deep, the clone will have the same instance of value. The clone will not have registered PropertyChangeListeners.
        Overrides:
        clone in class AbstractChoiceProperty
        Returns:
        the cloned property.