myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hasnain Badami" <hasnainbad...@gmail.com>
Subject Fwd: Panel Tabbed Pane
Date Tue, 06 Nov 2007 15:52:15 GMT
Any suggestions please ?

---------- Forwarded message ----------
From: Hasnain Badami <hasnainbadami@gmail.com>
Date: Nov 1, 2007 6:26 PM
Subject: Fwd: Panel Tabbed Pane
To: MyFaces Discussion <users@myfaces.apache.org>

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

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

<%@
taglib prefix="f" uri ="http://java.sun.com/jsf/core" %>

<%@
taglib prefix="h" uri ="http://java.sun.com/jsf/html" %>

<%@
taglib prefix="c" uri ="http://java.sun.com/jstl/core" %>

<%@
taglib uri="http://myfaces.apache.org/tomahawk " prefix="t"%>







<
f:view>



<html>



<head>



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



<title>



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

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



</title>



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



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

</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['snapshot_view']}" >

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

<f:subview id="tabportfoliodetailsnapshotview" >



<h:outputText value="snapshot" />



</f:subview>



</c:if>

</t:panelTab>

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

<h:outputText value="timeseries" />



</t:panelTab>

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

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

<h:outputText value="documents" />



</c:if>

</t:panelTab>

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

<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
{

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

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

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

PortfolioTabIndex

package com.prytania.model.backingbeans;

import java.io.Serializable;

import org.apache.log4j.Logger;

/**
 *
 * @author hbadami
 * @jsf.bean
 *  name="portfolioTabIndex"
 *  scope="request"
 */

public class PortfolioTabIndex implements Serializable
{
 private static final long serialVersionUID = 1L;
 private static final Logger log = Logger.getLogger(PortfolioTabIndex.class
);

 private int index=0;
 public int getIndex() {
  return index;
 }
 public void setIndex(int index)
 {
  log.info("The old index is " + this.index + " the new index is " + index);
  this.index = index;
 }

 public PortfolioTabIndex()
 {
  log.info("Executing PortfolioTabIndex()");
  log.info("Exiting PortfolioTabIndex()");
 }

}


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 < hasnainbadami@gmail.com>
Date: Oct 31, 2007 5:06 PM
Subject: Panel Tabbed Pane
To: MyFaces Discussion < users@myfaces.apache.org>


HI

I am trying to use the panel tabbed pane with server side tab switching. I
am using myfaces 1.1.6 Snapshot and tomahawak 1.1.7. snapshot. 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_view']}" >

<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

Mime
View raw message