[
http://jira.jboss.com/jira/browse/JBSEAM-2148?page=comments#action_12419959 ]
Stephen Friedrich commented on JBSEAM-2148:
-------------------------------------------
groupVar is already optional, you can use both groupVar and var in groupEscape and
groupDisabled (see tag docs).
However both "group" and "groupLabel" are required (if you want
grouping), which is a little silly when you just want a single, fixed label for all the
select items. One possibility would be to make group optional, too.
I think it would be simpler to remove both group and groupVar and have only attributes for
group label, escape and disabled. (The number of attributes already is a little confusing
for the user.)
As for the internal structure: Sorry if the code looks somewhat unfamiliar. At first I
tried to make do with very little changes only, but it evolved into the current form. The
basics and quite a lot of code are still the same, though (converting the value to an
Iterable, for each one setting var/groupVar and creating the SelectItem).
The main change was caused by the need to create an intermediate representation of each
SelectItemGroup (so that SelectItems can be dynamically added to each group) and only
convert that to a real SelectItemGroup after iteration is done.
I tried to keep the ContextualSelectItem, but that was a problem because the varValue was
set/removed only for the creation of the item itself (and wasn't available for the
group), and the code was becoming a little convoluted.
Plus I found ContextualSelectItem to be unnecessary: Rather than creating an abstract base
class, plus a concrete anonymous subclass that overrides accessors to initialize each
instance field, you can simply pass the field values to the constructor. When you do that
you can just as well use the SelectItem class itself.
Well, and honestly speaking, I did not understand the code then as well as I do now...
So, please bear with me. I can create a new patch and keep the changes as small as
possible at all. I would then create a ContextualSelectItemGroup as a subclass of
ContextualSelectItem (like SelectItemGroup is a subclass of SelectItem).
The only question then is whether to keep all of "group", "groupVar"
and "groupLabel" or only have a single "group" attribute that is used
for both logical grouping and as the label (that would also remove the strange (if
improbable) edge case where the same group object would give different labels (for example
because the groupLabel EL expression accidentally uses the var attribute)).
Support for SelectItemGroup
---------------------------
Key: JBSEAM-2148
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2148
Project: Seam
Issue Type: Feature Request
Components: JSF Controls
Affects Versions: 2.0.0.CR2
Reporter: Pete Muir
Assigned To: Pete Muir
Fix For: 2.1.0.BETA2
Attachments: selectItems_group.patch
We can do something like
<s:selectItemGroup label="#{foo.bar}">
<s:selectItems .../>
<s:selectItems .../>
</s:selectItemGroup>
and, as a shorthand to put each list in a distinct group
<s:selectItems group="Foo"/>
I don't understand why this isn't in JSF core.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira