Menu

ManualCustomConverters

Remo

Custom Converters and Databinding Validators

Eclipse Data Binding uses converters and validators (which are different to model validators) to convert values between their model representation and their widget representation.
E.g. binding a Date to a Text field which uses a string representation will internally use a DateToStringConverter to convert the model value to the text representation
and a StringToDateConverter to convert it back after being modified by the user. A validator will be called before conversion to make sure the text in the widget
is in a valid date format.

RCPForms adds some useful default converters for dates, null value handling and more.
You can use different converters in the following ways:

  • if there are specific places in your system where values should be converted differently than usual, you can pass custom converters directly in the ValidationManager.bindValue(...., IConverter,IConverter,....) method.
  • Not fully implemented yet !: If you want to configure system-wide conversions e.g. for account numbers or specific date formatting; this guarantees that individual form developers do not need to take care of this topic and these values are handled the same way system wide.

System wide conversions can be registered using the ConverterRegistry.registerConverter() methods. These are automatically used if values are bound using the ValidationManager.bindValue() methods.
TODO: explain class hierarchy type matching and lookup.
TODO: examples


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.