org.openfaces.util
Class Components

java.lang.Object
  extended by org.openfaces.util.Components

public class Components
extends java.lang.Object


Method Summary
static java.lang.Object[] anyArrayToObjectArray(java.lang.Object array)
           
static javax.faces.component.html.HtmlOutputText composeHtmlOutputText(javax.faces.context.FacesContext context, javax.faces.component.UIComponent parent, java.lang.String idSuffix, java.lang.String text)
          This method create new output text component and add it as facet to parent component
static javax.faces.component.html.HtmlCommandButton createButtonFacet(javax.faces.context.FacesContext context, javax.faces.component.UIComponent parent, java.lang.String idSuffix, java.lang.String text)
          This method create new command button component and add it as facet to parent component
static javax.faces.component.UIComponent createChildComponent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent parent, java.lang.String componentType, java.lang.String idSuffix)
          This method add child to parent component
static javax.faces.component.UIComponent createChildComponent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent parent, java.lang.String componentType, java.lang.String idSuffix, int i)
          This method add child to parent component at the specified position
static javax.faces.component.UIComponent createComponent(javax.faces.context.FacesContext context, java.lang.String id, java.lang.String componentType)
          This method create components with given name and class and create, if needed, its subcomponents
static javax.faces.component.html.HtmlOutputText createOutputText(javax.faces.context.FacesContext context, java.lang.String text)
          Create HtmlOutputText component with given text
static javax.faces.component.html.HtmlOutputText createOutputText(javax.faces.context.FacesContext context, java.lang.String text, boolean escape)
          Create HtmlOutputText component with given text
static
<T> java.util.List<T>
findChildrenWithClass(javax.faces.component.UIComponent parent, java.lang.Class<? extends T> childClass, boolean onlyRendered, boolean recursive)
           
static
<T extends javax.faces.component.UIComponent>
java.util.List<T>
findChildrenWithClass(javax.faces.component.UIComponent parent, java.lang.Class<T> childClass)
           
static
<T extends javax.faces.component.UIComponent>
T
findChildWithClass(javax.faces.component.UIComponent parent, java.lang.Class<T> childClass)
           
static
<T extends javax.faces.component.UIComponent>
T
findChildWithClass(javax.faces.component.UIComponent parent, java.lang.Class<T> childClass, java.lang.String childTagName)
           
static javax.faces.component.UIForm findForm(javax.faces.component.UIComponent component)
           
static void generateIdIfNotSpecified(javax.faces.component.UIComponent component)
          Check component id and generate it, if necessary
static java.lang.String generateIdWithSuffix(javax.faces.component.UIComponent baseComponent, java.lang.String idSuffix)
          Generate id on base of component id.
static javax.faces.component.UIComponent getChildBySuffix(javax.faces.component.UIComponent component, java.lang.String idSuffix)
          Find child component by its suffix
static
<T extends javax.faces.component.UIComponent>
T
getChildWithClass(javax.faces.component.UIComponent parent, java.lang.Class<T> childClass, java.lang.String defaultIdSuffix)
           
static javax.faces.component.UIForm getEnclosingForm(javax.faces.component.UIComponent component)
          Return the closest form for component
static javax.faces.component.UIComponent getFacet(javax.faces.component.UIComponent component, java.lang.String facetName)
           
static javax.faces.component.UIComponent getFacet(javax.faces.component.UIComponent parent, java.lang.String identifier, java.lang.Class enforceComponentClass)
          This method searches in parent component for facet with given name and throw exception, if not found.
static javax.faces.component.UIComponent getFacetOwner(javax.faces.component.UIComponent facetComponent)
           
static
<E extends javax.faces.component.UIComponent>
E
getOrCreateFacet(javax.faces.context.FacesContext context, javax.faces.component.UIComponent parent, java.lang.String componentType, java.lang.String identifier, java.lang.Class<E> enforceComponentClass)
          This method checks and create, if needed new facet of parent component.
static
<E extends javax.faces.component.UIComponent>
E
getOrCreateFacet(javax.faces.context.FacesContext context, javax.faces.component.UIComponent parent, java.lang.String componentType, java.lang.String facetName, java.lang.String id, java.lang.Class<E> enforceComponentClass)
           
static
<E extends javax.faces.component.UIComponent>
E
getParentWithClass(javax.faces.component.UIComponent component, java.lang.Class<E> parentClass)
           
static boolean isChildComponent(javax.faces.component.UIComponent child, javax.faces.component.UIComponent parent)
           
static boolean isComponentIdSpecified(javax.faces.component.UIComponent component)
           
static boolean isImplicitPanel(javax.faces.component.UIComponent facet)
           
