jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: [jsr372-experts mirror] ui:repeat

From: Cagatay Civici <cagatay.civici_at_gmail.com>
Date: Wed, 13 Jan 2016 18:56:10 +0200

Hi,

My main issue was with implementation not specification. As an example, case below works with MyFaces but fails with Mojarra so we had to create p:repeat as a quick workaround since repeating PF components is common and users were having issues.

https://github.com/primefaces/primefaces/issues/720

Mojarra ui:repeat checks if it is nested inside another data or ui:repeat component to clean the model, since we have components that may repeat children like Tabview or Accordion which are neither UIData or UIRepeat, model is not cleared causing issues like above.

Following is from Mojarra that is used by UIData and UIRepeat;

private Boolean isNestedWithinIterator() {
        if (isNested == null) {
            UIComponent parent = this;
            while (null != (parent = parent.getParent())) {
                if (parent instanceof UIData || parent.getClass().getName().endsWith("UIRepeat")) {
                    isNested = Boolean.TRUE;
                    break;
                }
            }
            if (isNested == null) {
                isNested = Boolean.FALSE;
            }
            return isNested;
        } else {
            return isNested;
        }
    }


One problem is checking class with name;

parent.getClass().getName().endsWith("UIRepeat”)

Another problem is performance since it checks until viewport.

In terms of Spec, an interface like Repeater should solve it where we at PF can implement as well for our components. Another thing is MyFaces doesn’t have checks like this, there is a nice nested data model solution that doesn’t to class checks or tree traversal.

So overall my issue was implementation specific as it works with MyFaces.

Regards,

Cagatay Civici
PrimeFaces Lead
PrimeTek Informatics
www.primefaces.org (http://www.primefaces.org)



On Wednesday 13 January 2016 at 16:27, arjan tijms wrote:

> Hi,
>
> Interesting, indeed. There's quite an amount of issues in the spec tracker that concern ui:repeat and the related h:dataTable. I planned to do a JSF 2.3 wishlist part II, but never came around to doing that.
>
> See:
> https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-236
> UIData needs review on a couple of fronts https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-935
> Alignment/extending of iterating ui components https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-963
> Provide a component for iterating over hierarchical data https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-965
> ui:repeat requires document "begin" and "end" properties https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-892
> add "maxRepeats" attribute to ui:repeat. https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1249
> Add a styleClass attribute to h:column https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-217
> Inconsistent column styles handling with h:dataTable https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-627
> ui:repeat varStatus incompletely specified https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-609
> Add rowStatePreserved property to UIRepeat, exactly the same as UIData https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1263
> UIData (and related classes) doesn't respect contract for UIComponent process https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1120
> UIRepeat supports Collection https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1103
> Add support for condition check like regular for-loop in ui:repeat https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1102
> Have DataModel implementations registerable https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1078
> h:datatable component to handle multiple entities lists https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-713
> UIRepeat et al are not specified https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-704
> Ajax inside a DataTable (getClientId append rowIndex) https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-865
> Perhaps some of the inconsistencies Cagatay found are related to any of those?
>
> Kind regards,
> Arjan Tijms
>
>
>
>
>
> On Wed, Jan 13, 2016 at 3:15 PM, Kito Mann <kito.mann_at_virtua.com (mailto:kito.mann_at_virtua.com)> wrote:
> > Hello Cagatay,
> >
> > I noticed you just added a PrimeFaces repeat component (https://github.com/primefaces/primefaces/issues/999) citing "inconsistencies between ui:repeat implementations of mojarra and myfaces with our components". Is there something we need to do with the spec to ensure that the two implementations of ui:repeat behave more consistently?
> > ___
> >
> > Kito D. Mann | @kito99 | Author, JSF in Action
> > Web Components, Polymer, JSF, PrimeFaces, Java EE, and Liferay training and consulting
> > Virtua, Inc. | virtua.tech (http://virtua.tech)
> > JSFCentral.com (http://JSFCentral.com) | @jsfcentral
> > +1 203-998-0403 (tel:%2B1%20203-998-0403)
> >
> > * Listen to the Enterprise Java Newscast: http:// (http://blogs.jsfcentral.com/JSFNewscast/)enterprisejavanews.com (http://ww.enterprisejavanews.com)
> >
>