|
||||||||||
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 |
java.util.Map<java.lang.String,java.lang.Object> |
createParametersMap(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
|
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 |
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,
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,
java.lang.String defaultHtmlEvent)
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,
java.lang.String defaultHtmlEvent)
Encode pass-through attributes except specified ones |
void |
encodePassThruWithExclusionsArray(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String[] exclusions,
java.lang.String defaultHtmlEvent)
|
java.lang.String |
encodePctOrPx(java.lang.String value)
formats given value to |
java.lang.String |
encodePx(java.lang.String 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.util.Collection<java.lang.String> |
findComponentsFor(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.util.Collection<java.lang.String> shortIds)
|
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 |
getPredefinedMetaComponentId(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
java.lang.String id)
|
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 |
hasExplicitId(javax.faces.component.UIComponent component)
|
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 java.util.Map<java.lang.String,java.lang.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, java.lang.String defaultHtmlEvent) 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, java.lang.String defaultHtmlEvent) 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.String[] exclusions, java.lang.String defaultHtmlEvent) 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
- 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
- property
- attributeName
-
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.IOException
public 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
o
- object to check for emptiness
true
if the argument is empty, false
otherwisepublic 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 java.lang.String encodePx(java.lang.String value)
public java.lang.String encodePctOrPx(java.lang.String value)
value
-
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.IOException
public java.lang.String getActionUrl(javax.faces.context.FacesContext facesContext)
facesContext
-
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
- component
- script
-
java.io.IOException
public java.lang.String getPredefinedMetaComponentId(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, java.lang.String id)
public java.util.Collection<java.lang.String> findComponentsFor(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.util.Collection<java.lang.String> shortIds)
context
- component
- shortIds
-
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
- component
- 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)
public void encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws java.io.IOException
java.io.IOException
public boolean hasExplicitId(javax.faces.component.UIComponent component)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |