org.kuali.rice.krad.uif.util
Class ComponentUtils

java.lang.Object
  extended by org.kuali.rice.krad.uif.util.ComponentUtils

public class ComponentUtils
extends Object

Utility class providing methods to help create and modify Component instances

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
private static org.apache.log4j.Logger LOG
           
 
Constructor Summary
ComponentUtils()
           
 
Method Summary
static
<T extends Component>
T
copy(T component)
           
static
<T extends Component>
T
copy(T component, String idSuffix)
           
static
<T extends Component>
T
copyComponent(T component, String addBindingPrefix, String idSuffix)
           
static
<T extends Component>
List<T>
copyComponentList(List<T> components, String idSuffix)
           
static
<T extends Field>
List<T>
copyFieldList(List<T> fields, String idSuffix)
           
static
<T extends Field>
List<T>
copyFieldList(List<T> fields, String addBindingPrefix, String idSuffix)
           
static
<T> T
copyObject(T object)
           
private static void evaluateCurrentStack(String stack, List<String> controlNames)
          Used internally by parseExpression to evalute if the current stack is a property name (ie, will be a control on the form)
static List<String> getComponentPropertyNames(Class<? extends Component> componentClass)
           
static
<T extends Component>
List<T>
getComponentsOfType(List<? extends Component> items, Class<T> componentType)
           
static
<T extends Component>
List<T>
getComponentsOfTypeDeep(Component component, Class<T> componentType)
           
static
<T extends Component>
List<T>
getComponentsOfTypeDeep(List<? extends Component> items, Class<T> componentType)
           
protected static Object getCopyPropertyValue(Set<String> propertiesForReferenceCopy, String propertyName, Object propertyValue)
           
static String getLinePathValue(Component component)
           
protected static
<T> T
getNewInstance(T object)
           
static String parseExpression(String exp, List<String> controlNames)
          This method takes in an expression and a list to be filled in with names(property names) of controls found in the expression.
static void prefixBindingPath(DataBinding field, String addBindingPrefix)
           
static void prefixBindingPath(List<? extends Field> fields, String addBindingPrefix)
           
static void prefixBindingPathNested(Component component, String addBindingPrefix)
           
static void processIds(Component component, Map<String,Integer> seenIds)
           
static void pushObjectToContext(Component component, String contextName, Object contextValue)
           
static void pushObjectToContext(List<? extends Component> components, String contextName, Object contextValue)
           
static String replaceLineAttr(String statement, String replacement)
           
static void setComponentPropertyDeep(Component component, String propertyPath, Object propertyValue)
           
static void setComponentsPropertyDeep(List<? extends Component> components, String propertyPath, Object propertyValue)
           
static List<? extends Ordered> sort(List<? extends Ordered> items, int defaultOrderSequence)
          Performs sorting logic of the given list of Ordered instances by its order property
static void updateContextForLine(Component component, Object collectionLine, int lineIndex)
           
static void updateContextsForLine(List<? extends Component> components, Object collectionLine, int lineIndex)
           
static void updateIdsWithSuffix(Component component, String idSuffix)
           
static void updateIdsWithSuffixNested(Component component, String idSuffix)
           
