enhancement
critical
major
minor
minor
critical
#25647
Multiple relationships between components
Currently, a component channel can only be linked to one other channel at a time. It would be better if, when selecting a component channel, you could link multiple channels to it and thus create a composite model.
This is important, for example, when a list of values needs to be calculated from multiple selections in different components.
Application
In-App Configuration now offers two additional options for component linking: "Combination" and "Transformation." These options allow the values of multiple input channels to be combined into a single list value,
or a value from an input channel can be transformed using a function.
The XML configuration syntax for combination is:
#!xml
<model class="com.top_logic.layout.channel.linking.impl.CombineLinking">
<channel name="selection">
<target name="com.top_logic.demo/technical/components/combiningChannel/attributeChecklistMultiSelector.layout.xml#Selector"/>
</channel>
<channel name="selection">
<target name="com.top_logic.demo/technical/components/combiningChannel/attributeChecklistSingleSelector.layout.xml#Selector"/>
</channel>
</model>
The XML configuration syntax for transformation is:
#!xml <model class="com.top_logic.model.search.providers.TransformLinkingByExpression" function="x -> $x.get(`DemoTypes:A#singleStructure`)" input="selection(com.top_logic.demo/technical/components/transformingChannel/asTable.layout.xml#Table)" />
Code Migration
The "LayoutRelationManager" has been removed. Component events are delivered directly via component channel links.
- LayoutComponent.beforeModelSet(...) has been removed. Instead, afterModelSet(...) must be used.
- The LayoutComponent.changedByXXX() methods have been removed without replacement.
- The ValidationListener interface and the configurability in LayoutComponent have been removed. Instead, doValidateModel(...) must be overridden in a subclass of the component.
- The methods `receiveModelXXXByYYY(...) ` in `LayoutComponent ` have been removed. Instead, a ` ChannelListener ` or `ChannelValueFilter ` can be registered on a component channel.
- Components that implement the Selectable interface must no longer override its default methods for getSelected() and setSelected(). Likewise, the `fireSelection(...)` method of `LayoutComponent` must no longer be called. Its functionality has been removed. A new selection is announced exclusively by calling ` Selectable.setSelected(...) `. This is handled automatically by the corresponding component channel.
- The ability to transform component models upon receipt in a component has been removed, along with the ModelTransform interface and all related configuration options. The corresponding functionality must now be implemented using a TransformingChannel.
- The LayoutComponent#getInitialModel() hook has been removed. Instead, a ModelProvider must be configured to calculate the initial model.
- An external Relations.xml file is no longer supported. All component relationships must be specified in the component definition.
- A form no longer has a selection channel. Instead of model="selection(MyForm)", you must now write model="model(MyForm)".
- The configuration options `supportsHistoric ` and `showCurrent` in `tl:LayoutComponent` have been removed. Components display exactly the models they receive; further details may be handled by a `tl:ModelBuilder`. The transformation of a historical model into a current one must be implemented via a transformation on the model channel.
Test
- /com.top_logic.demo/src/test/com/top_logic/demo/scripted/layout/channels/TestCombiningChannel.script.xml
- /com.top_logic.demo/src/test/com/top_logic/demo/scripted/layout/channels/TestTransformingChannel.script.xml