|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ajax4jsf.renderkit.RendererUtils
public class RendererUtils
Util class for common render operations - render passthru html attributes, iterate over child components etc.
| Nested Class Summary | |
|---|---|
static interface |
RendererUtils.HTML
Common HTML elements and attributes names. |
static class |
RendererUtils.ScriptHashVariableWrapper
Wrapper class around object value used to transform values into particular JS objects |
| Field Summary | |
|---|---|
static java.lang.String |
DUMMY_FORM_ID
|
| Constructor Summary | |
|---|---|
protected |
RendererUtils()
|
| Method Summary | |
|---|---|
void |
addToScriptHash(java.util.Map<java.lang.String,java.lang.Object> hash,
java.lang.String name,
java.lang.Object value)
Puts value into map under specified key if the value is not empty and not default. |
void |
addToScriptHash(java.util.Map<java.lang.String,java.lang.Object> hash,
java.lang.String name,
java.lang.Object value,
java.lang.String defaultValue)
Puts value into map under specified key if the value is not empty and not default. |
void |
addToScriptHash(java.util.Map<java.lang.String,java.lang.Object> hash,
java.lang.String name,
java.lang.Object value,
java.lang.String defaultValue,
RendererUtils.ScriptHashVariableWrapper wrapper)
Puts value into map under specified key if the value is not empty and not default. |
protected java.lang.Object |
attributeValue(java.lang.String name,
java.lang.Object value)
Convert attribute value to proper object. |
java.lang.String |
clientId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Simplified version of encodeId |
java.lang.String |
correctForIdReference(java.lang.String forAttr,
javax.faces.component.UIComponent component)
If target component contains generated id and for doesn't, correct for id |
void |
encodeAttribute(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object property,
java.lang.String attributeName)
|
void |
encodeAttribute(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String attribute)
|
void |
encodeAttributes(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String attrs)
Encode attributes given by comma-separated string list. |
void |
encodeAttributesFromArray(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String[] attrs)
|
void |
encodeBeginForm(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
javax.faces.context.ResponseWriter writer,
java.lang.String clientId)
|
void |
encodeBeginFormIfNessesary(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 |
encodeDimensions(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
org.ajax4jsf.resource.InternetResource resource)
|
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,
java.lang.String attribute)
Encode clientId to custom attribute ( for example, to control name ) |
void |
encodePassThru(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Encode common pass-thru html attributes. |
void |
encodePassThruAttribute(javax.faces.context.FacesContext context,
java.util.Map<java.lang.String,java.lang.Object> attributes,
javax.faces.context.ResponseWriter writer,
java.lang.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,
java.lang.String exclusions)
Encode pass-through attributes except specified ones |
void |
encodePassThruWithExclusionsArray(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object[] exclusions)
|
java.lang.String |
encodePctOrPx(java.lang.String value)
formats given value to |
java.lang.String |
encodePx(java.lang.String value)
|
java.lang.String |
encodeResourceURL(TemplateContext context,
java.lang.Object value)
|
java.lang.String |
escapeJavaScript(java.lang.Object o)
|
javax.faces.component.UIComponent |
findComponentFor(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String id)
|
javax.faces.component.UIComponent |
findComponentFor(javax.faces.component.UIComponent component,
java.lang.String id)
|
java.lang.String |
formatValue(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
Convert any object value to string. |
java.lang.String |
getActionUrl(javax.faces.context.FacesContext facesContext)
|
org.ajax4jsf.javascript.JSFunctionDefinition |
getAsEventHandler(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String attributeName,
java.lang.String append)
|
protected java.lang.Object |
getComponentAttributeName(java.lang.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.UIForm |
getNestingForm(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Find nested form for given component |
java.lang.String |
getValueAsString(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Return converted value for ValueHolder as
String, perform nessesary convertions. |
boolean |
isBooleanAttribute(javax.faces.component.UIComponent component,
java.lang.String name)
Get boolean value of logical attribute |
boolean |
isEmpty(java.lang.Object o)
Checks if the argument passed in is empty or not. |
boolean |
isValidProperty(java.lang.Object property)
Test for valid value of property. |
boolean |
shouldRenderAttribute(java.lang.Object attributeVal)
|
boolean |
shouldRenderAttribute(java.lang.String attributeName,
java.lang.Object attributeVal)
|
void |
writeAttribute(javax.faces.context.ResponseWriter writer,
java.lang.String attribute,
java.lang.Object value)
Write html-attribute |
static void |
writeEventHandlerFunction(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String eventName)
|
void |
writeScript(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object script)
Wtrie JavaScript with start/end elements and type. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DUMMY_FORM_ID
| Constructor Detail |
|---|
protected RendererUtils()
| Method Detail |
|---|
public static RendererUtils getInstance()
public void encodeId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
throws java.io.IOException
context - component -
java.io.IOException
public void encodeId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String attribute)
throws java.io.IOException
context - component - attribute -
java.io.IOException
public void encodeCustomId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
throws java.io.IOException
context - component -
java.io.IOException
public void encodePassThru(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
throws java.io.IOException
context - component -
java.io.IOException
public void encodePassThruWithExclusions(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String exclusions)
throws java.io.IOException
context - component - exclusions -
java.io.IOException
public void encodePassThruWithExclusionsArray(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object[] exclusions)
throws java.io.IOException
java.io.IOException
public void encodePassThruAttribute(javax.faces.context.FacesContext context,
java.util.Map<java.lang.String,java.lang.Object> attributes,
javax.faces.context.ResponseWriter writer,
java.lang.String attribute)
throws java.io.IOException
context - component - writer - attribute -
java.io.IOException
public void encodeAttributesFromArray(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String[] attrs)
throws java.io.IOException
java.io.IOException
public void encodeAttributes(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String attrs)
throws java.io.IOException
context - current JSF contextcomponent - for with render attributes valuesattrs - comma separated list of attributes
java.io.IOException
public void encodeAttribute(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object property,
java.lang.String attributeName)
throws java.io.IOException
context - component - string - string2 -
java.io.IOException
public void encodeAttribute(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String attribute)
throws java.io.IOException
java.io.IOException
public void writeAttribute(javax.faces.context.ResponseWriter writer,
java.lang.String attribute,
java.lang.Object value)
throws java.io.IOException
writer - attribute - value -
java.io.IOExceptionpublic boolean shouldRenderAttribute(java.lang.Object attributeVal)
attributeVal is
an instance of a wrapper for a primitive type and its value is
equal to the default value for that type as given in the spec.
public boolean shouldRenderAttribute(java.lang.String attributeName,
java.lang.Object attributeVal)
public boolean isValidProperty(java.lang.Object property)
property - -
value of property returned from
UIComponent.getAttributes()
public boolean isEmpty(java.lang.Object o)
null
- zero-length string
- empty collection
- empty map
- zero-length array
- Parameters:
o - object to check for emptiness
- Returns:
true if the argument is empty, false otherwise- Since:
- 3.3.2
public void addToScriptHash(java.util.Map<java.lang.String,java.lang.Object> hash,
java.lang.String name,
java.lang.Object value,
java.lang.String defaultValue,
RendererUtils.ScriptHashVariableWrapper wrapper)
hash - name - value - defaultValue - wrapper -
public void addToScriptHash(java.util.Map<java.lang.String,java.lang.Object> hash,
java.lang.String name,
java.lang.Object value,
java.lang.String defaultValue)
hash - name - value - defaultValue -
public void addToScriptHash(java.util.Map<java.lang.String,java.lang.Object> hash,
java.lang.String name,
java.lang.Object value)
hash - name - value - protected java.lang.Object getComponentAttributeName(java.lang.Object key)
key -
protected java.lang.Object attributeValue(java.lang.String name,
java.lang.Object value)
name - attribute name.value -
public boolean isBooleanAttribute(javax.faces.component.UIComponent component,
java.lang.String name)
component - name - attribute name
public java.lang.String getValueAsString(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
ValueHolder as
String, perform nessesary convertions.
context - component -
public java.lang.String formatValue(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
ValueHolder got Converter for formatting. If not,
attempt to use converter based on value type.
context - component -
public void encodeDimensions(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
org.ajax4jsf.resource.InternetResource resource)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String encodePx(java.lang.String value)
public java.lang.String encodePctOrPx(java.lang.String value)
value - pattern -
public javax.faces.component.UIForm getNestingForm(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
component -
UIForm component, or null
public void encodeBeginFormIfNessesary(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
throws java.io.IOException
context - component -
java.io.IOException
public void encodeBeginForm(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
javax.faces.context.ResponseWriter writer,
java.lang.String clientId)
throws java.io.IOException
context - component - writer - clientId -
java.io.IOException
public void encodeEndFormIfNessesary(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
throws java.io.IOException
context - component -
java.io.IOException
public void encodeEndForm(javax.faces.context.FacesContext context,
javax.faces.context.ResponseWriter writer)
throws java.io.IOException
context - writer -
java.io.IOExceptionpublic java.lang.String getActionUrl(javax.faces.context.FacesContext facesContext)
facesContext -
public java.lang.String encodeResourceURL(TemplateContext context,
java.lang.Object value)
context - value -
public java.lang.String clientId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
encodeId
context - component -
public void writeScript(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object script)
throws java.io.IOException
context - tab - string -
java.io.IOException
public javax.faces.component.UIComponent findComponentFor(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String id)
public javax.faces.component.UIComponent findComponentFor(javax.faces.component.UIComponent component,
java.lang.String id)
component - id -
public java.lang.String correctForIdReference(java.lang.String forAttr,
javax.faces.component.UIComponent component)
forAttr - target -
public static void writeEventHandlerFunction(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String eventName)
throws java.io.IOException
java.io.IOException
public org.ajax4jsf.javascript.JSFunctionDefinition getAsEventHandler(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String attributeName,
java.lang.String append)
public java.lang.String escapeJavaScript(java.lang.Object o)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||