static void updateIdsWithSuffixNested(List<? extends Component> components, String idSuffix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG
Constructor Detail

ComponentUtils

public ComponentUtils()
Method Detail

copy

public static <T extends Component> T copy(T component)

copy

public static <T extends Component> T copy(T component,
                                           String idSuffix)

copyObject

public static <T> T copyObject(T object)

getCopyPropertyValue

protected static Object getCopyPropertyValue(Set<String> propertiesForReferenceCopy,
                                             String propertyName,
                                             Object propertyValue)

getNewInstance

protected static <T> T getNewInstance(T object)

copyFieldList

public static <T extends Field> List<T> copyFieldList(List<T> fields,
                                                      String addBindingPrefix,
                                                      String idSuffix)

copyFieldList

public static <T extends Field> List<T> copyFieldList(List<T> fields,
                                                      String idSuffix)

copyComponent

public static <T extends Component> T copyComponent(T component,
                                                    String addBindingPrefix,
                                                    String idSuffix)

copyComponentList

public static <T extends Component> List<T> copyComponentList(List<T> components,
                                                              String idSuffix)

getComponentsOfType

public static <T extends Component> List<T> getComponentsOfType(List<? extends Component> items,
                                                                Class<T> componentType)

getComponentsOfTypeDeep

public static <T extends Component> List<T> getComponentsOfTypeDeep(List<? extends Component> items,
                                                                    Class<T> componentType)

getComponentsOfTypeDeep

public static <T extends Component> List<T> getComponentsOfTypeDeep(Component component,
                                                                    Class<T> componentType)

prefixBindingPath

public static void prefixBindingPath(List<? extends Field> fields,
                                     String addBindingPrefix)

prefixBindingPathNested

public static void prefixBindingPathNested(Component component,
                                           String addBindingPrefix)

prefixBindingPath

public static void prefixBindingPath(DataBinding field,
                                     String addBindingPrefix)

updateIdsWithSuffixNested

public static void updateIdsWithSuffixNested(List<? extends Component> components,
                                             String idSuffix)

updateIdsWithSuffixNested

public static void updateIdsWithSuffixNested(Component component,
                                             String idSuffix)

updateIdsWithSuffix

public static void updateIdsWithSuffix(Component component,
                                       String idSuffix)

setComponentsPropertyDeep

public static void setComponentsPropertyDeep(List<? extends Component> components,
                                             String propertyPath,
                                             Object propertyValue)

setComponentPropertyDeep

public static void setComponentPropertyDeep(Component component,
                                            String propertyPath,
                                            Object propertyValue)

getComponentPropertyNames

public static List<String> getComponentPropertyNames(Class<? extends Component> componentClass)

pushObjectToContext

public static void pushObjectToContext(List<? extends Component> components,
                                       String contextName,
                                       Object contextValue)

pushObjectToContext

public static void pushObjectToContext(Component component,
                                       String contextName,
                                       Object contextValue)

updateContextsForLine

public static void updateContextsForLine(List<? extends Component> components,
                                         Object collectionLine,
                                         int lineIndex)

updateContextForLine

public static void updateContextForLine(Component component,
                                        Object collectionLine,
                                        int lineIndex)

processIds

public static void processIds(Component component,
                              Map<String,Integer> seenIds)

sort

public static List<? extends Ordered> sort(List<? extends Ordered> items,
                                           int defaultOrderSequence)
Performs sorting logic of the given list of Ordered instances by its order property

Items list is sorted based on its order property. Lower order values are placed higher in the list. If a item does not have a value assigned for the order (or is equal to the default order of 0), it will be assigned the a value based on the given order sequence integer. If two or more items share the same order value, all but the last item found in the list will be removed.

Parameters:
items -
defaultOrderSequence -
Returns:
List sorted items
See Also:
org.kuali.rice.krad.uif.Component.getOrder(), org.springframework.core.Ordered

parseExpression

public static String parseExpression(String exp,
                                     List<String> controlNames)
This method takes in an expression and a list to be filled in with names(property names) of controls found in the expression. This method returns a js expression which can be executed on the client to determine if the original exp was satisfied before interacting with the server - ie, this js expression is equivalent to the one passed in. There are limitations on the Spring expression language that can be used as this method. It is only used to parse expressions which are valid case statements for determining if some action/processing should be performed. ONLY Properties, comparison operators, booleans, strings, matches expression, and boolean logic are supported. Properties must be a valid property on the form, and should have a visible control within the view. Example valid exp: account.name == 'Account Name'

Parameters:
exp -
controlNames -
Returns:

evaluateCurrentStack

private static void evaluateCurrentStack(String stack,
                                         List<String> controlNames)
Used internally by parseExpression to evalute if the current stack is a property name (ie, will be a control on the form)

Parameters:
stack -
controlNames -

getLinePathValue

public static String getLinePathValue(Component component)

replaceLineAttr

public static String replaceLineAttr(String statement,
                                     String replacement)


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.