How to open first tab in panelTabbed

Problem Statement – I have one scenario where,

There is one JSPX

it has one command button and a popup

popup has one taskflow dropped as region

taskflow has a PanelGroupLayout which has a panelTabbed component with 3 showDetailItems.

I open this popup, select tab2 and close. When i re-opn it for 2nd time it still displays, Tab2 as selected.

Solution – 

1. Create one bean mapped with JSPX.

2. in popup on popupCanceledListener invoke “#{backingBeanScope.testBean.testInitialize}

3. write this code in bean,

public void testInitialize(PopupCanceledEvent popupCanceledEvent) {
// Add event code here…
System.out.println(“Called cancelled”);
((RichShowDetailItem)((RichPanelTabbed)((RichPanelGroupLayout)((RichRegion)((RichPanelWindow)popupCanceledEvent.getComponent().getChildren().get(0)).getChildren().get(0)).getChildren().get(0)).getChildren().get(0)).getChildren().get(0)).setDisclosed(true);
}

and it is done.

JSFF Code – 

<?xml version=’1.0′ encoding=’UTF-8′?>
<jsp:root xmlns:jsp=”http://java.sun.com/JSP/Page&#8221; version=”2.1″
xmlns:af=”http://xmlns.oracle.com/adf/faces/rich”&gt;
<af:panelGroupLayout id=”pgl1″>
<af:panelTabbed id=”pt1″ dimensionsFrom=”disclosedChild”>
<af:showDetailItem text=”showDetailItem 1″ id=”sdi1″ disclosed=”true”/>
<af:showDetailItem text=”showDetailItem 2″ id=”sdi2″ disclosed=”false”/>
<af:showDetailItem text=”showDetailItem 3″ id=”sdi3″ disclosed=”false”></af:showDetailItem>
</af:panelTabbed>
</af:panelGroupLayout>
</jsp:root>

JSPX Code

<af:form id=”f1″>
<af:commandButton text=”commandButton 1″ id=”cb1″
action=”#{backingBeanScope.testBean.submit}”>
<af:showPopupBehavior popupId=”p1″ triggerType=”action”/>
</af:commandButton>
<af:popup id=”p1″ contentDelivery=”lazyUncached” childCreation=”deferred”
popupCanceledListener=”#{backingBeanScope.testBean.testInitialize}”>
<af:panelWindow title = “test” id=”pw” closeIconVisible=”true”>
<af:region value=”#{bindings.taskflowdefinition1.regionModel}”
id=”r1″/>
</af:panelWindow>
</af:popup>
</af:form>

Find Attached JDeveloper Project – 

Right Click below “code” image and “Save As” to your local disk.

Change file extension from “.png” to “.zip” and extract.

Open Project in JDeveloper and run. (JDeveloper  11.1.1.7 has been used to develop this project.)

Code

Advertisements

2 comments

    1. Hi Swathi,

      This code is perfectly fine. For your convenience I have created a JDeveloper Application using this code and added to the post.

      Hope it helps.

      Don’t hesitate asking if you face further challenges.

      Thanks,
      -Kumar

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s