cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: [woody] using on-activate handlers
Date Thu, 27 Nov 2003 23:41:50 GMT
Jeremy Quinn wrote:

> Hi All
> I am having problems using on-activate handlers.
> I have them attached to several buttons, but they do not really help.
> I have one attached to a <wd:row-action id="delete" 
> action-command="delete"/>, but it appears to get called after the 
> delete, so I do not appear to be able to find out which row was 
> deleted, so I cannot remove that object from the persistence layer. 
> (the returned index is '-1').

Yep. Row actions are particular actions that have a built-in event 
handler that is always called first. For this kind of application, 
you'll need to use a "normal" action and remove the repeater row by 
yourself as part of the event handler (a few lines of code, actually).

> I have one attached to a <wd:row-action id="down" 
> action-command="move-down"/> and a <wd:row-action id="up" 
> action-command="move-up"> button, but my handler gets called AFTER 
> woody has moved them, complicating the issue of replicating the move 
> in the BizData (the binding does not replicate the row order, so moves 
> have no effect on BizData, if it is a Bean.)
> ie. calling event.getSourceWidget ().getParent ().getId () gives you 
> the index of the row AFTER the move has already taken place.

Same problem here...

> Furthermore, because the Up button incorrectly shows on the top row, 
> and the down button incorrectly shows on the bottom row, if the User 
> clicks them, the row cannot be moved, so you get the 'correct' index 
> of those rows.  =:-0

Sorry, I lost you here...

> IMHO, this is making things a lot more difficult than they really need 
> to be .....
> Would it break Woody terribly if on-activate handlers could be called 
> BEFORE the row-action's action-command?

You're the first one to report this kind of problems. Two solutions come 
to mind:
- change the order as you suggest it. It seems to make sense at first, 
but won't someone come tomorrow with good reasons for doing it the other 
- use a regular action and "manually" use the row-action's event 
listener using its java class name, i.e.
      <... your event listener here ...>
      <java class="o.a.c...DeleteRowListener"/>

What do you think?


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -

View raw message