-
Notifications
You must be signed in to change notification settings - Fork 127
TabbedPane
TabbedPane is a well... tabbed pane like you can see in your browser or almost any text editor. TabbedPane is available since VisUI 0.7.0
Except boring features like adding, removing, inserting tabs you can do: marking tab as dirty so when user will try to close it, pane will automatically display “Do you want to save changes?” dialog. You can make a tab which user won’t be able to close. You can also allow user deselect tab, allowing that there won't be any active tab.
TabbedPane doesn't manage displaying tab content for you, you have to do it manually. This approach gives more flexibility. TabbedPane#getTable() returns ONLY table for tab switcher:
To display current content tab you have to add listener to TabbedPane and when tab was switched you have to get tab content table (tab.getContentTable()) and add it to some other table what will display tab view.
Example:
tabbedPane.addListener(new TabbedPaneAdapter(){
@Override
public void switchedTab (Tab tab) {
Table content = tab.getContentTable();
someOtherTable.clearChildren();
someOtherTable.add(content).expand().fill();
}
});
public class TestTab extends Tab {
Table content = new Table();
public TestTab () {
super(false, true); //tab is not savable, tab is closeable by user
content.add(new VisLabel("Some widget"));
//content.add(...)
}
@Override
public String getTabTitle () {
return "Test Tab";
}
@Override
public Table getContentTable () {
return content;
}
}
then to add it to pane just do:
tabbedPane.add(new TestTab());
// -- OR --
tabbedPane.insert(index, new TestTab());
See README for VisUI introduction.