move rowKey string token map from UIXCollection into corresponding Renderer
---------------------------------------------------------------------------

                 Key: ADFFACES-210
                 URL: http://issues.apache.org/jira/browse/ADFFACES-210
             Project: MyFaces ADF-Faces
          Issue Type: Improvement
            Reporter: Arjuna Wijeyekoon


Folks,

Currently the UIXCollection class (which is the super class for 
table/tree/treeTable) maintains a mapping between
Object rowkeys and String tokens.

>>>>>>>>
        see
            private ValueMap<Object> _currencyCache = null;
<<<<<<<<

I would like to suggest that we move this mapping from the component and into 
the corresponding renderer.
We would still have the methods
UIXCollection.getCurrencyString()
UIXCollection.setCurrencyString(..)

However, these would call into the renderer and the renderer would maintain the 
mapping, and would control pruning of the mapping.

Why should we do this?

The reason is that only the renderer knows exactly which tokens are still being 
used on the client-side. The component does not know this.
And so the component does not know when to clear or prune this mapping.
At the moment the component is clearing the mapping at the start of each encode 
cycle.
But this breaks some 3rd party renderers which are still displaying certain 
rows on the client-side.

A good example is the treeTable component. Let's say the tree is rendering a 
certain set of rows. The tokens for these rows are being held in the mapping.
Now the user expands a node, introducing a new subset of rows. Tokens for these 
rows are now needed (in addition to the existing tokens).
The encode phase starts and the mapping is cleared.
The current trinidad treeTable renderer rerenders the entire tree, so all 
tokens (including the ones for the newly inserted rows are recreated) and 
things work fine.

Now let's suppose a 3rd party treeTable renderer has an optimization that only 
rerenders the part that was inserted.
Since the component cleared the mapping, only the tokens for the newly inserted 
rows will exist. The tokens for the old set of rows (which still exist) on the 
client-side
are missing. Things will break during decode when the treeTable is subsequently 
submitted.

Suggested Changes

Introduce a new Renderer API called , for eg: RowKeyTokenManager, or 
RowKeyStringManager, or CurrencyStringManager.
The tableRenderer would implement this.
The UIXCollection class would cast its renderer into an instance of this new 
API and use it to handle the
get/setCurrencyString  methods.

It would be up to the renderer to prune and manage the lifecycle of these token 
strings.
The renderer would probably store the mapping as a private attribute on the 
component so that it is properly serialized along with the component.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to