Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-5014

UiEngineImpl.createComponents trigger page initiator after page init


    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • None

      Steps to Reproduce

      Add initiator to zk.xml




      Run sample locally (attached files)


      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")'>
      		<button onClick="@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")'>
      				<label value="@load(content)"/>


      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.


      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

        1. shadow-initiator.zul
          0.6 kB
        2. ShadowInitiatorViewModel-1.java
          0.3 kB
        3. ShadowPageInitiator-1.java
          0.8 kB
        4. template-inner.zul
          0.1 kB

            Unassigned Unassigned
            MDuchemin MDuchemin
            0 Vote for this issue
            3 Start watching this issue