public SimpleTabPanelSamplePane() {
final SimpleTabPanel panel = new SimpleTabPanel(true);
panel.addTab(new TabSpec("tab1", "Tab 1", null, new Label("Tab 1 content"), true));
ScrollPanel content2 = new ScrollPanel(createContent(createVeryLongText(), "#CCFFCC"));
content2.setSize("100%", "100%");
panel.addTab("Tab 2", content2);
SimpleHorizontalSplitPanel hsp = new SimpleHorizontalSplitPanel();
hsp.setLeftWidget(new Label("Left"));
hsp.setRightWidget(new Label("Right"));
hsp.setSplitPosition("25%");
hsp.setSize("100%", "100%");
panel.addTab("Tab 3", hsp);
TabSpec tab4 = new TabSpec("tab4", "Tab 4", null, new Label("Confent for Tab 4"), false).setMenuBuilder(new MenuBuilder() {
public void build(Menu menu) {
CheckMenuItem item = new CheckMenuItem("Disable", !panel.isTabEnabled("tab4"));
item.addListener(new MenuItemSelectionListener() {
public void selectionChanged(SelectionMenuItem item) {
panel.setTabEnabled("tab4", !item.isSelected());
}
});
menu.addItem(item);
}
});
panel.addTab(tab4);
// panel.addTab("Tab 4", new Label("Content 4"));
panel.addTab("Tab 5", new Label("Content 5"));
panel.addTab("Tab 6", new Label("Content 6"));
panel.setSelectedTab("Tab 3");
panel.setWidth("100%");
// panel.setHeight("500px");
panel.setHeight("100%");
DOM.setStyleAttribute(panel.getElement(), "borderBottom", "1px solid blue");
HorizontalPanel hp = new HorizontalPanel();
SimpleButton button = new SimpleButton("Remove Tab 1", new ClickHandler() {
public void onClick(ClickEvent event) {
panel.removeTab("Tab 1");
}
});
hp.add(button);
addGap(hp, "10px");
button = new SimpleButton("Clear Tabs", new ClickHandler() {
public void onClick(ClickEvent event) {
panel.clear();
}
});
hp.add(button);
addGap(hp, "10px");
button = new SimpleButton("Add Tab...", new ClickHandler() {
public void onClick(ClickEvent event) {
String tabName = Window.prompt("Enter the tab name", "");
if (tabName != null) {
TabSpec tabSpec = new TabSpec(tabName, tabName, null, new Label("This is the content of '" + tabName + "'"), true);
panel.addTab(tabSpec);
}
}
});
hp.add(button);