- Direct Known Subclasses:
BaseTableRenderer,BodyRenderer,ButtonRenderer,CommandScriptRenderer,FormRenderer,GroupRenderer,HeadRenderer,HtmlBasicInputRenderer,ImageRenderer,LinkRenderer,MessageRenderer,MessagesRenderer,OutcomeTargetRenderer,PassthroughRenderer,WebsocketRenderer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classStructure to hold common info used by Select* components to reduce the number of times component attributes are evaluated when rendering options.static classSimple class to encapsulate the name and value of aUIParameter. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final HtmlBasicRenderer.Param[]protected static final LoggerFields inherited from class jakarta.faces.render.Renderer
PASSTHROUGH_RENDERER_LOCALNAME_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaugmentIdReference(String forValue, UIComponent fromComponent) Conditionally augment an id-reference value.convertClientId(FacesContext context, String clientId) Convert the component generated client id to a form suitable for transmission to the client.voiddecode(FacesContext context, UIComponent component) Decode any new state of the specifiedUIComponentfrom the request contained in the specifiedFacesContext, and store that state on theUIComponent.protected final StringdecodeBehaviors(FacesContext context, UIComponent component) voidencodeEnd(FacesContext context, UIComponent component) Render the ending of the current state of the specifiedUIComponent, following the rules described forencodeBegin()to acquire the appropriate value to be rendered.protected voidencodeRecursive(FacesContext context, UIComponent component) Render nested child components by invoking the encode methods on those components, but only when therenderedproperty istrue.protected Collection<ClientBehaviorContext.Parameter> getBehaviorParameters(UIComponent command) Collections parameters for use with Behavior script rendering.protected Iterator<UIComponent> getChildren(UIComponent component) protected StringgetCurrentValue(FacesContext context, UIComponent component) protected voidgetEndTextToRender(FacesContext context, UIComponent component, String currentValue) Renderers override this method to write appropriate HTML content into the buffer.protected UIComponentgetFacet(UIComponent component, String name) protected UIComponentgetForComponent(FacesContext context, String forComponent, UIComponent component) Locates the component identified byforComponentprotected StringgetFormattedValue(FacesContext context, UIComponent component, Object currentValue) protected StringgetFormattedValue(FacesContext context, UIComponent component, Object currentValue, Converter converter) Overloads getFormattedValue to take a advantage of a previously obtained converter.protected IteratorgetMessageIter(FacesContext context, String forComponent, UIComponent component) protected HtmlBasicRenderer.Param[]getParamList(UIComponent command) protected static Map<String, List<ClientBehavior>> getPassThruBehaviors(UIComponent component, String domEventName, String componentEventName) When rendering pass thru attributes, we need to take any attached Behaviors into account.booleanReturn a flag indicating whether thisRendereris responsible for rendering the children the component it is asked to render.protected ObjectgetValue(UIComponent component) protected booleanisBehaviorSource(FacesContext ctx, String behaviorSourceId, String componentClientId) protected voidrendererParamsNotNull(FacesContext context, UIComponent component) protected voidsetSubmittedValue(UIComponent component, Object value) Renderers override this method to store the previous value of the associated component.protected booleanshouldDecode(UIComponent component) protected booleanshouldEncode(UIComponent component) protected booleanshouldEncodeChildren(UIComponent component) protected booleanshouldWriteIdAttribute(UIComponent component) protected StringwriteIdAttributeIfNecessary(FacesContext context, ResponseWriter writer, UIComponent component) Methods inherited from class jakarta.faces.render.Renderer
encodeBegin, encodeChildren, getConvertedValue
-
Field Details
-
logger
-
EMPTY_PARAMS
-
-
Constructor Details
-
HtmlBasicRenderer
public HtmlBasicRenderer()
-
-
Method Details
-
convertClientId
Description copied from class:RendererConvert the component generated client id to a form suitable for transmission to the client.
The default implementation returns the argument
clientIdunchanged.- Overrides:
convertClientIdin classRenderer- Parameters:
context-FacesContextfor the current requestclientId- the client identifier to be converted to client a specific format.- Returns:
- the converted
clientId
-
decode
Description copied from class:RendererDecode any new state of the specified
UIComponentfrom the request contained in the specifiedFacesContext, and store that state on theUIComponent.During decoding, events may be enqueued for later processing (by event listeners that have registered an interest), by calling
queueEvent()on the associatedUIComponent.- Overrides:
decodein classRenderer- Parameters:
context-FacesContextfor the request we are processingcomponent-UIComponentto be decoded.
-
encodeEnd
Description copied from class:RendererRender the ending of the current state of the specified
UIComponent, following the rules described forencodeBegin()to acquire the appropriate value to be rendered.- Overrides:
encodeEndin classRenderer- Parameters:
context-FacesContextfor the response we are creatingcomponent-UIComponentto be rendered- Throws:
IOException- if an input/output error occurs while rendering
-
getRendersChildren
public boolean getRendersChildren()Description copied from class:RendererReturn a flag indicating whether this
Rendereris responsible for rendering the children the component it is asked to render. The default implementation returnsfalse.- Overrides:
getRendersChildrenin classRenderer- Returns:
- the current value of the flag
-
decodeBehaviors
-
isBehaviorSource
protected boolean isBehaviorSource(FacesContext ctx, String behaviorSourceId, String componentClientId) - Parameters:
ctx- theFacesContextfor the current requestbehaviorSourceId- the ID of the behavior sourcecomponentClientId- the client ID of the component being decoded- Returns:
trueif the behavior source is for the component being decoded, otherwisefalse
-
augmentIdReference
Conditionally augment an id-reference value.
If the
forValuedoesn't already include a generated suffix, but the id of thefromComponentdoes include a generated suffix, then append the suffix from thefromComponentto theforValue. Otherwise just return theforValueas is.- Parameters:
forValue- - the basic id-reference value.fromComponent- - the component that holds theforValue.- Returns:
- the (possibly augmented)
forValue.
-
encodeRecursive
Render nested child components by invoking the encode methods on those components, but only when the
renderedproperty istrue.- Parameters:
context- FacesContext for the current requestcomponent- the component to recursively encode- Throws:
IOException- if an error occurrs during the encode process
-
getChildren
- Parameters:
component-UIComponentfor which to extract children- Returns:
- an Iterator over the children of the specified component, selecting only those that have a
renderedproperty oftrue.
-
getCurrentValue
- Parameters:
context- the FacesContext for the current requestcomponent- the UIComponent whose value we're interested in- Returns:
- the value to be rendered and formats it if required. Sets to empty string if value is null.
-
getEndTextToRender
protected void getEndTextToRender(FacesContext context, UIComponent component, String currentValue) throws IOException Renderers override this method to write appropriate HTML content into the buffer.- Parameters:
context- the FacesContext for the current requestcomponent- the UIComponent of interestcurrentValue-component's current value- Throws:
IOException- if an error occurs rendering the text
-
getFacet
- Parameters:
component- Component from which to return a facetname- Name of the desired facet- Returns:
- the specified facet from the specified component, but only if its
renderedproperty is set totrue.
-
getForComponent
protected UIComponent getForComponent(FacesContext context, String forComponent, UIComponent component) Locates the component identified byforComponent- Parameters:
context- the FacesContext for the current requestforComponent- - the component to search forcomponent- - the starting point in which to begin the search- Returns:
- the component with the the
idthat matchesforComponentotherwise null if no match is found.
-
getFormattedValue
protected String getFormattedValue(FacesContext context, UIComponent component, Object currentValue, Converter converter) throws ConverterException Overloads getFormattedValue to take a advantage of a previously obtained converter.- Parameters:
context- the FacesContext for the current requestcomponent- UIComponent of interestcurrentValue- the current value ofcomponentconverter- the component's converter- Returns:
- the currentValue after any associated Converter has been applied
- Throws:
ConverterException- if the value cannot be converted
-
getFormattedValue
protected String getFormattedValue(FacesContext context, UIComponent component, Object currentValue) throws ConverterException - Parameters:
context- the FacesContext for the current requestcomponent- UIComponent of interestcurrentValue- the current value ofcomponent- Returns:
- the currentValue after any associated Converter has been applied
- Throws:
ConverterException- if the value cannot be converted
-
getMessageIter
-
getParamList
- Parameters:
command- the command which may have parameters- Returns:
- an array of parameters
-
getBehaviorParameters
Collections parameters for use with Behavior script rendering. Similar to getParamList(), but returns a collection of ClientBehaviorContext.Parameter instances.- Parameters:
command- the command which may have parameters- Returns:
- a collection of ClientBehaviorContext.Parameter instances.
-
getValue
-
setSubmittedValue
Renderers override this method to store the previous value of the associated component.- Parameters:
component- the target component to which the submitted value will be setvalue- the value to set
-
shouldWriteIdAttribute
- Parameters:
component- the component of interest- Returns:
- true if this renderer should render an id attribute.
-
writeIdAttributeIfNecessary
protected String writeIdAttributeIfNecessary(FacesContext context, ResponseWriter writer, UIComponent component) -
rendererParamsNotNull
-
shouldEncode
-
shouldDecode
-
shouldEncodeChildren
-
getPassThruBehaviors
protected static Map<String,List<ClientBehavior>> getPassThruBehaviors(UIComponent component, String domEventName, String componentEventName) When rendering pass thru attributes, we need to take any attached Behaviors into account. The presence of a non-empty Behaviors map can cause us to switch from optimized pass thru attribute rendering to the unoptimized code path. However, in two very common cases - attaching action behaviors to commands and attaching value change behaviors to editable value holders - the behaviors map is populated with behaviors that are not handled by the pass thru attribute code - ie. the behaviors are handled locally by the renderer. In order to optimize such cases, we check to see whether the component's behaviors map actually contains behaviors only for these non-pass thru attributes. If so, we can pass a null behavior map into renderPassThruAttributes(), thus ensuring that we can take advantage of the optimized pass thru rendering logic. Note that in all cases where we use this method, we actually have two behavior events that we want to check for - a low-level/dom event (eg. "click", or "change") plus a high-level component event (eg. "action", or "valueChange").- Parameters:
component- the component that we are renderingdomEventName- the name of the dom-level eventcomponentEventName- the name of the component-level event
-