Package org.kuali.rice.krad.uif.modifier
Class ComponentConvertModifier
java.lang.Object
org.kuali.rice.krad.datadictionary.DictionaryBeanBase
org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
org.kuali.rice.krad.uif.modifier.ComponentModifierBase
org.kuali.rice.krad.uif.modifier.ComponentConvertModifier
- All Implemented Interfaces:
Serializable,Cloneable,Copyable,DictionaryBean,UifDictionaryBean,Ordered,ComponentModifier,org.springframework.core.Ordered
For a given
Component instance converts all component properties
of a certain type to instances of another configured Component.
The conversion is performed recursively down all the component children
Some example uses of this are converting all checkbox controls to radio group controls within a group and replacement of a widget with another
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
-
Field Summary
Fields inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
componentCode, namespaceCodeFields inherited from interface org.kuali.rice.krad.uif.component.Ordered
INITIAL_ORDER_VALUEFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconvertToReplacement(Component component, int idSuffix) Reads the component properties and looks for types that match the configured type to replace.List of components that are maintained by the modifier as prototypes for creating other component instancesPrototype for the component replacementType of component that should be replaced with an instance of the component prototypeSetofComponentclasses that may be sent to the modifierprotected voidperformConversion(Component component, String componentProperty, int idSuffix) Creates a new instance of the replacement component prototype and sets a the property value for the given property name and component instancevoidperformModification(Object model, Component component) Invoked within the configured phase of the component lifecycle.voidsetComponentReplacementPrototype(Component componentReplacementPrototype) Setter for the replacement component prototypevoidsetComponentTypeToReplace(Class<? extends Component> componentTypeToReplace) Setter for the component type to replaceMethods inherited from class org.kuali.rice.krad.uif.modifier.ComponentModifierBase
getOrder, getRunCondition, getRunPhase, performInitialization, setOrder, setRunCondition, setRunPhaseMethods inherited from class org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
getExpressionGraph, getPropertyExpression, getPropertyExpressions, setExpressionGraph, setPropertyExpressionsMethods inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
clone, copy, dataDictionaryPostProcessing, getComponentCode, getNamespaceCode, setComponentCode, setNamespaceCodeMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.kuali.rice.krad.datadictionary.DictionaryBean
dataDictionaryPostProcessing, getComponentCode, getNamespaceCodeMethods inherited from interface org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean
getExpressionGraph, getPropertyExpression, getPropertyExpressions, setExpressionGraph, setPropertyExpressions
-
Constructor Details
-
ComponentConvertModifier
public ComponentConvertModifier()
-
-
Method Details
-
performModification
Invoked within the configured phase of the component lifecycle. This is where theComponentModifiershould perform its work against the givenComponentinstance- Parameters:
model- - top level object containing the view datacomponent- - the component instance to modify- See Also:
-
convertToReplacement
Reads the component properties and looks for types that match the configured type to replace. If a match is found, a new instance of the replacement component prototype is created and set as the property value. The method is then called for each of the component's children- Parameters:
component- component instance to inspect properties foridSuffix- suffix string to use for any generated component replacements
-
performConversion
Creates a new instance of the replacement component prototype and sets a the property value for the given property name and component instance- Parameters:
component- component instance to set property oncomponentProperty- property name to setidSuffix- suffix string to use for the generated component
-
getSupportedComponents
SetofComponentclasses that may be sent to the modifierIf an empty or null list is returned, it is assumed the modifier supports all components. The returned set will be used by the dictionary validation
- Returns:
- Set component classes
-
getComponentPrototypes
Description copied from interface:ComponentModifierList of components that are maintained by the modifier as prototypes for creating other component instancesPrototypes are held for configuring how a component should be created during the lifecycle. An example of this are the fields in a collection group that are created for each collection record. They only participate in the initialize phase.
- Specified by:
getComponentPrototypesin interfaceComponentModifier- Overrides:
getComponentPrototypesin classComponentModifierBase- Returns:
- List<Component> child component prototypes
- See Also:
-
getComponentTypeToReplace
Type of component that should be replaced with an instance of the component prototype- Returns:
- component type to replace
-
setComponentTypeToReplace
Setter for the component type to replace- Parameters:
componentTypeToReplace-
-
getComponentReplacementPrototype
Prototype for the component replacementEach time the type to replace if found a new instance of the component prototype will be created and set as the new property value
- Returns:
- Component
-
setComponentReplacementPrototype
Setter for the replacement component prototype- Parameters:
componentReplacementPrototype-
-