Simon,
The use case is this:
Say I have a table with a selectedRowKeys attribute that contains the
identifiers for the currently selected rows. If my application allows a
row key to change (perhaps during creation or because the application
actually allows the fields that make up the primary key to be edited),
we have a problem because we have a stale key reference. We would like
to update that reference with the new key, but the table doesn't know if
some other piece of code has added the table's selectedRowKeys
attribute. So the table wants to check if the selectedRowKeys are
already in the ChangeManager and if they are, add a new change. You are
right that whether the change actually replaces the old change or not is
irrelevant as long as the result is that the new achange eclipses the
old. So, we have one function that does everything, but we could also
add a new function to see if the ChangeManager contains an attribute
change instead.
-- Blake Sullivan
Simon Lessard said the following On 4/8/2010 6:17 AM PT:
-1. I really don't like it. It should be an implementation detail of the
ChangeManager to either replace/chain the attribute change in the
addComponentChange (or any other change for that matter). We have an
implementation on our project doing just that. That method would make no
sense for our use case and would introduce backward compatibility issues. I
could change my opinion, but I'd like a detailed use case as of why this
cannot be just an implementation detail before I do.
Regards,
~ Simon
On Wed, Apr 7, 2010 at 5:17 PM, Yuan Gao <[email protected]> wrote:
hi,
For JIRA 1761 (https://issues.apache.org/jira/browse/TRINIDAD-1761), we
propose to add this API to the ChangeManager interface:
/**
* Replace an AttributeComponentChange if it's present.
*
* @param facesContext
* @param uiComponent
* @param attributeComponentChange
* @return the old change instance
*/
public AttributeComponentChange
replaceAttributeChangeIfPresent(FacesContext facesContext,
UIComponent uiComponent,
AttributeComponentChange attributeComponentChange);
Let me know what do you think about it.
Thanks,
-Yuan