Stephan Sladek
Stephan Sladek

Reputation: 21

How to expose an iterator variable from a JSF composite component to the IDE in the using page

My setup is Eclipse Oxygen, JSF 2.2, JBoss 7.0 (Mojarra JSF implementation) and Primefaces 6.0. I've wrapped the Primefaces dataTable in a JSF composite-component (my:dataTable):

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:p="http://primefaces.org/ui"
    xmlns:pt="http://xmlns.jcp.org/jsf/passthrough" xmlns:composite="http://xmlns.jcp.org/jsf/composite"
    xmlns:c="http://java.sun.com/jsp/jstl/core">

<composite:interface>
    <composite:attribute name="value" required="true" type="java.lang.Object" /> 
    <composite:attribute name="var" required="true" type="java.lang.String" targets="dataTable"/>   
</composite:interface>

<composite:implementation>      
    <div class="ui-g">
        <div class="ui-g-12">
            <p:dataTable id="dataTable" value="#{cc.attrs.value}" sortMode="multiple"
                paginator="true" rows="10"                
                rowsPerPageTemplate="10, 20, 50, 100" currentPageReportTemplate="Ergebnisse {startRecord} - {endRecord} von {totalRecords}"
                paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
               <c:set target="#{component}" property="var" value="#{cc.attrs.var}"/>                    
               <composite:insertChildren/>                            
            </p:dataTable>  
        </div>
    </div>
</composite:implementation>

The Primefaces column is implemented as a custom component (my:column):

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:p="http://primefaces.org/ui"
    xmlns:pt="http://xmlns.jcp.org/jsf/passthrough" >
        <p:column headerText="#{headerText}" sortable="#{sortable}">
            <ui:insert />
        </p:column>                   
</ui:composition>

And the component is called in the using page:

<my:dataTable id="datenTabelleID" value="#{showcaseDatenTabelleBean.quellWerteListe}" var="laufvar">
    <my:column headerText="ID">
        <h:outputText value="#{laufvar.id}" />
    </my:column>
    <my:column headerText="Name">
        <h:outputText value="#{laufvar.name}" />
    </my:column>
</my:dataTable>

Everything works as expected except for the IDE (in my case Eclipse) code assist for the iterator variable. I have no code completion for the attribute declared as var (laufvar).

Thanks in advance.

Upvotes: 2

Views: 255

Answers (0)

Related Questions