com.mindoo.xpages2eclipse.tools
Class JSFUtil

java.lang.Object
  extended by com.mindoo.xpages2eclipse.tools.JSFUtil

public class JSFUtil
extends java.lang.Object

Utility class for JSF APIs


Constructor Summary
JSFUtil()
           
 
Method Summary
static UIComponent findComponent(java.lang.String compId)
          Finds an UIComponent by its component identifier in the current component tree.
static UIComponent findComponent(UIComponent topComponent, java.lang.String compId)
          Finds an UIComponent by its component identifier in the component tree below the specified topComponent top component.
static java.lang.Object getBindingValue(java.lang.String ref)
          The method creates a javax.faces.el.ValueBinding from the specified value binding expression and returns its current value.
static java.lang.String getClientId(UIComponent currentComponent, java.lang.String compId)
          This method returns the client side ID of a component, similar to what the #{id:xx} function does
static UIComponent getComponentFor(UIComponent currentComponent, java.lang.String compId)
          Finds a component by its ID.
static java.lang.Object getVariableValue(java.lang.String varName)
          The method returns the value of a global JavaScript variable.
static void setBindingValue(java.lang.String ref, java.lang.Object newObject)
          The method creates a javax.faces.el.ValueBinding from the specified value binding expression and sets a new value for it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSFUtil

public JSFUtil()
Method Detail

getBindingValue

public static java.lang.Object getBindingValue(java.lang.String ref)
The method creates a javax.faces.el.ValueBinding from the specified value binding expression and returns its current value.

If the expression references a managed bean or its properties and the bean has not been created yet, it gets created by the JSF runtime.

Parameters:
ref - value binding expression, e.g. #{Bean1.property}
Returns:
value of ValueBinding throws javax.faces.el.ReferenceSyntaxException if the specified ref has invalid syntax

setBindingValue

public static void setBindingValue(java.lang.String ref,
                                   java.lang.Object newObject)
The method creates a javax.faces.el.ValueBinding from the specified value binding expression and sets a new value for it.

If the expression references a managed bean and the bean has not been created yet, it gets created by the JSF runtime.

Parameters:
ref - value binding expression, e.g. #{Bean1.property}
newObject - new value for the ValueBinding throws javax.faces.el.ReferenceSyntaxException if the specified ref has invalid syntax

getVariableValue

public static java.lang.Object getVariableValue(java.lang.String varName)
The method returns the value of a global JavaScript variable.

Parameters:
varName - variable name
Returns:
value
Throws:
javax.faces.el.EvaluationException - if an exception is thrown while resolving the variable name

findComponent

public static UIComponent findComponent(java.lang.String compId)
Finds an UIComponent by its component identifier in the current component tree.

Parameters:
compId - the component identifier to search for
Returns:
found UIComponent or null
Throws:
java.lang.NullPointerException - if compId is null

findComponent

public static UIComponent findComponent(UIComponent topComponent,
                                        java.lang.String compId)
Finds an UIComponent by its component identifier in the component tree below the specified topComponent top component.

Parameters:
topComponent - first component to be checked
compId - the component identifier to search for
Returns:
found UIComponent or null
Throws:
java.lang.NullPointerException - if compId is null

getComponentFor

public static UIComponent getComponentFor(UIComponent currentComponent,
                                          java.lang.String compId)
Finds a component by its ID. The method starts searching at the specified component and goes up the tree to the parent nodes, stopping at the top element of custom controls. This method is used internally in the XPages framework for the #{id:xx} function

Parameters:
currentComponent - starting component for search
compId - the component identifier to search for
Returns:
found UIComponent or null

getClientId

public static java.lang.String getClientId(UIComponent currentComponent,
                                           java.lang.String compId)
This method returns the client side ID of a component, similar to what the #{id:xx} function does

Parameters:
currentComponent - starting component for search
compId - the component identifier
Returns:
client-side id for component or null