List Info

Thread: Fwd: Panel Tabbed Pane




Fwd: Panel Tabbed Pane
user name
2007-11-06 09:52:15
Any suggestions please ?

---------- Forwarded message ----------
From: Hasnain Badami < hasnainbadamigmail.com">hasnainbadamigmail.com >
Date: Nov 1, 2007 6:26 PM
Subject: Fwd: Panel Tabbed Pane
To: MyFaces Discussion < usersmyfaces.apache.org">usersmyfaces.apache.org&gt;

There is an other issue, related to the earlier one, which I think is weird. Possibly I am doing something&nbsp;wrong. When I  
execute the code

<% page contentType="text/html;charset=UTF-8&quot; language="java" %>

<%

taglib prefix="f&quot; uri ="http://java.sun.com/jsf/core&quot; %>

<%

taglib prefix="h&quot; uri ="http://java.sun.com/jsf/html&quot; %>

<%

taglib prefix="c&quot; uri ="http://java.sun.com/jstl/core&quot; %>

<%

taglib uri=" http://myfaces.apache.org/tomahawk " prefix="t&quot;%>

 

 

 

<

f:view>

 

<html>

 

<head>

 

<f:loadBundle basename="com.prytania.resource.Messages " var="messages"/>

 

<title>

 

<h:outputText value="#{messages[9;portfolio']}&quot; />

<h:outputText value="#{portfolioUI.portfolioName}" />

 

</title>

 

<t:stylesheet path="/report.css&quot; />

 

<t:stylesheet path="/tablepresentation.css&quot; />

</head>

 

<body class="mainBody" >

 

<h:form id="portfolioFatherForm" >

<t:saveState value="#{portfolioTabIndex}"; />

<t:panelTabbedPane

styleClass="levelOneTabbedPane"

width="100%"

bgcolor="#FFFFCC"

activeTabStyleClass="levelOneActiveTab"

inactiveTabStyleClass="levelOneInactiveTab"

activeSubStyleClass="levelOneActiveSub"

inactiveSubStyleClass="levelOneInactiveSub"

tabContentStyleClass="levelOneTabContent"

serverSideTabSwitch="true"

id="pDetailTab";

>

<t:panelTab label="#{messages[9;snapshot_view']}" >

<c:if test="${portfolioTabIndex==null || portfolioTabIndex.index==0 }&quot; >

<f:subview id="tabportfoliodetailsnapshotview" >

 

<h:outputText value="snapshot" />

 

</f:subview>

 

</c:if>

</t:panelTab>

<t:panelTab label="#{messages[9;time_series_view';]}" >

<h:outputText value="timeseries"; />

 

</t:panelTab>

<t:panelTab label="#{messages[9;documents']}&quot; >

<c:if test="${portfolioTabIndex.index==2}" >

<h:outputText value="documents" />

 

</c:if>

</t:panelTab>

<t:panelTab label="#{messages[9;analysis&#39;]}"; >

<c:if test="${portfolioTabIndex.index==3}" >

<f:subview id="tabportfoliodetailanalysisview" >

<h:outputText value="analysis" />

 

</f:subview>

</c:if>

</t:panelTab>

<t:tabChangeListener type="com.prytania.model.backingbeans.PortfolioDetailTabManager " />

</t:panelTabbedPane>

</h:form>

 

</body>

 

</html>

</

f:view>
 
PortfolioDetailTabManager.java
 

package com.prytania.model.backingbeans;


import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;

import org.apache.log4j.Logger;
import org.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPane;
import org.apache.myfaces.custom.tabbedpane.TabChangeEvent;
import org.apache.myfaces.custom.tabbedpane.TabChangeListener ;

 ;

public class PortfolioDetailTabManager implements TabChangeListener
{

&nbsp;private static final long serialVersionUID = 1L;
 private static final Logger log = Logger.getLogger(PortfolioDetailTabManager.class);

