Well,if every tab you have is a panel you can add the listener to your panel
instead of the tabpanel.
addListener(new PanelListenerAdapter(){
public boolean doBeforeClose(Panel panel){
//do your magic here.
return true;
}
});
Hope it helps,
_____________________
Ing. Gabriel Gutiérrez
On Fri, Jun 12, 2009 at 11:39 PM, weaxler <[email protected]> wrote:
>
> Come on guys and girls.
> I cannot be the only one facing this issue?
> Non of you have encountered it??
>
> -Dan
>
> On 5 Jun., 12:34, weaxler <[email protected]> wrote:
> > Hi All,
> >
> > I have an application in which tab panels are used to display and
> > gather input data from the users.
> > In some occations we need to catch a closing event on a tab and then
> > ask the user whether he/she needs to save before close.
> > I will show you the code i have made in order to catch this event when
> > tabpanels are removed from the container holding them.
> >
> > The code in onRemove is not called everytime a tab is closed even
> > though the javadoc says:
> > Fires after any Component is removed from the container.
> > Strangely the code is run if I close a not active tab and if the tab
> > is the last tab in the container (not when the tab i close is the
> > active one).
> >
> > // hide the panel when the tab is closed
> > centerPanel.addListener(new TabPanelListenerAdapter() {
> > public boolean doBeforeTabChange(TabPanel source,
> Panel newPanel,
> > Panel oldPanel) {
> > WindowMgr.hideAll();
> > return true;
> > }
> >
> > public void onRemove(Container self, Component
> component) {
> > component.hide();
> > //TODO KILL tab upon close...see how
> _2operate panel is
> > constructed...
> > //component.destroy();
> > }
> >
> > // hide the panel when the tab is closed
> > centerPanel.addListener(new TabPanelListenerAdapter() {
> > public boolean doBeforeTabChange(TabPanel source,
> Panel newPanel,
> > Panel oldPanel) {
> > WindowMgr.hideAll();
> > return true;
> > }
> > //Expect this code to run when a tab is closed
> > public void onRemove(Container self, Component
> component) {
> >
> > }
> >
> > public void onContextMenu(TabPanel source, Panel
> tab, EventObject
> > e) {
> > showMenu(tab, e);
> > }
> > });
> > });
> >
> > Has any of you seen the same issue or what am I doing wrong here??
> > Hope for your help as this is a very important thing for our
> > application.
> > -Dan
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---