public class MenuRenderer extends HtmlBasicInputRenderer
UISelectOne or UISelectMany component as a list of menu
options.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.sun.faces.renderkit.html_basic.HtmlBasicRenderer
HtmlBasicRenderer.OptionComponentInfo, HtmlBasicRenderer.Param
-
Field Summary
-
Fields inherited from class com.sun.faces.renderkit.html_basic.HtmlBasicRenderer
EMPTY_PARAMS, logger
-
Fields inherited from class javax.faces.render.Renderer
PASSTHROUGH_RENDERER_LOCALNAME_KEY
-
Constructor Summary
Constructors
Constructor and Description
MenuRenderer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
protected Collection<Object>
bestGuess(Class<? extends Collection<Object>> type,
int initialSize)
protected Collection<Object>
cloneValue(Object value)
Utility method to invoke the the clone
method on the provided value.
protected Object
coerceToModelType(FacesContext ctx,
Object value,
Class<?> itemValueType)
protected boolean
containsaValue(Object valueArray)
Object
convertSelectManyValue(FacesContext context,
UISelectMany uiSelectMany,
String[] newValues)
protected Object
convertSelectManyValuesForArray(FacesContext context,
UISelectMany uiSelectMany,
Class<?> elementType,
String[] newValues)
protected Collection<Object>
convertSelectManyValuesForCollection(FacesContext context,
UISelectMany uiSelectMany,
Class<? extends Collection<Object>> collectionType,
String[] newValues)
protected Object
convertSelectManyValuesForModel(FacesContext context,
UISelectMany uiSelectMany,
Class<?> modelType,
String[] newValues)
Object
convertSelectOneValue(FacesContext context,
UISelectOne uiSelectOne,
String newValue)
protected Collection<Object>
createCollection(Collection<Object> collection,
Class<? extends Collection<Object>> fallBackType)
protected Collection<Object>
createCollectionFromHint(Object collectionTypeHint)
Create a collection from the provided hint.
void
decode(FacesContext context,
UIComponent component)
Decode any new state of the specified UIComponent
from the request contained in the specified FacesContext
,
and store that state on the UIComponent
.
void
encodeBegin(FacesContext context,
UIComponent component)
Render the beginning specified UIComponent
to the
output stream or writer associated with the response we are creating.
void
encodeEnd(FacesContext context,
UIComponent component)
Render the ending of the current state of the specified
UIComponent
, following the rules described for
encodeBegin()
to acquire the appropriate value
to be rendered.
Object
getConvertedValue(FacesContext context,
UIComponent component,
Object submittedValue)
Attempt to convert previously stored state information into an
object of the type required for this component (optionally using the
registered Converter
for this component,
if there is one).
protected Object
getCurrentSelectedValues(UIComponent component)
protected String
getMultipleText(UIComponent component)
protected Object[]
getSubmittedSelectedValues(UIComponent component)
protected static boolean
isHideNoSelection(UIComponent component)
protected boolean
isSelected(FacesContext context,
UIComponent component,
Object itemValue,
Object valueArray,
Converter<?> converter)
protected boolean
renderOption(FacesContext context,
UIComponent component,
UIComponent selectComponent,
Converter<?> converter,
SelectItem curItem,
Object currentSelections,
Object[] submittedValues,
HtmlBasicRenderer.OptionComponentInfo optionInfo)
protected int
renderOptions(FacesContext context,
UIComponent component,
SelectItemsIterator<SelectItem> items)
protected void
renderSelect(FacesContext context,
UIComponent component)
protected void
writeDefaultSize(ResponseWriter writer,
int itemCount)
-
Methods inherited from class com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer
getNonOnChangeBehaviors, getNonOnClickSelectBehaviors, getValue, setSubmittedValue
-
Methods inherited from class com.sun.faces.renderkit.html_basic.HtmlBasicRenderer
augmentIdReference, convertClientId, decodeBehaviors, encodeRecursive, getBehaviorParameters, getChildren, getCurrentValue, getEndTextToRender, getFacet, getForComponent, getFormattedValue, getFormattedValue, getMessageIter, getParamList, getPassThruBehaviors, getRendersChildren, isBehaviorSource, rendererParamsNotNull, shouldDecode, shouldEncode, shouldEncodeChildren, shouldWriteIdAttribute, writeIdAttributeIfNecessary
-
Methods inherited from class javax.faces.render.Renderer
encodeChildren
-
-
Method Detail
-
convertSelectManyValue
public Object convertSelectManyValue(FacesContext context,
UISelectMany uiSelectMany,
String[] newValues)
throws ConverterException
- Throws:
ConverterException
-
convertSelectOneValue
public Object convertSelectOneValue(FacesContext context,
UISelectOne uiSelectOne,
String newValue)
throws ConverterException
- Throws:
ConverterException
-
decode
public void decode(FacesContext context,
UIComponent component)
Description copied from class: Renderer
Decode any new state of the specified UIComponent
from the request contained in the specified FacesContext
,
and store that state on the UIComponent
.
During decoding, events may be enqueued for later processing
(by event listeners that have registered an interest), by calling
queueEvent()
on the associated UIComponent
.
- Overrides:
decode
in class HtmlBasicRenderer
- Parameters:
context
- FacesContext
for the request we are processing
component
- UIComponent
to be decoded.
-
encodeBegin
public void encodeBegin(FacesContext context,
UIComponent component)
throws IOException
Description copied from class: Renderer
Render the beginning specified UIComponent
to the
output stream or writer associated with the response we are creating.
If the conversion attempted in a previous call to
getConvertedValue()
for this component failed, the state
information saved during execution
of decode()
should be used to reproduce the incorrect
input.
- Overrides:
encodeBegin
in class Renderer
- Parameters:
context
- FacesContext
for the request we are processing
component
- UIComponent
to be rendered
- Throws:
IOException
- if an input/output error occurs while rendering
-
encodeEnd
public void encodeEnd(FacesContext context,
UIComponent component)
throws IOException
Description copied from class: Renderer
Render the ending of the current state of the specified
UIComponent
, following the rules described for
encodeBegin()
to acquire the appropriate value
to be rendered.
- Overrides:
encodeEnd
in class HtmlBasicRenderer
- Parameters:
context
- FacesContext
for the response we are creating
component
- UIComponent
to be rendered
- Throws:
IOException
- if an input/output error occurs while rendering
-
getConvertedValue
public Object getConvertedValue(FacesContext context,
UIComponent component,
Object submittedValue)
throws ConverterException
Description copied from class: Renderer
Attempt to convert previously stored state information into an
object of the type required for this component (optionally using the
registered Converter
for this component,
if there is one). If conversion is successful, the new value
should be returned from this method; if not, a
ConverterException
should be thrown.
- Overrides:
getConvertedValue
in class HtmlBasicInputRenderer
- Parameters:
context
- FacesContext
for the request we are processing
component
- UIComponent
to be decoded.
submittedValue
- a value stored on the component during
decode
.
- Returns:
- the converted value
- Throws:
ConverterException
- if the submitted value
cannot be converted successfully.
-
convertSelectManyValuesForModel
protected Object convertSelectManyValuesForModel(FacesContext context,
UISelectMany uiSelectMany,
Class<?> modelType,
String[] newValues)
-
convertSelectManyValuesForArray
protected Object convertSelectManyValuesForArray(FacesContext context,
UISelectMany uiSelectMany,
Class<?> elementType,
String[] newValues)
throws ConverterException
- Throws:
ConverterException
-
convertSelectManyValuesForCollection
protected Collection<Object> convertSelectManyValuesForCollection(FacesContext context,
UISelectMany uiSelectMany,
Class<? extends Collection<Object>> collectionType,
String[] newValues)
-
renderOption
protected boolean renderOption(FacesContext context,
UIComponent component,
UIComponent selectComponent,
Converter<?> converter,
SelectItem curItem,
Object currentSelections,
Object[] submittedValues,
HtmlBasicRenderer.OptionComponentInfo optionInfo)
throws IOException
- Throws:
IOException
-
writeDefaultSize
protected void writeDefaultSize(ResponseWriter writer,
int itemCount)
throws IOException
- Throws:
IOException
-
containsaValue
protected boolean containsaValue(Object valueArray)
-
getCurrentSelectedValues
protected Object getCurrentSelectedValues(UIComponent component)
-
getMultipleText
protected String getMultipleText(UIComponent component)
-
getSubmittedSelectedValues
protected Object[] getSubmittedSelectedValues(UIComponent component)
-
isSelected
protected boolean isSelected(FacesContext context,
UIComponent component,
Object itemValue,
Object valueArray,
Converter<?> converter)
-
renderOptions
protected int renderOptions(FacesContext context,
UIComponent component,
SelectItemsIterator<SelectItem> items)
throws IOException
- Throws:
IOException
-
renderSelect
protected void renderSelect(FacesContext context,
UIComponent component)
throws IOException
- Throws:
IOException
-
coerceToModelType
protected Object coerceToModelType(FacesContext ctx,
Object value,
Class<?> itemValueType)
-
createCollection
protected Collection<Object> createCollection(Collection<Object> collection,
Class<? extends Collection<Object>> fallBackType)
- Parameters:
collection
- a Collection instance
- Returns:
- a new
Collection
instance or null if the instance cannot be
created
-
cloneValue
protected Collection<Object> cloneValue(Object value)
Utility method to invoke the the clone
method on the provided value.
- Parameters:
value
- the value to clone
- Returns:
- the result of invoking
clone()
or null
if the
value could not be cloned or does not implement the Cloneable
interface
-
bestGuess
protected Collection<Object> bestGuess(Class<? extends Collection<Object>> type,
int initialSize)
- Parameters:
type
- the target model type
initialSize
- the initial size of the Collection
- Returns:
- a
Collection
instance that best matches type
-
createCollectionFromHint
protected Collection<Object> createCollectionFromHint(Object collectionTypeHint)
Create a collection from the provided hint.
- Parameters:
collectionTypeHint
- the Collection type as either a String or Class
- Returns:
- a new Collection instance
-
isHideNoSelection
protected static boolean isHideNoSelection(UIComponent component)
Comments to: faces-dev@eclipse.org.
Copyright © 2019 Eclipse Foundation. All rights reserved.
Use is subject to license terms.