com.smartgwt.client.widgets.tab
Class Tab

java.lang.Object
  extended by com.smartgwt.client.core.JsObject
      extended by com.smartgwt.client.core.DataClass
          extended by com.smartgwt.client.core.RefDataClass
              extended by com.smartgwt.client.widgets.tab.Tab

public class Tab
extends RefDataClass

Tabs are specified as objects, not class instances. For example, when developing in JavaScript, a typical initialization block for a TabSet would look like this:

 TabSet.create({
     tabs: [
      
 {title: "tab1", pane: "pane1"},
         {title: "tab2"}
     ]
 });
 
And in XML:
 <TabSet>
    <tabs>
        <Tab title="tab1" pane="pane1"/>
        <Tab
 title="tab2"/>
    </tabs>
 </TabSet>
 


Field Summary
 
Fields inherited from class com.smartgwt.client.core.JsObject
jsObj
 
Constructor Summary
Tab()
           
Tab(JavaScriptObject jsObj)
           
Tab(String title)
           
Tab(String title, String icon)
           
 
Method Summary
 Boolean getCanClose()
          Determines whether this tab should show an icon allowing the user to dismiss the tab by clicking on it directly.
 String getCloseIcon()
          Custom src for the close icon for this tab to display if it is closeable.
 Menu getContextMenu()
          Context menu to show for this object, an instance of the Menu widget.
 Boolean getDisabled()
          If specified, this tab will initially be rendered in a disabled state.
 String getIcon()
          If specified, this tab will show an icon next to the tab title.
 String getID()
          Optional ID for the tab, which can later be used to reference the tab.
static Tab getOrCreateRef(JavaScriptObject jsObj)
           
 Canvas getPane()
          The pane associated with the tab.
 String getPickerTitle()
          If showTabPicker is true for this TabSet, if set this property will determine the title of the picker menu item for this tab.
 String getTitle()
          Specifies the title of the this tab.
 int getWidth()
          You can specify an explicit width for the tab using this property.
 void setCanClose(boolean canClose)
           
 void setCanClose(Boolean canClose)
          Determines whether this tab should show an icon allowing the user to dismiss the tab by clicking on it directly.
 void setCloseIcon(String closeIcon)
          Custom src for the close icon for this tab to display if it is closeable.
 void setCloseIconSize(int closeIconSize)
          Size in pixels of the icon for closing tabs, displayed when canCloseTabs is true.
 void setContextMenu(Menu contextMenu)
          Context menu to show for this tab.
 void setDisabled(boolean disabled)
           
 void setDisabled(Boolean disabled)
          If specified, this tab will initially be rendered in a disabled state.
 void setIcon(String icon)
          If specified, this tab will show an icon next to the tab title.
 void setID(String ID)
          Optional ID for the tab, which can later be used to reference the tab.
 void setPane(Canvas pane)
          Specifies the pane associated with this tab.
 void setPaneID(String paneID)
           
 void setPickerTitle(String pickerTitle)
          If showTabPicker is true for this TabSet, if set this property will determine the title of the picker menu item for this tab.
 void setTitle(String title)
          Specifies the title of the this tab.
 void setWidth(int width)
          You can specify an explicit width for the tab using this property.
 
Methods inherited from class com.smartgwt.client.core.RefDataClass
getRef, getRef
 
Methods inherited from class com.smartgwt.client.core.DataClass
doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsObject, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, getJsObj, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute
 
Methods inherited from class com.smartgwt.client.core.JsObject
isCreated, setJsObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tab

public Tab()

Tab

public Tab(JavaScriptObject jsObj)

Tab

public Tab(String title)

Tab

public Tab(String title,
           String icon)
Method Detail

getOrCreateRef

public static Tab getOrCreateRef(JavaScriptObject jsObj)

setTitle

public void setTitle(String title)
Specifies the title of the this tab. To change the title after the TabSet has been created, call TabSet.setTabTitle(int, java.lang.String).

Parameters:
title - title Default value is null

getTitle

public String getTitle()
Specifies the title of the this tab. To change the title after the TabSet has been created, call TabSet.setTabTitle(int, java.lang.String).

Returns:
String

setPickerTitle

public void setPickerTitle(String pickerTitle)
If showTabPicker is true for this TabSet, if set this property will determine the title of the picker menu item for this tab. If unset, title will be used instead

Parameters:
pickerTitle - pickerTitle Default value is null

getPickerTitle

public String getPickerTitle()
If showTabPicker is true for this TabSet, if set this property will determine the title of the picker menu item for this tab. If unset, title will be used instead

Returns:
String

setID