static java.lang.String referenceIdToClientId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent base, java.lang.String refId)
           
static javax.faces.component.UIComponent referenceIdToComponent(javax.faces.component.UIComponent component, java.lang.String refId)
           
static void runScheduledActions()
           
static void runWhenReady(SelfScheduledAction action)
           
static java.lang.Object setRequestMapValue(java.lang.String requestMapKey, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

anyArrayToObjectArray

public static java.lang.Object[] anyArrayToObjectArray(java.lang.Object array)

referenceIdToClientId

public static java.lang.String referenceIdToClientId(javax.faces.context.FacesContext context,
                                                     javax.faces.component.UIComponent base,
                                                     java.lang.String refId)

referenceIdToComponent

public static javax.faces.component.UIComponent referenceIdToComponent(javax.faces.component.UIComponent component,
                                                                       java.lang.String refId)

setRequestMapValue

public static java.lang.Object setRequestMapValue(java.lang.String requestMapKey,
                                                  java.lang.Object value)

getChildWithClass

public static <T extends javax.faces.component.UIComponent> T getChildWithClass(javax.faces.component.UIComponent parent,
                                                                                java.lang.Class<T> childClass,
                                                                                java.lang.String defaultIdSuffix)

findChildWithClass

public static <T extends javax.faces.component.UIComponent> T findChildWithClass(javax.faces.component.UIComponent parent,
                                                                                 java.lang.Class<T> childClass)

findChildWithClass

public static <T extends javax.faces.component.UIComponent> T findChildWithClass(javax.faces.component.UIComponent parent,
                                                                                 java.lang.Class<T> childClass,
                                                                                 java.lang.String childTagName)

findChildrenWithClass

public static <T extends javax.faces.component.UIComponent> java.util.List<T> findChildrenWithClass(javax.faces.component.UIComponent parent,
                                                                                                    java.lang.Class<T> childClass)

findChildrenWithClass

public static <T> java.util.List<T> findChildrenWithClass(javax.faces.component.UIComponent parent,
                                                          java.lang.Class<? extends T> childClass,
                                                          boolean onlyRendered,
                                                          boolean recursive)

isComponentIdSpecified

public static boolean isComponentIdSpecified(javax.faces.component.UIComponent component)

composeHtmlOutputText

public static javax.faces.component.html.HtmlOutputText composeHtmlOutputText(javax.faces.context.FacesContext context,
                                                                              javax.faces.component.UIComponent parent,
                                                                              java.lang.String idSuffix,
                                                                              java.lang.String text)
This method create new output text component and add it as facet to parent component

Parameters:
context - FacesContext for the current request
parent - Method will search fo facet in this component or create it, if needed
idSuffix - The suffix identifying the HtmlOutputText to be returned
text - The text in output text field
Returns:
created or existed output text component

createChildComponent

public static javax.faces.component.UIComponent createChildComponent(javax.faces.context.FacesContext context,
                                                                     javax.faces.component.UIComponent parent,
                                                                     java.lang.String componentType,
                                                                     java.lang.String idSuffix)
This method add child to parent component

Parameters:
context - FacesContext for the current request
parent - Method will create child for this component
componentType - The class for child creation
idSuffix - The suffix identifying the child UIComponent to be returned
Returns:
created child

createChildComponent

public static javax.faces.component.UIComponent createChildComponent(javax.faces.context.FacesContext context,
                                                                     javax.faces.component.UIComponent parent,
                                                                     java.lang.String componentType,
                                                                     java.lang.String idSuffix,
                                                                     int i)
This method add child to parent component at the specified position

Parameters:
context - FacesContext for the current request
parent - Method will create child for this component
componentType - The class for child creation
idSuffix - The suffix identifying the child UIComponent to be returned
i - index at which the specified child is to be inserted to paranet's child list
Returns:
created child

createComponent

public static javax.faces.component.UIComponent createComponent(javax.faces.context.FacesContext context,
                                                                java.lang.String id,
                                                                java.lang.String componentType)
This method create components with given name and class and create, if needed, its subcomponents

Parameters:
context - FacesContext for the current request
id - The id identifying the UIComponent to be returned
componentType - The component type for which to create and return a new UIComponent instance
Returns:

createButtonFacet

public static javax.faces.component.html.HtmlCommandButton createButtonFacet(javax.faces.context.FacesContext context,
                                                                             javax.faces.component.UIComponent parent,
                                                                             java.lang.String idSuffix,
                                                                             java.lang.String text)
This method create new command button component and add it as facet to parent component

Parameters:
context - FacesContext for the current request
parent - Method will search fo facet in this component or create it, if needed
idSuffix - The suffix identifying the HtmlCommandButton to be returned
text - The text on command button
Returns:
created or existed command button component

generateIdWithSuffix

public static java.lang.String generateIdWithSuffix(javax.faces.component.UIComponent baseComponent,
                                                    java.lang.String idSuffix)
Generate id on base of component id.

Parameters:
baseComponent - The component, which id will be used for generating
idSuffix - The suffix, which will be added to component id
Returns:
generated id

createOutputText

public static javax.faces.component.html.HtmlOutputText createOutputText(javax.faces.context.FacesContext context,
                                                                         java.lang.String text,
                                                                         boolean escape)
Create HtmlOutputText component with given text

Parameters:
context - FacesContext for the current request
text - The text to be set in output text
escape - Flag indicating that characters that are sensitive in HTML and XML markup must be escaped.
Returns:
the created HtmlOutputText

createOutputText

public static javax.faces.component.html.HtmlOutputText createOutputText(javax.faces.context.FacesContext context,
                                                                         java.lang.String text)
Create HtmlOutputText component with given text

Parameters:
context - FacesContext for the current request
text - The text to be set in output text
Returns:
the created HtmlOutputText

getEnclosingForm

public static javax.faces.component.UIForm getEnclosingForm(javax.faces.component.UIComponent component)
Return the closest form for component

Parameters:
component - The component, which form we obtain
Returns:
the nearest enclosing form for component

findForm

public static javax.faces.component.UIForm findForm(javax.faces.component.UIComponent component)

generateIdIfNotSpecified

public static void generateIdIfNotSpecified(javax.faces.component.UIComponent component)
Check component id and generate it, if necessary

Parameters:
component - The component for id generation

getChildBySuffix

public static javax.faces.component.UIComponent getChildBySuffix(javax.faces.component.UIComponent component,
                                                                 java.lang.String idSuffix)
Find child component by its suffix

Parameters:
component - The parent component to search in
idSuffix - The suffix identifying the UIComponent to be returned
Returns:
the found UIComponent, or null if the component was not found.
See Also:
generateIdWithSuffix(javax.faces.component.UIComponent, java.lang.String)

runWhenReady

public static void runWhenReady(SelfScheduledAction action)

runScheduledActions

public static void runScheduledActions()

isChildComponent

public static boolean isChildComponent(javax.faces.component.UIComponent child,
                                       javax.faces.component.UIComponent parent)

getOrCreateFacet

public static <E extends javax.faces.component.UIComponent> E getOrCreateFacet(javax.faces.context.FacesContext context,
                                                                               javax.faces.component.UIComponent parent,
                                                                               java.lang.String componentType,
                                                                               java.lang.String identifier,
                                                                               java.lang.Class<E> enforceComponentClass)
This method checks and create, if needed new facet of parent component.

Parameters:
context - FacesContext for the current request
parent - Method will search fo facet in this component or create it, if needed
componentType - The component type for which to create and return a new UIComponent instance
identifier - The id identifying the UIComponent to be returned
enforceComponentClass - If facet with given identifier exist, but it's class doesn't seem to be equal to enforceComponentClass, facet will be recreated
Returns:
facet of parent component

getOrCreateFacet

public static <E extends javax.faces.component.UIComponent> E getOrCreateFacet(javax.faces.context.FacesContext context,
                                                                               javax.faces.component.UIComponent parent,
                                                                               java.lang.String componentType,
                                                                               java.lang.String facetName,
                                                                               java.lang.String id,
                                                                               java.lang.Class<E> enforceComponentClass)

getFacet

public static javax.faces.component.UIComponent getFacet(javax.faces.component.UIComponent parent,
                                                         java.lang.String identifier,
                                                         java.lang.Class enforceComponentClass)
This method searches in parent component for facet with given name and throw exception, if not found.

Parameters:
parent - The component, in which facet will be searched
identifier - The id identifying the UIComponent to be returned
enforceComponentClass - If facet with given identifier exist, but it's class doesn't seem to be equal to enforceComponentClass, exception will be thrown
Returns:
facet with given name

getParentWithClass

public static <E extends javax.faces.component.UIComponent> E getParentWithClass(javax.faces.component.UIComponent component,
                                                                                 java.lang.Class<E> parentClass)

getFacet

public static javax.faces.component.UIComponent getFacet(javax.faces.component.UIComponent component,
                                                         java.lang.String facetName)

isImplicitPanel

public static boolean isImplicitPanel(javax.faces.component.UIComponent facet)

getFacetOwner

public static javax.faces.component.UIComponent getFacetOwner(javax.faces.component.UIComponent facetComponent)


Copyright © 1998-2010 TeamDev Ltd. All Rights Reserved.