|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.datadictionary.DictionaryBeanBase org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase org.kuali.rice.krad.uif.component.PropertyReplacer
public class PropertyReplacer
Configuration for replacing a property value based on a condition
A Component
may be configured with one or more PropertyReplacer
instances. Each defines
a condition to evaluate during the apply model phase, and if that condition succeeds the property on the component
given by getPropertyName()
, will be replaced with the value given by getReplacement()
. Conditions
are defined using an expression language and may reference any variables available in the component's context.
Property replacers can be used to change out an entire Component or List/Map of Components. For example, based on a
condition you might want to display a TextControl
or RadioControl
for an
InputField
. You can define the field with a text control, then include a property replacer as
follows:
Note
Component
contains a List
or property replacers which will be evaluated in the order
contained within the list. So in the above example if we wanted to now add a further condition which sets the
control
to a checkbox, we would just add another property replacer bean.
Property replacers may be used to substitute primitive properties as well, such as Strings
Field Summary |
---|
Fields inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase |
---|
componentCode, namespaceCode |
Constructor Summary | |
---|---|
PropertyReplacer()
|
Method Summary | |
---|---|
void |
completeValidation(ValidationTrace tracer)
Validates different requirements of component compiling a series of reports detailing information on errors found in the component. |
String |
getCondition()
Gives the expression that should be evaluated to determine whether or not the property replacement should be made |
List<Component> |
getNestedComponents()
Returns a list of nested components |
String |
getPropertyName()
Name of the property on the Component the property replacer is associated with that will be set when the condition for the replacer succeeds |
Object |
getReplacement()
Gives the Object that should be used to set the property value if the replacers condition evaluates to true |
void |
setCondition(String condition)
Setter for the replacement condition |
void |
setPropertyName(String propertyName)
Setter for the property name that will be set |
void |
setReplacement(Object replacement)
Setter for the replacement Object |
Methods inherited from class org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase |
---|
getExpressionGraph, getPropertyExpression, getPropertyExpressions, setExpressionGraph, setPropertyExpressions |
Methods inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase |
---|
clone, copy, dataDictionaryPostProcessing, getComponentCode, getNamespaceCode, preventModification, setComponentCode, setNamespaceCode, unwrap |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.kuali.rice.krad.datadictionary.DictionaryBean |
---|
dataDictionaryPostProcessing, getComponentCode, getNamespaceCode |
Constructor Detail |
---|
public PropertyReplacer()
Method Detail |
---|
public List<Component> getNestedComponents()
All nested components will be returned in the list. Current assumption is that
PropertyReplacer
can only contain a Component
, List
or
Map
for nested components
public String getPropertyName()
Note the property name must be readable/writable on the component. The property name may be nested, and include Map or List references.
public void setPropertyName(String propertyName)
propertyName
- public String getCondition()
Expression follows SPEL and may access any model data along with any variables
available in the context for the Component. The expression should evaluate to
a boolean. If the resulting boolean is true, the object given by getReplacement()
will be set as the value for the associated property on the component. If the resulting
boolean is false, no action will take place
Note the value does not need to contain the expression placeholder @{}
ExpressionEvaluator
,
UifConstants.ContextVariableNames
public void setCondition(String condition)
condition
- public Object getReplacement()
Note the configured Object must be valid for the type given by the property on the Component. Standard property editors will be used for setting the property value
public void setReplacement(Object replacement)
replacement
- public void completeValidation(ValidationTrace tracer)
tracer
- record of component's location
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |