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

[jsr372-experts] Re: [jsr372-experts mirror] Re: 1364-MapInUIRepeatUIData

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Thu, 26 Feb 2015 13:38:28 +0100

Hi there,

On Thu, Feb 26, 2015 at 12:24 AM, Edward Burns <edward.burns_at_oracle.com> wrote:
>>>>>> On Fri, 20 Feb 2015 01:06:32 +0100, arjan tijms <arjan.tijms_at_gmail.com> said:
>
> So, essentially when you say
>
> <h:dataTable value="#{cart.items}" var="cur">
> <p>#{cur.key} #{cur.value}</p>
> </h:dataTable>
>
> with
>
> public class Cart {
>
> public Map<String, Object> getItems() {}
> }

That's correct (with <p> being inside an <h:column> of course).


> What do we need to say about calling setValue()?

Do you mean UIData#setValue? In that case, the JavaDoc for
UIData#setValue does not have to change.


> I expect we would need to create MapDataModel and specify its creation
> in the UIData javadoc.

We could create a MapDataModel indeed, but we can also just pass
((Map) current).entrySet() into IterableDataModel.

E.g. in Mojarra:

// ..
} else if (current instanceof Iterable) {
    setDataModel(new IterableDataModel<>((Iterable<?>) current));
} else if (current instance Map) {
    setDataModel(new IterableDataModel<>(((Map) current).entrySet() );
}

Kind regards,
Arjan


>
> AT> I created https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1364
> AT> to track this.
>
> AT> I just asked in 1103-IterableInUIRepeatUIData for your opinion about
> AT> this, but at second thought a separate thread might make it clearer.
> AT> Sorry for that.
>
> Yes, though I want us to be careful about not creating too many
> discussion threads. Generally, I like to reserve the right to top-post
> to Manfred and I, but because he and I have limited availability to
> manage the list, it's probably better to be looser about this so the
> group can continue to make progress without Manfred and I.
>
> Ed
>
> --
> | edward.burns_at_oracle.com | office: +1 407 458 0017
> | 8 days til DevNexus 2015
> | 18 days til JavaLand 2015
> | 28 days til CONFESS 2015