Verbesserung
Top-Thema
Detail
Wichtig
Detail
Detail
#26263
Keine Konfigurationsdefaults für `content-layouting` in Layout-Konfigurationen
Die content-layouting (getContentLayouting) Konfiguration der tl:LayoutComponent besitzt eine tl:InstanceFormat und tl:InstanceDefault Annotation. Der Standartwert entspricht tl:ContentLayouting. ContentLayouting besitzt jedoch kein eigenes Config-Interface. Beim Erzeugen bspw. einer neuen Instanz von LayoutComponent.Config werden insbesondere die Standartwerte initialisiert, also auch das ContentLayouting. Dazu erzeugt er neue Instanz von AbstractContentLayouting.Config und setzt darauf die Implementierungsklasse ContentLayouting. Also ist valueSet der Implementierungsklasse true. Da die Implementierungsklasse geändert wurde, schreibt der tl:ConfigurationWriter auch die Property content-layouting mit heraus. Das ist unschön und führt zu sehr unlesbaren Konfigurationen.
Zum Beispiel:
#!xml <components> <layout-reference resource="foobar.layout.xml"> <content-layouting class="com.top_logic.layout.structure.ContentLayouting"> <contextMenuFactory class="com.top_logic.layout.basic.contextmenu.component.factory.PlainComponentContextMenuFactory"> <customCommands class="com.top_logic.layout.basic.contextmenu.config.NoContextMenuCommands"/> </contextMenuFactory> </content-layouting> </layout-reference> <layout-reference resource="foobar2.layout.xml"> <content-layouting class="com.top_logic.layout.structure.ContentLayouting"> <contextMenuFactory class="com.top_logic.layout.basic.contextmenu.component.factory.PlainComponentContextMenuFactory"> <customCommands class="com.top_logic.layout.basic.contextmenu.config.NoContextMenuCommands"/> </contextMenuFactory> </content-layouting> </layout-reference> </components>
Man sieht, dass für Tabbars das Ergebnis sehr unschön ist. Stattdessen wäre
#!xml <components> <layout-reference resource="foobar.layout.xml"/> <layout-reference resource="foobar2.layout.xml"/> </components>
eine wesentlich übersichtlere Serialisierung der Konfiguration.
Lösung
Explizite Config-Interfaces für die Implementierungsklassen, obwohl keine Konfigurationseigenschaften gesetzt werden können.
Code-Migration
Durch den Ant-Task z_remove_default_content_layouting werden die Layouts im Dateisystem wie oben beschrieben angepasst. Es ist keine Code-Migration zwingend notwendig, die alten Layouts sind selbstverständlich weiterhin gültig.
Test
Refactoring, kein Test.