Ryan Wynn Wrote:

>This incorporates 2 things. First the idName attribute added to the clay 
>component 
>which is replaced on the contents just like managedBeanName. 
>

Interesting idea.  I think this would be more efficient and easier to 
distinguish a 
replacement attribute if we required that these replacement attributes did not 
exist 
in the component attribute definitions corresponding to the bound JSF component 
via the "jsfid" attribute.  This would provide some freedom to add more than 
one replacement attribute mnemonic.  You could choose you own naming convention 
(myId, fooId, varId).

>Second, the horizontal override of the subtree - based on the renderId - in 
>conjunction with 
>the fact that jsfid is Not specified on the 1st element inside lastName.  If 
>jsfid is not specified 
>that would mean that attributes are being overriden in the element with the 
>same renderId in the parent. 
>Not a replace. Using renderId alleviates the need to create a unique id for 
>containment as renderId 
>already must be unique. 
>

This one would take a bit more work but I like the convention.  A element with 
a jsfid would override the parent's nested element where one with just a 
renderId would extend the parent's nested element.

>Just food for thought.  I realize the horizontal thing would not work for 
>validators and converters because 
>I do not think they have anything like a renderId. 


Ya, I like the idea of merging two trees having one override or extend the 
other.  But, until we figure out a good way of doing that, I think these 
changes will go a long way in increasing usability of component 
groupings/patterns.

>I can think of a few use cases for this functionality: 
>        1. linking an error message with a input field (above) 
>        2. dependant select boxes, e.g country/state 
>        3. labelFor and 508 Compliance 

Unless others have concerns about these features, I would like to adding them 
to Clay.

Gary
-------------- Original message -------------- 

Gary, thanks for the reply. 

Just my thoughts on this: 

in shared component spec 

<component jsfid="requiredInputText" extends="inputText">
       <validator jsfid="commonsValidator">
               <attributes>
                       <set name="client" value="false" />
                       <set name="server" value="true" />
                       <set name="type" value="required" />
               </attributes>
       </validator>
</component> 

<component jsfid="requiredInputPanel" extends="panelGroup">
       <element renderId="1" jsfid="requiredInputText" id="id-name"/>
       <element renderId="2" jsfid="message">
               <attributes>
                       <set name="for" value="id-name"/>
                       <set name="styleClass" value="errors"/>
               </attributes>
       </element>
</component> 


then in app component spec 

<component jsfid="lastName" extends="requiredInputPanel"> 
        <element renderId="1"> 
                <attributes> 
                        <set name="value" value="#{myBean.lastName}/> 
                </attributes> 
        </element> 
</component> 

and finally in html file 

<span jsfid="clay" idName="lastNameId" allowBody="true"> 
        <span jsfid="lastName"/> 
</span> 

This incorporates 2 things. First the idName attribute added to the clay 
component which is replaced on the contents just like managedBeanName. Second, 
the horizontal override of the subtree - based on the renderId - in conjunction 
with the fact that jsfid is Not specified on the 1st element inside lastName.  
If jsfid is not specified that would mean that attributes are being overriden 
in the element with the same renderId in the parent. Not a replace. Using 
renderId alleviates the need to create a unique id for containment as renderId 
already must be unique. 

Just food for thought.  I realize the horizontal thing would not work for 
validators and converters because I do not think they have anything like a 
renderId. 

I can think of a few use cases for this functionality: 
        1. linking an error message with a input field (above) 
        2. dependant select boxes, e.g country/state 
        3. labelFor and 508 Compliance 


Ryan 





To"Struts Users Mailing List" <user@struts.apache.org> 
cc
SubjectRe: [Shale] Clay Component Grouping







