You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Simone Gianni (JIRA)" <ji...@apache.org> on 2006/03/18 03:04:11 UTC

[jira] Created: (COCOON-1801) [PATCH] Repeater events

[PATCH] Repeater events
-----------------------

         Key: COCOON-1801
         URL: http://issues.apache.org/jira/browse/COCOON-1801
     Project: Cocoon
        Type: New Feature
  Components: Blocks: Forms  
    Versions: 2.1.9-dev (current SVN)    
    Reporter: Simone Gianni
 Attachments: repeaterlistener-sample.diff, repeaterlistener.diff

Since I felt the need and there are many comments in the code about it, i've implemented a RepeaterListener. The listener is triggered on row addition, deletion, reordering and clear. The event also brings informations about the row index and the actual action that took place.

I've adapted the javascript listener to support this new listener, and in the meanwhile also noticed that lines 59 to 70 of it are useless, since i believe that code has been moved inside the JavaScriptHelper methods and those lines were left there.

I've added a sample in form1, in the contact repeater. It's better to use the flow version of the sample, since in the no-flow sample the repeater is always recreated, an all events are broadcasted again.

The usage is simply :
<fd:repeater>
  <fd:on-repeater-modified>
    <fd:javascript>....</fd:javascript>
    <fd:other-listener>...</fd:other-listener>
  </fd:on-repeater-modified>
</fd:repeater>

I took care to call the event after the row has been initalized and to provide two events (deleting and deleted) for row deletion, so that accessing the new or "about to be deleted" row inside the listener should not be a problem. The forms1.xml listener has an example on how to do this.

The only place where i'm not sure this will always work correctly is inside the initialize method, maybe the event broadcast should be moved to somewhere else, or at least after the super.initialize() call, just to make sure that when the listener gets the event everything is properly set up.

----
Please note that the patch includes modifications on the javascript listener (o.a.c.forms.events.impl.JavaScript*) which i already modified in COCOON-1781. Regarding this file this patch will conflict with the other one (since both contains the same modifications) and in part superseedes the other one (due to the lines i've removed). So please apply the COCOON-1781 first, then this one, and if having problems applying this one revert the o.a.c.forms.event.impl.JavaScript* classes and then retry.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (COCOON-1801) [PATCH] Repeater events

Posted by "Simone Gianni (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/COCOON-1801?page=all ]
     
Simone Gianni closed COCOON-1801:
---------------------------------

    Resolution: Fixed

Committed the patch.

> [PATCH] Repeater events
> -----------------------
>
>          Key: COCOON-1801
>          URL: http://issues.apache.org/jira/browse/COCOON-1801
>      Project: Cocoon
>         Type: New Feature

>   Components: Blocks: Forms
>     Versions: 2.1.9
>     Reporter: Simone Gianni
>  Attachments: repeaterlistener-sample.diff, repeaterlistener.diff
>
> Since I felt the need and there are many comments in the code about it, i've implemented a RepeaterListener. The listener is triggered on row addition, deletion, reordering and clear. The event also brings informations about the row index and the actual action that took place.
> I've adapted the javascript listener to support this new listener, and in the meanwhile also noticed that lines 59 to 70 of it are useless, since i believe that code has been moved inside the JavaScriptHelper methods and those lines were left there.
> I've added a sample in form1, in the contact repeater. It's better to use the flow version of the sample, since in the no-flow sample the repeater is always recreated, an all events are broadcasted again.
> The usage is simply :
> <fd:repeater>
>   <fd:on-repeater-modified>
>     <fd:javascript>....</fd:javascript>
>     <fd:other-listener>...</fd:other-listener>
>   </fd:on-repeater-modified>
> </fd:repeater>
> I took care to call the event after the row has been initalized and to provide two events (deleting and deleted) for row deletion, so that accessing the new or "about to be deleted" row inside the listener should not be a problem. The forms1.xml listener has an example on how to do this.
> The only place where i'm not sure this will always work correctly is inside the initialize method, maybe the event broadcast should be moved to somewhere else, or at least after the super.initialize() call, just to make sure that when the listener gets the event everything is properly set up.
> ----
> Please note that the patch includes modifications on the javascript listener (o.a.c.forms.events.impl.JavaScript*) which i already modified in COCOON-1781. Regarding this file this patch will conflict with the other one (since both contains the same modifications) and in part superseedes the other one (due to the lines i've removed). So please apply the COCOON-1781 first, then this one, and if having problems applying this one revert the o.a.c.forms.event.impl.JavaScript* classes and then retry.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira