This content has been marked as final.
Show 2 replies
-
1. Re: Backing selectmanycheckbox with Enum Type
cash1981 Sep 20, 2010 3:28 AM (in response to darthmaul)Should be pretty straight forward.
xhtml:
<s:decorate template="/layout/edit_block.xhtml"> <ui:define name="label">#{messages['rulingType.choose']}</ui:define> <h:selectManyCheckbox id="radioRuling" value="#{rulingPage.ruling}" required="true"> <s:selectItems var="rul" value="#{rulings}" label="#{rul.label}" /> <s:convertEnum /> </h:selectManyCheckbox> </s:decorate> @Factory(value = "rulings", scope = ScopeType.EVENT) @BypassInterceptors public List<Ruling> getRulings() { Set<Ruling> allRulings = EnumSet.of(Ruling.INNVILGET,Ruling.DELVIS,Ruling.AVSLAG); return Collections.unmodifiableList(new ArrayList<Ruling>(allRulings)); } //In your bean @Name("rulingPage") public class RulingPage { List<Ruling> ruling; //Getter and setter
-
2. Re: Backing selectmanycheckbox with Enum Type
darthmaul Sep 20, 2010 10:23 AM (in response to darthmaul)I figured it was pretty straightforward, but I just needed a pointer in the right direction. The EnumSet class and the Factory annotation did the trick.
The only difference is that I used EnumSet.range() because I am lazy. Otherwise, I followed your guidance precisely, and it worked like a charm.
Thanks for you help.