Tapestry 5
  1. Tapestry 5
  2. TAP5-746

Zone should include an option to periodically update itself

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.5
    • Fix Version/s: 5.3
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      By default, it should re-render its own body, unless some other renderable result is return by event handlers for the update event it will trigger.

      1. zone-refresh.patch
        13 kB
        Taha Hafeez
      2. zone-refresh.patch
        15 kB
        Taha Hafeez
      3. zone-refresh.patch
        16 kB
        Taha Hafeez

        Activity

        Hide
        Giulio Micali added a comment -

        I suggest to NOT add more weight to the zone class.

        A simple mixin can render the javascript timer initialization and can handle the event request.
        And, more important, component developers can create alternative mixins, without the need of dribbling existing code in order to avoid javascript/event handler conflicts.

        Show
        Giulio Micali added a comment - I suggest to NOT add more weight to the zone class. A simple mixin can render the javascript timer initialization and can handle the event request. And, more important, component developers can create alternative mixins, without the need of dribbling existing code in order to avoid javascript/event handler conflicts.
        Hide
        Paul Stanton added a comment -

        i agree, this should not be added directly to the zone component. there are other considerations, like which event last updated the zone? was it part of a multizoneupdate? if you hand control to the zone to decide where to ask for an update, it is likely to get it wrong. often, a zone in my applications could be updated by many different events within the same page.

        Show
        Paul Stanton added a comment - i agree, this should not be added directly to the zone component. there are other considerations, like which event last updated the zone? was it part of a multizoneupdate? if you hand control to the zone to decide where to ask for an update, it is likely to get it wrong. often, a zone in my applications could be updated by many different events within the same page.
        Hide
        Taha Hafeez added a comment -

        The patch adds a mixin ZoneRefresh which can be added to a zone to periodically update it

        Show
        Taha Hafeez added a comment - The patch adds a mixin ZoneRefresh which can be added to a zone to periodically update it
        Hide
        Taha Hafeez added a comment -

        Modified the ZoneRefresh mixin to load the zone by default without the need of an event handler.

        Show
        Taha Hafeez added a comment - Modified the ZoneRefresh mixin to load the zone by default without the need of an event handler.
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #406 (See https://builds.apache.org/job/tapestry-trunk-freestyle/406/)
        TAP5-746 : Zone should include an option to periodically update itself
        From Taha Hafeez

        ffacon : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1142187
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneRefreshDemo.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/zone-refresh.js
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/EventConstants.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/mixins/ZoneRefreshTest.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneRefreshDemo.tml
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/mixins
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Index.tml
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/ZoneRefresh.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #406 (See https://builds.apache.org/job/tapestry-trunk-freestyle/406/ ) TAP5-746 : Zone should include an option to periodically update itself From Taha Hafeez ffacon : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1142187 Files : /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneRefreshDemo.java /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/zone-refresh.js /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/EventConstants.java /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/mixins/ZoneRefreshTest.java /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneRefreshDemo.tml /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/mixins /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Index.tml /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/ZoneRefresh.java /tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml
        Hide
        Taha Hafeez added a comment -

        Rewrite tests, replacing calls to Thread.sleep() with waitForCondition(). Also changed implementation to prevent memory leaks

        Show
        Taha Hafeez added a comment - Rewrite tests, replacing calls to Thread.sleep() with waitForCondition(). Also changed implementation to prevent memory leaks
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #409 (See https://builds.apache.org/job/tapestry-trunk-freestyle/409/)
        TAP5-746 : Zone should include an option to periodically update itself
        Taha Hafeez : replacing Thread.sleep() with waitForCondition(prototype) . implementation use of js event and zone.getBody()

        ffacon : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1142826
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneRefreshDemo.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/zone-refresh.js
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneRefreshWithHandlerReturningVoid.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneRefreshWithHandlerReturningVoid.tml
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneRefreshDemo.tml
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Index.tml
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneRefreshWithHandlerReturningZone.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/ZoneRefresh.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneRefreshWithHandlerReturningZone.tml
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #409 (See https://builds.apache.org/job/tapestry-trunk-freestyle/409/ ) TAP5-746 : Zone should include an option to periodically update itself Taha Hafeez : replacing Thread.sleep() with waitForCondition(prototype) . implementation use of js event and zone.getBody() ffacon : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1142826 Files : /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneRefreshDemo.java /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/mixins/zone-refresh.js /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneRefreshWithHandlerReturningVoid.java /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneRefreshWithHandlerReturningVoid.tml /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneRefreshDemo.tml /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/Index.tml /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ZoneRefreshWithHandlerReturningZone.java /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/ZoneRefresh.java /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ZoneRefreshWithHandlerReturningZone.tml
        Hide
        François Facon added a comment -

        I guess that soon Tapestry components will use an agnostic js layer. The current implementation depend on prototype.
        for the timer, test on ajax call, dom manipulation. So I let this jira open in order change the implementation in the future.

        Next step will be the use of pubsub pattern.
        It would be nice to connect this component to a push channel (WS, RTMPT (Flash), comet, polling). If we define a startegie based on both client and server capabilities, the frequency parameter make sense only on polling. Also in polling mode, server must be able to regulate the client call frequency when facing heavy charge, session get invalidate, or nothing to update...
        So I feel that it would be better to replace this parameter by an ordered Array of JSON object get from the server and define a way to let the server regulate the pooling frequency if needed.

        In pooling mode, I guess that a single timer or executor or worker is needed. It would be in charge of :

        • registering the subscription on a channel from any zone
        • getting data related to channel from the server
        • dispatching data to any listener.

        But perhaps it's to much.

        Show
        François Facon added a comment - I guess that soon Tapestry components will use an agnostic js layer. The current implementation depend on prototype. for the timer, test on ajax call, dom manipulation. So I let this jira open in order change the implementation in the future. Next step will be the use of pubsub pattern. It would be nice to connect this component to a push channel (WS, RTMPT (Flash), comet, polling). If we define a startegie based on both client and server capabilities, the frequency parameter make sense only on polling. Also in polling mode, server must be able to regulate the client call frequency when facing heavy charge, session get invalidate, or nothing to update... So I feel that it would be better to replace this parameter by an ordered Array of JSON object get from the server and define a way to let the server regulate the pooling frequency if needed. In pooling mode, I guess that a single timer or executor or worker is needed. It would be in charge of : registering the subscription on a channel from any zone getting data related to channel from the server dispatching data to any listener. But perhaps it's to much.
        Hide
        Massimo Lusetti added a comment -

        I think you have committed the changes for this and this should be closed.

        Your suggestion are valid and now zone-refresh use an optional div which is not needed by my tests but we are approaching 5.3 release so a future issue could be raised to improve things

        Show
        Massimo Lusetti added a comment - I think you have committed the changes for this and this should be closed. Your suggestion are valid and now zone-refresh use an optional div which is not needed by my tests but we are approaching 5.3 release so a future issue could be raised to improve things
        Hide
        Massimo Lusetti added a comment -

        This is a leftover from after the commit r1142187 and r1142826 improvements will be addressed

        Show
        Massimo Lusetti added a comment - This is a leftover from after the commit r1142187 and r1142826 improvements will be addressed

          People

          • Assignee:
            François Facon
            Reporter:
            Howard M. Lewis Ship
          • Votes:
            5 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development