> I would like to at least have the option to have the
> IDirectListener called before rendering, whether this
> is implemented directly or virtually (through a 
rewind).

That is exactly how IDirectListener is implemented.  The 
page is *loaded*, persistent page properties are 
restored, and the listener is invoked.  Then the 
response page is renderred.

When using an Action (and the action service) things are 
more complicated, but the Direct is simple ... and 
direct.  That's the reason for the name, it goes 
directly to the component.  Please see DirectService to 
understand what happens ... there's also sequence 
diagrams in the developer's guide.




> For us, it is a reasonably common pattern for a page 
to contain
> a ForEach with embedded Direct components that change
> the state of the underlying object that the containing
> Page represents. What happens now is that the Page
> gets rerendered, with the old data, then the data
> gets updated. So you don't see the effect of the 
> update. It just seems unnatural to have the 
IDirectListener
> run _after_ rendering.

I agree.  There's something else going on with the 
construction of your page.


> 
> Another thing that I would like is the ability to 
> create Map contexts for a Direct component.
> Ideally you should be able to specify a complete
> Map of names and values, and the IDirectListener
> interface would have a Map argument instead of
> a String[] argument.

This is simply an aesthetic decision I made when 
creating the Direct component.  To me, positional 
arguments are less ambiguous than named arguments.  
Index 0 is always index 0, but is "name" the same 
as "Name"?

You could "simulate" this by having the even (0, 2, 4) 
indexes by keys and the odd (1, 3, 5) indexes be values.

> 
> the .jwc would look something like this:
> 
>   <component id="editPerson" type="Direct">
>     <binding name="listener" property-
path="listeners.editPerson"/>
>     <map-binding name="context"> 
>       <binding name="fname"
> property-path="components.persons.value.firstName"/>
>       <binding name="lname"
> property-path="components.persons.value.lastName"/>
>     </map-binding>
>   </component>
> 
> the IDirectListener interface would look like/be 
extended with this:
> void directTriggered(IDirect component, Map context, 
IRequestCycle cycle) 
> 
> and in your implementing method
> public void editPerson(Map context, IRequestCycle 
cycle) {
>     //context will look like this: {"fname" -
> "chuck", "lname" ->
> "windsor"}
> }
> 
> The Map binding would be useful when dealing with list 
of objects
> with compound foreign keys (among other things). 
> 
> -----Original Message-----
> From: Tom Davies [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 10:46 AM
> Cc: Tapestry Developer (E-mail)
> Subject: Re: [Tapestry-developer] request for help 
with rewind
> 

--
[EMAIL PROTECTED]

http://tapestry.sf.net

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to