AdvancedTabPanel is a GWT widget that has rather similar functionality with standard TabPanel. But there are several differences:
Taking into account features and restrictions listed above you can make decision whether you need this component.
Everything you need is to create an instance and add tabs:
AdvancedTabPanel panel1 = new AdvancedTabPanel(TabPosition.LEFT); AdvancedTabPanel panel2 = new AdvancedTabPanel(TabPosition.BOTTOM); panel1.addTab(new Label("Nested Tabs"), panel2);
This sample creates two panels and adds one of them into other.
You can customize:
The sample below illustrates how do all these customizations:
BorderFactory contentbBorderFactory = new BorderFactory() { public Border create() { return new SingleBorder(); } }; BorderFactory tabBorderFactory = new BorderFactory() { public Border create() { return new RoundCornerBorder(); } }; AdvancedTabPanel panel = new AdvancedTabPanel(TabPosition.TOP, tabBorderFactory, contentbBorderFactory);
AdvancedTabPanel provides API that allows to define a custom tabs band renderer. It's not trivial to use this API but possible. The easiest way is to extends one of existing renderers:
public static class MyTabBandRenderer extends TopBandRenderer { public Widget render(AdvancedTabPanel panel) { Widget tab = super.render(panel); //do something specific return tab; } }
There is no a special method to set the custom renderer. But there is a back door. You will have to extend the TabPosition class since its constructor has protected access level and requires that the renderer is passed as a parameter:
public static class MyTabPosition extends TabPosition { public static final TabPosition CUSTOM = new MyTabPosition("custom"); protected MyTabPosition(String name) { super(name, new MyTabBandRenderer(), DockPanel.NORTH); } }
Now pass the CUSTOM tab position in the AdvancedTabPanel constructor.