Top Description Fields Constructors Methods
com.sun.faces.renderkit.html_basic

public Class MenuRenderer

extends HtmlBasicInputRenderer
Class Inheritance
Known Direct Subclasses
com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer, com.sun.faces.renderkit.html_basic.ListboxRenderer
Static Imports
com.sun.faces.RIConstants.NO_VALUE, com.sun.faces.renderkit.RenderKitUtils.getSelectItems, .RenderKitUtils.renderOnchange, .RenderKitUtils.renderPassThruAttributes, .RenderKitUtils.renderXHTMLStyleBooleanAttributes, com.sun.faces.util.MessageUtils.CONVERSION_ERROR_MESSAGE_ID, .MessageUtils.getExceptionMessage, .ReflectionUtils.lookupMethod, .RequestStateManager.TARGET_COMPONENT_ATTRIBUTE_NAME, .Util.getConverterForClass, .Util.isAllNull, java.lang.Integer.MIN_VALUE, java.lang.reflect.Array.get, .Array.getLength, .Array.set, .Modifier.isAbstract, java.util.Arrays.stream, java.util.logging.Level.FINE, .Level.FINER, .Level.SEVERE, java.util.stream.Collectors.joining

MenuRenderer is a class that renders the current value of UISelectOne or UISelectMany component as a list of menu options.

Field Summary

Modifier and TypeField and Description
private static final Attribute[]

Constructor Summary

AccessConstructor and Description

Method Summary

Modifier and TypeMethod and Description
protected Collection<Object>

Returns:

a Collection instance that best matches type
bestGuess
(Class<? extends Collection<Object>>
the target model type
type
,
int
the initial size of the Collection
initialSize
)

protected Collection<Object>

Returns:

the result of invoking clone() or null if the value could not be cloned or does not implement the Cloneable interface
cloneValue
(Object
the value to clone
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)

public 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)

public Object
convertSelectOneValue(FacesContext context, UISelectOne uiSelectOne, String newValue)

protected Collection<Object>

Returns:

a new Collection instance or null if the instance cannot be created
createCollection
(Collection<Object>
a Collection instance
collection
,
Class<? extends Collection<Object>> fallBackType)

protected Collection<Object>

Returns:

a new Collection instance
createCollectionFromHint
(Object
the Collection type as either a String or Class
collectionTypeHint
)

Create a collection from the provided hint.

public void
decode(FacesContext
FacesContext for the request we are processing
context
,
UIComponent
UIComponent to be decoded.
component
)

Overrides com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.decode.

Decode any new state of the specified UIComponent from the request contained in the specified FacesContext, and store that state on the UIComponent.

private void
decodeUISelectMany(FacesContext context, UISelectMany component, String clientId)

private void
decodeUISelectOne(FacesContext context, UIComponent component, String clientId)

public void
encodeBegin(FacesContext
FacesContext for the request we are processing
context
,
UIComponent
UIComponent to be rendered
component
)

Overrides javax.faces.render.Renderer.encodeBegin.

Render the beginning specified UIComponent to the output stream or writer associated with the response we are creating.

public void
encodeEnd(FacesContext
FacesContext for the response we are creating
context
,
UIComponent
UIComponent to be rendered
component
)

Overrides com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd.

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.

public Object
getConvertedValue(FacesContext
FacesContext for the request we are processing
context
,
UIComponent
UIComponent to be decoded.
component
,
Object
a value stored on the component during decode.
submittedValue
)

Overrides com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue.

Attempt to convert previously stored state information into an object of the type required for this component (optionally using the registered javax.faces.convert.Converter for this component, if there is one).

