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)

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)
           
static List<Component> getAllNestedComponents(Component component)
           
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 void prefixBindingPath(DataBinding field, String addBindingPrefix)
           
static void prefixBindingPath(List<? extends Field> fields, String addBindingPrefix)
           
static void prefixBindingPathNested(Component component, String addBindingPrefix)
           
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
 

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)

getAllNestedComponents

public static List<Component> getAllNestedComponents(Component component)

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)

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:
Component.getOrder(), org.springframework.core.Ordered

getLinePathValue

public static String getLinePathValue(Component component)

replaceLineAttr

public static String replaceLineAttr(String statement,
                                     String replacement)


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