Class ValidValuesBinding
java.lang.Object
org.eclnt.jsfserver.elements.util.ValidValuesBinding
- All Implemented Interfaces:
Serializable
,IValueByToString
,IDynamicContentBindingObject
public class ValidValuesBinding
extends Object
implements IValueByToString, 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 either to
be passed as
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
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Item within the ValidValuesBinding. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addValidValue
(Comparable value, String text) Adding value, allowing to passe simple data types as object.void
addValidValue
(Comparable value, String text, String valuecomment) Same asaddValidValue(String, String, String)
but now passing a simple data type object as value.void
addValidValue
(Comparable value, String text, String valuecomment, String image) Same asaddValidValue(String, String, String, String)
but now passing any other simple data type object as value.void
addValidValue
(String value, String text) Default method for adding values.void
addValidValue
(String value, String text, String valuecomment) Extended method for adding values, seeaddValidValue(String, String)
.void
addValidValue
(String value, String text, String valuecomment, String image) Extended method for adding values, seeaddValidValue(String, String)
.void
clear()
long
getValidValueByName
(String value) Passes back valid value for corresponding name.getValidValueByValue
(Comparable value) getValidValueByValue
(String value) Passes back valid value for corresponding value.protected float
Converts a string value into a float value - as part of the methodsortByNumberValue()
void
removeValidValue
(Comparable value) void
removeValidValue
(String value) int
size()
void
Sort the contained items by text.void
sortByName
(Comparator<String> comparator) Same assortByName()
, but now passing an explicit comparator.void
Sort the contained items by value.void
Sort the contained items by value.void
sortByValue
(Comparator<String> comparator) Same assortByValue()
, but now passing an explicit comparator.final String
toString()
-
Constructor Details
-
ValidValuesBinding
public ValidValuesBinding()
-
-
Method Details
-
addValidValue
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
Adding value, allowing to passe simple data types as object. Only simple data types (Integer, BigDecimal, BigInteger, ...) are allowed.- Parameters:
value
-text
-
-
addValidValue
Extended method for adding values, seeaddValidValue(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
Same asaddValidValue(String, String, String)
but now passing a simple data type object as value. -
addValidValue
Extended method for adding values, seeaddValidValue(String, String)
. Now passing image definition in addtion. -
addValidValue
Same asaddValidValue(String, String, String, String)
but now passing any other simple data type object as value. -
removeValidValue
-
removeValidValue
-
clear
public void clear() -
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
Same assortByValue()
, 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
Converts a string value into a float value - as part of the methodsortByNumberValue()
-
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
Same assortByName()
, but now passing an explicit comparator. -
getValidValueByValue
Passes back valid value for corresponding value. -
getValidValueByValue
-
getValidValueByName
Passes back valid value for corresponding name. In case of multiple values having the same name, the first value will be returned. -
exportAsString
-
toString
-