You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by cpnguyen <cp...@ucsd.edu> on 2007/12/04 01:20:25 UTC

[T4] Help converting InjectComponent annotation to page specification

Hi all,

I'm a newbie at Tapestry and I'm reading Kent's book trying to get Tapestry
to work with AJAX.

In one of his examples, he has a customerCRUD.java class with the following
annotation:
@InjectComponent("customersLoop")
    public abstract ForBean getRow();
    
    public String getRowClientId() {
        return getRow().getClientId();
    }

This method will return the HTML id for the current <tr> element generated
from a For loop component.

I am having issues getting this to work with my current project and I want
to move annotation specification to page file specification.  What is the
equivalent page specification syntax for the above?


>From Tapestry's annotation reference:
The  InjectComponent  annotation allows nested components to be injected as
read-only properties. It is attached to an accessor method:

  @InjectComponent("inputUserName")
  public abstract TextField getUserInput();

This is functionally the same as providing the property attribute of the
<component> element. 


So I tried the following:
<component id="customersLoop" type="For" property="row">
        <binding name="source" value="customerEntries"/>
        <binding name="value" value="customerEntry"/>
        <binding name="index" value="idx"/>
    </component>

<property name="rowClientId" initial-value="row.clientId"/>
    
THEN

<bean name="rowClientId" class="java.util.String" property="row.clientId"/>

and other variations without any luck.

What am I doing wrong?  TIA!

-- 
View this message in context: http://www.nabble.com/-T4--Help-converting-InjectComponent-annotation-to-page-specification-tf4940334.html#a14142129
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: [T4] Help converting InjectComponent annotation to page specification

Posted by Andreas Andreou <an...@gmail.com>.
Hi,
i'm not exactly sure how you're going to use that client id,
but if you really want to get rid of annotations, why not just try:

     public String getRowClientId() {
         return getComponent("customersLoop").getClientId();
     }



On Dec 4, 2007 2:20 AM, cpnguyen <cp...@ucsd.edu> wrote:
>
> Hi all,
>
> I'm a newbie at Tapestry and I'm reading Kent's book trying to get Tapestry
> to work with AJAX.
>
> In one of his examples, he has a customerCRUD.java class with the following
> annotation:
> @InjectComponent("customersLoop")
>     public abstract ForBean getRow();
>
>     public String getRowClientId() {
>         return getRow().getClientId();
>     }
>
> This method will return the HTML id for the current <tr> element generated
> from a For loop component.
>
> I am having issues getting this to work with my current project and I want
> to move annotation specification to page file specification.  What is the
> equivalent page specification syntax for the above?
>
>
> From Tapestry's annotation reference:
> The  InjectComponent  annotation allows nested components to be injected as
> read-only properties. It is attached to an accessor method:
>
>   @InjectComponent("inputUserName")
>   public abstract TextField getUserInput();
>
> This is functionally the same as providing the property attribute of the
> <component> element.
>
>
> So I tried the following:
> <component id="customersLoop" type="For" property="row">
>         <binding name="source" value="customerEntries"/>
>         <binding name="value" value="customerEntry"/>
>         <binding name="index" value="idx"/>
>     </component>
>
> <property name="rowClientId" initial-value="row.clientId"/>
>
> THEN
>
> <bean name="rowClientId" class="java.util.String" property="row.clientId"/>
>
> and other variations without any luck.
>
> What am I doing wrong?  TIA!
>
> --
> View this message in context: http://www.nabble.com/-T4--Help-converting-InjectComponent-annotation-to-page-specification-tf4940334.html#a14142129
> 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
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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