|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Composite
com.google.gwt.user.client.ui.TabBar
A horizontal bar of folder-style tabs, most commonly used as part of a
TabPanel.
public class TabBarExample implements EntryPoint {
public void onModuleLoad() {
// Create a tab bar with three items.
TabBar bar = new TabBar();
bar.addTab("foo");
bar.addTab("bar");
bar.addTab("baz");
// Hook up a tab listener to do something when the user selects a tab.
bar.addTabListener(new TabListener() {
public void onTabSelected(SourcesTabEvents sender, int tabIndex) {
// Let the user know what they just did.
Window.alert("You clicked tab " + tabIndex);
}
public boolean onBeforeTabSelected(SourcesTabEvents sender,
int tabIndex) {
// Just for fun, let's disallow selection of 'bar'.
if (tabIndex == 1)
return false;
return true;
}
});
// Add it to the root panel.
RootPanel.get().add(bar);
}
}
| Constructor Summary | |
TabBar()
Creates an empty tab bar. |
|
| Method Summary | |
void |
addTab(java.lang.String text)
Adds a new tab with the specified text. |
void |
addTab(java.lang.String text,
boolean asHTML)
Adds a new tab with the specified text. |
void |
addTabListener(TabListener listener)
Adds a listener interface to receive click events. |
int |
getSelectedTab()
Gets the tab that is currently selected. |
int |
getTabCount()
Gets the number of tabs present. |
java.lang.String |
getTabHTML(int index)
Gets the specified tab's HTML. |
void |
insertTab(java.lang.String text,
boolean asHTML,
int beforeIndex)
Inserts a new tab at the specified index. |
void |
insertTab(java.lang.String text,
int beforeIndex)
Inserts a new tab at the specified index. |
void |
onClick(Widget sender)
Fired when the user clicks on a widget. |
void |
removeTab(int index)
Removes the tab at the specified index. |
void |
removeTabListener(TabListener listener)
Removes a previously added listener interface. |
boolean |
selectTab(int index)
Programmatically selects the specified tab. |
| Methods inherited from class com.google.gwt.user.client.ui.Composite |
getElement, initWidget, onAttach, onDetach, setWidget |
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
getParent, isAttached, onBrowserEvent, onLoad, removeFromParent |
| Methods inherited from class com.google.gwt.user.client.ui.UIObject |
addStyleName, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getTitle, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public TabBar()
| Method Detail |
public void addTab(java.lang.String text)
text - the new tab's text
public void addTab(java.lang.String text,
boolean asHTML)
text - the new tab's textasHTML - true to treat the specified text as htmlpublic void addTabListener(TabListener listener)
SourcesTabEvents
addTabListener in interface SourcesTabEventslistener - the listener interface to addpublic int getSelectedTab()
public int getTabCount()
public java.lang.String getTabHTML(int index)
index - the index of the tab whose HTML is to be retrieved
public void insertTab(java.lang.String text,
boolean asHTML,
int beforeIndex)
text - the new tab's textasHTML - true to treat the specified text as HTMLbeforeIndex - the index before which this tab will be inserted
public void insertTab(java.lang.String text,
int beforeIndex)
text - the new tab's textbeforeIndex - the index before which this tab will be insertedpublic void onClick(Widget sender)
ClickListener
onClick in interface ClickListenersender - the widget sending the event.public void removeTab(int index)
index - the index of the tab to be removedpublic void removeTabListener(TabListener listener)
SourcesTabEvents
removeTabListener in interface SourcesTabEventslistener - the listener interface to removepublic boolean selectTab(int index)
index - the index of the tab to be selected
true if successful, false if the
change is denied by the TabListener.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||