>From: Ryan Wynn <[EMAIL PROTECTED]> 
>
> Can the renderId of a component be less than 1? I have built parent 
> components that reference child components. These parent components 
> are meant to be extended to add more child components. What I would 
> like is to have the base parent components reference their child as 
> say renderId=-1 and renderId=0, so that when extended renderId will 
> always start at 1. Currently, extending my parents requires the 
> extender to start at say renderId=2 because parent already references 
> some children. 
> 
> For example (may already be supported) 
> 
><component jsfid="parent">
>  <element renderId="-1" id="a"/>
>  <element renderId="0" id="b"/>
></component>
>
><component jsfid="child" extends="parent">
>  <element renderId="1" id="c"/>
></component>
>
> 
> resulting a child component with children ordered a, b, c. 
> 
> The reason for this is usability and not having to document where to 
> begin renderId for each descendant.

Gosh, I've never thought to try it but it should work.  The renderId is handled 
by the standard digester rule.  
If it doesn't, we can make a custom digester rule.

I like you idea of creating these meta component definitions that can be 
extended on.  I was thinking that we 
might be able to include some of these in the Clay baseline but they would have 
to use the vanilla JSF 
component offering.  I was thinking of the standard two select list boxs where 
you move from one to the other.

Besides defining these in XML, you can do this sort of thing mixing in HTML 
templating.

Common XML Config:

 <component jsfid="widgetsLabel" extends="baseLabel"> 
     <attributes>
     <set name="value" value="@label" />  
     <set name="for"   value="@property" />
     </attributes>
 </component>    
 <component jsfid="widgetsText" extends="inputText" id="@property"> 
     <attributes>
        <set name="value" value="[EMAIL PROTECTED]@property}"/>  
     <set name="size" value="@size" />
     <set name="maxlength" value="@maxlength" />
     <set name="required" value="@required" />
     <set name="immediate" value="@immediate"/>
     </attributes>
 </component>
 <component jsfid="widgetsMessage" extends="baseMessage" > 
     <attributes>
        <set name="for" value="@property" />  
     </attributes>
 </component>

HTML template "/widgets.html":
<tr>
   <td><label jsfid="widgetsLabel">Mock Label:</label></td>
   <td><input jsfid="widgetsText" type="text"/></td>
   <td><span jsfid="widgetsMessage">Mock Message</span><td>
</tr>

Outer HTML template include:
<table>
    <tr>
       <td colspan="3">
          <p>This example show how a pattern of components, label, input 
          text and message can be abstracted into a common template. </p> 
       </td>   
    </tr>
    <tr jsfid="clay" clayJsfid="/widgets.html" label="First Name:" 
        property="firstName" size="20" maxlength="30" 
        required="true" immediate="false"/>
    <tr jsfid="clay" clayJsfid="/widgets.html" label="Middle Name:" 
        property="middleName" size="20" maxlength="30" 
        required="false" immediate="false"/>
    <tr jsfid="clay" clayJsfid="/widgets.html" label="Last Name:" 
        property="lastName" size="30" maxlength="40" 
        required="true" immediate="false"/>
    <tr jsfid="clay" clayJsfid="/widgets.html" label="Business Name:" 
        property="lastName" size="40" maxlength="50" 
        required="true" immediate="false"/>
     
</table>


Gary






 

Reply via email to