|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.trinidad.render.RenderUtils
public class RenderUtils
Generic utilities for rendering.
Method Summary | |
---|---|
static void |
encodeRecursive(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Encodes a component and all of its children. |
static String |
getFormId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Retrieves id of the form the component is contained in. |
static String |
getRelativeId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent from,
String scopedId)
Given a 'from' component and a relativeId, return the clientId for use at rendering time that will identify the id of the component you are referencing on the client. |
static String |
getRendererClientId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Returns the clientId used by the renderer in place of the clientId used by the component. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void encodeRecursive(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException
IOException
public static String getFormId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context
- the faces context objectcomponent
- UIComponent whose container form id is to be retuirned
public static String getRelativeId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent from, String scopedId)
e.g., given this hierarchy
<f:subview id="aaa">
<f:subview id="xxx">
<tr:chooseColor id="cp1" .../>
<f:subview id="yyy">
<tr:inputColor id="sic1" chooseId="::cp1" .../>
</f:subview>
</f:subview>
</f:subview>
The 'from' component is the inputColor component. The 'relativeId' is "::cp1". ('::' pops up one naming container) The return value is 'aaa:xxx:cp1' when the clientId of the 'xxx' component is 'aaa:xxx'.
It does not assume that the target component can be located, although it does check. If it can't be found, it returns the correct relativeId anyway.
A relativeId starting with NamingContainer.SEPARATOR_CHAR (that is, ':') will be treated as absolute (after dropping that character). A relativeId with no colons means it is within the same naming container as the 'from' component (this is within the 'from' component if 'from' is a naming container). A relativeId starting with '::' pops out of the 'from' component's naming container. If the 'from' component is a naming container, then '::' will pop out of the 'from' component itself. A relativeId with ':::' pops up two naming containers, etc. ComponentUtils.findRelativeComponent finds and returns the component, whereas this method returns a relativeId that can be used during renderering so the component can be found in javascript on the client.
context
- from
- the component to search relative toscopedId
- the relative id path from the 'from' component to the
component to find
ComponentUtils.findRelativeComponent(javax.faces.component.UIComponent, java.lang.String)
,
UIComponent.findComponent(java.lang.String)
public static String getRendererClientId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context
- FacesContent.component
- UIComponent.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |