Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| RichFaces UI Components UI 4.3.0.Final
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.richfaces.function
Class RichFunction

    java.lang.Object
      org.richfaces.function.RichFunction

    public final class RichFunction

extends Object

Created 20.03.2008

Since:
  3.2
Author:
  Nick Belaevski

Nested Class Summary
`protected static interface` | `RichFunction.ComponentLocator`

Method Summary
`static String` | `clientId(String id)` The rich:clientId('id') function returns the client identifier related to the passed component identifier ('id').
`static String` | `component(String id)` The rich:component('id') function is equivalent to the RichFaces.$('clientId') code.
`static String` | `element(String id)` The rich:element('id') function is a shortcut for the equivalent document.getElementById(#{rich:clientId('id')}) code.
`static javax.faces.component.UIComponent` | `findComponent(javax.faces.context.FacesContext context, String id)`
`static javax.faces.component.UIComponent` | `findComponent(String id)` The rich:findComponent('id') function returns the a UIComponent instance of the passed component identifier.
`static boolean` | `isUserInRole(Object rolesObject)` The rich:isUserInRole(Object) function checks whether the logged-in user belongs to a certain user role, such as being an administrator.
`static String` | `jQuery(String id)` The rich:jQuery('id') function is a shortcut for the equivalent jQuery(#{rich:element('id')}) code.
`static String` | `jQuerySelector(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component)` Utility method which finds component's jQuery selector based on component's clientId.
`static String` | `jQuerySelector(String id)` The rich:jQuerySelector('id') function will perform nearly the same function as rich:clientId('id') but will transform the resulting id into a jQuery id selector which means that it will add a "#" character at the beginning and escape all reserved characters in CSS selectors.
`static String` | `toScript(Object o)` Convert any Java Object to JavaScript representation, converting types properly, e.g.: `Java primitives` `Arrays: toScript(new int[] { 1, 2, 3 }) -> [1, 2, 3]` `Collections (sets, lists): toScript(Arrays.asList(new int[] { 1, 2, 3 })) -> [1, 2, 3]` `Maps: toScript((Map<String, String>)map) -> {\"a\":\"foo\",\"b\":\"bar\",\"c\":\"baz\"}` `Beans / Objects: toScript(new Bean[] { new Bean(1, true, "bar") }) -> [{\"bool\":true,\"foo\":\"bar\",\"integer\":1}]` `Dates and Timezones` `Combinations of above` This function delegates to org.ajax4jsf.javascript.ScriptUtils#toScript(Object)

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### findComponent

    public static javax.faces.component.UIComponent findComponent(javax.faces.context.FacesContext context,
                                                                  String id)

### clientId

    public static String clientId(String id)

  The rich:clientId('id') function returns the client identifier related to the passed component identifier ('id'). If the specified component identifier is not found, null is returned instead.

### component

    public static String component(String id)

  The rich:component('id') function is equivalent to the RichFaces.$('clientId') code. It returns the client object instance based on the passed server-side component identifier ('id'). If the specified component identifier is not found, null is returned instead. The function can be used to get an object from a component to call a JavaScript API function without using the component.

### element

    public static String element(String id)

  The rich:element('id') function is a shortcut for the equivalent document.getElementById(#{rich:clientId('id')}) code. It returns the element from the client, based on the passed server-side component identifier. If the specified component identifier is not found, null is returned instead.

  This function is for use in EL. Refer to the <rich:jQuery> component for access to the jQuery library as a facelet tag.

### jQuerySelector

    public static String jQuerySelector(String id)

  The rich:jQuerySelector('id') function will perform nearly the same function as rich:clientId('id') but will transform the resulting id into a jQuery id selector which means that it will add a "#" character at the beginning and escape all reserved characters in CSS selectors.

### jQuerySelector

    public static String jQuerySelector(javax.faces.context.FacesContext facesContext,
                                        javax.faces.component.UIComponent component)

  Utility method which finds component's jQuery selector based on component's clientId.

### jQuery

    public static String jQuery(String id)

  The rich:jQuery('id') function is a shortcut for the equivalent jQuery(#{rich:element('id')}) code. It returns the jQuery object from the client, based on the passed server-side component identifier. If the specified component identifier is not found, empty jQuery object is returned instead.

### findComponent

    public static javax.faces.component.UIComponent findComponent(String id)

  The rich:findComponent('id') function returns the a UIComponent instance of the passed component identifier. If the specified component identifier is not found, null is returned instead.

### isUserInRole

    public static boolean isUserInRole(Object rolesObject)

  The rich:isUserInRole(Object) function checks whether the logged-in user belongs to a certain user role, such as being an administrator. User roles are defined in the web.xml settings file.

  Since:
    3.3.1

### toScript

    public static String toScript(Object o)

  Convert any Java Object to JavaScript representation, converting types properly, e.g.:
  - `Java primitives`
  - `Arrays: toScript(new int[] { 1, 2, 3 }) -> [1, 2, 3]`
  - `Collections (sets, lists): toScript(Arrays.asList(new int[] { 1, 2, 3 })) -> [1, 2, 3]`
  - `Maps: toScript((Map<String, String>)map) -> {\"a\":\"foo\",\"b\":\"bar\",\"c\":\"baz\"}`
  - `Beans / Objects: toScript(new Bean[] { new Bean(1, true, "bar") }) -> [{\"bool\":true,\"foo\":\"bar\",\"integer\":1}]`
  - `Dates and Timezones`
  - `Combinations of above`
  This function delegates to org.ajax4jsf.javascript.ScriptUtils#toScript(Object)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| RichFaces UI Components UI 4.3.0.Final
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.