>I have the following clay composite:
>
>&lt;component jsfid="requiredInputText" extends="inputText"&lg;
>        &lt;validator jsfid="commonsValidator"&lg;
>                &lt;attributes&lg;
>                        &lt;set name="client" value="false" /&lg;
>                        &lt;set name="server" value="true" /&lg;
>                        &lt;set name="type" value="required" /&lg;
>                &lt;/attributes&lg;
>        &lt;/validator&lg;
>&lt;/component&lg;
>
>This enables me to do the following and get validation for free:
>
>&lt;component jsfid="lastName" extends="requiredInputText"&lg;
>        &lt;attributes&lg;
>                        &lt;set name="value" value="#{myBean.lastName}" /&lg;
>        &lt;/attributes&lg;
>&lt;/component&lg;
>
>
>Now I want to add an associated jsf message component right next to the 
>inputText in a reusable way - like I was able to do with the validator.
>
>For example,
>
>&lt;component jsfid="requiredInputPanel" extends="panelGroup"&lg;
>        &lt;element renderId="1" jsfid="requiredInputText"/&lg;
>        &lt;element renderId="2" jsfid="message"&lg;
>                &lt;attributes&lg;
>                        &lt;set name="for" value="?"/&lg;
>                        &lt;set name="styleClass" value="errors"/&lg;
>                &lt;/attributes&lg;
>        &lt;/element&lg;
>&lt;/component&lg;
>
>First question, if there any way in clay to support matching the for 
>attribute of the message above with the dynamically assigned id from the 
>requiredInputText?
>

You must explicitly define the id's.  Id's can be defined on the component or 
element.  

&lt;component jsfid="lastName" extends="requiredInputText" id="lastName" &lg;
       &lt;attributes&lg;
                       &lt;set name="value" value="#{myBean.lastName}" /&lg;
       &lt;/attributes&lg;
&lt;/component&lg;

*And/OR*

&lt;component jsfid="requiredInputPanel" extends="panelGroup"&lg;
       &lt;element renderId="1" jsfid="requiredInputText" id="lastName" /&lg;
       &lt;element renderId="2" jsfid="message"&lg;
               &lt;attributes&lg;
                       &lt;set name="for" value="lastName"/&lg;
                       &lt;set name="styleClass" value="errors"/&lg;
               &lt;/attributes&lg;
       &lt;/element&lg;
&lt;/component&lg;


>Second question, can I define a component that extends requiredInputPanel 
>and overrides the value attribute of the nested requiredInputText?
>

The inheritance only has the capability of overriding attributes of the parent 
and contained elements.  Overriding an element will replace the element.  The 
"signature" for inheritance is the renderId of the element.  

There is not a way to override an attribute "horizontally" meaning you cannot 
specify a jsfid that represents containment similar to the generated clientId 
of the JSF component.

"myPanel/lastName/validator/validator1"

I might be interesting think about being able to apply customizations to a 
subtree "horizontally".  This would allow you to slip in an override without 
restructuring the hierarchy of the inheritance.  Challenge would be 
creating/requiring a unique id to represent containment.  IdÂ’s generated by the 
component could not be correlated to the metadata component id's.

In short, the only way to override a validator of an element of an extended 
component would be to replace the element.
 
&lt;component jsfid="requiredInputPanel" extends="panelGroup"&lg;
      &lt;element jsfid="inputText" renderId="1"  id="lastName" &lg;
            &lt;validator jsfid="commonsValidator"&lg;
                    &lt;attributes&lg;
                            &lt;set name="client" value="false" /&lg;
                            &lt;set name="server" value="true" /&lg;
                            &lt;set name="type" value="required" /&lg;
                    &lt;/attributes&lg;
            &lt;/validator&lg;
      &lt;/element&lg;
       &lt;element renderId="2" jsfid="message"&lg;
               &lt;attributes&lg;
                       &lt;set name="for" value="lastName"/&lg;
                       &lt;set name="styleClass" value="errors"/&lg;
               &lt;/attributes&lg;
       &lt;/element&lg;
&lt;/component&lg;



>Also, any suggestions on accomplishing this are welcome.
>
>Thanks,
>Ryan

Gary



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to