Tapestry
  1. Tapestry
  2. TAPESTRY-2014

ComponentResources should expose the page's lifecycle to interested listeners

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.7
    • Fix Version/s: 5.0.8
    • Component/s: None
    • Labels:
      None

      Description

      binding should be aware of at least pageAtached and pageDetached events
      to initialize, or clear contents.

      I've made a binding prefix for zebra effect

      <t:grid source="vessels" rowsPerPage="15" t:id="results" rowClass="cycle:line1,line2">
      </t:grid>

      the problem was that for every reload the first line would alternate. This is because binding is
      attached to a page instance and is not aware of page's lifecycle.

      I've made a workarround by having a static WeakHashmap tracking pages with this binding,
      and by adding:

      $

      {cycle:reset}

      at the begining of each page that uses this binding.

      some other bindings may also need to clean resources...

        Activity

        Davor Hrg created issue -
        Hide
        Howard M. Lewis Ship added a comment -

        I think your issue could be addressed by making it possible to add a PageLifecycleListener via the ComponentResources interface. Your binding instance could implement the interface, and be notified when the page was loaded, attached or detached.

        Clever use of bindings, btw.

        Show
        Howard M. Lewis Ship added a comment - I think your issue could be addressed by making it possible to add a PageLifecycleListener via the ComponentResources interface. Your binding instance could implement the interface, and be notified when the page was loaded, attached or detached. Clever use of bindings, btw.
        Hide
        Davor Hrg added a comment -

        yes, that would fit in nicxely.

        I've tried to do it right away, abut couldn't find a way to add the listener.
        the add method is internal and also "package private".

        I suppose this was intentionaly hidden...

        Show
        Davor Hrg added a comment - yes, that would fit in nicxely. I've tried to do it right away, abut couldn't find a way to add the listener. the add method is internal and also "package private". I suppose this was intentionaly hidden...
        Hide
        Davor Hrg added a comment -

        I see you have added var: binding prefix without exposing page lifecycle..

        _resources.storeRenderVariable(_name);
        _resources.getRenderVariable(_name);

        will page lifecycle be exposed ?

        I could just use those two methods using "::cycle_binding::" as key...

        Show
        Davor Hrg added a comment - I see you have added var: binding prefix without exposing page lifecycle.. _resources.storeRenderVariable(_name); _resources.getRenderVariable(_name); will page lifecycle be exposed ? I could just use those two methods using "::cycle_binding::" as key...
        Howard M. Lewis Ship made changes -
        Field Original Value New Value
        Assignee Howard M. Lewis Ship [ hlship ]
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Howard M. Lewis Ship added a comment -

        Changed the description; bindings are one good example of an interested listener.

        Show
        Howard M. Lewis Ship added a comment - Changed the description; bindings are one good example of an interested listener.
        Howard M. Lewis Ship made changes -
        Summary binding prefix should be aware of page's lifecycle ComponentResources should expose the page's lifecycle to interested listeners
        Howard M. Lewis Ship made changes -
        Fix Version/s 5.0.8 [ 12312898 ]
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12420215 ] Default workflow, editable Closed status [ 12568288 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12568288 ] jira [ 12591354 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        3d 13h 47m 1 Howard M. Lewis Ship 07/Jan/08 23:02
        In Progress In Progress Closed Closed
        1h 5m 1 Howard M. Lewis Ship 08/Jan/08 00:08

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Davor Hrg
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development