PDA

View Full Version : Identify selected tab in plain tab Panel



jeremy_mccoy
10 Apr 2015, 7:03 AM
Hello,

I have a plainTabPanel and 2 tabs say "Tab-1" and "Tab-2". where "Tab-1" and "Tab-2" are independent views. I want to find out which tab is currently active/selected by the user. How can I achieve it?

Thanks,

Andreas Samjeske
10 Apr 2015, 8:41 AM
I think
plainTabPanel.getActiveWidget() is what you are looking for.

jeremy_mccoy
15 Apr 2015, 11:05 AM
plainTabPanel.getActiveWidget() is not working for me.

In Tab-1 I have an object of myView Class (myView.java) and myView.java extends IsWidget class.
In Tab-2 I have a Simple Container.

My specific question is how to find if the getActiveWidget() is a object of myView class(Tab-1) or an instance of Simple Container(Tab-2)

Andreas Samjeske
16 Apr 2015, 1:58 AM
plainTabPanel.getActiveWidget() is not working for me.

In Tab-1 I have an object of myView Class (myView.java) and myView.java extends IsWidget class.
In Tab-2 I have a Simple Container.

My specific question is how to find if the getActiveWidget() is a object of myView class(Tab-1) or an instance of Simple Container(Tab-2)

There you go. ;)
I had a similar issue. Solved it by setting id on my widgets.

someWidget.getElement().setId(itemId);

Then you can ask activeWidget for its id:

tabPanel.getActiveWidget().getElement().getId();