-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
10.0.0, 9.6.0.1
-
None
Steps to Reproduce
Add initiator to zk.xml
<listener> <listener-class>foo.bar.ShadowPageInitiator</listener-class> </listener>
Run sample locally (attached files)
Put breakpoint in foo.bar.ShadowPageInitiator.doInit(Page, Map<String, Object>)
Click button
Current Result
These component creations trigger Initiator.doInit
<apply templateURI="template-inner.zul" content='@load("separate zul file as template")' /> <template name="myExtTemplate" src="template-inner.zul" /> <apply template="myExtTemplate" content='@load("external template")'> </apply> <button onClick="@command('doTheThing')"/>
@Command("doTheThing") public void doTheThing() { Executions.createComponents("template-inner.zul", Executions.getCurrent().getDesktop().getFirstPage().getFirstRoot(),null); }
These component creations do not trigger Initiator.doInit
<apply templateURI="template-inner.zul" content='@load("separate zul file as template")' /> <apply templateName="myTemplate" content='@load("inline content")'> <div> <label value="@load(content)"/> </div> </apply>
Expected Result
Intiator.doInit javadoc states:
Note: when it is called, Page.getDesktop(), Page.getId() and Page.getTitle() all return null, since the page is not initialized yet.
When initiator is triggered by createComponents, it receives a page that has already been instantiated.
Debug Information
CreateComponents create a dummy page to instantiate the components.
Need to check if this is on spec.
- Should CreateComponents call initiators on the dummy page?
- Different apply structures have different results.
Workaround
To not trigger pre-init on initiator calls triggered by shadow element / createComponents calls, check for page UUID.
If page UUID is not null, do not proceed with page init workflow