We're currently using JDev 22.214.171.124.0 and a source code cut of the ADF UI Shell which is packaged inside an ADF Library JAR. Our ADF UI Shell source code is now used by several applications through these ADF Library JARs. One such application has a specific requirement around the 2nd level "activity" tabs that the ADF UI Shell provides.
Readers will be familiar that the ADF UI shell provides the ability to spawn 1 to 15 separate tabs representing "activities" where the user can interact with the system. Our requirement is when a user opens multiple such tabs, and switches from the active tab to another tab that is already open, we need to capture that event and do something specific for the application.
As we have a copy of the ADF UI Shell source code it should be easy for me to update the TabContext.tabActivatedEvent() method to include our own functionality. However as the ADF UI Shell code is sourced by more than 1 application, I cannot write specific code into the TabContext.tabActivatedEvent() method for just 1 application, as it wont work for the other applications. (and for other readers who aren't using a source code cut of the ADF UI Shell, but just that packaged by Oracle, they wont have the ability to override the source code anyhow).
I've been trying to come up with some other solutions to solve this issue:
a) One solution in the specific application is for me to programatically locate the af:commandNavigationItem UI components of the af:navigationPane that comprise the tabs, and programmatically add a new ActionListener() to each as they're spawned. The custom actionListener then can fire any additional logic I require as specified in my custom ActionListener() class.
Unfortunately I've hit a wall in doing this, as I can't seem to programmatically access the nodeStamp children of the af:navigationPane UI component, as described in the following OTN JDev forum post: Programatically accessing the nodeStamp children of an af:navigationPane?
As I can't access the children, I therefore cannot add my own ActionListener() implementation in code.
b) Another option was to define my own TabContext class in my application inheriting from the ADF UI Shell equivalent, with overriden/extended tabActivatedEvent() method, and then configure the same named bean in the application's adfc-config.xml file, in the hope that my bean would be used over the one used by the ADF UI Shell.
Again unfortunately it seems that the loading behaviour of beans across multiple adfc-config.xml files loaded from the main application and the ADF Library JAR that provides the ADF UI Shell and the original TabContext class takes precedence in the EL evaluation. As such my new overrriden class is never used.
Does anyone have any suggestions for how I can resolve this issue so I can capture the event when the user activates a different tab please?
Thanks & regards,
we also needed that functionality and implemented it like this - don't know if it fits your use case but it seems to work for us:
- New method TabContext.setSelectedTabIndexInternal(int index) which invokes TabContext.tabSelectionChangedEvent() in addition to setting the tab index.
- TabContext.setSelectedTabIndexInternal is called by setSelectedTabIndex and the removeTab method.
- New common interfaces DisplayChangeListener (implemented by any parties interested in the tab selection change event) and DisplayChangeNotifier (implemented by TabContext).
- The tabSelectionChangedEvent() method gets the currently selected tab's ID (maybe also new) and informs all registered DisplayChangeListeners by calling the interface method DisplayChangeListener.displayChanged(String selectedTabId, boolean displayed).
- The TabContext is registered as a managed bean and implements a common interface DisplayChangeNotifier which has got a method addDisplayChangeListener(DisplayChangeListener l).
- The TabContext instance puts itself in the external context's session map with a key DISPLAY_CHANGE_NOTIFIER so it can be retrieved by any other class to invoke the addDisplayChangeListener method.
I hope my description was straight-forward enough. We've used this with our Forms integration in ADF to be able to control the display of the Forms applet in some tabs.
I can send you the modified UIShell sources if you want to have a look at it, might be easier than digesting source code in the forum :)
Thanks for the follow up answer, I appreciate the fact you took time out to write up a response :-)
What I ended up doing was giving the consumer the ability to inject code via a parameter into the page template, and overriding the original TabContext.tabActivatedEvent to call the injected code via the parameter if present.
The end solution still required a change to the TabContext class, but one of little impact as the consumer doesn't need to necessarily inject any code.
I am having the same problem. I implemented UI shell tab in my application and now I have a requirement where I have to get the change tab event and it's id and based on that have to perform some operation.
Can you please share your application/code snippet or any video how to resolve this issue.
My actual issue is :
1) I have multiple show details of panel accordion and respective table in left pane.
2) when user disclose any show detail a link comes up which is to take this table in to the tab in right pane.
3) Real challenge is this table ( both row and col) comes from a dynamic VO and hence while opening tab I get the data from a VO.
4) I have to reexecute the VO when user change the tab with current parameters so to get respective data.
Any help on this would be appretiated.