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

Lucas Jellema
0 0
Read Time:1 Minute, 36 Second

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: https://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

About Post Author

Lucas Jellema

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Kubernetes & Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press book Oracle SOA Suite 12c Handbook. Frequent presenter on user groups and community events and conferences such as JavaOne, Oracle Code, CodeOne, NLJUG JFall and Oracle OpenWorld.
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
Next Post

Create a JasperReport from Oracle BPEL

In my previous post I described how to create a Report (CDBooklet) with JasperReport in Java. Follow this link to take a look at the post ‘Using Java to create a report with the JasperReport java API’ For this new post I created a webservice wrapper around this reporting functionality […]
%d bloggers like this: