|
BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.jsp.tagext.TagSupport javax.servlet.jsp.tagext.BodyTagSupport com.bea.wlw.netui.tags.AbstractBaseTag com.bea.wlw.netui.tags.DataSourceTag com.bea.wlw.netui.tags.DefaultableDataSourceTag com.bea.wlw.netui.tags.OptionsDataSourceTag com.bea.wlw.netui.tags.html.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.
Attribute Descriptions | |||
---|---|---|---|
Attribute | Required | Runtime Expression Evaluation | Data Bindable |
dataSource | Yes | No | Read / Write |
The name of a form bean property or an expression that contains the CheckBoxGroup state. | |||
defaultValue | No | No | Read Only |
A literal value or an expression that is used to set the CheckBoxGroup's initial state. | |||
disabled | No | No | Read Only |
A boolean value which if true will cause the CheckBoxGroup to be disabled. | |||
labelStyle | No | No | No |
The style of the label for each contained CheckBoxOption. | |||
labelStyleClass | No | No | No |
The style class of the label for each contained CheckBoxOption. | |||
optionsDataSource | No | No | Read Only |
An expression that is used to generate a set of dynamic CheckBoxOptions. If the underlying type is a com.bean.wlw.netui.tags.GroupOption the name, value, alt and accesskey may be individually set. If the underlying type is a Map the name and value may be set individually. | |||
tagId | No | No | No |
The ID of this button used by the enclosing html tag to get the tag's real ID attribute for Javascript and focus purposes. The real ID attribute id is generated based upon this name. |
CheckBox
,
CheckBoxOption
,
Serialized FormpreferredColors
.
<netui:checkBoxGroup dataSource="{actionForm.preferredColors}" optionsDataSource="{pageFlow.colors}" />The
optionsDataSource
attribute points to a String[] on the Controller file:
colors = new String[] {"Red", "Blue", "Green", "Yellow", "White", "Black"};This automatically renders the appropriate set of checkbox options within the <checkBoxGroup>:
<input type="checkbox" value="Red">Red</input> <input type="checkbox" value="Blue">Blue</input> <input type="checkbox" value="Green">Green</input> <input type="checkbox" value="Yellow">Yellow</input> <input type="checkbox" value="White">White</input> <input type="checkbox" value="Black">Black</input>The
defaultValue
attribute may point to a String or a String[].
defaultValue = new String ("Blue");
defaultValue = new String[] {"Red", "Blue"};In either case, the appropriate checkbox options will appear checked in the browser.
<input type="checkbox" value="Red" checked="true">Red</input> <input type="checkbox" value="Blue" checked="true">Blue</input> <input type="checkbox" value="Green">Green</input> <input type="checkbox" value="Yellow">Yellow</input> <input type="checkbox" value="White">White</input> <input type="checkbox" value="Black">Black</input>
CheckBoxOption
tags.
Submitting Data
The <netui:checkBoxGroup> submits data in the form of a String[] object. For example, if the <netui:checkBoxGroup> submits data to a Form Bean field...
<netui:checkBoxGroup dataSource="{actionForm.userSelections}" optionsDataSource="{pageFlow.availableSelections}" />...then the Form Bean field must be a String[] object...
public static class SubmitForm extends FormData { private String[] userSelections; public void setUserSelections(String[] userSelections) { this.userSelections = userSelections; } public String[] getUserSelections() { return this.userSelections; } }
Dynamically Defined Checkboxes
You can dynamically define a set of checkboxes by pointing theoptionsDataSource
attribute
at a String[] object. When the <netui:checkBoxGroup> is rendered in the browser, a
corresponding set of
checkboxes will be genereated from the String[] object.
For example, if you define a String[] object in the Controller file...
public String[] availableOptions = {"option1", "option2", "option3"};...and reference this String[] from the
optionDataSource
attribute...
<netui:checkBoxGroup dataSource="{actionForm.userSelections}" optionsDataSource="{pageFlow.availableSelections}" />...then the appropriate checkboxes will be rendered in the browser.
<input type="checkbox" value="option1">option1</input> <input type="checkbox" value="option2">option2</input> <input type="checkbox" value="option3">option3</input>For checkboxes to be rendered, either the
optionsDataSource
attribute must be provided
(and point to a String[] object) or the <netui:checkBoxGroup> must have children
<netuiCheckBoxOption> tags.
Setting Default Options
The defaultValue
attribute can be used to determine which checkboxs are checked
when they are first rendered in the browser. The defaultValue
attribute
should point to a String, if only one checkbox should appear checked, or to a String[] object,
if multiple checkboxes should appear checked.
Nested Class Summary | |
---|---|
static class |
CheckBoxGroup.CheckboxGroupPrefixHandler
The handler for naming and indexing the CheckBoxGroup. |
Field Summary | |
---|---|
static String |
CHECKBOXGROUP_KEY
|
protected String |
labelStyle
The style of the label for each contained CheckBoxOption. |
protected String |
labelStyleClass
The style class of the label for each contained CheckBoxOption. |
protected String[] |
match
The actual values we will match against, calculated in doStartTag(). |
protected String |
saveBody
The saved body content of this tag. |
protected boolean |
useDefault
|
Fields inherited from class com.bea.wlw.netui.tags.AbstractBaseTag |
---|
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, JAVASCRIPT_STATUS, NETUI_UNIQUE_CNT |
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
---|
bodyContent |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
id, pageContext |
Fields inherited from interface com.bea.wlw.netui.tags.html.HtmlConstants |
---|
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH |
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag |
---|
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
---|
EVAL_BODY_AGAIN |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Constructor Summary | |
---|---|
CheckBoxGroup()
|
Method Summary | |
---|---|
int |
doAfterBody()
Save the body content of the CheckBoxGroup. |
int |
doEndTag()
Render the set of CheckBoxOptions. |
int |
doStartTag()
Determine the set of matches for the CheckBoxGroup |
protected Object |
evaluateDefaultValue()
|
protected Object |
evaluateOptionsDataSource()
This method will evalute the optionsDataSource and return an object. |
String |
getDisabled()
Returns the boolean value or expression indicating the disable state of the CheckBoxGroup. |
String |
getLabelStyle()
Return the label style for each contained CheckBoxOption.. |
String |
getLabelStyleClass()
Return the label style class for each contained CheckBoxOption.. |
String |
getStyle()
Gets the style of the rendered html tag. |
String |
getStyleClass()
Gets the style class of the rendered html tag. |
String |
getTagId()
Return the ID of the checkbox group. |
String |
getTagName()
Return the name of the Tag. |
boolean |
isMatched(String value)
Checks whether the given value matches one of the CheckBoxGroup's selected CheckBoxOptions. |
protected void |
localRelease()
Release any acquired resources. |
String |
qualifyDataSource()
|
void |
setDisabled(String disabled)
Set the disable state either with the literal "true" or "false" or with an expression. |
void |
setLabelStyle(String labelStyle)
Set the label style for each contained CheckBoxOption.. |
void |
setLabelStyleClass(String labelStyleClass)
Set the label style class for each contained CheckBoxOption.. |
void |
setStyle(String style)
Sets the style of the rendered html tag. |
void |
setStyleClass(String styleClass)
Sets the style class of the rendered html tag. |
void |
setTagId(String tagId)
Set the ID of the checkbox group. |
Methods inherited from class com.bea.wlw.netui.tags.OptionsDataSourceTag |
---|
getOptionsDataSource, setOptionsDataSource |
Methods inherited from class com.bea.wlw.netui.tags.DefaultableDataSourceTag |
---|
getDefaultValue, setDefaultValue |
Methods inherited from class com.bea.wlw.netui.tags.DataSourceTag |
---|
addNamingInterceptor, doNaming, evaluateDataSource, getDataSource, qualifyAttribute, removeNamingInterceptor, setDataSource |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
---|
doInitBody, getBodyContent, getPreviousOut, setBodyContent |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.jsp.tagext.Tag |
---|
getParent, setParent |
Field Detail |
---|
public static final String CHECKBOXGROUP_KEY
protected String[] match
protected String labelStyle
protected String labelStyleClass
protected String saveBody
protected boolean useDefault
Constructor Detail |
---|
public CheckBoxGroup()
Method Detail |
---|
public String getTagName()
getTagName
in class AbstractBaseTag
protected Object evaluateDefaultValue()
evaluateDefaultValue
in class DefaultableDataSourceTag
protected Object evaluateOptionsDataSource() throws javax.servlet.jsp.JspException
evaluateOptionsDataSource
in class OptionsDataSourceTag
javax.servlet.jsp.JspException
public String getTagId()
public void setTagId(String tagId)
tagId
- - the ID.String value. Sets the id
(or name
) attribute of the rendered HTML tag.
Note that the real id attribute rendered in the browser may be
changed by the application container (for example, Portal containers may change
the rendered id value to ensure the uniqueness of
id's on the page). In this case, the real id rendered
in the browser may be looked up
through the JavaScript function getNetuiTagName( tagId, tag ).
For example, assume that some tag's tagId
attribute is set to foo
.
<netui:textBox tagId="foo" />
Then the following JavaScript function will return the real id attribute rendered in the browser:
getNetuiTagName( "foo", this )
To get a <netui:form> element and all of its children elements in JavaScript, use
the same JavaScript function getNetuiTagName( tagId, tag )
. For example,
assume that there is a <netui:form> whose
tagId attribute is set to bar
.
<netui:form tagId="bar" >
Then the following JavaScript function will return the <netui:form> element and its children (packaged as an array).
document[getNetuiTagName( "bar", this )]
To retreive the value entered into a <netui:textBox> within the <netui:form> tag, use the following JavaScript expression.
document[getNetuiTagName("bar", this)][getNetuiTagName("foo", this)].value
The second parameter ensures that the JavaScript function
begins its search within the correct Portlet scope. Pass the
JavaScript keyword this
as the second parameter.
For detailed information on using the function
getNetuiTagName( tagId, tag )
see
Using JavaScript in Page Flow and Portal Applications.
public String getDisabled()
public void setDisabled(String disabled)
disabled
- - true or false or an expressiontrue
, then the rendered set of check boxes will be disabled.public String getLabelStyle()
public void setLabelStyle(String labelStyle)
labelStyle
- - the label stylepublic String getLabelStyleClass()
public void setLabelStyleClass(String labelStyleClass)
labelStyleClass
- - the label stylepublic void setStyle(String style)
style
- - the html style.public String getStyle()
public void setStyleClass(String styleClass)
styleClass
- - the html style class.public String getStyleClass()
public boolean isMatched(String value)
value
- Value to be comparedpublic int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- if a JSP exception has occurredpublic int doAfterBody() throws javax.servlet.jsp.JspException
doAfterBody
in interface javax.servlet.jsp.tagext.IterationTag
doAfterBody
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- if a JSP exception has occurredpublic int doEndTag() throws javax.servlet.jsp.JspException
doEndTag
in interface javax.servlet.jsp.tagext.Tag
doEndTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- if a JSP exception has occurredprotected void localRelease()
localRelease
in class OptionsDataSourceTag
public String qualifyDataSource() throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException
|
BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |