|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectTagSupport
BodyTagSupport
AbstractClassicTag
HtmlGroupBaseTag
CheckBoxGroup
public class CheckBoxGroup
Groups a collection of CheckBoxOptions, and handles databinding of their values. CheckBoxGroup binds to an Iterator of Strings. If CheckBoxGroup uses any Format tags, it must have those tags come before any nested CheckBoxOption tags.
preferredColors.
<netui:checkBoxGroup
dataSource="actionForm.preferredColors"
optionsDataSource="${pageFlow.colors}" />
The optionsDataSource attribute points to a get method for a String[] on the Controller file:
String[] colors = new String[] {"Red", "Blue", "Green", "Yellow", "White", "Black"};
public String[] getColors()
{
return colors;
}
This automatically renders the appropriate set of checkbox options within the <checkBoxGroup>:
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="Red">Red</input>
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="Blue">Blue</input>
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="Green">Green</input>
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="Yellow">Yellow</input>
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="White">White</input>
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="Black">Black</input>
The defaultValue attribute may point to a String or a String[].
<netui:checkBoxGroup
dataSource="actionForm.preferredColors"
optionsDataSource="${pageFlow.colors}"
defaultValue="${pageFlow.defaultColor}" />
And in the Controller:
String defaultColor = new String ("Blue");
...
or
String[] defaultColor = new String[] {"Red", "Blue"};
...
In either case, the appropriate
checkbox options will appear checked in the browser.
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="Red" checked="true">Red</input>
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="Blue" checked="true">Blue</input>
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="Green">Green</input>
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="Yellow">Yellow</input>
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="White">White</input>
<input type="checkbox" name="wlw-checkbox_group_key:{actionForm.preferredColors}" value="Black">Black</input>| Nested Class Summary | |
|---|---|
static class |
CheckBoxGroup.CheckboxGroupPrefixHandler
The handler for naming and indexing the CheckBoxGroup. |
| Field Summary | |
|---|---|
static String |
CHECKBOXGROUP_KEY
This is the name of the prefixHandler for the checkbox grup. |
| Fields inherited from class HtmlGroupBaseTag |
|---|
_cr, _dataSource, _defaultValue, _disabled, _labelStyle, _labelStyleClass, _optionsDataSource, _repCurItem, _repeater, _repIdx, HORIZONTAL_VALUE, VERTICAL_VALUE |
| Fields inherited from class AbstractClassicTag |
|---|
DefaultNamingChain, EMPTY_STRING, NETUI_UNIQUE_CNT |
| Fields inherited from class BodyTagSupport |
|---|
bodyContent |
| Fields inherited from class TagSupport |
|---|
id, pageContext |
| Fields inherited from interface BodyTag |
|---|
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
| Fields inherited from interface IterationTag |
|---|
EVAL_BODY_AGAIN |
| Fields inherited from interface Tag |
|---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
| Constructor Summary | |
|---|---|
CheckBoxGroup()
|
|
| Method Summary | |
|---|---|
void |
createHiddenField(AbstractRenderAppender results)
|
int |
doAfterBody()
Save any body content of this tag, which will generally be the option(s) representing the values displayed to the user. |
int |
doEndTag()
Render the set of CheckBoxOptions. |
int |
doStartTag()
Determine the set of matches for the CheckBoxGroup |
protected List |
getNamingChain()
Return an ArrayList which represents a chain of INameInterceptor
objects. |
String |
getTagName()
Return the name of the Tag. |
boolean |
isMatched(String value,
Boolean defaultValue)
Checks whether the given value matches one of the CheckBoxGroup's selected CheckBoxOptions. |
protected void |
localRelease()
Release any acquired resources. |
| Methods inherited from class BodyTagSupport |
|---|
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent |
| Methods inherited from class TagSupport |
|---|
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface Tag |
|---|
getParent, setPageContext, setParent |
| Field Detail |
|---|
public static final String CHECKBOXGROUP_KEY
| Constructor Detail |
|---|
public CheckBoxGroup()
| Method Detail |
|---|
public String getTagName()
getTagName in interface INetuiTaggetTagName in class AbstractClassicTagprotected List getNamingChain()
ArrayList which represents a chain of INameInterceptor
objects. This method by default returns null and should be overridden
by objects that support naming.
getNamingChain in class HtmlGroupBaseTagArrayList that will contain INameInterceptor objects.
public boolean isMatched(String value,
Boolean defaultValue)
isMatched in class HtmlGroupBaseTagvalue - Value to be compared
public int doStartTag()
throws JspException
doStartTag in interface TagdoStartTag in class BodyTagSupportJspException - if a JSP exception has occurred
public int doAfterBody()
throws JspException
doAfterBody in interface IterationTagdoAfterBody in class BodyTagSupportJspException - if a JSP exception has occurred
public int doEndTag()
throws JspException
doEndTag in interface TagdoEndTag in class BodyTagSupportJspException - if a JSP exception has occurred
public void createHiddenField(AbstractRenderAppender results)
throws JspException
JspExceptionprotected void localRelease()
localRelease in class HtmlGroupBaseTag
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||