org.eclnt.jsfserver.elements.util

## Class ValidValuesBinding

- java.lang.Object
- - org.eclnt.jsfserver.elements.util.ValidValuesBinding

- All Implemented Interfaces:
    java.io.Serializable, IValueByToString, IDynamicContentBindingObject

      public class ValidValuesBinding
      extends java.lang.Object
      implements IValueByToString, java.io.Serializable, IDynamicContentBindingObject

  Holds a series of valid values, each value with an id and a text. Used e.g. in COMBOBOX component. The id is eihter to be passed as `String` or as simple data type. It is NOT allowed to pass a complex object inside.
  The simple data types that are suppored right now are:
  char, Character
  String
  int, Integer
  long, Long
  float, Float
  double, Double
  BigDecimal
  BigInteger
  UUID
  LocalDate, LocalTime
  Date
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `ValidValuesBinding.ValidValue` Item within the ValidValuesBinding.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ValidValuesBinding()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addValidValue(java.lang.Comparable value, java.lang.String text)` Adding value, allowing to passe simple data types as object.
    `void` | `addValidValue(java.lang.Comparable value, java.lang.String text, java.lang.String valuecomment)` Same as `addValidValue(String, String, String)` but now passing a simple data type object as value.
    `void` | `addValidValue(java.lang.Comparable value, java.lang.String text, java.lang.String valuecomment, java.lang.String image)` Same as `addValidValue(String, String, String, String)` but now passing any other simple data type object as value.
    `void` | `addValidValue(java.lang.String value, java.lang.String text)` Default method for adding values.
    `void` | `addValidValue(java.lang.String value, java.lang.String text, java.lang.String valuecomment)` Extended method for adding values, see `addValidValue(String, String)`.
    `void` | `addValidValue(java.lang.String value, java.lang.String text, java.lang.String valuecomment, java.lang.String image)` Extended method for adding values, see `addValidValue(String, String)`.
    `void` | `clear()`
    `java.lang.String` | `exportAsString()`
    `long` | `getChangeCounter()`
    `ValidValuesBinding.ValidValue` | `getValidValueByName(java.lang.String value)` Passes back valid value for corresponding name.
    `ValidValuesBinding.ValidValue` | `getValidValueByValue(java.lang.Comparable value)`
    `ValidValuesBinding.ValidValue` | `getValidValueByValue(java.lang.String value)` Passes back valid value for corresponding value.
    `java.util.Iterator<ValidValuesBinding.ValidValue>` | `getValidValues()`
    `protected float` | `numberValueOfString(java.lang.String s)` Converts a string value into a float value - as part of the method `sortByNumberValue()`
    `void` | `removeValidValue(java.lang.Comparable value)`
    `void` | `removeValidValue(java.lang.String value)`
    `int` | `size()`
    `void` | `sortByName()` Sort the contained items by text.
    `void` | `sortByName(java.util.Comparator<java.lang.String> comparator)` Same as `sortByName()`, but now passing an explicit comparator.
    `void` | `sortByNumberValue()` Sort the contained items by value.
    `void` | `sortByValue()` Sort the contained items by value.
    `void` | `sortByValue(java.util.Comparator<java.lang.String> comparator)` Same as `sortByValue()`, but now passing an explicit comparator.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ValidValuesBinding

          public ValidValuesBinding()

  - ### Method Detail

    - #### addValidValue

          public void addValidValue(java.lang.String value,
                                    java.lang.String text)

      Default method for adding values.
      Parameters:
        `value` - The id/value - this is the value actually filled into the corresponding property.
        `text` - The text description - this it what the user actually sees.

    - #### addValidValue

          public void addValidValue(java.lang.Comparable value,
                                    java.lang.String text)

      Adding value, allowing to passe simple data types as object. Only simple data types (Integer, BigDecimal, BigInteger, ...) are allowed.
      Parameters:
        `value` -
        `text` -

    - #### addValidValue

          public void addValidValue(java.lang.String value,
                                    java.lang.String text,
                                    java.lang.String valuecomment)

      Extended method for adding values, see `addValidValue(String, String)`.
      Parameters:
        `valuecomment` - You can pass an extended comment - in the combo box component definition you can specify to show a value-comment line (attribute WITHVALUECOMMENT). In this case the combo box item is a double line item, the first line being the text, the seconde line the value comment.

    - #### addValidValue

          public void addValidValue(java.lang.Comparable value,
                                    java.lang.String text,
                                    java.lang.String valuecomment)

      Same as `addValidValue(String, String, String)` but now passing a simple data type object as value.

    - #### addValidValue

          public void addValidValue(java.lang.String value,
                                    java.lang.String text,
                                    java.lang.String valuecomment,
                                    java.lang.String image)

      Extended method for adding values, see `addValidValue(String, String)`. Now passing image definition in addtion.

    - #### addValidValue

          public void addValidValue(java.lang.Comparable value,
                                    java.lang.String text,
                                    java.lang.String valuecomment,
                                    java.lang.String image)

      Same as `addValidValue(String, String, String, String)` but now passing any other simple data type object as value.

    - #### removeValidValue

          public void removeValidValue(java.lang.String value)

    - #### removeValidValue

          public void removeValidValue(java.lang.Comparable value)

    - #### clear

          public void clear()

    - #### getValidValues

          public java.util.Iterator<ValidValuesBinding.ValidValue> getValidValues()

    - #### size

          public int size()

    - #### getChangeCounter

          public long getChangeCounter()

    - #### sortByValue

          public void sortByValue()

      Sort the contained items by value. The sorting is done in a way that it is adequate for the data type being used as value.

    - #### sortByValue

          public void sortByValue(java.util.Comparator<java.lang.String> comparator)

      Same as `sortByValue()`, but now passing an explicit comparator.

    - #### sortByNumberValue

          public void sortByNumberValue()

      Sort the contained items by value. The String value is interpreted as number, so that sorting follows number sorting (not lexical sorting). Please pay attention: in case a string cannot be converted to a number, the string will be interpreted as value "0".

    - #### numberValueOfString

          protected float numberValueOfString(java.lang.String s)

      Converts a string value into a float value - as part of the method `sortByNumberValue()`

    - #### sortByName

          public void sortByName()

      Sort the contained items by text. Internally a simple bubble sort is used for sorting - expecting the number of items being not too high...

    - #### sortByName

          public void sortByName(java.util.Comparator<java.lang.String> comparator)

      Same as `sortByName()`, but now passing an explicit comparator.

    - #### getValidValueByValue

          public ValidValuesBinding.ValidValue getValidValueByValue(java.lang.String value)

      Passes back valid value for corresponding value.

    - #### getValidValueByValue

          public ValidValuesBinding.ValidValue getValidValueByValue(java.lang.Comparable value)

    - #### getValidValueByName

          public ValidValuesBinding.ValidValue getValidValueByName(java.lang.String value)

      Passes back valid value for corresponding name. In case of multiple values having the same name, the first value will be returned.

    - #### exportAsString

          public java.lang.String exportAsString()

    - #### toString

          public final java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright © CaptainCasa Gmbh. All Rights Reserved.