|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.uif.util.ComponentUtils
public class ComponentUtils
ComponentUtils is a utility class providing methods to help create and modify Component
instances
Constructor Summary | |
---|---|
ComponentUtils()
|
Method Summary | ||
---|---|---|
static void |
adjustNestedLevelsForTableCollections(Container container,
int currentLevel)
Adjust nestingLevel properties for collections which use RichTable with forceLocalJsonData on and for all of its potentially additional nested subcollections |
|
static
|
bindAndIdFieldList(List<T> fields,
String addBindingPrefix,
String idSuffix)
Equivalent to copyFieldList(java.util.List, String, String) but does not copy the given list of fields
first. |
|
static void |
clearIds(Component component)
Clear all ids from a component and its children. |
|
static void |
clearIds(List<? extends Component> components)
|
|
static boolean |
containsPropertyExpression(Component component,
String propertyName,
boolean collectionMatch)
Determines whether the given component contains an expression for the given property name |
|
static
|
copy(T component)
|
|
static
|
copy(T component,
String idSuffix)
|
|
static
|
copyComponent(T component,
String addBindingPrefix,
String idSuffix)
|
|
static
|
copyComponentList(List<T> components,
String idSuffix)
|
|
static
|
copyFieldList(List<T> fields,
String idSuffix)
|
|
static
|
copyFieldList(List<T> fields,
String addBindingPrefix,
String idSuffix)
|
|
static Component |
findComponentInList(List<Component> components,
String componentId)
Searches for the component with the given id within the given list of components |
|
static Component |
findNestedComponentById(Component parent,
String nestedId)
Finds the child component of the given parent component that has the required id |
|
static List<InputField> |
getAllInputFieldsWithinContainer(Container container)
Gets all the input fields contained in this container, but also in every sub-container that is a child of this container. |
|
static List<Component> |
getAllNestedComponents(Component component)
Get all nested children of a given component. |
|
static List<String> |
getComponentPropertyNames(Class<? extends Component> componentClass)
|
|
static
|
getComponentsOfType(List<? extends Component> items,
Class<T> componentType)
|
|
static
|
getComponentsOfTypeDeep(Component component,
Class<T> componentType)
Return the components of the specified type from the given component list |
|
static
|
getComponentsOfTypeDeep(List<? extends Component> items,
Class<T> componentType)
Return the components of the specified type from the given component list |
|
static
|
getComponentsOfTypeShallow(Component component,
Class<T> componentType)
Returns components of the given type that are direct children of the given component (only checks one level) including itself |
|
static
|
getNestedComponentsOfTypeShallow(Component component,
Class<T> componentType)
Get nested components of the type specified one layer deep; this defers from getComponentsOfTypeShallow because it does NOT include itself as a match if it also matches the type being requested |
|
protected static
|
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 |
pushAllToContext(Component component,
Map<String,Object> sourceContext)
pushes object to a component's context so that it is available from Component.getContext() |
|
static void |
pushAllToContext(List<? extends Component> components,
Map<String,Object> sourceContext)
places a all entries from a map into each context map of a list of components |
|
static void |
pushObjectToContext(Component component,
String contextName,
Object contextValue)
pushes object to a component's context so that it is available from Component.getContext() |
|
static void |
pushObjectToContext(List<? extends Component> components,
String contextName,
Object contextValue)
places a key, value pair in each context map of a list of components |
|
static void |
setComponentPropertyDeep(Component component,
String propertyPath,
Object propertyValue)
|
|
static void |
setComponentPropertyFinal(Component component,
String propertyName,
Object propertyValue)
Sets a property on the given component and removes any expressions for that property so the value is not overridden |
|
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 |
updateChildIdsWithSuffixNested(Component component,
String idSuffix)
|
|
static void |
updateContextForLine(Component component,
Object collectionLine,
int lineIndex,
String lineSuffix)
update the context map for the given component |
|
static void |
updateContextsForLine(List<? extends Component> components,
Object collectionLine,
int lineIndex,
String lineSuffix)
update the contexts of the given components |
|
static void |
updateIdsWithSuffixNested(Component component,
String idSuffix)
|
|
static void |
updateIdsWithSuffixNested(List<? extends Component> components,
String idSuffix)
|
|
static void |
updateIdWithSuffix(Component component,
String idSuffix)
add a suffix to the id |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ComponentUtils()
Method Detail |
---|
public static <T extends Component> T copy(T component)
public static <T extends Component> T copy(T component, String idSuffix)
protected static <T> T getNewInstance(T object)
public static <T extends Field> void bindAndIdFieldList(List<T> fields, String addBindingPrefix, String idSuffix)
copyFieldList(java.util.List, String, String)
but does not copy the given list of fields
first.
public static <T extends Field> List<T> copyFieldList(List<T> fields, String addBindingPrefix, String idSuffix)
public static <T extends Field> List<T> copyFieldList(List<T> fields, String idSuffix)
public static <T extends Component> T copyComponent(T component, String addBindingPrefix, String idSuffix)
public static <T extends Component> List<T> copyComponentList(List<T> components, String idSuffix)
public static <T extends Component> List<T> getComponentsOfType(List<? extends Component> items, Class<T> componentType)
public static <T extends Component> List<T> getComponentsOfTypeDeep(List<? extends Component> items, Class<T> componentType)
Components that match, implement or are extended from the specified componentType
are returned in
the result. If a component is a parent to other components then these child components are searched for
matching component types as well.
T
- the type of the components that are returneditems
- list of components from which to searchcomponentType
- the class or interface of the component type to return
public static <T extends Component> List<T> getComponentsOfTypeDeep(Component component, Class<T> componentType)
Components that match, implement or are extended from the specified componentType
are returned in
the result. If a component is a parent to other components then these child components are searched for
matching component types as well.
T
- the type of the components that are returnedcomponent
- The components to searchcomponentType
- the class or interface of the component type to return
public static <T extends Component> List<T> getComponentsOfTypeShallow(Component component, Class<T> componentType)
T
- type of component that will be returnedcomponent
- instance to get children forcomponentType
- type for component to return
public static <T extends Component> List<T> getNestedComponentsOfTypeShallow(Component component, Class<T> componentType)
T
- type of component that will be returnedcomponent
- instance to get children forcomponentType
- type for component to return
public static List<Component> getAllNestedComponents(Component component)
component
- The component to search.
Component.getComponentsForLifecycle()
public static Component findComponentInList(List<Component> components, String componentId)
components
- list of components to search throughcomponentId
- id for the component to find
public static Component findNestedComponentById(Component parent, String nestedId)
parent
- parent component for component to findnestedId
- id of the component to find
public static void prefixBindingPath(List<? extends Field> fields, String addBindingPrefix)
public static void prefixBindingPathNested(Component component, String addBindingPrefix)
public static void prefixBindingPath(DataBinding field, String addBindingPrefix)
public static void updateIdsWithSuffixNested(List<? extends Component> components, String idSuffix)
public static void updateIdsWithSuffixNested(Component component, String idSuffix)
public static void updateChildIdsWithSuffixNested(Component component, String idSuffix)
public static void clearIds(Component component)
component
- the component to clear all ids frompublic static void clearIds(List<? extends Component> components)
public static void updateIdWithSuffix(Component component, String idSuffix)
component
- the component instance whose id will be changedidSuffix
- the suffix to be appendedpublic static void setComponentsPropertyDeep(List<? extends Component> components, String propertyPath, Object propertyValue)
public static void setComponentPropertyDeep(Component component, String propertyPath, Object propertyValue)
public static List<String> getComponentPropertyNames(Class<? extends Component> componentClass)
public static void setComponentPropertyFinal(Component component, String propertyName, Object propertyValue)
component
- component instance to set property onpropertyName
- name of property to setpropertyValue
- value to set property topublic static void pushObjectToContext(List<? extends Component> components, String contextName, Object contextValue)
components
- the list componentscontextName
- a value to be used as a key to retrieve the objectcontextValue
- the value to be placed in the contextpublic static void pushObjectToContext(Component component, String contextName, Object contextValue)
Component.getContext()
The component's nested components that are available via Component#getComponentsForLifecycle
are also updated recursively
component
- the component whose context is to be updatedcontextName
- a value to be used as a key to retrieve the objectcontextValue
- the value to be placed in the contextpublic static void pushAllToContext(List<? extends Component> components, Map<String,Object> sourceContext)
components
- The list components.sourceContext
- The source context map.public static void pushAllToContext(Component component, Map<String,Object> sourceContext)
Component.getContext()
The component's nested components that are available via Component#getComponentsForLifecycle
are also updated recursively
component
- the component whose context is to be updatedsourceContext
- The source context map.public static void updateContextsForLine(List<? extends Component> components, Object collectionLine, int lineIndex, String lineSuffix)
calls updateContextForLine(org.kuali.rice.krad.uif.component.Component, Object, int, String)
for each component
components
- the components whose components to updatecollectionLine
- an instance of the data object for the linelineIndex
- the line indexlineSuffix
- id suffix for components in the line to make them uniquepublic static void updateContextForLine(Component component, Object collectionLine, int lineIndex, String lineSuffix)
The values of UifConstants.ContextVariableNames.LINE
and UifConstants.ContextVariableNames.INDEX
are set to collectionLine
and lineIndex
respectively.
component
- the component whose context is to be updatedcollectionLine
- an instance of the data object for the linelineIndex
- the line indexlineSuffix
- id suffix for components in the line to make them uniquepublic static List<? extends Ordered> sort(List<? extends Ordered> items, int defaultOrderSequence)
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.
items
- defaultOrderSequence
-
Component.getOrder()
,
org.springframework.core.Ordered
public static List<InputField> getAllInputFieldsWithinContainer(Container container)
public static boolean containsPropertyExpression(Component component, String propertyName, boolean collectionMatch)
component
- component instance to check for expressionspropertyName
- name of the property to determine if there is an expression forcollectionMatch
- if set to true will find an expressions for properties that start with the given
property name (for matching expressions on collections like prop[index] or prop['key'])
public static void adjustNestedLevelsForTableCollections(Container container, int currentLevel)
container
- container to traverse and update nested levels incurrentLevel
- the current nesting level, the initial call to this method should be 0
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |