Class ChoiceProperty

All Implemented Interfaces:
PropertyVisitorAcceptor, Cloneable
Direct Known Subclasses:
LocaleProperty

@OpenApiAll public class ChoiceProperty extends AbstractChoiceProperty
The property selecting some value from a list of possible values or entering a new String value.
  • Constructor Details

    • ChoiceProperty

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

      public ChoiceProperty(String id, @CheckForNull Object value, 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(String id, @CheckForNull Object value, 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(String id, int index, 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(String id, int index, 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 Details

    • 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.
    • accept

      public void accept(PropertyVisitor v) throws Exception
      Accepts the PropertyVisitor.
      Specified by:
      accept in interface PropertyVisitorAcceptor
      Overrides:
      accept in class Property
      Parameters:
      v - the given visitor.
      Throws:
      Exception
    • 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(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 Object value)
      Sets value of the property.
      Overrides:
      setValue in class Property
      Parameters:
      value - a new value.
    • getClassType

      public String getClassType()
      Returns property class type.
      Specified by:
      getClassType in interface PropertyVisitorAcceptor
      Overrides:
      getClassType in class Property
      Returns:
      PropertyID.CHOICE_PROPERTY.
      See Also:
    • toString

      public 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.