Saturday, January 8, 2011

Why does ADF Faces have both a Select Boolean Checkbox and a Select Many Checkbox?


Just as in Core JSF, there are two components to serve two different needs - af:selectBooleanCheckbox is a bit more cumbersome to use, but allows for greater flexibility with layout.  af:selectManyCheckbox is simpler to use, but has greater restrictions on layout.
  • Each checkbox in your group is represented by a one-to-one mapping to a selectBooleanCheckbox component
  • The value of the selectBooleanCheckbox is a boolean, and we recommend you use the typesafe attribute "selected" instead of "value"
  • Since each checkbox is rendered individually, the app developer has great control over alignment.  For example, the app developer can create a UI like these two below using af:selectBooleanCheckbox

SelectBooleanCheckbox components intermixed with other controls within a form
A grid layout of eight selectBooleanCheckbox components
af:selectManyCheckbox component:
  • All checkboxes in the group are represented by one af:selectManyCheckbox component, which has af:selectItem, f:selectItems, or af:selectItems as its children.
  • The value of the af:selectManyCheckbox is a List of the selected values
  • The checkboxes can be laid out either all in one horizontal row or all in one vertical row, by using the "layout" attribute on af:selectManyCheckbox

No comments:

Post a Comment