Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIRepeat and UIData supports Iterable #1103

Closed
eclipse-faces-bot opened this issue May 23, 2012 · 18 comments
Closed

UIRepeat and UIData supports Iterable #1103

eclipse-faces-bot opened this issue May 23, 2012 · 18 comments

Comments

@eclipse-faces-bot
Copy link

I encountered a problem attempting to set the ui:repeat "value" attribute to an
instance that was a subclass of java.util.Set (specifically Hibernate's
PersistentSet class): the UIRepeat class treated it like a scalar object.

An iteration tag like ui:repeat should work with all Collection types in my
opinion. In the UIRepeat.getDataModel() method it's possible to detect an
instance of Collection and make use of the ArrayDataModel by invoking the
toArray() method on the instance. In this way a new DataModel implementation
isn't needed. I've made this change in my own copy of Facelets and it works
beautifully.

Hibernate happens to use Sets quite a bit, so this was important to me. I'd be
happy to submit a patch.

This issue occurs in Facelets 1.2 as well.\

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Reported by @edburns

@eclipse-faces-bot
Copy link
Author

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
adynn93 said:
Not only just collections, ui:repeat should also support iterables as well for the value attribute.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
ertiop93 said:
ui:repeat should allow iterables to be used with them. Currently we are required to create a new list from iterable just to support ui:repeat. This limitation should be removed.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
kithouna said:
The collection / iterable to datamodel conversion should be abstracted and put in a global place. Now DataTable and UIRepeat do pretty much the same thing and differences crop up between them that benefit no one.

Then, we the users should be able to register additional datamodel converters, so we can register something like OmniFaces' IterableDataModel and they would be automatically used by DataTable, UIRepeat and others.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@manfredriem said:
Setting priority to Major

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@arjantijms said:

Not only just collections, ui:repeat should also support iterables as well for the value attribute.

I agree, and have adjusted the title of the issue to reflect that. If UIRepeat supports iterables, UIData should support that as well. Thanks for this suggestion!

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Section 4.1.3.2 in the spec PDF must be updated as well for this issue to be considered closed. The relevant text in the latest version of the spec is the following:

The current value identified by the value property is normally of type DataModel. [P1-start-uidataModel]However, a
DataModel wrapper instance must automatically be provided by the JSF implementation if the current value is of one
of the following types:
java.util.List
Array of java.util.Object
java.sql.ResultSet (which therefore also supports javax.sql.RowSet)
javax.servlet.jsp.jstl.sql.Result
Any other Java object is wrapped by a DataModel instance with a single row.[P1-end]
Convenience implementations of DataModel are provided in the javax.faces.model package for each of the
above (see Section 4.2.1.4 “Concrete Implementations”), and must be used by the UIData component to create the
required DataModel wrapper.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@edburns said:
I have some comments about the changebundle, but I'll add them on the impl issue JAVASERVERFACES-3785.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@arjantijms said:

The relevant text in the latest version of the spec is the following:

The spec currently lists:

  • java.util.List
  • Array of java.util.Object
  • java.sql.ResultSet
  • javax.servlet.jsp.jstl.sql.Result
  • (Object wrapped as single row)

But java.util.Collection is missing, while this was added via a spec issue (#479).

The new list would therefor become:

  • java.util.List
  • Array of java.util.Object
  • java.sql.ResultSet
  • javax.servlet.jsp.jstl.sql.Result
  • java.util.Collection
  • java.lang.Iterable
  • (Object wrapped as single row)

Also, a similar list appears in UIRepeat, but I can't find anything about that in the spec.

The updated text in section 4.1.3.2 after this update (and after taking into account the change from 2.2) would be the following:

The current value identified by the value property is normally of type DataModel. [P1-start-uidataModel]However, a DataModel wrapper instance must automatically be provided by the JSF implementation if the current value is of one of the following types:

java.util.List
Array of java.util.Object
java.sql.ResultSet (which therefore also supports javax.sql.RowSet)
javax.servlet.jsp.jstl.sql.Result
java.util.Collection
java.lang.Iterable
Any other Java object is wrapped by a DataModel instance with a single row.[P1-end]

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
File: changebundle.txt
Attached By: @arjantijms

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@arjantijms said:
Patch for ui:repeat's taglib/tld doc

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@arjantijms said:
Oops, UIRepeat changes did not make it into previous bundle

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
@manfredriem said:
Applied to 2.3 trunk,

svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1103, UIRepeat and UIData supports Iterable"
Sending jsf-ri/conf/share
Sending jsf-ri/conf/share/ui.taglib.xml
Sending jsf-ri/conf/share/ui.tld
Transmitting file data ..
Committed revision 14464.

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
Marked as fixed on Monday, March 2nd 2015, 9:27:43 am

@eclipse-faces-bot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-1103

@eclipse-faces-bot
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant