|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.uif.view.ViewIndex
public class ViewIndex
Holds component indexes of a View
instance for convenient retrieval during the lifecycle
and persisting components for the refresh process
Field Summary | |
---|---|
protected Map<String,CollectionGroup> |
collectionsIndex
|
protected Map<String,Map<String,String>> |
componentExpressionGraphs
|
protected Map<String,DataField> |
dataFieldIndex
|
protected Map<String,PropertyEditor> |
fieldPropertyEditors
|
protected Map<String,Integer> |
idSequenceSnapshot
|
protected Set<String> |
idsToHoldInIndex
|
protected Set<String> |
idsToHoldInitialState
|
protected Map<String,Component> |
index
|
protected Map<String,Component> |
initialComponentStates
|
protected Map<String,Map<String,Object>> |
postContext
|
protected Map<String,PropertyEditor> |
secureFieldPropertyEditors
|
Constructor Summary | |
---|---|
ViewIndex()
Constructs new instance |
Method Summary | |
---|---|
void |
addInitialComponentStateIfNeeded(Component component)
Adds a copy of the given component instance to the map of initial component states keyed |
void |
addPostContextEntry(String componentId,
String entryKey,
Object entryValue)
Adds an entry to the post context for the given component |
void |
addSequenceValueToSnapshot(String componentId,
int sequenceVal)
Adds a sequence value to the id snapshot map for the given component id |
protected boolean |
canBeRefreshed(Component component)
Indicates if the given component has configuration that it allows it to be refreshed |
void |
clearIndexesAfterRender()
Invoked after the view lifecycle or component refresh has run to clear indexes that are not needed for the post |
ViewIndex |
copy()
Returns a clone of the view index. |
CollectionGroup |
getCollectionGroupByPath(String collectionPath)
Retrieves a CollectionGroup instance from the index |
Map<String,CollectionGroup> |
getCollectionsIndex()
Gets the Map that contains collection indexing information. |
Component |
getComponentById(String id)
Retrieves a Component from the view index by Id |
Map<String,Map<String,String>> |
getComponentExpressionGraphs()
Map of components with their associated expression graphs that will be used during the component refresh process |
DataField |
getDataFieldByPath(String propertyPath)
Retrieves a DataField instance from the index |
DataField |
getDataFieldByPropertyName(String propertyName)
Retrieves a DataField instance that has the given property name
specified (note this is not the full binding path and first match is returned) |
Map<String,DataField> |
getDataFieldIndex()
Gets the Map that contains attribute field indexing information. |
Map<String,PropertyEditor> |
getFieldPropertyEditors()
Maintains configuration of properties that have been configured for the view (if render was set to true) and there corresponding PropertyEdtior (if configured) |
Map<String,Integer> |
getIdSequenceSnapshot()
Map of components ids to starting id sequences used for the component refresh process |
Map<String,Component> |
getInitialComponentStates()
Preserves initial state of components needed for doing component refreshes |
Map<String,Map<String,Object>> |
getPostContext()
A map of state that is held in the session |
Object |
getPostContextEntry(String componentId,
String entryKey)
Retrieves a context entry values for the given component and entry key |
Map<String,PropertyEditor> |
getSecureFieldPropertyEditors()
Maintains configuration of secure properties that have been configured for the view (if render was set to true) and there corresponding PropertyEdtior (if configured) |
protected void |
index(View view)
Walks through the View tree and indexes all components found. |
void |
indexComponent(Component component)
Adds an entry to the main index for the given component. |
boolean |
isIdForRefreshComponent(String componentId)
Indicates whether the given component id is for a component maintained by the view index for the refresh process |
void |
setInitialComponentStates(Map<String,Component> initialComponentStates)
Setter for the map holding initial component states |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map<String,Component> index
protected Map<String,DataField> dataFieldIndex
protected Set<String> idsToHoldInIndex
protected Map<String,CollectionGroup> collectionsIndex
protected Map<String,Component> initialComponentStates
protected Set<String> idsToHoldInitialState
protected Map<String,PropertyEditor> fieldPropertyEditors
protected Map<String,PropertyEditor> secureFieldPropertyEditors
protected Map<String,Integer> idSequenceSnapshot
protected Map<String,Map<String,String>> componentExpressionGraphs
protected Map<String,Map<String,Object>> postContext
Constructor Detail |
---|
public ViewIndex()
Method Detail |
---|
protected void index(View view)
DataField
instances are indexed by the attribute path.
This is useful for retrieving the InputField based on the incoming
request parameter
CollectionGroup
instances are indexed by the collection
path. This is useful for retrieving the CollectionGroup based on the
incoming request parameter
public void indexComponent(Component component)
DataField
or CollectionGroup
an
entry is created in the corresponding indexes for those types as well. Then
the #indexComponent method is called for each of the component's children
If the component is already contained in the indexes, it will be replaced
Special processing is done for DataField instances to register their property editor which will be used for form binding
component
- component instance to indexpublic void clearIndexesAfterRender()
protected boolean canBeRefreshed(Component component)
component
- instance to check
public boolean isIdForRefreshComponent(String componentId)
componentId
- id for the component to check
public Component getComponentById(String id)
Component
from the view index by Id
id
- id for the component to retrieve
public DataField getDataFieldByPath(String propertyPath)
DataField
instance from the index
propertyPath
- full path of the data field (from the form)
public DataField getDataFieldByPropertyName(String propertyName)
DataField
instance that has the given property name
specified (note this is not the full binding path and first match is returned)
propertyName
- property name for field to retrieve
public Map<String,DataField> getDataFieldIndex()
DataField
instance
public Map<String,CollectionGroup> getCollectionsIndex()
CollectionGroup
instance
public CollectionGroup getCollectionGroupByPath(String collectionPath)
CollectionGroup
instance from the index
collectionPath
- full path of the collection (from the form)
public Map<String,Component> getInitialComponentStates()
Some components, such as those that are nested or created in code cannot be requested from the spring factory to get new instances. For these a copy of the component in its initial state is set in this map which will be used when doing component refreshes (which requires running just that component's lifecycle)
Map entries are added during the perform initialize phase from ViewHelperService
public void addInitialComponentStateIfNeeded(Component component)
Component is only added if its factory id is not set yet (which would happen if it had a spring bean id and we can get the state from Spring). Once added the factory id will be set to the component id
component
- component instance to addpublic void setInitialComponentStates(Map<String,Component> initialComponentStates)
initialComponentStates
- public Map<String,PropertyEditor> getFieldPropertyEditors()
Information is pulled out of the View during the lifecycle so it can be used when a form post is done
from the View. Note if a field is secure, it will be placed in the getSecureFieldPropertyEditors()
map
instead
public Map<String,PropertyEditor> getSecureFieldPropertyEditors()
Information is pulled out of the View during the lifecycle so it can be used when a form post is done
from the View. Note if a field is non-secure, it will be placed in the getFieldPropertyEditors()
map
instead
public Map<String,Integer> getIdSequenceSnapshot()
public void addSequenceValueToSnapshot(String componentId, int sequenceVal)
componentId
- id for the component the id sequence value is associated itsequenceVal
- current sequence value to insert into the snapshotpublic Map<String,Map<String,String>> getComponentExpressionGraphs()
Because expressions that impact a component being refreshed might be on a parent component, a special map needs to be held around that contains expressions that apply to the component and all its nested components. This map is populated during the initial view processing and populating of the property expressions from the initial expression graphs
ExpressionUtils.populatePropertyExpressionsFromGraph(org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean,
boolean)
public Map<String,Map<String,Object>> getPostContext()
Instead of storing entire components in the session in order to retrieve information for posts, just the state that is needed can be added to this map and then retrieve on the post through the posted view's index
public void addPostContextEntry(String componentId, String entryKey, Object entryValue)
componentId
- id of the component the context is associated withentryKey
- key for the entryentryValue
- value for the entrypublic Object getPostContextEntry(String componentId, String entryKey)
componentId
- id of the component the entry is associated withentryKey
- key for the entry
public ViewIndex copy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |