Major
Nice to have
Bugfix
Major
The default functionality fails if you do not represent the root node from a default structure:
- Tree selection is inconsistent: if the tree is empty (no child except the root node) the tree selects the invisible root node.
- Create not possible at level 1 (directly below the invisible root node). If you deselect the tree (Ctrl-click on the selection), the selection in the tree is empty and the Create command disappears. So you can create at most one child on level 1 and that only because of the first bug.
Improvements
Layout template for editing structures without root node
See /com.top_logic.element/webapp/WEB-INF/layouts/editStructureNoRoot.xml.
Configurable model transformation
New configuration options:
WithModelTransform (new mixin interface of LayoutComponent.Config and CommandHandler.Config:
List<PolymorphicConfiguration<? extends ModelTransform>> getTransforms().
A ModelTransform is a function that transforms a component model or the base model of a CommandHandler`s. So far, the model that a `CommandHandler gets in handleCommand(DisplayContext, LayoutComponent, Object model, Map<String, Object>) can be chosen relative to the component that the handler is configured on via the target configuration option. Possible values are accesses to component channels such as selection(self()). Now additionally a transformation of this so selected model can be configured. The transformation is applied to the model that is selected via the component channel in target. The transformation can either be implemented in Java or specified directly via TL-Scritp:
#!xml <open-handler id="openCreateElementDialog" target="selection(self())" > <transforms> <script function="x -> ($x == null).ifElse(`DemoTypes#ROOT`, $x)"/> </transforms> </open-handler>
Here the open-handler of a dialog gets either the selected object of the opening component, or the singleton ROOT of the DemoTypes structure if nothing is selected.
Code migration
- com.top_logic.layout.component.ModelForwardingDialogOpener has been dropped. Configuration of this handler can be omitted, functionality is available in default open handler.
- com.top_logic.mig.html.layout.DialogInfo.getOpenHandler() now has the com.top_logic.tool.boundsec.OpenModalDialogCommandHandler as default implementation. Explicit configurations can be omitted.
Test
- The aspect inheritance types in tl-demo are now displayed without root nodes.
- /com.top_logic.demo/src/test/com/top_logic/demo/scripted/tree/TestTreeWithoutRoot.script.xml