Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For example, a datetime dataprovider can be shown and edited in a calendar UI element.
With a UI converter you can use any dataprovider type in any UI element.

Configuring UI converters in form editor

The UI converter is configured at element level in the form editor.
It is edited as part of the format property of an element.

The format property editor allows configuration of the UI converter (mark the checkbox and select one of the available converters).

Built-in UI converter (

...

GlobalMethodConverter)

Servoy delivers one built-in UI converter, the GlobalMethodConverter, which can also be used as database value converter.
The GlobalMethodConverter has 3 properties:

  • fromObjectMethodName
    The global method that converts from UI value to dataprovider value
  • toObjectMethodName
    The global method that converts from dataprovider value to UI value
  • type (one of TEXT, INTEGER, NUMBER, DATETIME or MEDIA)
    The UI data type (so the resulting type of the toObjectMethodName method).

Example of configuring a UI converter for a form element using the GlobalMethodConverter:

UI Converter from java code (plugin)

A UI converter can be contributed by a java plugin.
To do this, the plugin must implement interface IUIConverterProvider to produce IUIConverter instances in the getUIConverters() method, see http://www.servoy.com/docs/public-api/70x/com/servoy/j2db/plugins/IUIConverterProvider.html.

A IUIConverter converter has 3 methods, similar to the GlobalMethodConverter:

  • convertFromObject()
    Convert from UI value to dataprovider value
  • convertToObject()
    Converts from dataprovider value to UI value
  • type (one of TEXT, INTEGER, NUMBER, DATETIME or MEDIA)
    The UI data type (so the resulting type of the convertToObject()).

Java code example

Solution model

UI converters are currently not supported by the solution model.