Extending linkki

Faktor-IPS Extension

linkki is often used in conjunction with Faktor-IPS. The module linkki-ips-vaadin8 provides some useful functionalities for this combination.

To use the extension simply include the following maven dependeny:

<dependency>
    <groupId>org.linkki-framework</groupId>
    <artifactId>linkki-ips-vaadin8</artifactId>
</dependency>

Fields for Specific Datatypes

A new UI component annotation @UIDecimalField supports the Faktor-IPS datatype Decimal. It is quite similar to @UIDoubleField but supports Decimal instead of Double.

Other specific fields for example a money field may follow.

Message Converter

Faktor-IPS brings its own implementation of Message and MessageList which are used for the validation framework on the business layer. linkki on the other hand uses its own Message and MessageList implementation in the UI layer. To convert these messages from Faktor-IPS to linkki, the Faktor-IPS extension provides a MessageConverter. It is best used directly in the ValidationService which is provided to the BindingManager.

Have a look at the code example in the section below.

Faktor-IPS Property Dispatcher

A special PropetyDispatcher called IpsPropertyDispatcher could be used in a binding context to get some information from the Faktor-IPS model when using appropriate model binding.

In case you do not specify a label for an UI component in your PMO the dispatcher tries to retrieve the label from the underlying model object. That means, if your underlying model object is generated by Faktor-IPS and the associated bound model attribute is a Faktor-IPS attribute, it returns the label of this Faktor-IPS attribute.

To include the IpsPropertyDispatcher as a custom dispatcher in the BindingContext, the IpsPropertyDispatcherFactory can be provided to the constructor of the DefaultBindingManager. If you already have a custom PropertyDispatcherFactory you could simply instantiate the IpsPropertyDispatcher in your subclass using the factory method IpsPropertyDispatcher#createIpsPropertyDispatcher.

Using IpsPropertyDispatcherFactory
        BindingManager bindingManager = new DefaultBindingManager(
                () -> MessageConverter.convert(ipsModelObject.validate(new ValidationContext())),
                PropertyBehaviorProvider.NO_BEHAVIOR_PROVIDER, new IpsPropertyDispatcherFactory());