public void setID(String ID)
Optional ID for the tab, which can later be used to reference the tab. APIs requiring a referenct a tab will accept the tabs ID [including TabSet.selectTab(int), TabSet.updateTab(int, com.smartgwt.client.widgets.Canvas), TabSet.removeTab(int)].
The ID will also be passed to the TabSet.addTabSelectedHandler(com.smartgwt.client.widgets.tab.events.TabSelectedHandler) and TabSet.addTabDeselectedHandler(com.smartgwt.client.widgets.tab.events.TabDeselectedHandler) handler functions, if specified.

Note that if you provide an ID, it must be globally unique.

Parameters:
ID - ID Default value is null

getID

public String getID()
Optional ID for the tab, which can later be used to reference the tab. APIs requiring a referenct a tab will accept the tabs ID [including TabSet.selectTab(int), TabSet.updateTab(int, com.smartgwt.client.widgets.Canvas), TabSet.removeTab(int)].
The ID will also be passed to the TabSet.addTabSelectedHandler(com.smartgwt.client.widgets.tab.events.TabSelectedHandler) and TabSet.addTabDeselectedHandler(com.smartgwt.client.widgets.tab.events.TabDeselectedHandler) handler functions, if specified.

Note that if you provide an ID, it must be globally unique.

Returns:
String

setWidth

public void setWidth(int width)
You can specify an explicit width for the tab using this property. Note that tabs automatically size to make room for the full title, but if you want to e.g. specify a uniform width for all tabs in a TabSet, this property enables you to do so.

Parameters:
width - width Default value is 100

getWidth

public int getWidth()
You can specify an explicit width for the tab using this property. Note that tabs automatically size to make room for the full title, but if you want to e.g. specify a uniform width for all tabs in a TabSet, this property enables you to do so.

Returns:
int

setDisabled

public void setDisabled(Boolean disabled)
If specified, this tab will initially be rendered in a disabled state. To enable or disable tabs on the fly use the TabSet.enableTab(int), and TabSet.disableTab(int) methods.

Parameters:
disabled - disabled Default value is null

getDisabled

public Boolean getDisabled()
If specified, this tab will initially be rendered in a disabled state. To enable or disable tabs on the fly use the TabSet.enableTab(int), and TabSet.disableTab(int) methods.

Returns:
Boolean

setIcon

public void setIcon(String icon)
If specified, this tab will show an icon next to the tab title. Note that as with icon, the URL of a tabs icon will be updated to reflect disabled state.
If desired a click handler may be assigned to the icon, which will be fired when the user clicks the tab. This method takes a single parameter tab, a pointer to the tab object.

Parameters:
icon - icon Default value is null

getIcon

public String getIcon()
If specified, this tab will show an icon next to the tab title. Note that as with icon, the URL of a tabs icon will be updated to reflect disabled state.
If desired a click handler may be assigned to the icon, which will be fired when the user clicks the tab. This method takes a single parameter tab, a pointer to the tab object.

Returns:
String

setCanClose

public void setCanClose(Boolean canClose)
Determines whether this tab should show an icon allowing the user to dismiss the tab by clicking on it directly. The URL for this icon's image will be derived from closeTabIcon by default, but may be overridden by explicitly specifying closeIcon.

If unset, this property is derived from canCloseTabs

Parameters:
canClose - canClose Default value is null

getCanClose

public Boolean getCanClose()
Determines whether this tab should show an icon allowing the user to dismiss the tab by clicking on it directly. The URL for this icon's image will be derived from closeTabIcon by default, but may be overridden by explicitly specifying closeIcon.

If unset, this property is derived from canCloseTabs

Returns:
Boolean

setCloseIcon

public void setCloseIcon(String closeIcon)
Custom src for the close icon for this tab to display if it is closeable. See canClose and canCloseTabs.

Parameters:
closeIcon - closeIcon Default value is null

getCloseIcon

public String getCloseIcon()
Custom src for the close icon for this tab to display if it is closeable. See canClose and canCloseTabs.

Returns:
String

setCanClose

public void setCanClose(boolean canClose)

setDisabled

public void setDisabled(boolean disabled)

setPaneID

public void setPaneID(String paneID)

setPane

public void setPane(Canvas pane)
Specifies the pane associated with this tab. You can change the pane associated with a given tab after the TabSet has been created by calling TabSet.updateTab(int, com.smartgwt.client.widgets.Canvas)

Parameters:
pane - the tab pane

getPane

public Canvas getPane()
The pane associated with the tab.

Returns:
the tab pane

setCloseIconSize

public void setCloseIconSize(int closeIconSize)
Size in pixels of the icon for closing tabs, displayed when canCloseTabs is true.

Parameters:
closeIconSize - closeIconSize Default value is 16

setContextMenu

public void setContextMenu(Menu contextMenu)
Context menu to show for this tab.

Parameters:
contextMenu - contextMenu Default value is null

getContextMenu

public Menu getContextMenu()
Context menu to show for this object, an instance of the Menu widget.

Returns:
Menu