Provide ChangeManager APIs to remove and restore changes to components in a 
subtree
-----------------------------------------------------------------------------------

                 Key: TRINIDAD-2209
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2209
             Project: MyFaces Trinidad
          Issue Type: Improvement
          Components: Components, Infrastructure
    Affects Versions: 2.0.2-core
         Environment: n/a
            Reporter: Prakash Udupa



There are frequent changes to attributes of components due to end user 
interaction. For example the 'displayIndex' value of a custom 'column' 
component changes whenever user reorders the column in a table. 
SessionChangeManager records such changes on certain attributes of certain 
components and restores it as 'preference' / 'personalization' for that user 
for future 'GET' requests on the page. While this is generally desirable, it 
sometimes could interfere with expectations of other components. For example a 
custom 'query' component may choose to allow users to save keyed by a 'name' 
the 'search criteria', and then additionally the 'layout' of the results area, 
which most likely is a table. The changes on the table (or any other component 
on results area) that the SessionChangeManager frequently saves and restores 
interferes with the component's feature to save and restore the layout of the 
results area / table. We need some ChangeManager API to reduce this 
interference.

This proposal is to add APIs to ChangeManager that components can call to:
1. Remove the ChangeManager changes for the result area subtree when it 
switches to a saved search that includes layout.
2. Add back the ChangeManager changes for the result area subtree when user 
switches to a saved search that does not include a layout. 

------------------------

Specifically proposing the following new APIs (two public methods) on 
ChangeManager class:

  /**
   * Removes all changes that the ChangeManager holds for components in a 
subtree.
   * Note that the ChangeManager would still continue to record any new changes 
on the
   * components in the subtree.
   * @param subTreeRoot The UIComponent that is the root of the component 
subtree for which the
   *                    changes are to be removed. Note that if the viewroot is 
suplied, the
   *                    changes for the entire view are removed.
   * @return Object a Serializable Object of all the component changes for the 
subtree that was
   *                just removed. This value can be passed back to
   *                restoreComponentChangesForSubtree() to restore the changes.
   */
  public Object removeComponentChangesForSubtree(FacesContext context, 
UIComponent subTreeRoot)

  /**
   * Restores the component changes to the ChangeManager for components in a  
subtree.
   * Before adding the changes, if there are existing changes to the subtree it 
will be removed.
   * @param changes The Serializable Object of the component changes as 
returned by
   *        removeComponentChangesForSubtree()
   */
  public void restoreComponentChangesForSubtree(FacesContext context, Object 
changes)

------------------------

These methods will be implemented in SessionChangeManager, and will be a no-op 
in the document based ChangeManager implementations.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to