Class AbstractRenderer
- Direct Known Subclasses:
BaseRenderer
,CommandLinkRenderer
,ErrorsRenderer
,FormRenderer
,HtmlRenderer
,JavascriptValidatorRenderer
,LoadMessagesRenderer
,StylesheetRenderer
,WriteRenderer
jakarta.faces.render.Renderer
for the
Struts-Faces Integration Library.- Version:
- $Rev$ $Date$
-
Field Summary
Fields inherited from class jakarta.faces.render.Renderer
PASSTHROUGH_RENDERER_LOCALNAME_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
decode
(FacesContext context, UIComponent component) Decode any new state of the specifiedUIComponent
from the request contained in the specifiedFacesContext
, and store that state on theUIComponent
.void
encodeBegin
(FacesContext context, UIComponent component) Render the beginning of the specifiedUIComponent
to the output stream or writer associated with the response we are creating.void
encodeChildren
(FacesContext context, UIComponent component) Render the children of the specifiedUIComponent
to the output stream or writer associated with the response we are creating.void
encodeEnd
(FacesContext context, UIComponent component) Render the ending of the specifiedUIComponent
to the output stream or writer associated with the response we are creating.protected void
encodeRecursive
(FacesContext context, UIComponent component) Render nested child components by invoking the encode methods on those components, but only when therendered
property istrue
.protected String
getAsString
(FacesContext context, UIComponent component, Object value) Convert the Object representation of this component's value to the corresponding String representation.protected boolean
isDisabled
(UIComponent component) Returntrue
if the specified component is disabled.protected boolean
isReadOnly
(UIComponent component) Returntrue
if the specified component is read only.protected boolean
isXhtml
(UIComponent component) Returntrue
if we should render as XHTML.protected void
renderAttributes
(FacesContext context, UIComponent component, ResponseWriter writer) Render the element attributes for the generated markup related to this component.protected void
renderBoolean
(FacesContext context, UIComponent component, ResponseWriter writer, String[] names) Render any boolean attributes on the specified list that havetrue
values on the corresponding attribute of the specifiedUIComponent
.protected void
renderEnd
(FacesContext context, UIComponent component, ResponseWriter writer) Render the element end for the generated markup related to this component.protected void
renderPassThrough
(FacesContext context, UIComponent component, ResponseWriter writer, String[] names) Render any attributes on the specified list directly to the specifiedResponseWriter
for which the specifiedUIComponent
has a non-null
attribute value.protected void
renderStart
(FacesContext context, UIComponent component, ResponseWriter writer) Render the element start for the generated markup related to this component.protected <T extends UIComponent>
TsearchComponent
(Class<T> clazz, UIComponent component) Search the giveUIComponent
in the component-tree.protected void
setSubmittedValue
(FacesContext context, UIComponent component) If a submitted value was included on this request, store it in the component as appropriate.Methods inherited from class jakarta.faces.render.Renderer
convertClientId, getConvertedValue, getRendersChildren
-
Constructor Details
-
AbstractRenderer
public AbstractRenderer()
-
-
Method Details
-
decode
Decode any new state of the specifiedUIComponent
from the request contained in the specifiedFacesContext
, and store that state on theUIComponent
.The default implementation calls
setSubmittedValue()
unless this component has a booleandisabled
orreadonly
attribute that is set totrue
.- Overrides:
decode
in classRenderer
- Parameters:
context
-FacesContext
for the current requestcomponent
-UIComponent
to be decoded- Throws:
NullPointerException
- ifcontext
orcomponent
isnull
-
encodeBegin
Render the beginning of the specifiedUIComponent
to the output stream or writer associated with the response we are creating.The default implementation calls
renderStart()
andrenderAttributes()
.- Overrides:
encodeBegin
in classRenderer
- Parameters:
context
-FacesContext
for the current requestcomponent
-UIComponent
to be decoded- Throws:
NullPointerException
- ifcontext
orcomponent
isnull
IOException
- if an input/output error occurs
-
encodeChildren
Render the children of the specifiedUIComponent
to the output stream or writer associated with the response we are creating.The default implementation iterates through the children of this component and renders them.
- Overrides:
encodeChildren
in classRenderer
- Parameters:
context
-FacesContext
for the current requestcomponent
-UIComponent
to be decoded- Throws:
NullPointerException
- ifcontext
orcomponent
isnull
IOException
- if an input/output error occurs
-
encodeEnd
Render the ending of the specifiedUIComponent
to the output stream or writer associated with the response we are creating.The default implementation calls
renderEnd()
.- Overrides:
encodeEnd
in classRenderer
- Parameters:
context
-FacesContext
for the current requestcomponent
-UIComponent
to be decoded- Throws:
NullPointerException
- ifcontext
orcomponent
isnull
IOException
- if an input/output error occurs
-
encodeRecursive
Render nested child components by invoking the encode methods on those components, but only when therendered
property istrue
.- Throws:
IOException
-
isDisabled
Returntrue
if the specified component is disabled.- Parameters:
component
-UIComponent
to be checked
-
isReadOnly
Returntrue
if the specified component is read only.- Parameters:
component
-UIComponent
to be checked
-
renderAttributes
protected void renderAttributes(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException Render the element attributes for the generated markup related to this component. Simple renderers that create a single markup element for this component should override this method and include calls to towriteAttribute()
andwriteURIAttribute
on the specifiedResponseWriter
.The default implementation does nothing.
- Parameters:
context
-FacesContext
for the current requestcomponent
-EditableValueHolder
component whose submitted value is to be storedwriter
-ResponseWriter
to which the element start should be rendered- Throws:
IOException
- if an input/output error occurs
-
renderEnd
protected void renderEnd(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException Render the element end for the generated markup related to this component. Simple renderers that create a single markup element for this component should override this method and include a call toendElement()
on the specifiedResponseWriter
.The default implementation does nothing.
- Parameters:
context
-FacesContext
for the current requestcomponent
-EditableValueHolder
component whose submitted value is to be storedwriter
-ResponseWriter
to which the element start should be rendered- Throws:
IOException
- if an input/output error occurs
-
renderBoolean
protected void renderBoolean(FacesContext context, UIComponent component, ResponseWriter writer, String[] names) throws IOException Render any boolean attributes on the specified list that havetrue
values on the corresponding attribute of the specifiedUIComponent
.- Parameters:
context
-FacesContext
for the current requestcomponent
-EditableValueHolder
component whose submitted value is to be storedwriter
-ResponseWriter
to which the element start should be renderednames
- List of attribute names to be passed through- Throws:
IOException
- if an input/output error occurs
-
renderPassThrough
protected void renderPassThrough(FacesContext context, UIComponent component, ResponseWriter writer, String[] names) throws IOException Render any attributes on the specified list directly to the specifiedResponseWriter
for which the specifiedUIComponent
has a non-null
attribute value. This method may be used to "pass through" commonly used attribute name/value pairs with a minimum of code.- Parameters:
context
-FacesContext
for the current requestcomponent
-EditableValueHolder
component whose submitted value is to be storedwriter
-ResponseWriter
to which the element start should be renderednames
- List of attribute names to be passed through- Throws:
IOException
- if an input/output error occurs
-
renderStart
protected void renderStart(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException Render the element start for the generated markup related to this component. Simple renderers that create a single markup element for this component should override this method and include a call tostartElement()
on the specifiedResponseWriter
.The default implementation does nothing.
- Parameters:
context
-FacesContext
for the current requestcomponent
-EditableValueHolder
component whose submitted value is to be storedwriter
-ResponseWriter
to which the element start should be rendered- Throws:
IOException
- if an input/output error occurs
-
setSubmittedValue
If a submitted value was included on this request, store it in the component as appropriate.The default implementation determines whether this component implements
EditableValueHolder
. If so, it checks for a request parameter with the same name as theclientId
of thisUIComponent
. If there is such a parameter, its value is passed (as a String) to thesetSubmittedValue()
method on theEditableValueHolder
component.- Parameters:
context
-FacesContext
for the current requestcomponent
-EditableValueHolder
component whose submitted value is to be stored
-
getAsString
protected String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException Convert the Object representation of this component's value to the corresponding String representation. The default implementation utilizes the
getAsString()
method of any associatedConverter
.- Parameters:
context
- TheFacesContext
for this requestcomponent
- TheUIComponent
whose value is being convertedvalue
- The Object representation to be converted- Throws:
ConverterException
- if conversion fails
-
isXhtml
Returntrue
if we should render as XHTML.- Parameters:
component
- The component we are rendering
-
searchComponent
Search the giveUIComponent
in the component-tree.- Parameters:
component
- The entry-point into component-tree.- Returns:
- The
UIComponent
ornull
if thecomponent
is not found.
-