net.pleso.framework.client.ui.controls.tabcontrol
Class TabBar

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by net.pleso.framework.client.ui.controls.tabcontrol.TabBar
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.SourcesTabEvents, TabItemWidgetEventListener

public class TabBar
extends com.google.gwt.user.client.ui.Composite
implements com.google.gwt.user.client.ui.SourcesTabEvents, TabItemWidgetEventListener

A horizontal bar of folder-style tabs, most commonly used as part of a TabPanel. Modified for "Close tab" button functionality.

CSS Style Rules

Example


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(com.google.gwt.user.client.ui.TabListener listener)
           
 void clickCloseButton(TabItemWidget item)
          Calls when user click "close" button
 void clickLabel(TabItemWidget item)
          Calls when user click label with caption
 RemoveTabListener getRemoveTabListener()
           
 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 removeTab(int index)
          Removes the tab at the specified index.
 void removeTabListener(com.google.gwt.user.client.ui.TabListener listener)
           
 boolean selectTab(int index)
          Programmatically selects the specified tab.
 void setRemoveTabListener(RemoveTabListener removeTabListener)
          Sets RemoveTabListener.
 boolean setTabHTML(int index, java.lang.String text)
           
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getElement
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onBrowserEvent, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getTitle, isVisible, isVisible, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TabBar

public TabBar()
Creates an empty tab bar.

Method Detail

addTab

public void addTab(java.lang.String text)
Adds a new tab with the specified text.

Parameters:
text - the new tab's text

addTab

public void addTab(java.lang.String text,
                   boolean asHTML)
Adds a new tab with the specified text.

Parameters:
text - the new tab's text
asHTML - true to treat the specified text as html

addTabListener

public void addTabListener(com.google.gwt.user.client.ui.TabListener listener)
Specified by:
addTabListener in interface com.google.gwt.user.client.ui.SourcesTabEvents

getSelectedTab

public int getSelectedTab()
Gets the tab that is currently selected.

Returns:
the selected tab

getTabCount

public int getTabCount()
Gets the number of tabs present.

Returns:
the tab count

getTabHTML

public java.lang.String getTabHTML(int index)
Gets the specified tab's HTML.

Parameters:
index - the index of the tab whose HTML is to be retrieved
Returns:
the tab's HTML

setTabHTML

public boolean setTabHTML(int index,
                          java.lang.String text)

insertTab

public void insertTab(java.lang.String text,
                      boolean asHTML,
                      int beforeIndex)
Inserts a new tab at the specified index.

Parameters:
text - the new tab's text
asHTML - true to treat the specified text as HTML
beforeIndex - the index before which this tab will be inserted

insertTab

public void insertTab(java.lang.String text,
                      int beforeIndex)
Inserts a new tab at the specified index.

Parameters:
text - the new tab's text
beforeIndex - the index before which this tab will be inserted

removeTab

public void removeTab(int index)
Removes the tab at the specified index.

Parameters:
index - the index of the tab to be removed

removeTabListener

public void removeTabListener(com.google.gwt.user.client.ui.TabListener listener)
Specified by:
removeTabListener in interface com.google.gwt.user.client.ui.SourcesTabEvents

selectTab

public boolean selectTab(int index)
Programmatically selects the specified tab. Use index -1 to specify that no tab should be selected.

Parameters:
index - the index of the tab to be selected.
Returns:
true if successful, false if the change is denied by the TabListener.

getRemoveTabListener

public RemoveTabListener getRemoveTabListener()
Returns:
a RemoveTabListener

setRemoveTabListener

public void setRemoveTabListener(RemoveTabListener removeTabListener)
Sets RemoveTabListener.

Parameters:
removeTabListener -

clickCloseButton

public void clickCloseButton(TabItemWidget item)
Description copied from interface: TabItemWidgetEventListener
Calls when user click "close" button

Specified by:
clickCloseButton in interface TabItemWidgetEventListener
Parameters:
item - TabItemWidget container of this "close" button

clickLabel

public void clickLabel(TabItemWidget item)
Description copied from interface: TabItemWidgetEventListener
Calls when user click label with caption

Specified by:
clickLabel in interface TabItemWidgetEventListener
Parameters:
item - TabItemWidget container of this label


Copyright © 2006-2007 pleso.net crew All Rights Reserved.