Reducing Redirects
From Vexi
This has been implemented as of r2908
Contents |
[edit]
Current Structure
Currently the widgets are heavily nested children which were originally created when Vexi had problems with repeatedly assigning the redirect property. The template vexi.util'redirect was created specifically to redirect properties in the widget templates.
e.g. vexi.widget.mywidget with addRedirect() for properties to each node:
<ui:box redirect=":$content">
<lay:margin>
<theme:mywidget>
<lay:pad>
<ui:box id="content" />
Disadvantages:
- The library component of the widget can not see the outermost widget (Note: we set 'v_widget' where required)
- A large number of redirects (which amounts to a non-trivial amount of start-up overhead)
[edit]
Proposed Structure
Instead we could use preapplies where the redirect is implicit. This would allow a large reduction in the addRedirect() calls:
e.g. vexi.widget.mywidget
<lay:margin /> <theme:mywidget /> <lay:pad />
[edit]
Issues
- May still need to redirect some properties:
- 'layout', 'orient'
[edit]
Improvements
- Preset margin/padding detection can be built in to the lay:margin and lay:pad widgets
- Post-apply of role:focusable can be moved into theme or library widgets

