ULC offers formatting and input validation on the client side through configurable formatters and validators. Using ULC validators, an application can handle validation automatically on the client and therefore eliminate server round trips for user input validation.
The data type classes convert non-text values (e.g., {@link java.util.Date} objects) to
strings using a specified format. Conversely, they are responsible for converting string values back to the non-text
type, applying validation criteria. These formatters and validators hence offer the abstraction for displaying and
editing non-text values in some ULCComponents (e.g., ULCTextField). For this reason, the
base interface for all
formatters and validators is called IDataType.
As an example, a ULCTextField can be configured to use a
ULCDateDataType. This object formats the displayed {@link java.util.Date} object in the specified way
and validates the user
input to be a valid date. In addition, the developer can access the value of the field directly as a {@link
java.util.Date} object.
ULCTextField dateField = new ULCTextField();
dateField.setDataType(new ULCDateDataType("dd.MM.yyyy"));
dateField.setValue(new Date());
// ...
Date dateEntered = (Date)dateField.getValue();
The following list shows all ULCComponents that can make use of IDataTypes.
| ULCComponent | Comments |
ULCTextField |
The value displayed in the text field is formatted and validated. |
ULCLabel |
The value displayed by the label is formatted. |
ULCTableColumn |
The values displayed by a column�s cells are formatted and validated. |
ULCTableTreeColumn |
The values displayed by a column�s cells are formatted and validated. |