You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Eugene Zhulkov <ez...@gmail.com> on 2009/08/21 09:16:42 UTC

Dynamically changу attribute set

Good day!

Is there any way to dynamically change attributes set in some TML element?
Like XSLT <xsl:attribute> element does

To be more presize - I have 1 component with <t:form> element. 
In some cases I want to add t:zone attribute or omit it.

Thank for responses!
-- 
View this message in context: http://www.nabble.com/Dynamically-chang%D1%83-attribute-set-tp25075265p25075265.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Dynamically changу attribute set

Posted by "Juan E. Maya" <ma...@gmail.com>.
Cool! thanks for sharing the solution :)

On Fri, Aug 21, 2009 at 4:45 PM, Eugene Zhulkov<ez...@gmail.com> wrote:
>
> Thx for reply
>
> Yes - the easiest but the worst decision... What if the form contains 1000
> lines of tml code? Copy&Paste and support 2 identical blocks? :) No :)
>
> I've solved this problem with Java code in component:
>
> public void afterRender() {
>  if(needZoneSupport){
>  Link link = resources.createFormEventLink(EventConstants.ACTION);
>  renderSupport.addInit("linkZone", form.getClientId(), zoneName,
> link.toString() + ".form");
>  }
> }
>
> So my form does not contain zone attr by default. But If I need one - It's
> being added manually with init Tapestry javascripts...
> --
> View this message in context: http://www.nabble.com/Dynamically-change-attribute-set-tp25075265p25081221.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: Dynamically changу attribute set

Posted by Eugene Zhulkov <ez...@gmail.com>.
Thx for reply

Yes - the easiest but the worst decision... What if the form contains 1000
lines of tml code? Copy&Paste and support 2 identical blocks? :) No :)

I've solved this problem with Java code in component:

public void afterRender() {
 if(needZoneSupport){
  Link link = resources.createFormEventLink(EventConstants.ACTION);
  renderSupport.addInit("linkZone", form.getClientId(), zoneName,
link.toString() + ".form");
 }
}

So my form does not contain zone attr by default. But If I need one - It's
being added manually with init Tapestry javascripts...
-- 
View this message in context: http://www.nabble.com/Dynamically-change-attribute-set-tp25075265p25081221.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Dynamically changу attribute set

Posted by "Juan E. Maya" <ma...@gmail.com>.
Hmm in the works case u can create 2 blocks. What containing the form
with the zone and another without the zone. the delegate method would
take care of which block to render.

On Fri, Aug 21, 2009 at 1:57 PM, Eugene Zhulkov<ez...@gmail.com> wrote:
>
> Thx for reply!
>
> But I need to totally remove attribute - not only change its value...
> In some cases my form uses Zones in some cases does not. If I specify null -
> it crashes :(
>
>
> Juan E. Maya wrote:
>>
>> Good day for u tooo :)
>>
>> I think u could do something like this:
>>
>> in the template u specify the template using a "prop" prefix
>>
>> <t: form t:zone="prop:zone">
>> </t:form>
>>
>> in java i have
>> @Parameter(allowNull=true,defaultPrefx=defaultPrefix=BindingConstants.LITERAL)
>> @Property
>> private String zone;
>>
>> have a nice day
>> On Fri, Aug 21, 2009 at 9:16 AM, Eugene Zhulkov<ez...@gmail.com> wrote:
>>>
>>> Good day!
>>>
>>> Is there any way to dynamically change attributes set in some TML
>>> element?
>>> Like XSLT <xsl:attribute> element does
>>>
>>> To be more presize - I have 1 component with <t:form> element.
>>> In some cases I want to add t:zone attribute or omit it.
>>>
>>> Thank for responses!
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Dynamically-chang%D1%83-attribute-set-tp25075265p25075265.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Dynamically-change-attribute-set-tp25075265p25077838.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: Dynamically changу attribute set

Posted by Eugene Zhulkov <ez...@gmail.com>.
Thx for reply!

But I need to totally remove attribute - not only change its value...
In some cases my form uses Zones in some cases does not. If I specify null -
it crashes :(


Juan E. Maya wrote:
> 
> Good day for u tooo :)
> 
> I think u could do something like this:
> 
> in the template u specify the template using a "prop" prefix
> 
> <t: form t:zone="prop:zone">
> </t:form>
> 
> in java i have
> @Parameter(allowNull=true,defaultPrefx=defaultPrefix=BindingConstants.LITERAL)
> @Property
> private String zone;
> 
> have a nice day
> On Fri, Aug 21, 2009 at 9:16 AM, Eugene Zhulkov<ez...@gmail.com> wrote:
>>
>> Good day!
>>
>> Is there any way to dynamically change attributes set in some TML
>> element?
>> Like XSLT <xsl:attribute> element does
>>
>> To be more presize - I have 1 component with <t:form> element.
>> In some cases I want to add t:zone attribute or omit it.
>>
>> Thank for responses!
>> --
>> View this message in context:
>> http://www.nabble.com/Dynamically-chang%D1%83-attribute-set-tp25075265p25075265.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamically-change-attribute-set-tp25075265p25077838.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Dynamically changу attribute set

Posted by "Juan E. Maya" <ma...@gmail.com>.
Good day for u tooo :)

I think u could do something like this:

in the template u specify the template using a "prop" prefix

<t: form t:zone="prop:zone">
</t:form>

in java i have
@Parameter(allowNull=true,defaultPrefx=defaultPrefix=BindingConstants.LITERAL)
@Property
private String zone;

have a nice day
On Fri, Aug 21, 2009 at 9:16 AM, Eugene Zhulkov<ez...@gmail.com> wrote:
>
> Good day!
>
> Is there any way to dynamically change attributes set in some TML element?
> Like XSLT <xsl:attribute> element does
>
> To be more presize - I have 1 component with <t:form> element.
> In some cases I want to add t:zone attribute or omit it.
>
> Thank for responses!
> --
> View this message in context: http://www.nabble.com/Dynamically-chang%D1%83-attribute-set-tp25075265p25075265.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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