 public PortfolioDetailTabManager()
&nbsp;{
 &nbsp;log.info("Executing PortfolioDetailTabManager()";);
 &nbsp;log.info("Exiting PortfolioDetailTabManager()";);
 }
 public void processTabChange(TabChangeEvent event) throws AbortProcessingException
 {
 &nbsp;log.info("TabSupport:processPortfolioDetailTabChange() called " + event.getNewTabIndex());
 &nbsp;PortfolioTabIndex tabIndices = (PortfolioTabIndex)FacesContext.getCurrentInstance().getApplication().getVariableResolver().resolveVariable( FacesContext.getCurrentInstance(), "portfolioTabIndex");
  ;HtmlPanelTabbedPane tabbedPane = (HtmlPanelTabbedPane)event.getComponent();

 &nbsp;if(tabIndices!=null)
 &nbsp; tabIndices.setIndex(event.getNewTabIndex());
  ;if(tabbedPane!=null)
  ; tabbedPane.setSelectedIndex(event.getNewTabIndex());
 } &nbsp;
}

PortfolioTabIndex

package com.prytania.model.backingbeans;

import java.io.Serializable;

import org.apache.log4j.Logger;

/**
 *
 * author hbadami
&nbsp;* jsf.bean
&nbsp;*  name="portfolioTabIndex"
&nbsp;*  scope="request"
 */

public class PortfolioTabIndex implements Serializable
{
 private static final long serialVersionUID = 1L;
 private static final Logger log = Logger.getLogger(PortfolioTabIndex.class);
 
&nbsp;private int index=0;
 public int getIndex() {
 &nbsp;return index;
&nbsp;}
 public void setIndex(int index)
 {
&nbsp; log.info(&quot;The old index is " + this.index + " the new index is " + index);
&nbsp; this.index = index;
 }
 
&nbsp;public PortfolioTabIndex()
&nbsp;{ ;
 &nbsp;log.info("Executing PortfolioTabIndex()&quot;);
&nbsp; log.info(";Exiting PortfolioTabIndex()&quot;);
&nbsp;}
 
}

&nbsp;
 ;
now when I execute this code, only the code in the selected tab gets executed, but the tabbed pane creates additonal tabs automatically when you move between tabs back and forth. Any idea why is this happening? Thanks in advance

---------- Forwarded message ----------
From: Hasnain Badami <gmail.com" target="_blank"> hasnainbadamigmail.com>
Date: Oct 31, 2007 5:06 PM
Subject: Panel Tabbed Pane
To: MyFaces Discussion <myfaces.apache.org" target="_blank"> usersmyfaces.apache.org&gt;

 
HI
&nbsp;
I am trying to use the panel tabbed pane with server side tab switching. I am using ;myfaces 1.1.6 Snapshot&nbsp;and tomahawak 1.1.7. snapshot.&nbsp;Consider the following code snippet
portfolioDetailUI backing bean is in request scope.

<

t:panelTabbedPane

styleClass="levelOneTabbedPane"

width="100%"

bgcolor="#FFFFCC"

activeTabStyleClass="levelOneActiveTab"

inactiveTabStyleClass="levelOneInactiveTab"

activeSubStyleClass="levelOneActiveSub"

inactiveSubStyleClass="levelOneInactiveSub"

tabContentStyleClass="levelOneTabContent"

serverSideTabSwitch="true"

id="pDetailTab";

binding="#{portfolioDetailUI.panelTabbedPane}"

>

<t:panelTab label=" #{messages['snapshot_view9;]}" >

<f:subview id="tabportfoliodetailsnapshotview" >

<jsp:include page="portfoliodetailsnapshotview.jsp " />

</f:subview>

</t:panelTab>

<t:panelTab label=" #{messages['time_series_view']}" >

<f:subview id="tabportfoliodetailtimeseriesview"; >

<jsp:include page="portfoliodetailtimeseriesview.jsp " />

</f:subview>

</t:panelTab>

<t:tabChangeListener type="com.prytania.model.backingbeans.PortfolioDetailTabManager " />

</t:panelTabbedPane>

I am a little bit confused. When the page loads the selected index for this tab is 0. This means only portfoliodetailsnapshotview.jsp should be included, but both of these files are included. Similary when second tab is clicked only portfoliodetailtimeseriesview.jsp should be included, but again both are included. Any pointers as to why is this happening. I shall appreciate any help

Thanks

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )