Class CompareFieldCreateModifier
- All Implemented Interfaces:
Serializable,Cloneable,Copyable,DictionaryBean,UifDictionaryBean,Ordered,ComponentModifier,org.springframework.core.Ordered
Field instances to produce a comparison view among
objects of the same type
Modifier is initialized with a List of ComparableInfo instances.
For each comparable info, a copy of the configured group field is made and
adjusted to the binding object path for the comparable. The comparison fields
are ordered based on the configured order property of the comparable. In
addition, a HeaderField can be generated to label each group
of comparison fields.
- 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 StringgetComparableId(ComparableInfo comparable, int index) Generates an comparableId suffix for the comparable itemList ofComparableInfoinstances the compare fields should be generated forList of components that are maintained by the modifier as prototypes for creating other component instancesintIndicates the starting integer sequence value to use forComparableInfoinstances that do not have the order property setPrototype instance to use for creating theHeaderFieldfor each group of comparison fields (if generateCompareHeaders is true)SetofComponentclasses that may be sent to the modifierbooleanIndicates whether aHeaderFieldshould be created for each group of comparison fieldsvoidperformInitialization(Object model, Component component) Default performInitialization impl (does nothing) Should be called to initialize the ComponentModifiervoidperformModification(Object model, Component component) Generates the comparison fieldsprotected booleanperformValueComparison(Group group, Component compareItem, Object model, String compareValueObjectBindingPath) For each attribute field in the compare item, retrieves the field value and compares against the value for the main comparable.voidsetComparables(List<ComparableInfo> comparables) Setter for the list of comparable info instancesvoidsetDefaultOrderSequence(int defaultOrderSequence) Setter for the default sequence starting valuevoidsetGenerateCompareHeaders(boolean generateCompareHeaders) Setter for the generate comparison headers indicatorvoidsetHeaderFieldPrototype(Header headerFieldPrototype) Setter for the header field prototypeMethods inherited from class org.kuali.rice.krad.uif.modifier.ComponentModifierBase
getOrder, getRunCondition, getRunPhase, 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
-
CompareFieldCreateModifier
public CompareFieldCreateModifier()
-
-
Method Details
-
performInitialization
Default performInitialization impl (does nothing) Should be called to initialize the ComponentModifierThis is where component modifiers can set defaults and setup other necessary state. The initialize method should only be called once per layout manager lifecycle and is invoked within the initialize phase of the view lifecylce.
Note if the component modifier holds nested components, they should be initialized in this method by calling the view helper service
- Specified by:
performInitializationin interfaceComponentModifier- Overrides:
performInitializationin classComponentModifierBase- Parameters:
model- - object instance containing the view datacomponent- - Component the modifier is configured on- See Also:
-
performModification
Generates the comparison fieldsFirst the configured List of ComparableInfo instances are sorted based on their order property. Then if generateCompareHeaders is set to true, a HeaderField is created for each comparable using the headerFieldPrototype and the headerText given by the comparable. Finally for each field configured on the Group, a corresponding comparison field is generated for each comparable and adjusted to the binding object path given by the comparable in addition to suffixing the id and setting the readOnly property
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:
-
performValueComparison
protected boolean performValueComparison(Group group, Component compareItem, Object model, String compareValueObjectBindingPath) For each attribute field in the compare item, retrieves the field value and compares against the value for the main comparable. If the value is different, adds script to the field on ready event to add the change icon to the field and the containing group header- Parameters:
group- group that contains the item and whose header will be highlighted for changescompareItem- the compare item being generated and to pull attribute fields frommodel- object containing the datacompareValueObjectBindingPath- object path for the comparison item- Returns:
- true if the value in the field represented by compareItem is equal to the comparison items value, false otherwise
-
getComparableId
Generates an comparableId suffix for the comparable itemIf the comparableId to use if configured on the ComparableInfo it will be used, else the given integer index will be used with an underscore
- Parameters:
comparable- comparable info to check for id suffixindex- sequence integer- Returns:
- id suffix
- See Also:
-
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:
-
getDefaultOrderSequence
public int getDefaultOrderSequence()Indicates the starting integer sequence value to use forComparableInfoinstances that do not have the order property set- Returns:
- default sequence starting value
-
setDefaultOrderSequence
public void setDefaultOrderSequence(int defaultOrderSequence) Setter for the default sequence starting value- Parameters:
defaultOrderSequence-
-
isGenerateCompareHeaders
public boolean isGenerateCompareHeaders()Indicates whether aHeaderFieldshould be created for each group of comparison fieldsIf set to true, for each group of comparison fields a header field will be created using the headerFieldPrototype configured on the modifier with the headerText property of the comparable
- Returns:
- true if the headers should be created, false if no headers should be created
-
setGenerateCompareHeaders
public void setGenerateCompareHeaders(boolean generateCompareHeaders) Setter for the generate comparison headers indicator- Parameters:
generateCompareHeaders-
-
getHeaderFieldPrototype
Prototype instance to use for creating theHeaderFieldfor each group of comparison fields (if generateCompareHeaders is true)- Returns:
- header field prototype
-
setHeaderFieldPrototype
Setter for the header field prototype- Parameters:
headerFieldPrototype-
-
getComparables
List ofComparableInfoinstances the compare fields should be generated forFor each comparable, a copy of the fields configured for the
Groupwill be created for the comparison view- Returns:
- comparables to generate fields for
-
setComparables
Setter for the list of comparable info instances- Parameters:
comparables-
-