public class MenuRenderer extends HtmlBasicInputRenderer
UISelectOne or UISelectMany component as a list of menu
options.
HtmlBasicRenderer.OptionComponentInfo, HtmlBasicRenderer.Param
EMPTY_PARAMS, logger
PASSTHROUGH_RENDERER_LOCALNAME_KEY
Constructor and Description |
---|
MenuRenderer() |
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) |
getNonOnChangeBehaviors, getNonOnClickSelectBehaviors, getValue, setSubmittedValue
augmentIdReference, convertClientId, decodeBehaviors, encodeRecursive, getBehaviorParameters, getChildren, getCurrentValue, getEndTextToRender, getFacet, getForComponent, getFormattedValue, getFormattedValue, getMessageIter, getParamList, getPassThruBehaviors, getRendersChildren, isBehaviorSource, rendererParamsNotNull, shouldDecode, shouldEncode, shouldEncodeChildren, shouldWriteIdAttribute, writeIdAttributeIfNecessary
encodeChildren
public Object convertSelectManyValue(FacesContext context, UISelectMany uiSelectMany, String[] newValues) throws ConverterException
ConverterException
public Object convertSelectOneValue(FacesContext context, UISelectOne uiSelectOne, String newValue) throws ConverterException
ConverterException
public void decode(FacesContext context, UIComponent component)
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
.
decode
in class HtmlBasicRenderer
context
- FacesContext
for the request we are processingcomponent
- UIComponent
to be decoded.public void encodeBegin(FacesContext context, UIComponent component) throws IOException
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.
encodeBegin
in class Renderer
context
- FacesContext
for the request we are processingcomponent
- UIComponent
to be renderedIOException
- if an input/output error occurs while renderingpublic void encodeEnd(FacesContext context, UIComponent component) throws IOException
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.
encodeEnd
in class HtmlBasicRenderer
context
- FacesContext
for the response we are creatingcomponent
- UIComponent
to be renderedIOException
- if an input/output error occurs while renderingpublic Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException
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.
getConvertedValue
in class HtmlBasicInputRenderer
context
- FacesContext
for the request we are processingcomponent
- UIComponent
to be decoded.submittedValue
- a value stored on the component during
decode
.ConverterException
- if the submitted value
cannot be converted successfully.protected Object convertSelectManyValuesForModel(FacesContext context, UISelectMany uiSelectMany, Class<?> modelType, String[] newValues)
protected Object convertSelectManyValuesForArray(FacesContext context, UISelectMany uiSelectMany, Class<?> elementType, String[] newValues) throws ConverterException
ConverterException
protected Collection<Object> convertSelectManyValuesForCollection(FacesContext context, UISelectMany uiSelectMany, Class<? extends Collection<Object>> collectionType, String[] newValues)
protected boolean renderOption(FacesContext context, UIComponent component, UIComponent selectComponent, Converter<?> converter, SelectItem curItem, Object currentSelections, Object[] submittedValues, HtmlBasicRenderer.OptionComponentInfo optionInfo) throws IOException
IOException
protected void writeDefaultSize(ResponseWriter writer, int itemCount) throws IOException
IOException
protected boolean containsaValue(Object valueArray)
protected Object getCurrentSelectedValues(UIComponent component)
protected String getMultipleText(UIComponent component)
protected Object[] getSubmittedSelectedValues(UIComponent component)
protected boolean isSelected(FacesContext context, UIComponent component, Object itemValue, Object valueArray, Converter<?> converter)
protected int renderOptions(FacesContext context, UIComponent component, SelectItemsIterator<SelectItem> items) throws IOException
IOException
protected void renderSelect(FacesContext context, UIComponent component) throws IOException
IOException
protected Object coerceToModelType(FacesContext ctx, Object value, Class<?> itemValueType)
protected Collection<Object> createCollection(Collection<Object> collection, Class<? extends Collection<Object>> fallBackType)
collection
- a Collection instanceCollection
instance or null if the instance cannot be
createdprotected Collection<Object> cloneValue(Object value)
Utility method to invoke the the clone
method on the provided value.
value
- the value to cloneclone()
or null
if the
value could not be cloned or does not implement the Cloneable
interfaceprotected Collection<Object> bestGuess(Class<? extends Collection<Object>> type, int initialSize)
type
- the target model typeinitialSize
- the initial size of the Collection
Collection
instance that best matches type
protected Collection<Object> createCollectionFromHint(Object collectionTypeHint)
Create a collection from the provided hint.
collectionTypeHint
- the Collection type as either a String or Classprotected static boolean isHideNoSelection(UIComponent component)
Comments to: faces-dev@eclipse.org.
Copyright © 2019 Eclipse Foundation. All rights reserved.
Use is subject to license terms.