tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Piterman <rpiter...@gmx.net>
Subject Re: [jira] Created: (TAPESTRY-733) Tapestry should call listeners (such as PageBeginRenderListener) in some predefined order
Date Wed, 02 Nov 2005 01:24:46 GMT
ציטוט Leonardo Quijano Vincenzi:
> Ron Piterman wrote:
> 
>> 2) the "take an object *source* (binding) and edit it" approach.
>>
>> Tapestry form components use the second - they read an write to 
>> sources (properties) instead of manipulating the values.
>>
>> You probably want to take that same second approach ( am I right here? )
> 
> 
> Yes you're right. I want to be able to edit arbirtrary sections of my 
> object graph using the binding system.
> 
>> you want your component to get the clients' address *source* and if 
>> its empty set it.
> 
> 
> Exactly.
> 
>>
>> what about this:
>>
>> <parameter name="address" property="addressParameter"/>
> 
> 
> I'm using annotations, though I guess that can be done with that.
> 
>>
>> now in the component code you don't use the parameter directly but 
>> abother method:
>>
>> public Address getAddress() {
>>   Address a = getAddressParameter();
>>   if (a == null) {
>>     a = createNewAddress();
>>     IBinding binding = getBinding("address"); // am not certain its the
>>                                               // right syntax here
>>     binding.setValue(a);
>>   }
>>   return a;
>> }
>>
>> now this way, the first component which accesses the clients address 
>> will initialize it and set it back to the client.
> 
> 
> That'd be:
> 
> public Address getAddress() {
>  Address a = getAddressParameter();
>  if (a == null) {
>    a = createNewAddress();
>    setAddressParameter(a);
>  }
>  return a;
> }
> 
> But it doesn't work for @Persist bindings, since rendering has already 
> begun.

I don't know what you mean with @Persist bindings - @Persist is a 
parameter - did you use both @Parameter and @Persist on the same 
property? you shouldn't.

Any way, parameters in T4 are dynamic, so it should work - check this 
again, you might be doing something wrong -

its just like in the For iteration - the for changes a binding, which is 
given to a component as a parameter and is reevaluated for each iteration...

Cheers and good night...
Ron


> 
> (hahaha, yes. I tried it all. Don't even mention @InvokeListener!)
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Mime
View raw message