This post is just a demonstration on how to open a default activity upon page load in ADF UI Shell, based on the accompanying sample application named "UISHellSherman_V02".
Let us simulate the concept using the page First.jspx.
- Add the Trinidad HTML Components 1.2 JSP Tag Library on the uiShellViewController project
- Open First.jspx and add the Trinidad "trh" tag declaration on the jsp root. The jsp root declaration should look like the following:
<?xml version='1.0' encoding='UTF-8'?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:af="http://xmlns.oracle.com/adf/faces/rich" xmlns:trh="http://myfaces.apache.org/trinidad/html">
- Add the following client and server listeners:
<af:document id="d1" title="First Page"> <af:clientListener method="initialize" type="load" /> <af:serverListener type="launchDefaultActivity" method="#{backingBeanScope.launcher.launchDefaultActivity}" />
- Right-click the line <af:document id="d1" title="First Page"> click Facets -document, then enable the Meta Container facet.
Modify the Meta Container facet to reflect the following:
<f:facet name="metaContainer"> <af:group> <trh:script> function initialize(event) { var source = event.getSource(); AdfCustomEvent.queue(source,"launchDefaultActivity",{},false); } </trh:script> </af:group> </f:facet>
- Add a launchDefaultActivity() method on the Launcher class.
public void launchDefaultActivity(ClientEvent clientEvent) { _launchActivity( "The Default Activity", "/WEB-INF/flows/first.xml#first", false); }
- Run the First.jspx
Related Posts
- ADF UI Shell: Customizing the Dynamic Tab Shell Layout
- ADF UI Shell: Extending the UI Shell to Allow Passing of Parameters to Bounded Task Flows
- UI Shell in Action - an app based on the UI Shell that connects to HR Schema
Cheers!
Thanks very much for this Pino, saved me some work, which I always appreciate!
ReplyDeleteCouple little tweaks:
1) Under JDev 11g PS1 the Javascript code can be placed inside an af:resource tag, therefore not requiring the Trinidad Library.
2) There are a couple of situations where the on-load event will be called when rendering another activity/tab in first.jspx. As such in the launchDefaultactivity method you can wrap the _launchActivity call with:
if (TabContext.getCurrentInstance().getSelectedTabIndex() == -1)
Thanks again for your assistance, appreciated.
CM.
Hi.
ReplyDeleteInitial opened tab works fine.
I found one use case where it does not work.
If I add for example one table in "navigation" facet than tab is not initially opened.
After I do a browser refresh it does work.
How to bypass this issue?
Thx
Boris
Hi Pino,
ReplyDeleteBy default close icon on dynamic tab is shown at the end
We have a requirement to show the close icon on tab itself just like in 11.1.2
but we have to do this in 11.1.1.5.
Can you help us with steps ?
Please drop a mail to sai194@gmail.com
Regards,
Sai Yeluri.
useful post..
ReplyDeletethank you :)