public class ViewIndex extends Object implements Serializable
View instance for retrieval| Constructor and Description |
|---|
ViewIndex()
Constructs new instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
addInitialComponentStateIfNeeded(Component component)
Adds a copy of the given component instance to the map of initial component states keyed
|
void |
addSequenceValueToSnapshot(String componentId,
int sequenceVal) |
void |
clearIndexesAfterRender()
Invoked after the view lifecycle or component refresh has run to clear indexes that are not
needed for the post
|
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 |
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<String,Component> |
getInitialComponentStates()
Preserves initial state of components needed for doing component refreshes
|
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.
|
void |
setFieldPropertyEditors(Map<String,PropertyEditor> fieldPropertyEditors)
Setter for the Map that holds view property paths to configured Property Editors (non secure fields only)
|
void |
setIdSequenceSnapshot(Map<String,Integer> idSequenceSnapshot) |
void |
setInitialComponentStates(Map<String,Component> initialComponentStates)
Setter for the map holding initial component states
|
void |
setSecureFieldPropertyEditors(Map<String,PropertyEditor> secureFieldPropertyEditors)
Setter for the Map that holds view property paths to configured Property Editors (secure fields only)
|
public ViewIndex()
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()
public Component getComponentById(String id)
Component from the view index by Idid - - id for the component to retrievepublic DataField getDataFieldByPath(String propertyPath)
DataField instance from the indexpropertyPath - - 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 retrievepublic Map<String,DataField> getDataFieldIndex()
DataField instancepublic Map<String,CollectionGroup> getCollectionsIndex()
CollectionGroup instancepublic CollectionGroup getCollectionGroupByPath(String collectionPath)
CollectionGroup instance from the indexcollectionPath - - 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 void setFieldPropertyEditors(Map<String,PropertyEditor> fieldPropertyEditors)
fieldPropertyEditors - 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 void setSecureFieldPropertyEditors(Map<String,PropertyEditor> secureFieldPropertyEditors)
secureFieldPropertyEditors - public Map<String,Integer> getIdSequenceSnapshot()
public void setIdSequenceSnapshot(Map<String,Integer> idSequenceSnapshot)
public void addSequenceValueToSnapshot(String componentId, int sequenceVal)
Copyright © 2005–2016 The Kuali Foundation. All rights reserved.