You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2006/08/09 22:21:07 UTC

Dynamic name for components

Hello there! I have a component (datetime) which has nested components on it:

<!DOCTYPE component-specification PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<component-specification
class="com.synos.pbh.chat.view.components.DateTime" allow-body="yes"
allow-informal-parameters="yes">
	<description>
		Simple Date and Time Component
	</description>
  <parameter name="style" required="no"
default-value="literal:input"></parameter>
  <component id="days" type="PropertySelection">
  	<binding name="model" value="daysInMonth"></binding>
  	<binding name="value" value="selectedDay"></binding>
  	<binding name="name" value="ognl:getNestedName('days')"></binding>
  </component>
  <component id="months" type="PropertySelection">
  	<binding name="model" value="months"></binding>
  	<binding name="value" value="selectedMonth"></binding>
  </component>
  <component id="years" type="PropertySelection">
  	<binding name="model" value="years"></binding>
  	<binding name="value" value="selectedYear"></binding>
  </component>
  <component id="hours" type="TextField">
  	<binding name="value" value="inputHour"></binding>
  </component>
  <component id="minutes" type="TextField">
  	<binding name="value" value="inputMinute"></binding>
  </component>
  <inject property="validatableFieldSupport"
object="service:tapestry.form.ValidatableFieldSupport"/>
  <inject property="translatedFieldSupport"
object="service:tapestry.form.TranslatedFieldSupport"/>
</component-specification>

Well, it is *almost* working :) The problem is when I add more then
one component on the screen, as you can see, the nested components
(textfields and PropertySelecions) will have the same name. I tried to
use ognl on the first nested component so I could generate a unique
name for it, but the method is never called.

I'd like to know if it is possible to change those nested component
names in a dynamic way.

Best Regards

PS: I really need this stuff, if someone cares to give me a hand, we
are in a deadline here :(

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


Re: Dynamic name for components

Posted by Vinicius Carvalho <ja...@gmail.com>.
Sorry for this,  my mistake, tapestry is already adding a _# as suffix
of each component. I Was in such a rush that did not see it :P

Sorry for the inconvenience

On 8/9/06, Vinicius Carvalho <ja...@gmail.com> wrote:
> Hello there! I have a component (datetime) which has nested components on it:
>
> <!DOCTYPE component-specification PUBLIC
>   "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
>   "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
> <component-specification
> class="com.synos.pbh.chat.view.components.DateTime" allow-body="yes"
> allow-informal-parameters="yes">
>         <description>
>                 Simple Date and Time Component
>         </description>
>   <parameter name="style" required="no"
> default-value="literal:input"></parameter>
>   <component id="days" type="PropertySelection">
>         <binding name="model" value="daysInMonth"></binding>
>         <binding name="value" value="selectedDay"></binding>
>         <binding name="name" value="ognl:getNestedName('days')"></binding>
>   </component>
>   <component id="months" type="PropertySelection">
>         <binding name="model" value="months"></binding>
>         <binding name="value" value="selectedMonth"></binding>
>   </component>
>   <component id="years" type="PropertySelection">
>         <binding name="model" value="years"></binding>
>         <binding name="value" value="selectedYear"></binding>
>   </component>
>   <component id="hours" type="TextField">
>         <binding name="value" value="inputHour"></binding>
>   </component>
>   <component id="minutes" type="TextField">
>         <binding name="value" value="inputMinute"></binding>
>   </component>
>   <inject property="validatableFieldSupport"
> object="service:tapestry.form.ValidatableFieldSupport"/>
>   <inject property="translatedFieldSupport"
> object="service:tapestry.form.TranslatedFieldSupport"/>
> </component-specification>
>
> Well, it is *almost* working :) The problem is when I add more then
> one component on the screen, as you can see, the nested components
> (textfields and PropertySelecions) will have the same name. I tried to
> use ognl on the first nested component so I could generate a unique
> name for it, but the method is never called.
>
> I'd like to know if it is possible to change those nested component
> names in a dynamic way.
>
> Best Regards
>
> PS: I really need this stuff, if someone cares to give me a hand, we
> are in a deadline here :(
>

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