|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.xsp.util.FacesUtil
public class FacesUtil
This class provides various utility methods.
Field Summary | |
---|---|
static java.lang.String |
DATASOURCE
Deprecated. Use DataPublisher.DATASOURCE instead |
static java.lang.String |
DEFAULT_DATASOURCE
|
static java.lang.String |
HIDDEN_FIELD_ID
|
static java.lang.String |
RESTORE_ROOT
|
Constructor Summary | |
---|---|
FacesUtil()
|
Method Summary | |
---|---|
static void |
addErrorMessage(java.lang.String summary,
java.lang.String detail)
Add an error FacesMessage to the current context. |
static void |
addMessage(javax.faces.context.FacesContext context,
javax.faces.application.FacesMessage.Severity severity,
java.lang.String clientId,
java.lang.String summary,
java.lang.String detail)
Add a FacesMessage to the specified context. |
static void |
addMessage(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
javax.faces.application.FacesMessage.Severity severity,
java.lang.String summary,
java.lang.String detail)
Add a FacesMessage to the specified context. |
static void |
addMessage(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String summary,
java.lang.Throwable t)
Add a FacesMessage to the specified context. |
static void |
addMessage(javax.faces.application.FacesMessage.Severity severity,
java.lang.String summary,
java.lang.String detail)
Add a FacesMessage to the specified context. |
static java.util.List<java.lang.String> |
calculateBundleNames(java.lang.String baseName,
java.util.Locale locale)
Calculate bundle names to be loaded |
static boolean |
canSerializeObject(java.lang.Object data)
Returns true if this data can be saved using objectToSerializable . |
static void |
checkComponentIds(javax.faces.component.UIViewRoot viewRoot,
javax.faces.component.UIComponent base)
Recursively set unique ids for every component starting at the specified one. |
static void |
checkForNestedForms(java.lang.String viewId,
javax.faces.component.UIComponent component,
boolean hasParentForm)
Check for nested forms |
static void |
checkForNonSelectChildren(javax.faces.component.UIComponent component)
Throw an exception if any children are invalid |
static boolean |
containsForm(javax.faces.component.UIComponent component)
Check if this component is a form or if it contains one |
static java.lang.String |
convertValue(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Format the value of a component. |
static java.lang.String |
createId()
Utility method for generating a unique ID. |
static javax.faces.component.UIComponent |
findChildComponent(javax.faces.component.UIComponent component,
java.lang.String id)
Return the component with the specified id. |
static javax.faces.component.UIComponent |
findComponentWithFullId(javax.faces.component.UIViewRoot root,
java.lang.String id)
Return the UIComponent with the specified id, starting from the root. |
static javax.faces.component.UIComponent |
findRestoreComponent(javax.faces.context.FacesContext context,
java.lang.String restoreId)
|
static javax.faces.component.UIComponent |
getComponentFor(javax.faces.component.UIComponent start,
java.lang.String id)
Return the UIComponent with the specified id, starting from a particular component. |
static javax.faces.convert.Converter |
getConverterForClass(java.lang.Class<?> clazz)
Create a converter for the specified class |
static javax.faces.component.UIForm |
getForm(javax.faces.component.UIComponent component)
Return the parent UIForm component for the specified component. |
static java.lang.String |
getFullId(javax.faces.component.UIComponent c)
Get the full id of a component. |
static java.lang.String |
getHiddenExecId()
|
static java.lang.String |
getHiddenExecValue(javax.faces.context.FacesContext context)
|
static java.lang.String |
getHiddenFieldId()
Gets the id of the form's hidden field containing the ID of the control that submits the event. |
static java.lang.String |
getHiddenFieldValue(javax.faces.context.FacesContext context)
|
static javax.faces.lifecycle.Lifecycle |
getLifecycle(javax.faces.context.FacesContext context)
Return the Lifecycle for the specified FacesContext. |
static javax.faces.component.NamingContainer |
getNamingContainer(javax.faces.component.UIComponent component)
Find the parent NamingContainer for the specified component. |
static javax.faces.component.NamingContainer |
getNamingContainer(javax.faces.component.UIComponent component,
int skip)
Find the parent NamingContainer for the specified component skipping the specified number of naming containers. |
static java.lang.String |
getRealViewId(java.lang.String viewId)
Perform any required transformation of the view id |
static javax.faces.render.Renderer |
getRenderer(javax.faces.context.FacesContext context,
java.lang.String family,
java.lang.String rendererType)
Return the renderer associated with this component or null if there is none. |
static javax.faces.render.Renderer |
getRendererAs(javax.faces.render.Renderer renderer,
java.lang.Class<?> toImplement)
Used to find whether the renderer or any of it's delegates implements a certain interface, and if so returns the renderer or delegate. |
static java.lang.Object |
getRequestObject(javax.faces.context.FacesContext context,
java.lang.String name)
Return the named object from the request map. |
static java.lang.Object |
getRequestObject(java.lang.String name)
Return the named object from the request map. |
static java.lang.Object |
getRequestParameter(java.lang.String name)
Return the specified value from the request map if it exists. |
static RequestParameters |
getRequestParameters(javax.faces.context.FacesContext ctx)
Get the Request Customizer associayed with a FacesContext returns null if no customizer is available |
static java.io.InputStream |
getResourceAsStream(java.lang.Class<?> clazz,
java.lang.String name)
Open an input stream to the named resource |
static java.lang.String |
getRestoreId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
|
static java.util.List<javax.faces.model.SelectItem> |
getSelectItems(javax.faces.component.UIComponent component)
Return list of SelectItem instances associated with the specified component |
static StyleKit |
getStyleKit(javax.faces.context.FacesContext ctx)
Get the stylekit used by the request. |
static java.lang.Object |
getValue(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Get the value of a component. |
static javax.faces.component.UIViewRoot |
getViewRoot(javax.faces.component.UIComponent component)
Return the UIViewRoot for the specified component. |
static boolean |
hasMessage(javax.faces.context.FacesContext context,
java.lang.String summary)
Helper method to determine if the FacesContext contains a message with the specified summary. |
static boolean |
hasStyleSheet(UIViewRootEx viewRoot)
Return true if the view root contains any style sheet resource |
static boolean |
hasStyleSheet(UIViewRootEx viewRoot,
java.lang.String href)
Return true if the view root contains a style sheet resource matching the href |
static boolean |
isAbsoluteUrl(java.lang.String url)
The following are examples of absolute URLs: http://host:80/path ftp://user:pw@host:port/path news:a.news.group file:/c:/config.sys mailto:alasdair@domain.tld This method does not provide a comprehensive test for all URL cases, but should suffice for most. |
static boolean |
isCancelled(java.lang.Object value)
Static method to return true if the specified value indicates the operation been canceled. |
static boolean |
isChecked(java.lang.Object value)
Return the checked state of the submitted value |
static boolean |
isClientId(javax.faces.context.FacesContext context,
java.lang.String id)
Check if an id is a client id |
static boolean |
isClientIdChildOf(FacesContextEx context,
javax.faces.component.UIComponent component,
java.lang.String targetId)
Check if a component is a child of another, based on its client id. |
static boolean |
isComponentReadOnly(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Test if the specified component should be in a read-only state. |
static boolean |
isDecodeable(javax.faces.component.UIComponent component)
Return true if this component can be decoded |
static boolean |
isDuplicateMessage(javax.faces.application.FacesMessage.Severity severity,
java.lang.String summary,
java.lang.String detail,
javax.faces.application.FacesMessage message)
|
static boolean |
isEditable(javax.faces.component.UIComponent component)
Return true if this component is editable |
static java.lang.String |
makeUrlAbsolute(javax.faces.context.FacesContext context,
java.lang.String path)
|
static javax.faces.component.UIForm |
needForm(javax.faces.component.UIComponent component)
Return the parent UIForm of the specified component throws exception otherwise |
static java.lang.String |
normalizePageName(javax.faces.context.FacesContext context,
java.lang.String name)
Normalize the page name if it is a relative page. |
static java.lang.Object |
objectFromSerializable(javax.faces.context.FacesContext context,
java.lang.Object serForm)
|
static java.lang.Object |
objectFromSerializable(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent src,
java.lang.Object serForm)
|
static java.lang.Object |
objectToSerializable(javax.faces.context.FacesContext context,
java.lang.Object data)
Utility method for serializing data. |
static java.util.List<?> |
removeNonSelectItemChildren(javax.faces.component.UIComponent component)
Remove any children of the component which are not UISelectItem or UISelectItems instances |
static void |
renderChildren(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Render the children of a specified component |
static void |
renderComponent(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Render the specified component and its children |
static java.lang.Object |
resolveRequestMapVariable(javax.faces.context.FacesContext context,
java.lang.String name)
|
static java.lang.Object |
resolveVariable(javax.faces.context.FacesContext context,
java.lang.String name)
Resolve the named variable |
static void |
restoreNonSelectItemChildren(javax.faces.component.UIComponent component,
java.util.List<?> removed)
Restore any children of the component which are not UISelectItem or UISelectItems instances |
static boolean |
save(javax.faces.context.FacesContext context,
DataSource dataSource,
boolean removeFromManager)
Save the specified component data if it's is not read only |
static boolean |
save(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
boolean removeFromManager)
Save all data associated with the specified component and it's children |
static void |
saveViewState(javax.faces.context.FacesContext context)
Save the state of the view if it requires it. |
static void |
serviceFacesRequest(com.ibm.xsp.controller.FacesController controller,
java.lang.Object request,
java.lang.Object response,
java.lang.Object containerContext,
javax.faces.component.UIViewRoot viewRoot)
Execute the lifecycle and render the response for the specified request. |
static void |
setRestoreRoot(javax.faces.context.FacesContext context,
javax.faces.component.UIViewRoot viewRoot)
|
static java.lang.String |
toString(javax.faces.component.UIComponent component)
Return a string representation of the specified component tree. |
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 DEFAULT_DATASOURCE
public static final java.lang.String DATASOURCE
DataPublisher.DATASOURCE
insteadpublic static final java.lang.String HIDDEN_FIELD_ID
public static final java.lang.String RESTORE_ROOT
Constructor Detail |
---|
public FacesUtil()
Method Detail |
---|
public static void serviceFacesRequest(com.ibm.xsp.controller.FacesController controller, java.lang.Object request, java.lang.Object response, java.lang.Object containerContext, javax.faces.component.UIViewRoot viewRoot)
controller
- request
- response
- viewRoot
- public static java.lang.String getRealViewId(java.lang.String viewId)
public static java.lang.String getFullId(javax.faces.component.UIComponent c)
public static javax.faces.component.UIForm getForm(javax.faces.component.UIComponent component)
public static javax.faces.component.UIForm needForm(javax.faces.component.UIComponent component)
javax.faces.FacesException
public static boolean isClientId(javax.faces.context.FacesContext context, java.lang.String id)
public static javax.faces.component.UIComponent findComponentWithFullId(javax.faces.component.UIViewRoot root, java.lang.String id)
root
- the root component of the page to start fromid
- th id (or full id) of the component top search
public static javax.faces.component.UIComponent findChildComponent(javax.faces.component.UIComponent component, java.lang.String id)
public static javax.faces.component.UIComponent getComponentFor(javax.faces.component.UIComponent start, java.lang.String id)
public static boolean isClientIdChildOf(FacesContextEx context, javax.faces.component.UIComponent component, java.lang.String targetId)
context
- component
-
public static javax.faces.component.UIViewRoot getViewRoot(javax.faces.component.UIComponent component)
public static javax.faces.lifecycle.Lifecycle getLifecycle(javax.faces.context.FacesContext context)
public static javax.faces.component.NamingContainer getNamingContainer(javax.faces.component.UIComponent component, int skip)
public static javax.faces.component.NamingContainer getNamingContainer(javax.faces.component.UIComponent component)
public static boolean isEditable(javax.faces.component.UIComponent component)
public static boolean save(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, boolean removeFromManager)
public static boolean save(javax.faces.context.FacesContext context, DataSource dataSource, boolean removeFromManager)
public static void checkForNestedForms(java.lang.String viewId, javax.faces.component.UIComponent component, boolean hasParentForm)
public static boolean containsForm(javax.faces.component.UIComponent component)
public static void checkComponentIds(javax.faces.component.UIViewRoot viewRoot, javax.faces.component.UIComponent base)
public static javax.faces.render.Renderer getRenderer(javax.faces.context.FacesContext context, java.lang.String family, java.lang.String rendererType)
public static java.lang.Object getRequestParameter(java.lang.String name)
public static java.util.List<javax.faces.model.SelectItem> getSelectItems(javax.faces.component.UIComponent component)
public static java.util.List<?> removeNonSelectItemChildren(javax.faces.component.UIComponent component)
public static void restoreNonSelectItemChildren(javax.faces.component.UIComponent component, java.util.List<?> removed)
public static java.lang.String toString(javax.faces.component.UIComponent component)
public static void renderComponent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws java.io.IOException
java.io.IOException
public static void renderChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws java.io.IOException
java.io.IOException
public static boolean hasStyleSheet(UIViewRootEx viewRoot, java.lang.String href)
public static boolean hasStyleSheet(UIViewRootEx viewRoot)
public static boolean hasMessage(javax.faces.context.FacesContext context, java.lang.String summary)
public static boolean isCancelled(java.lang.Object value)
public static void addErrorMessage(java.lang.String summary, java.lang.String detail)
public static void addMessage(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String summary, java.lang.Throwable t)
public static void addMessage(javax.faces.application.FacesMessage.Severity severity, java.lang.String summary, java.lang.String detail)
public static void addMessage(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.application.FacesMessage.Severity severity, java.lang.String summary, java.lang.String detail)
public static void addMessage(javax.faces.context.FacesContext context, javax.faces.application.FacesMessage.Severity severity, java.lang.String clientId, java.lang.String summary, java.lang.String detail)
public static boolean isDuplicateMessage(javax.faces.application.FacesMessage.Severity severity, java.lang.String summary, java.lang.String detail, javax.faces.application.FacesMessage message)
public static java.lang.Object resolveVariable(javax.faces.context.FacesContext context, java.lang.String name)
public static java.lang.Object resolveRequestMapVariable(javax.faces.context.FacesContext context, java.lang.String name)
public static boolean isDecodeable(javax.faces.component.UIComponent component)
public static java.lang.Object getValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context
- component
-
javax.faces.convert.ConverterException
public static java.lang.String convertValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws javax.faces.convert.ConverterException
context
- component
-
javax.faces.convert.ConverterException
public static boolean isChecked(java.lang.Object value)
public static javax.faces.convert.Converter getConverterForClass(java.lang.Class<?> clazz)
public static java.lang.Object getRequestObject(java.lang.String name)
public static java.lang.Object getRequestObject(javax.faces.context.FacesContext context, java.lang.String name)
public static java.io.InputStream getResourceAsStream(java.lang.Class<?> clazz, java.lang.String name)
public static boolean canSerializeObject(java.lang.Object data)
objectToSerializable
.
This method should be used only in special cases; generally, implementers should know
if data can be serialized. Dependence on this method may lead to strange logical errors
(e.g. if a List can be serialized; its members cannot; the list is empty when passed to this method).
Use of this method may impact performance.
public static java.lang.Object objectToSerializable(javax.faces.context.FacesContext context, java.lang.Object data)
RuntimeException
.
context
- data
- must implement Serializable or StateHolder; may be null
public static java.lang.Object objectFromSerializable(javax.faces.context.FacesContext context, javax.faces.component.UIComponent src, java.lang.Object serForm)
context
- src
- serForm
-
public static java.lang.Object objectFromSerializable(javax.faces.context.FacesContext context, java.lang.Object serForm)
public static java.lang.String getHiddenFieldId()
context
- component
- submitAsForm
-
public static java.lang.String getHiddenFieldValue(javax.faces.context.FacesContext context)
public static java.lang.String getHiddenExecId()
public static java.lang.String getHiddenExecValue(javax.faces.context.FacesContext context)
public static java.lang.String createId()
public static java.lang.String getRestoreId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
public static void saveViewState(javax.faces.context.FacesContext context)
public static void setRestoreRoot(javax.faces.context.FacesContext context, javax.faces.component.UIViewRoot viewRoot)
public static javax.faces.component.UIComponent findRestoreComponent(javax.faces.context.FacesContext context, java.lang.String restoreId)
public static void checkForNonSelectChildren(javax.faces.component.UIComponent component)
public static java.util.List<java.lang.String> calculateBundleNames(java.lang.String baseName, java.util.Locale locale)
public static RequestParameters getRequestParameters(javax.faces.context.FacesContext ctx)
public static StyleKit getStyleKit(javax.faces.context.FacesContext ctx)
ctx
-
public static java.lang.String makeUrlAbsolute(javax.faces.context.FacesContext context, java.lang.String path)
public static boolean isAbsoluteUrl(java.lang.String url)
url
- the non-null URL to test
public static java.lang.String normalizePageName(javax.faces.context.FacesContext context, java.lang.String name)
context
- name
-
public static javax.faces.render.Renderer getRendererAs(javax.faces.render.Renderer renderer, java.lang.Class<?> toImplement)
renderer
- toImplement
-
public static boolean isComponentReadOnly(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |