Jaya, this sounds like a new question and should go in its own thread.
Please don't hijack another thread just because it discusses the same
component. This will only lead to confusion. :)
Danimal, perhaps rather than relying soley on "debugging" modes and
breakpoints, you could try using some logging output? With flexible
logging frameworks like Log4j and the commons-logging interface, it is
becoming very popular to use debugging output to track down problems.
If you were having trouble with it, perhaps your method could have read
(using log4j as an example):
public void processTabChange(TabChangeEvent event) throws
AbortProcessingException {
log.info("Processing tab change...");
log.info("Getting new tab index...");
int index = event.getNewTabIndex();
log.info("Finished getting new index: " + index);
log.info("Setting visible to true...");
positionVisible = true;
log.fino("Done processing tab change!");
}
And then, if not all the logging statements were being shown, you could
add something like:
public void processTabChange(TabChangeEvent event) throws
AbortProcessingException {
try{
log.info("Processing tab change...");
log.info("Getting new tab index...");
int index = event.getNewTabIndex();
log.info("Finished getting new index: " + index);
log.info("Setting visible to true...");
positionVisible = true;
log.fino("Done processing tab change!");
}
catch(Exception e) {
log.warn("Exception while processing tab change!";
log.warn(e.getClass().getSimpleName() + ": " + e.getMessage());
log.debug(e.getMessage(), e);
throw new AbortProcessingException(e.getMessage, e);
}
}
This may seem like a lot, but I guarantee you won't have to reboot. ;)
A project with a carefully-designed logging and exception-handling
framework might never need a "debug mode". In many cases recompiling
will not even be necessary to track down the problem.
Glad you figured out why the breakpoints weren't working. Sorry to hear
that panelTabbedPane is still giving you frustrations. I don't currently
use it, so I can't comment on the dynamic inclusion you are attempting.
Best of luck,
Jeff Bischoff
Kenneth L Kurz & Associates, Inc.
Jaya Saluja wrote:
Hi All,
How do I load a new page when I change tabs? I have two tabs in the
panelTabbedPane: switch and customer. I would like the appropriate page
to be loaded when I change tabs.
Thanks,
Jaya
-----Original Message-----
From: Danimal [mailto:[EMAIL PROTECTED]
Sent: Friday, August 25, 2006 1:25 PM
To: [email protected]
Subject: Re: tabChangedListener question
UPDATE: tabCahngeListener is working. I rebooted my machine and the code
is
breaking in the processTabChange method. Seems like it is the IDE ("bad
Netbeans! bad!"). In any case, the code I have below is not rerendering
the
subviews I have in the panelTabbedPane. I am moving the subviews outside
the
panelTabbedPane to see if this will work. This is pretty kludgey as I
was
hoping to create tabPanes with the appropriate code inside to prevent
from
having to pull all the data everytime a tab is selected. If my methods
or
assumptions are incorrect and there is a better way, please feel free to
let
me know.
panelTabbedPane has some short comings. Don't get me wrong, I love
tomahawk
and it is great, but it would be nice to have better examples as I
imagine
other people try to do the same thing with tabs by dynamically including
content depending on which tab is selected. There really aren't any
examples
that illustrate this behavior that I found at least.
Regards,
Danimal
Danimal wrote:
This is the code I am using in my JSF code:
<t:panelTabbedPane bgcolor="#CCFFFF" serverSideTabSwitch="true">
<t:tabChangeListener
type="ffldraft.presentation.rank.RankingsProfileWrapper"/>
<t:panelTab id="summarytab" label="summary" rendered="true">
</t:panelTab>
<t:panelTab id="qbtab" label="#{msgs['positions.qb']}"
rendered="true">
</t:panelTab>
<t:panelTab id="rbtab" label="#{msgs['positions.rb']}"
rendered="true">
</t:panelTab>
<t:panelTab id="wrtab" label="#{msgs['positions.wr']}"
rendered="true">
</t:panelTab>
<t:panelTab id="ktab" label="#{msgs['positions.k']}"
rendered="true">
</t:panelTab>
<t:panelTab id="deftab" label="#{msgs['positions.def']}"
rendered="true">
</t:panelTab>
<f:subview id="positionview"
rendered="#{profile.positionVisible}">
<jsp:include page="/WEB-INF/jsp/rankposition.jspf"/>
</f:subview>
<f:subview id="summaryview" rendered="#{not
profile.positionVisible}">
<jsp:include page="/WEB-INF/jsp/ranksummary.jspf"/>
</f:subview>
</t:panelTabbedPane>
The listener calls a class that implements TabChangeListener that is
also
my backing bean. I am not under the impression that it is calling the
instance of my backing bean in the session(which would be a bonus),
but
this method should be called when a new tab is selected:
public void processTabChange(TabChangeEvent event) throws
AbortProcessingException {
int index = event.getNewTabIndex();
positionVisible = true;
}
So, the tabs are being rendered fine and the summaryview is being
rendered
and positionview is not rendered as both should by default. However,
it
seems like nothing is happening when a new tab is selected. I put my
tool
in debug mode, I am using NetBeans 5.5 Beta 2, with breakpoints on
both
lines in the method and the IDE is not breaking in the method. This
makes
me suspect that the method is not being called, though it could be the
IDE.
Any ideas on what I am missing with my implementation? Is it better to
use
selectedIndex of panelTabbedPane and bind this to the backing bean?
The
page with the example says this is only used to set the default index.
Does it also set the selectedIndex when a new tab is selected? Here is
the
text from the example page at
http://myfaces.apache.org/tomahawk/tabbedPane.html, "selectedIndex -
Index
of tab that is selected by default".
Thank you for any help.
Regards,
Danimal