You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Edvin Syse <ed...@sysedata.no> on 2011/05/07 10:23:42 UTC
Closing a tab in a TabPane doesn't activate any of the remaining
tabs
When I close a tab in a TabPane, the TabPane-content area is left empty.
I added a listener to deal with this like so:
tabs.getTabPaneListeners().add(new TabPaneListener.Adapter() {
public void tabsRemoved(TabPane tabPane, int index,
Sequence<Component> tabs) {
if (tabPane.getTabs().getLength() > 0) {
int leftOfClosedTabIndex = Math.max(0, index - 1);
tabPane.setSelectedIndex(leftOfClosedTabIndex);
}
}
});
Is it correct that there is no such functionality or policies to choose
from in the framework? I'm not saying it's a bad thing though :)
-- Edvin
Re: Closing a tab in a TabPane doesn't activate any of the remaining
tabs
Posted by Greg Brown <gk...@verizon.net>.
Yes, the selection reverts to -1 if you remove the selected tab. It is up to your app to decide how to deal with that case.
G
On May 7, 2011, at 4:23 AM, Edvin Syse wrote:
> When I close a tab in a TabPane, the TabPane-content area is left empty. I added a listener to deal with this like so:
>
> tabs.getTabPaneListeners().add(new TabPaneListener.Adapter() {
> public void tabsRemoved(TabPane tabPane, int index, Sequence<Component> tabs) {
> if (tabPane.getTabs().getLength() > 0) {
> int leftOfClosedTabIndex = Math.max(0, index - 1);
> tabPane.setSelectedIndex(leftOfClosedTabIndex);
> }
> }
> });
>
> Is it correct that there is no such functionality or policies to choose from in the framework? I'm not saying it's a bad thing though :)
>
> -- Edvin