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

[jsr372-experts] Re: [jsr372-experts mirror] Re: StateHelper inside Repeat

From: Hanspeter <hampidu_at_gmail.com>
Date: Wed, 25 Feb 2015 10:10:52 +0100

Hello.
Actually this is more a matter od the state-handling of the iteraring
component. It must save/restore children component states per iteration as
it is done in UIData.

A component that may be a child of an iterating component should not have
to care about being child of an iteraring component.

So there might be iteraring components that do no proper children state
handling per iterarion - these need to be fixed.

Best regards
Hanspeter
Am 24.02.2015 15:20 schrieb "Cagatay Civici" <cagatay.civici_at_gmail.com>:

> That would be great.
>
> Cagatay Civici
> PrimeFaces Lead
> PrimeTek Informatics
> www.primefaces.org
>
> On Tuesday 24 February 2015 at 16:12, Kito Mann wrote:
>
> I wonder if a simple helper method that uses the clientId internally might
> help:
>
> getStateHelper().putIterableValue("mystate", somevalue);
>
> Not a good name, but you get the idea.
>
> ___
>
> Kito D. Mann | @kito99 | Author, JSF in Action
> Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting
> http://www.JSFCentral.com | @jsfcentral
> +1 203-998-0403
>
> * Listen to the Enterprise Java Newscast: *http://
> <http://blogs.jsfcentral.com/JSFNewscast/>enterprisejavanews.com
> <http://ww.enterprisejavanews.com>*
> * JSFCentral Interviews Podcast:
> http://www.jsfcentral.com/resources/jsfcentralpodcasts/
> * Sign up for the JSFCentral Newsletter:
> http://oi.vresp.com/?fid=ac048d0e17
>
> On Tue, Feb 24, 2015 at 9:05 AM, Cagatay Civici <cagatay.civici_at_gmail.com>
> wrote:
>
> Hi,
>
> When a component uses state map via stateHelper a problem occurs in case
> the component is inside Data iteration.
>
> For example there is a data iteration with ui:repeat from 0 to 9, comp
> keeps “mystate” in state helper in first index which is 0, for all other
> iterations from 1 to 9 “mystate” will be same.
>
> getStateHelper().put(“mystate”, somevalue);
>
> <ui:repeat>
> <my:comp />
> </ui:repeat>
>
> Can’t the JSF runtime create a unique state map using client id of the
> my:comp? So that the component can have a separate state map when we try to
> put and get from the map.
>
> Or would you suggest setting the state value using client id like;
>
> getStateHelper().put(this.clientId + “mystate”, somevalue);
>
> Regards,
>
> Cagatay Civici
> PrimeFaces Lead
> PrimeTek Informatics
> www.primefaces.or
>
>
>
>