protected Object
protected String
protected Object[]
protected static boolean
private boolean
isNoValueOrNull(String newValue, 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
protected void
protected void
writeDefaultSize(ResponseWriter writer, int itemCount)

Inherited from com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer:
getNonOnChangeBehaviorsgetNonOnClickSelectBehaviorsgetValuesetSubmittedValue

Field Detail

ATTRIBUTESback to summary
private static final Attribute[] ATTRIBUTES

Constructor Detail

Method Detail

bestGuessback to summary
protected Collection<Object> bestGuess(Class<? extends Collection<Object>> type, int initialSize)
Parameters
type:Class<? extends Collection<Object>>

the target model type

initialSize:int

the initial size of the Collection

Returns:Collection<Object>

a Collection instance that best matches type

cloneValueback to summary
protected Collection<Object> cloneValue(Object value)

Utility method to invoke the the clone method on the provided value.

Parameters
value:Object

the value to clone

Returns:Collection<Object>

the result of invoking clone() or null if the value could not be cloned or does not implement the Cloneable interface

coerceToModelTypeback to summary
protected Object coerceToModelType(FacesContext ctx, Object value, Class<?> itemValueType)
containsaValueback to summary
protected boolean containsaValue(Object valueArray)
convertSelectManyValueback to summary
public Object convertSelectManyValue(FacesContext context, UISelectMany uiSelectMany, String[] newValues) throws ConverterException
convertSelectManyValuesForArrayback to summary
protected Object convertSelectManyValuesForArray(FacesContext context, UISelectMany uiSelectMany, Class<?> elementType, String[] newValues) throws ConverterException
convertSelectManyValuesForCollectionback to summary
protected Collection<Object> convertSelectManyValuesForCollection(FacesContext context, UISelectMany uiSelectMany, Class<? extends Collection<Object>> collectionType, String[] newValues)
convertSelectManyValuesForModelback to summary
protected Object convertSelectManyValuesForModel(FacesContext context, UISelectMany uiSelectMany, Class<?> modelType, String[] newValues)
Annotations
@SuppressWarnings:unchecked
convertSelectOneValueback to summary
public Object convertSelectOneValue(FacesContext context, UISelectOne uiSelectOne, String newValue) throws ConverterException
createCollectionback to summary
protected Collection<Object> createCollection(Collection<Object> collection, Class<? extends Collection<Object>> fallBackType)
Parameters
collection:Collection<Object>

a Collection instance

Returns:Collection<Object>

a new Collection instance or null if the instance cannot be created

createCollectionFromHintback to summary
protected Collection<Object> createCollectionFromHint(Object collectionTypeHint)

Create a collection from the provided hint.

Parameters
collectionTypeHint:Object

the Collection type as either a String or Class

Returns:Collection<Object>

a new Collection instance

Annotations
@SuppressWarnings:unchecked
decodeback to summary
public void decode(FacesContext context, UIComponent component)

Overrides com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.decode.

Doc from javax.faces.render.Renderer.decode.

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.

Parameters
context:FacesContext

FacesContext for the request we are processing

component:UIComponent

UIComponent to be decoded.

Annotations
@Override
decodeUISelectManyback to summary
private void decodeUISelectMany(FacesContext context, UISelectMany component, String clientId)
decodeUISelectOneback to summary
private void decodeUISelectOne(FacesContext context, UIComponent component, String clientId)
encodeBeginback to summary
public void encodeBegin(FacesContext context, UIComponent component) throws IOException

Overrides javax.faces.render.Renderer.encodeBegin.

Doc from javax.faces.render.Renderer.encodeBegin.

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.

Parameters
context:FacesContext

FacesContext for the request we are processing

component:UIComponent

UIComponent to be rendered

Annotations
@Override
Exceptions
IOException:
if an input/output error occurs while rendering
encodeEndback to summary
public void encodeEnd(FacesContext context, UIComponent component) throws IOException

Overrides com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd.

Doc from javax.faces.render.Renderer.encodeEnd.

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.

Parameters
context:FacesContext

FacesContext for the response we are creating

component:UIComponent

UIComponent to be rendered

Annotations
@Override
Exceptions
IOException:
if an input/output error occurs while rendering
getConvertedValueback to summary
public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException

Overrides com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue.

Doc from javax.faces.render.Renderer.getConvertedValue.

Attempt to convert previously stored state information into an object of the type required for this component (optionally using the registered javax.faces.convert.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.

Parameters
context:FacesContext

FacesContext for the request we are processing

component:UIComponent

UIComponent to be decoded.

submittedValue:Object

a value stored on the component during decode.

Returns:Object

the converted value

Annotations
@Override
Exceptions
ConverterException:
if the submitted value cannot be converted successfully.
getCurrentSelectedValuesback to summary
protected Object getCurrentSelectedValues(UIComponent component)
Annotations
@SuppressWarnings:unchecked
getMultipleTextback to summary
protected String getMultipleText(UIComponent component)
getSubmittedSelectedValuesback to summary
protected Object[] getSubmittedSelectedValues(UIComponent component)
isHideNoSelectionback to summary
protected static boolean isHideNoSelection(UIComponent component)
isNoValueOrNullback to summary
private boolean isNoValueOrNull(String newValue, UIComponent component)
isSelectedback to summary
protected boolean isSelected(FacesContext context, UIComponent component, Object itemValue, Object valueArray, Converter<?> converter)
renderOptionback to summary
protected boolean renderOption(FacesContext context, UIComponent component, UIComponent selectComponent, Converter<?> converter, SelectItem curItem, Object currentSelections, Object[] submittedValues, HtmlBasicRenderer.OptionComponentInfo optionInfo) throws IOException
renderOptionsback to summary
protected int renderOptions(FacesContext context, UIComponent component, SelectItemsIterator<SelectItem> items) throws IOException
renderSelectback to summary
protected void renderSelect(FacesContext context, UIComponent component) throws IOException
writeDefaultSizeback to summary
protected void writeDefaultSize(ResponseWriter writer, int itemCount) throws IOException