a composite component inside panelgrid is not 'expanded'

Basically, i've been using this pattern again and again inside a panelgrid :

<h:panelGrid columns="2" >
    <h:outputLabel for="heroName" value="Hero Name : " />
    <h:panelGroup>
        <h:inputText label="Hero Name : "
            value="#{ccBean.data.map['heroName']}" id="heroName" />
        <p:message for="heroName" />
    </h:panelGroup>
    ...
</h:panelGrid>

I notice that i duplicate things so much, like the id in h:inputText, which will be duplicated again in for="idValue" for outputLabel, and then again in p:message. The same thing happens with the inputText's label value and h:outputLabel value.

So, i was thinking about making a simple composite component to wrap these up :

<composite:interface>
    <composite:attribute name="id" required="true" />
    <composite:attribute name="label" required="true" />
    <composite:attribute name="value" required="true" />
    <composite:attribute name="includeLabel" required="false" default="false"/>
</composite:interface>

<composite:implementation>
    <h:outputLabel for="#{cc.attrs.id}" value="#{cc.attrs.label}" 
            render="#{cc.attrs.includeLabel}" />
    <h:panelGroup>
        <h:inputText label="#{cc.attrs.label}"
            value="#{cc.attrs.value}" id="#{cc.attrs.id}" />
        <p:message for="#{cc.attrs.id}" />
    </h:panelGroup>
</composite:implementation>

And then i make use of the composite components :

<h:panelGrid columns="2" >
    <s:inputText
        id="heroName"
        label="Hero Name : "
        value="#{ccBean.data.map['heroName']}"
            includeLabel="true"
    />
    <s:inputText
        id="heroName2"
        label="Hero Name 2 : "
        value="#{ccBean.data.map['heroName2']}"
            includeLabel="true"
    />
    ...
</h:panelGrid>

That composite component works fine, but the panelGrid now assumes that the s:inputText is one component. Before using the composite component, there are 2 components in one row, which is the outputLabel and the panelGroup.

Is it possible to hint the composite component to 'expand' itself in this case so that it takes up 2 columns instead of 1 column in my panelGrid ?

Thank you !

Answers


No, unfortunately not. Your best bet is to create a simple tag file instead.

See also:

Need Your Help

Running SSIS packages remotely - what account do they run under?

c# .net ssis sql-server-2008-r2

I am currently building an application in .NET 4.0 that will use SSIS 2008R2 packages to do its job. The packages are located on a separate SQL Server. The SQL server has an account proxy that has ...

HTTP Client with https

ssl https httpclient apache-httpclient-4.x

What is the best way to process HTTP GET Method with SSL using HTTP Components HTTPClient 4 Project?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.