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

A way to remove a variable resolver automatically after a ZUML page is rendered

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 6.0.0
    • Component/s: None

      Description

      The variable resolver registered with <?variable-resolver?> will remain in the page. It is important for some applications, such as data binding, since variables will be retrieved later (after the page is initialized).

      However, some variable resolver is used only for providing variables that are required only in the rendering phase. It is better to be removed automatically after the page is rendered. Otherwise, if the same page has been created recursively, two or more instances of the same variable resolvers will be added and remained in the page.

      For example,
      //in a.zul
      <?variable-resolver class="X"?>
      <zscript>
      execution.createComponents("a.zul"...)
      </zscript>
      ${v}

      Since a.zul is rendered twice (recusively), two instances of X are added to page. Thus, if both instances resolves a variable, say, v, then ${v} is always an instance returned by the send instance of X, no matter it is called in the first rendering of a.zul or the second rendering.

      A possible solution: X implements an additional interface called Temporary, and then ZK remove it automatically if it found Temporary is implemented:

      class X implements VariableResolver, Temporary {
      ...

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            tomyeh tomyeh
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: