Intercepting user customization – such as column reordering in tables – in ADF 11g change persistence

0

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 -

Image

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

Image

that extends from SessionChangeManager. This class overrides the method addComponentChange. This method is invoked for many user induced customizations, including column repositioning.

Image

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

Image

the resulting logging is:

Image

Share.

About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director for Fusion Middleware. Consultant, trainer and instructor on diverse areas including Oracle Database (SQL & PLSQL), Service Oriented Architecture, BPM, ADF, Java in various shapes and forms and many other things. Author of the Oracle Press book: Oracle SOA Suite 11g Handbook. Frequent presenter on conferences such as JavaOne, Oracle OpenWorld, ODTUG Kaleidoscope, Devoxx and OBUG. Presenter for Oracle University Celebrity specials.

Leave a Reply