Hi
The method exists on my bean with the correct methodsignature.
I had "stolen" this from your excellent rolodex example, and there you had
it defined as:
<component jsfid="tabs" extends="clay" id="tabs" allowBody="false">
<attributes>
<set name="jsfid" value="RUNTIME"/>
<set name="managedBeanName" value="rolodex$hrolodex"/>
<set name="shapeValidator"
value="[EMAIL PROTECTED]"/>
</attributes>
</component>
So I thought that I could substitute the hardcoded name with a Clay symbol.
Your solution worked like a charm. Thanks.
I have an improvement to the rolodex createTabs that I want to put forward:
In the Rolodex.java file method createCommandLinkMetadata, you add
parameters to the link. If you need to add more than 1 parameter, you need
to use the renderId, because it is the key into the map. I tried to add
several parameters to no avail until I looked at the Element bean, where it
was stated. In order for others to grasp this more quickly I suggest that
you add do the following to the example:
// create a parameter
ElementBean param = new ElementBean();
param.setJsfid("param");
+ // RenderId is the key to the Map. Increment for each new
parameter
+ param.setRenderId(1);
param.setComponentType("javax.faces.Parameter");
Hermod
-----Opprinnelig melding-----
Fra: Gary VanMatre [mailto:[EMAIL PROTECTED]
Sendt: 25. mars 2006 02:18
Til: Struts Users Mailing List; [EMAIL PROTECTED]
Emne: Re: [Shale] Name scoping in Clay
>From: Hermod Opstvedt <[EMAIL PROTECTED]>
>
> Hi
>
> I have defined a Clay component:
>
><component jsfid="resultattabs" extends="clay" id="resultattabs"
allowBody="false">
><attributes>
> <set name="jsfid" value="RUNTIME"/>
> <set name="managedBeanName" value="@managed-bean-name"/>
> <set name="shapeValidator"
value="[EMAIL PROTECTED]"/>
> </attributes>
></component>
>
The "jsfid" attribute should be named "clayJsfid". The "jsfid" here says
that you want to use
the clay component and the "clayJsfid" is the root component of the subtree
under the
clay component. The special "RUNTIME" clayJsfid indicates you want to build
the
metadata at runtime.
Another way to do this is to use the "binding" attribute. You bind a
component to a
managed bean and add to it dynamically. Craig has an example of this in the
sql-browser example application. This approach is tricky if you don't just
delete
the subtree and rebuild it. You will see in the sql-browser example, the
children of the dataTable are cleared in the prerender method of the managed
bean.
http://svn.apache.org/viewcvs.cgi/struts/shale/trunk/sql-browser/src/java/or
g/apache/shale/examples/sqlbrowser/Query.java?view=markup
The Clay runtime option is similar but the component handles the details of
finding
an existing component versus creating a new one. In the clay method, you
create a graph of objects used to create the JSF component where the binding
method you actually create the components and hook them together.
>
>
> Where @managed-bean-name is set to the faces defined managed bean
> open$arrangement.
>
> I would have thought that Clay would resolve this to for instance
> myBean.createTabs, but I am getting an error :
>
> Exception while invoking expression #{open$arrangement.createTabs}
It looks like the symbol is being replaced. The expression show the
"open$arrangement" substitued for "@managed-bean-name". If you
look further down in the stack trace you will most likely seen another
exception, "Caused by: java.lang.NoSuchMethodException:".
This shapeValidator method binding signature is the same as
the validator signature.
The confusing part is that this method is invoked in the rendering phase
and not the validation phase. The thought was that by implementing the
method
you are validating the shape of the subtree. I should have choose another
attribute name.
Make sure that your managed bean implements a method with the following
signature:
public void createTabs(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object displayElementRoot) {
>
> Hermod
>
Gary
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]