|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.faces.render.Renderer
com.sun.rave.web.ui.renderer.AbstractRenderer
com.sun.rave.web.ui.renderer.RadioButtonGroupRenderer
public class RadioButtonGroupRenderer
The RadioButtonRenderer
renders a RadioButtonGroup
component as set of radio buttons. The RadioButtonGroupRenderer
creates an instance of RadioButton
for each
Option
instance in the Array
, Map
, or
Collection
returned by the RadioButtonGroup
getItems()
method and renders them. It also
creates a Label
component and renders it as the label for the
group.
Only one radio button may be selected at any time and one radio button
must always be selected. The value of the RadioButtonGroup
will determine which radio button shall be initially selected.
Subsequently, the RadioButtonGroup
's value holds the
currently selected radio button value.
The radio buttons are rendered as a single column or some number of
rows and columns. The rows and columns are rendered as a table as
defined by the RowColumnRenderer
superclass.
The elements
that make up the radio button occupy a cell in the table.
The style class selector for the group elements is identified by a java
constants defined in the ThemeStyles
class.
The name
property of each radio button is the component id of
the RadioButtonGroup
instance. The id of a
RadioButton
component is rbgrpid_N where
rbgrpid is the id of the
RadioButtonGroup
instance and _N is the nth
radio button.
The RadioButtonGroup
is decoded by identifying the
RadioButtonGroup
instance component id which is
returned as a request parameter. It represents the name attribute
of the selected radio button's <input> element. The value of
the identified request parameter is assigned as the submitted value of the
RadioButtonGroup
component.
If the items property of the RadioButtonGroup
is null or
zero length no output is produced.
Field Summary | |
---|---|
protected static int |
CAPTION_STYLE
Constant indicating a TD element stlye is desired. |
protected static int |
CELLEVEN_STYLE
Constant indicating a TD element style selector is desired. |
protected static int |
CELLODD_STYLE
Constant indicating a TD element style selector is desired. |
protected static int |
GRP
The define constant indicating the style class for the top level TABLE element. |
protected static int |
GRP_CAPTION
The define constant indicating the style class for the CSS table CAPTION (a CELL element). |
protected static int |
GRP_CELL_EVEN
The define constant indicating the style class for the even cells. |
protected static int |
GRP_CELL_ODD
The define constant indicating the style class for the odd cells. |
protected static int |
GRP_LABEL
The define constant indicating the style class for a disabled CSS table CAPTION (a LABEL) element. |
protected static int |
GRP_LABEL_DIS
The define constant indicating the style class for a disabled CSS table CAPTION (a LABEL) element. |
protected static int |
GRP_ROW_EVEN
The define constant indicating the style class for the even rows. |
protected static int |
GRP_ROW_ODD
The define constant indicating the style class for the odd rows. |
protected static int |
IMAGE
The define constant indicating the style class for the IMG element. |
protected static int |
IMAGE_DIS
The define constant indicating the style class for a disabled IMG element. |
protected static int |
INPUT
The define constant indicating the style class for an INPUT element. |
protected static int |
INPUT_DIS
The define constant indicating the style class for a disabled INPUT element. |
protected static int |
LABEL
The define constant indicating the style class for the LABEL element. |
protected static int |
LABEL_DIS
The define constant indicating the style class for a disabled LABEL element. |
protected static int |
LABEL_LVL_DEF
The define constant indicating the default label level style class for a LABEL element. |
protected static int |
LABEL_LVL1
The define constant indicating the label level style class for a LABEL element. |
protected static int |
LABEL_LVL2
The define constant indicating the label level style class for a LABEL element. |
protected static int |
LABEL_LVL3
The define constant indicating the label level style class for a LABEL element. |
protected static int |
ROWEVEN_STYLE
Constant indicating a TR element style selector is desired. |
protected static int |
ROWODD_STYLE
Constant indicating a TR element style selector is desired. |
protected java.lang.String[] |
styles
|
protected static int |
TABLE_STYLE
Constant indicating a TABLE element style selector is desired. |
Fields inherited from class com.sun.rave.web.ui.renderer.AbstractRenderer |
---|
BUNDLE, EVENTS_ATTRIBUTES, I18N_ATTRIBUTES |
Constructor Summary | |
---|---|
RadioButtonGroupRenderer()
Creates a new instance of RadioButtonGroupRenderer |
Method Summary | |
---|---|
void |
decode(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Decode the RadioButtonGroup or
CheckboxGroup selection. |
void |
encodeChildren(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Render the child components of this UIComponent, following the rules described for encodeBegin() to acquire the appropriate value to be rendered. |
protected Option[] |
getItems(Selector selector)
|
protected java.lang.String |
getRowColumnStyle(Theme theme,
int styleCode)
Pass on the style request from the RowColumnRenderer to
the SelectorGroupRenderer subclass. |
protected javax.faces.component.UIComponent |
getSelectorComponent(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Theme theme,
java.lang.String id,
Option option)
Return a RadioButton component to render. |
protected java.lang.String |
getStyle(Theme theme,
int styleCode,
int styleLevelCode)
Return the style class name and level for the structural element indicated by styleCode |
protected java.lang.String[] |
getStyles()
Return style constants for a RadioButton component. |
protected void |
renderCaption(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Theme theme,
javax.faces.context.ResponseWriter writer)
Called by the RowColumnRenderer superclass when the group label should be rendered. |
protected void |
renderCellContent(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Theme theme,
javax.faces.context.ResponseWriter writer,
int itemN)
Implemented by a subclass. |
protected void |
renderEmptyCell(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Theme theme,
javax.faces.context.ResponseWriter writer)
Called from the renderCellContent method implemented
in the sublclass when there are no more controls to render. |
void |
renderEnd(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
javax.faces.context.ResponseWriter writer)
RadioButtonGroupRenderer renders the entire RadioButtonGroup component within the renderEnd method. |
protected void |
renderRowColumnLayout(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Theme theme,
javax.faces.context.ResponseWriter writer,
int rows,
int columns)
Called from a subclass when rendering is to begin |
protected void |
renderSelectorGroup(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Theme theme,
javax.faces.context.ResponseWriter writer,
int columns)
Called from the renderEnd method of the subclass to begin rendering the component. |
void |
renderStart(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
javax.faces.context.ResponseWriter writer)
Ensure that the component to be rendered is a RadioButtonGroup instance. |
protected void |
transferEventAttributes(Selector group,
RbCbSelector rbcb)
|
Methods inherited from class com.sun.rave.web.ui.renderer.AbstractRenderer |
---|
addBooleanAttributes, addCoreAttributes, addIntegerAttributes, addStringAttributes, encodeBegin, encodeEnd, getApplication, getAsObject, getAsString, getExternalContext, getFacesContext, getSubmittedValue, isDisabled, isPortlet, isReadOnly, renderAttributes, renderMarkup, setSubmittedValue |
Methods inherited from class javax.faces.render.Renderer |
---|
convertClientId, getConvertedValue, getRendersChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String[] styles
protected static final int GRP
protected static final int GRP_CAPTION
protected static final int GRP_LABEL
protected static final int GRP_LABEL_DIS
protected static final int GRP_ROW_EVEN
protected static final int GRP_ROW_ODD
protected static final int GRP_CELL_EVEN
protected static final int GRP_CELL_ODD
protected static final int INPUT
protected static final int INPUT_DIS
protected static final int LABEL
protected static final int LABEL_DIS
protected static final int IMAGE
protected static final int IMAGE_DIS
protected static final int LABEL_LVL1
protected static final int LABEL_LVL2
protected static final int LABEL_LVL3
protected static final int LABEL_LVL_DEF
protected static final int TABLE_STYLE
protected static final int CAPTION_STYLE
protected static final int ROWEVEN_STYLE
protected static final int ROWODD_STYLE
protected static final int CELLEVEN_STYLE
protected static final int CELLODD_STYLE
Constructor Detail |
---|
public RadioButtonGroupRenderer()
Method Detail |
---|
public void renderStart(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer) throws java.io.IOException
renderEnd
renderStart
in class AbstractRenderer
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.writer
- ResponseWriter
to which the element
start should be rendered
java.io.IOException
- if an input/output error occurspublic void renderEnd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer) throws java.io.IOException
renderEnd
in class AbstractRenderer
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.writer
- ResponseWriter
to which the element
start should be rendered
java.io.IOException
- if an input/output error occursprotected javax.faces.component.UIComponent getSelectorComponent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Theme theme, java.lang.String id, Option option)
context
- FacesContext
for the current requestcomponent
- CheckboxGroup
component renderedtheme
- Theme
for the componentoption
- the Option
being rendered.id
- the new component's id.protected java.lang.String[] getStyles()
RadioButton
component.
public void decode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
RadioButtonGroup
or
CheckboxGroup
selection.
If the component clientId is found as a request parameter, which is
rendered as the value of the name
attribute of
the INPUT elements of type radio or checkbox, the String[]
value is assigned as the submitted value on the component.
In the case of a CheckboxGroup
component the array may
have zero or more elements. In the case of RadioButtonGroup
there is always only one element.
If the component clientId is not found as a request parameter a
String[0]
is assigned as the submitted value,
meaning that this is a CheckboxGroup
component with no
check boxes selected.
decode
in class AbstractRenderer
context
- FacesContext for the request we are processing.component
- The RadioButtonGroup component to be decoded.public void encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws java.io.IOException
encodeChildren
in class AbstractRenderer
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.
java.io.IOException
- if an input/output error occursprotected void renderSelectorGroup(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Theme theme, javax.faces.context.ResponseWriter writer, int columns) throws java.io.IOException
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.writer
- ResponseWriter
to which the HTML will
be outputcolumns
- the number of columns to use when rendering the controls
java.io.IOException
protected Option[] getItems(Selector selector)
protected void renderCellContent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Theme theme, javax.faces.context.ResponseWriter writer, int itemN) throws java.io.IOException
itemN
'th renderer cell.
context
- FacesContext
for the current requestcomponent
- component being renderedwriter
- ResponseWriter
to which the HTML is rendereditemN
- the nth cell to be rendered.
java.io.IOException
protected void renderCaption(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Theme theme, javax.faces.context.ResponseWriter writer) throws java.io.IOException
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.theme
- Theme for the request we are processing.writer
- ResponseWriter
to which the HTML will
be output
java.io.IOException
protected void renderEmptyCell(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Theme theme, javax.faces.context.ResponseWriter writer) throws java.io.IOException
renderCellContent
method implemented
in the sublclass when there are no more controls to render.
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.theme
- Theme for the request we are processing.writer
- ResponseWriter
to which the HTML will
be output
java.io.IOException
protected final java.lang.String getRowColumnStyle(Theme theme, int styleCode)
RowColumnRenderer
to
the SelectorGroupRenderer
subclass.
theme
- Theme for the request we are processing.styleCode
- the desired style class constantprotected java.lang.String getStyle(Theme theme, int styleCode, int styleLevelCode)
styleCode
styleCode
- identifies the style class for the element about
to be rendered.styleLevelCode
- identifies the style class level for the
element about to be rendered.protected void transferEventAttributes(Selector group, RbCbSelector rbcb)
protected void renderRowColumnLayout(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Theme theme, javax.faces.context.ResponseWriter writer, int rows, int columns) throws java.io.IOException
context
- FacesContext
for the current requestcomponent
- RadioButtonGroup
component renderedwriter
- ResponseWriter
to which the HTML is renderedrows
- the number of rows to rendercolumns
- the number of columns to render
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |