Intercepting user customization – such as column reordering in tables – in ADF 11g change persistence
The requirement I was facing was simple: act on column reordering through user drag and drop in a rich table. More specifically: invoke a method in a managed bean whenever the user changes the position (or side or visibility) of a column.
At first it seemed trivial – just use an AttributeChangeListener. When that turned out not to work – this listener does not get triggered for column reordering – the challenge turned almost unsurmountable. Finally I ran into the ADF Change Persistence framework and more specifically into the concept of a ChangeManager. See for some background this article that I wrote a long time ago: http://technology.amis.nl/blog/4595/adf-11g-persisted-run-time-user-ui-personalization-or-impatient-mans-mds. Some background can also be found here: http://docs.oracle.com/cd/E15523_01/web.1111/b31974/ad_persist.htm (Fusion Middleware Fusion Developer’s Guide for Oracle Application Development Framework 11g – 35 Allowing User Customizations at Runtime).
In short: enable user customizations and configure a custom class that extends from ChangeManager to intercept the customizations.
when User Customizations are enabled -
the web.xml file is extended with a context parameter org.apache.myfaces.trinidad.CHANGE_PERSISTENCE. This parameter has session (or mds) as default value. However, it can be overwriten with the name of a custom class that extends from org.apache.myfaces.trinidad.change.ChangeManager. This class is invoked every time a user customization is processed. I have implemented by own class
that extends from SessionChangeManager. This class overrides the method addComponentChange. This method is invoked for many user induced customizations, including column repositioning.
In this particular case, I have abused the headerClass attribute to make a string value (activiteit) available (note: I had a problem with using clientAttributes on the columns, perhaps because the columns are rendered dynamically inside a forEach and also contain two nested columns).
When I change the order of the columns
the resulting logging is:
- Did we spoil the end user? Building Customization and Personalization into JSF applications (NLJUG-JSpring)
- ADF 11g – Use the Change(d) Indicator to make AJAX originated value refresh explicit to the user
- MyFaces Trinidad – using AJAX (PPR) for Row and Column Summaries in Tables
- Intercept Hide/Show column event
- ADF Faces – Server Side (partial page rendering) Column Hide and Seek – Expanding/Collapsing Columns in Table