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 way?
- use a regular action and "manually" use the row-action's event listener using its java class name, i.e.
<on-action>
<... your event listener here ...>
<java class="o.a.c...DeleteRowListener"/>
</on-action>


What do you think?

Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com




Reply via email to