-
Notifications
You must be signed in to change notification settings - Fork 55
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
UIData should support the collection interface rather than the List interface #479
Comments
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented
PM> Currently UIData and UIRepeat only support List, not Collection (sets). PM> http://sfjsf.blogspot.com/2006/03/usings-sets-with-uidata.html PM> But what about the point that a Collection is not indexed by You bring a good point, and I'm delighted for your offer to contribute Ed |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented We really need to resolve this issue. It is embarrassing. |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented I've found iterating over this structure not at all to be uncommon. JSTL supported it directly, but in JSF with UIData based components we have to jump through some hoops. Currently I'm mostly using a helper method that I map to an EL function, like this: public static List<Map.Entry> mapToList(Map map) { if (map == null) { return null; } List<Map.Entry> list = new ArrayList<Map.Entry>(); return list; This will intuitively expose a "key" and "value" property on the iteration variable. However, for many developers it's not clear they have to use a helper function like this and a great deal of wasted time and frustration results. Supporting Maps directly would greatly simply matters. |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented It would be good if the API spec could be changed to include a factory for creating the DataModel. This would stop repeated code, but also allow third party components to generate a DataModel. E.g. Richfaces has a rich:list component that outputs an html ul (sadly missing from the standard library) but it does not support Sets. If it used a DataModel factory it would now work with Sets. |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented
Yes, please, and it will not make JSF 2.2.
Please file an issue, and it will not make JSF 2.2. |
@glassfishrobot Commented
What about using #1103 for this?
At this point I don't think anyone assumes that any new suggestions will still make it in JSF 2.2, but what about making some public announcement about this? I.e. that new suggestions are still welcome, but will be considered for JSF 2.3 at the earliest. |
@glassfishrobot Commented |
@glassfishrobot Commented |
|
The root of the Java collections class structure is java.util.Collection, yet
this interface is not supported in the UIData family of components. Instead,
developers are forced to use a List or wrap their collection in a custom
DataModel implementation (which is what Seam does). The impedance mismatch is
introduced by the fact that java.util.Set is likely the most common association
mapping in ORM. Since the UIData model and ORM go hand-in-hand, there should be
support for java.util.Set (and preferably java.util.Collection) in UIData.
Granted, only a java.util.List can be accessed by index, which is why it would
be acceptable to wrap any other collection in a List implementation internally.
Basically, the developer should not have to care that they are creating a data
table from a Set vs a List. This is an area where the JSF abstract just bleeds.
Environment
Operating System: All
Platform: All
Affected Versions
[1.2]
The text was updated successfully, but these errors were encountered: