public class RendererUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DUMMY_FORM_ID |
Modifier | Constructor and Description |
---|---|
protected |
RendererUtils() |
Modifier and Type | Method and Description |
---|---|
protected Object |
attributeValue(String name,
Object value)
Convert attribute value to proper object.
|
String |
clientId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Simplified version of
encodeId(FacesContext, UIComponent) |
String |
correctForIdReference(String forAttr,
javax.faces.component.UIComponent component)
If target component contains generated id and for doesn't, correct for id
|
Map<String,Object> |
createParametersMap(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component) |
Object |
createParameterValue(javax.faces.component.UIParameter parameter)
Returns value of the parameter.
|
void |
encodeAttribute(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Object property,
String attributeName) |
void |
encodeAttribute(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String attribute) |
void |
encodeAttributes(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String attrs)
Encode attributes given by comma-separated string list.
|
void |
encodeAttributesFromArray(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String[] attrs) |
void |
encodeBeginForm(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
javax.faces.context.ResponseWriter writer,
String clientId) |
void |
encodeBeginFormIfNessesary(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component) |
void |
encodeChildren(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component) |
void |
encodeCustomId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Encode id attribute with clientId component property.
|
void |
encodeEndForm(javax.faces.context.FacesContext context,
javax.faces.context.ResponseWriter writer) |
void |
encodeEndFormIfNessesary(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component) |
void |
encodeId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Encode id attribute with clientId component property
|
void |
encodeId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String attribute)
Encode clientId to custom attribute ( for example, to control name )
|
void |
encodePassThru(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String defaultHtmlEvent)
Encode common pass-thru html attributes.
|
void |
encodePassThruAttribute(javax.faces.context.FacesContext context,
Map<String,Object> attributes,
javax.faces.context.ResponseWriter writer,
String attribute)
Encode one pass-thru attribute, with plain/boolean/url value, got from properly component attribute.
|
void |
encodePassThruWithExclusions(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String exclusions,
String defaultHtmlEvent)
Encode pass-through attributes except specified ones
|
void |
encodePassThruWithExclusionsArray(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String[] exclusions,
String defaultHtmlEvent) |
String |
encodePctOrPx(String value)
formats given value to
|
String |
encodePx(String value) |
javax.faces.component.UIComponent |
findComponentFor(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String id)
Deprecated.
|
javax.faces.component.UIComponent |
findComponentFor(javax.faces.component.UIComponent component,
String id)
A modified JSF alghoritm for looking up components.
|
String |
getActionUrl(javax.faces.context.FacesContext facesContext) |
protected Object |
getComponentAttributeName(Object key)
Convert HTML attribute name to component property name.
|
static RendererUtils |
getInstance()
Use this method to get singleton instance of RendererUtils
|
javax.faces.component.UIComponent |
getNestingForm(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Deprecated.
|
javax.faces.component.UIComponent |
getNestingForm(javax.faces.component.UIComponent component)
Find nested form for given component
Deprecated: use
getNestingForm(UIComponent) instead |
javax.faces.component.UIComponent |
getSubmittedForm(javax.faces.context.FacesContext facesContext)
Find submitted form for given context
|
boolean |
hasExplicitId(javax.faces.component.UIComponent component) |
boolean |
isBooleanAttribute(javax.faces.component.UIComponent component,
String name)
Get boolean value of logical attribute
|
boolean |
isEmpty(Object o)
Checks if the argument passed in is empty or not.
|
boolean |
isForm(javax.faces.component.UIComponent component)
Detects whether given component is form
|
boolean |
isFormSubmitted(javax.faces.context.FacesContext context,
javax.faces.component.UIForm form)
Determines whenever given form has been submitted
|
void |
writeScript(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Object script)
Write JavaScript with start/end elements and type.
|
static void |
writeState(javax.faces.context.FacesContext context)
Write state saving markers to context, include MyFaces view sequence.
|
public static final String DUMMY_FORM_ID
public static RendererUtils getInstance()
public void encodeId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException
context
- component
- IOException
public void encodeId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String attribute) throws IOException
context
- component
- attribute
- IOException
public void encodeCustomId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException
context
- component
- IOException
public Object createParameterValue(javax.faces.component.UIParameter parameter)
JavaScriptParameter
, NoEcape
attribute is applied.parameter
- instance of UIParameter
Object
parameter valuepublic Map<String,Object> createParametersMap(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
public void encodePassThru(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String defaultHtmlEvent) throws IOException
context
- component
- IOException
public void encodePassThruWithExclusions(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String exclusions, String defaultHtmlEvent) throws IOException
context
- component
- exclusions
- IOException
public void encodePassThruWithExclusionsArray(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String[] exclusions, String defaultHtmlEvent) throws IOException
IOException
public void encodePassThruAttribute(javax.faces.context.FacesContext context, Map<String,Object> attributes, javax.faces.context.ResponseWriter writer, String attribute) throws IOException
context
- writer
- attribute
- IOException
public void encodeAttributesFromArray(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String[] attrs) throws IOException
IOException
public void encodeAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String attrs) throws IOException
context
- current JSF contextcomponent
- for with render attributes valuesattrs
- comma separated list of attributesIOException
public void encodeAttribute(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object property, String attributeName) throws IOException
context
- component
- property
- attributeName
- IOException
public void encodeAttribute(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String attribute) throws IOException
IOException
public boolean isEmpty(Object o)
null
o
- object to check for emptinesstrue
if the argument is empty, false
otherwiseprotected Object getComponentAttributeName(Object key)
key
- protected Object attributeValue(String name, Object value)
name
- attribute name.value
- public boolean isBooleanAttribute(javax.faces.component.UIComponent component, String name)
component
- name
- attribute namepublic String encodePctOrPx(String value)
value
- public javax.faces.component.UIComponent getNestingForm(javax.faces.component.UIComponent component)
getNestingForm(UIComponent)
insteadcomponent
- UIForm
component, or null
@Deprecated public javax.faces.component.UIComponent getNestingForm(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
component
- UIForm
component, or null
public boolean isForm(javax.faces.component.UIComponent component)
public javax.faces.component.UIComponent getSubmittedForm(javax.faces.context.FacesContext facesContext)
facesContext
- UIForm
component, or null
public boolean isFormSubmitted(javax.faces.context.FacesContext context, javax.faces.component.UIForm form)
public void encodeBeginFormIfNessesary(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException
context
- component
- IOException
public void encodeBeginForm(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer, String clientId) throws IOException
context
- component
- writer
- clientId
- IOException
public void encodeEndFormIfNessesary(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException
context
- component
- IOException
public static void writeState(javax.faces.context.FacesContext context) throws IOException
context
- IOException
public void encodeEndForm(javax.faces.context.FacesContext context, javax.faces.context.ResponseWriter writer) throws IOException
context
- writer
- IOException
public String getActionUrl(javax.faces.context.FacesContext facesContext)
facesContext
- public String clientId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
encodeId(FacesContext, UIComponent)
context
- component
- public void writeScript(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object script) throws IOException
context
- component
- script
- IOException
public String correctForIdReference(String forAttr, javax.faces.component.UIComponent component)
forAttr
- component
- public void encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException
IOException
public boolean hasExplicitId(javax.faces.component.UIComponent component)
@Deprecated public javax.faces.component.UIComponent findComponentFor(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String id)
findComponentFor(UIComponent, String)
.public javax.faces.component.UIComponent findComponentFor(javax.faces.component.UIComponent component, String id)
A modified JSF alghoritm for looking up components.
First try to find the component with given ID in subtree and then lookup in parents' subtrees.
If no component is found this way, it uses findUIComponentBelow(UIComponent, String)
applied to root component.
component
- id
- Copyright © 2014 JBoss by Red Hat. All Rights Reserved.