In current layout templates, many parameters need to be filled in for which there is a reasonable default (e.g., component names and resource prefixes). Both are derived from the name of the layout file.
Since components are assigned qualified names (filename + local name), component names in templates can be constants (view, tab, editor, ...).
The convention for a view’s resource prefix is layouts.<view name without .layout.xml>.. It would be desirable to have this convention applied automatically, without having to write the value into every file.
Application
Instead of
#!xml
<include name="templates/levelOne.xml"
componentName="tableTab"
resPrefix="demo.table."
>
<inject>
<tabInfo
image="css:fas fa-table"
label="demo.table.tabber"
/>
</inject>
<components>
<layout-reference resource="my.app/myView.layout.xml"/>
...
For example, you might want to write:
#!xml
<include name="templates/tabbar.xml"
tabIcon="css:fas fa-table"
>
<components>
<layout-reference resource="my.app/myView.layout.xml"/>
...
To avoid having to specify explicit resource prefixes in a view, the calculated alias variable %LAYOUT_RESPREFIX% is available, which expands in each view to an individual resource prefix derived from the view name (path to the *.layout.xml file). This calculated alias is now used by default in the provided templates.
Migration
- Existing layout configurations must be migrated:
- Execute the Ant target ` update ` from the build script `/com.top_logic/bin/compat/upgrade-layout-templates.xml `.
- Normalize all layouts (run the ` normalize_layouts ` target from the application’s build script)
- This migration leaves configurations that have become unnecessary in the application layouts (res prefix, component names) to simplify the migration. Such values are typically referenced from outside the application (test cases, translations). Settings that are no longer necessary are prefixed with z_legacy_.
Test
Refactoring; no additional testing required.