You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by Hermod Opstvedt <he...@opstvedt.com> on 2007/02/13 22:49:49 UTC

Clay challange

Hi

I'm struggling with a component that I have defined:

	<component jsfid="navnpanel" extends="clay" id="navnpanel">
		<element jsfid="t:htmlTag" renderId="1">
			<attributes>
				<set name="value" value="fieldset" />
			</attributes>
			<element jsfid="t:htmlTag" renderId="2">
				<attributes>
					<set name="value" value="legend" />
				</attributes>
				<element jsfid="outputText" renderId="2">
					<attributes>
						<set name="value"
	
value="#{messages['navnpanel.text']}">
						</set>
					</attributes>
				</element>
			</element>
			<element jsfid="outputLabel" renderId="2">
				<attributes>
					<set name="value"
value="#{messages['navnpanel.text']}"></set>
				</attributes>
			</element>
		</element>
	</component>

It is supposed to render a fieldset with a legend, and a label inside it.
However the label never appears and there are no errors what so ever.

Hermod



Re: Clay challange

Posted by Ryan Wynn <bi...@gmail.com>.
On 2/13/07, Hermod Opstvedt <he...@opstvedt.com> wrote:
> Hi
>
> I'm struggling with a component that I have defined:
>
>        <component jsfid="navnpanel" extends="clay" id="navnpanel">
>                <element jsfid="t:htmlTag" renderId="1">
>                        <attributes>
>                                <set name="value" value="fieldset" />
>                        </attributes>
>                        <element jsfid="t:htmlTag" renderId="2">
>                                <attributes>
>                                        <set name="value" value="legend" />
>                                </attributes>
>                                <element jsfid="outputText" renderId="2">
>                                        <attributes>
>                                                <set name="value"
>
> value="#{messages['navnpanel.text']}">
>                                                </set>
>                                        </attributes>
>                                </element>
>                        </element>
>                        <element jsfid="outputLabel" renderId="2">
>                                <attributes>
>                                        <set name="value"
> value="#{messages['navnpanel.text']}"></set>
>                                </attributes>
>                        </element>
>                </element>
>        </component>
>
> It is supposed to render a fieldset with a legend, and a label inside it.
> However the label never appears and there are no errors what so ever.

I think you might need to look at your renderIds.  The renderId
attribute is a way of ordering component children.  RenderIds are only
relevant for sibling elements.  If you have 2 sibling elements with
the same renderId value then one of the elements will be
"lost/replaced".

In your case the t:htmlTag and outputLabel both have the same parent
(t:htmlTag) but they also use the same renderId (2).  They should
instead be 1 and 2.

My renderIds usually start at 1 for each element set and increment
from there.  I think only the relative values matter, so you could
have renderIds 6 and 3 and you would still get 2 children with the 3
renderId as the first child.

With inheritance you are able to override a component's children
selectively by specifying another component with the same renderId.

<component jsfid="c1" extends="clay">
   <element jsfid="outputText" renderId="1">...</element>
  <element jsfid="outputText" renderId=2">...</element>
</component>

<component jsfid="c2" extends="c1">
<element jsfid="inputText" renderId=2">..</element>
</component>

both c1 and c2 produce a clay component with 2 children.  c2 uses
inheritance and the renderId attribute to override the second
outputText in c1 with an inputText.  But, c2 still inherits the first
outputText child from c1.

Hope this helps.

>
> Hermod
>
>
>