com.smartgwt.client.widgets.tab

## Class Tab

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

- All Implemented Interfaces:
    HasHandlers, HasTabDeselectedHandlers, HasTabSelectedHandlers

      public class Tab
      extends RefDataClass
      implements HasTabDeselectedHandlers, HasTabSelectedHandlers

  Tab instances for use with `TabSet`. Tab instances specify the appearance (`setTitle`, `setIcon`) of the tab, and provide the tab's `pane`. See `setTabs` for further details.

- - ### Field Summary

    - ### Fields inherited from class com.smartgwt.client.core.RefDataClass

      `id`

    - ### Fields inherited from class com.smartgwt.client.core.DataClass

      `factoryCreated, factoryProperties`

    - ### Fields inherited from class com.smartgwt.client.core.JsObject

      `jsObj`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Tab()`
    `Tab(JavaScriptObject jsObj)`
    `Tab(java.lang.String title)`
    `Tab(java.lang.String title, java.lang.String icon)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `HandlerRegistration` | `addTabDeselectedHandler(TabDeselectedHandler handler)` Add a tabDeselected handler.
    `HandlerRegistration` | `addTabSelectedHandler(TabSelectedHandler handler)` Add a tabSelected handler.
    `java.lang.Boolean` | `getCanClose()` Determines whether this tab should show a close icon allowing the user to dismiss the tab by clicking on the close icon directly.
    `java.lang.Boolean` | `getCanEditTitle()` If specified, overrides the `canEditTabTitles` setting, for this one tab only.
    `java.lang.Boolean` | `getCanReorder()` If `canReorderTabs` is set to `true`, setting `canReorder` explicitly to `false` for some tab will disallow drag-reordering of this tab.
    `java.lang.String` | `getCloseIcon()` Custom src for the close icon for this tab to display if it is closeable.
    `java.lang.Integer` | `getCloseIconSize()` Size of the `closeIcon` for this tab.
    `Menu` | `getContextMenu()` Context menu to show for this object, an instance of the Menu widget.
    `java.lang.Boolean` | `getDisabled()` If specified, this tab will initially be rendered in a disabled state.
    `java.lang.String` | `getIcon()` If specified, this tab will show an icon next to the tab title.
    `java.lang.Integer` | `getIconHeight()` If `icon` is specified, this property may be used to specify a size for the icon
    `java.lang.Integer` | `getIconSize()` If `icon` is specified, this property may be used to specify a size for the icon.
    `java.lang.Integer` | `getIconWidth()` If `icon` is specified, this property may be used to specify a size for the icon
    `java.lang.String` | `getID()` Optional ID for the tab, which can later be used to reference the tab.
    `java.lang.String` | `getName()` Optional name 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.
    `java.lang.Integer` | `getPaneMargin()` Space to leave around the pane within this Tab.
    `java.lang.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.
    `java.lang.String` | `getPrompt()` Specifies the prompt to be displayed when the mouse hovers over the tab.
    `StatefulCanvas` | `getTabCanvas()` Returns the live Canvas used to represent this tab in a tabSet.
    `TabSet` | `getTabSet()`
    `java.lang.String` | `getTitle()` Specifies the title of the this tab.
    `java.lang.String` | `getTitleStyle()` A separate style for the title text.
    `int` | `getWidth()` You can specify an explicit width for the tab using this property.
    `void` | `setCanClose(boolean canClose)`
    `void` | `setCanClose(java.lang.Boolean canClose)` Determines whether this tab should show a close icon allowing the user to dismiss the tab by clicking on the close icon directly.
    `void` | `setCanEditTitle(java.lang.Boolean canEditTitle)` If specified, overrides the `canEditTabTitles` setting, for this one tab only.
    `void` | `setCanReorder(java.lang.Boolean canReorder)` If `canReorderTabs` is set to `true`, setting `canReorder` explicitly to `false` for some tab will disallow drag-reordering of this tab.
    `void` | `setCloseIcon(java.lang.String closeIcon)` Custom src for the close icon for this tab to display if it is closeable.
    `void` | `setCloseIconSize(java.lang.Integer closeIconSize)` Size of the `closeIcon` for this tab.
    `void` | `setContextMenu(Menu contextMenu)` Context menu to show for this tab.
    `void` | `setDisabled(boolean disabled)` If specified, this tab will initially be rendered in a disabled state.
    `void` | `setIcon(java.lang.String icon)` If specified, this tab will show an icon next to the tab title.
    `void` | `setIcon(java.lang.String icon, int iconSize)` If specified, this tab will show an icon next to the tab title.
    `void` | `setIcon(java.lang.String icon, int iconWidth, int iconHeight)` If specified, this tab will show an icon next to the tab title.
    `void` | `setIconHeight(java.lang.Integer iconHeight)` If `icon` is specified, this property may be used to specify a size for the icon
    `void` | `setIconSize(java.lang.Integer iconSize)` If `icon` is specified, this property may be used to specify a size for the icon.
    `void` | `setIconWidth(java.lang.Integer iconWidth)` If `icon` is specified, this property may be used to specify a size for the icon
    `void` | `setID(java.lang.String ID)` Optional ID for the tab, which can later be used to reference the tab.
    `void` | `setName(java.lang.String name)` Optional name 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(java.lang.String paneID)`
    `void` | `setPaneMargin(java.lang.Integer paneMargin)` Space to leave around the pane within this Tab.
    `void` | `setPickerTitle(java.lang.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` | `setPrompt(java.lang.String prompt)` Specifies the prompt to be displayed when the mouse hovers over the tab.
    `void` | `setTabSet(TabSet tabSet)`
    `void` | `setTitle(java.lang.String title)` Specifies the title of the this tab.
    `void` | `setTitleStyle(java.lang.String titleStyle)` Provide a separate style for the title text.
    `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, internalSetID`

    - ### Methods inherited from class com.smartgwt.client.core.DataClass

      `applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated`

    - ### Methods inherited from class com.smartgwt.client.core.JsObject

      `equals, getJsObj, hashCode, isCreated, setJavaScriptObject, setJsObj`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.google.gwt.event.shared.HasHandlers

      `fireEvent`

- - ### Constructor Detail

    - #### Tab

          public Tab()

    - #### Tab

          public Tab(JavaScriptObject jsObj)

    - #### Tab

          public Tab(java.lang.String title)

    - #### Tab

          public Tab(java.lang.String title,
             java.lang.String icon)

  - ### Method Detail

    - #### getOrCreateRef

          public static Tab getOrCreateRef(JavaScriptObject jsObj)

    - #### setCanClose

          public void setCanClose(java.lang.Boolean canClose)

      Determines whether this tab should show a close icon allowing the user to dismiss the tab by clicking on the close icon directly. The URL for the close icon's image will be derived from `closeTabIcon` by default, but may be overridden by explicitly specifying `closeIcon`.

      If unset or null, this property is derived from `canCloseTabs`.

      Note that setting `canClose` means that `icon` cannot be used, because it's used for the `closeIcon` - see `canCloseTabs` for a workaround.

      After the TabSet has been created, you can change a tab's canClose property by calling `TabSet.setCanCloseTab()`.

      Parameters:
        `canClose` - Default value is null
      See Also:
        `com.smartgwt.client.widgets.tab.TabSet#closeClick`, Closeable Tabs Example

    - #### getCanClose

          public java.lang.Boolean getCanClose()

      Determines whether this tab should show a close icon allowing the user to dismiss the tab by clicking on the close icon directly. The URL for the close icon's image will be derived from `closeTabIcon` by default, but may be overridden by explicitly specifying `closeIcon`.

      If unset or null, this property is derived from `canCloseTabs`.

      Note that setting `canClose` means that `icon` cannot be used, because it's used for the `closeIcon` - see `canCloseTabs` for a workaround.

      After the TabSet has been created, you can change a tab's canClose property by calling `TabSet.setCanCloseTab()`.

      Returns:
        Boolean
      See Also:
        `com.smartgwt.client.widgets.tab.TabSet#closeClick`, Closeable Tabs Example

    - #### setCanEditTitle

          public void setCanEditTitle(java.lang.Boolean canEditTitle)

      If specified, overrides the `canEditTabTitles` setting, for this one tab only.

      Note that the TabSet's `titleEditEvent` must be set to a supported `TabTitleEditEvent` in order for users to be able to edit this tab's title.

      Parameters:
        `canEditTitle` - Default value is null
      See Also:
        `TabSet.setCanEditTabTitles(java.lang.Boolean)`, User-Editable Titles Example

    - #### getCanEditTitle

          public java.lang.Boolean getCanEditTitle()

      If specified, overrides the `canEditTabTitles` setting, for this one tab only.

      Note that the TabSet's `titleEditEvent` must be set to a supported `TabTitleEditEvent` in order for users to be able to edit this tab's title.

      Returns:
        Boolean
      See Also:
        `TabSet.getCanEditTabTitles()`, User-Editable Titles Example

    - #### setCanReorder

          public void setCanReorder(java.lang.Boolean canReorder)

      If `canReorderTabs` is set to `true`, setting `canReorder` explicitly to `false` for some tab will disallow drag-reordering of this tab. Has no effect if `canReorderTabs` is not true at the tabSet level.

      Note that this setting also disallows a reorder of another tab into the slot before or following this tab. This means for tabs located at the beginning or end of the tab-bar, users cannot changing the index of the tab by dropping another before or after it. However if you have a `canReorder:false` tab which is not at the beginning or end of the tab bar, users can drag reorder other tabs around it which may ultimately change its position.

      Parameters:
        `canReorder` - Default value is null
      See Also:
        `TabSet.setCanReorderTabs(java.lang.Boolean)`

    - #### getCanReorder

          public java.lang.Boolean getCanReorder()

      If `canReorderTabs` is set to `true`, setting `canReorder` explicitly to `false` for some tab will disallow drag-reordering of this tab. Has no effect if `canReorderTabs` is not true at the tabSet level.

      Note that this setting also disallows a reorder of another tab into the slot before or following this tab. This means for tabs located at the beginning or end of the tab-bar, users cannot changing the index of the tab by dropping another before or after it. However if you have a `canReorder:false` tab which is not at the beginning or end of the tab bar, users can drag reorder other tabs around it which may ultimately change its position.

      Returns:
        Boolean
      See Also:
        `TabSet.getCanReorderTabs()`

    - #### setCloseIcon

          public void setCloseIcon(java.lang.String closeIcon)

      Custom src for the close icon for this tab to display if it is closeable. See `canClose` and `canCloseTabs`.
      Parameters:
        `closeIcon` - See `SCImgURL` . Default value is null

    - #### getCloseIcon

          public java.lang.String getCloseIcon()

      Custom src for the close icon for this tab to display if it is closeable. See `canClose` and `canCloseTabs`.
      Returns:
        See `SCImgURL`

    - #### setCloseIconSize

          public void setCloseIconSize(java.lang.Integer closeIconSize)

      Size of the `closeIcon` for this tab. If unspecified the icon will be sized according to `closeTabIconSize`
      Parameters:
        `closeIconSize` - Default value is null

    - #### getCloseIconSize

          public java.lang.Integer getCloseIconSize()

      Size of the `closeIcon` for this tab. If unspecified the icon will be sized according to `closeTabIconSize`
      Returns:
        Integer

    - #### setIconHeight

          public void setIconHeight(java.lang.Integer iconHeight)

      If `icon` is specified, this property may be used to specify a size for the icon
      Parameters:
        `iconHeight` - Default value is null

    - #### getIconHeight

          public java.lang.Integer getIconHeight()

      If `icon` is specified, this property may be used to specify a size for the icon
      Returns:
        Integer

    - #### setIconSize

          public void setIconSize(java.lang.Integer iconSize)

      If `icon` is specified, this property may be used to specify a size for the icon. Per side sizing may be specified instead via `iconWidth` and `iconHeight`.
      Parameters:
        `iconSize` - Default value is 16

    - #### getIconSize

          public java.lang.Integer getIconSize()

      If `icon` is specified, this property may be used to specify a size for the icon. Per side sizing may be specified instead via `iconWidth` and `iconHeight`.
      Returns:
        Integer

    - #### setIconWidth

          public void setIconWidth(java.lang.Integer iconWidth)

      If `icon` is specified, this property may be used to specify a size for the icon
      Parameters:
        `iconWidth` - Default value is null

    - #### getIconWidth

          public java.lang.Integer getIconWidth()

      If `icon` is specified, this property may be used to specify a size for the icon
      Returns:
        Integer

    - #### setName

          public void setName(java.lang.String name)

      Optional name for the tab, which can later be used to reference the tab. APIs requiring a reference to a tab will accept the tab's name [including `TabSet.selectTab()`, `TabSet.updateTab()`, `TabSet.removeTab()`].
      This name will also be passed to the `TabSet.tabSelected()` and `TabSet.tabDeselected()` handler functions, if specified.

      This identifier is requred to be locally unique to the TabSet and cannot be used to get a global reference to the Tab. If you want a global reference, set `ID` instead.

      Parameters:
        `name` - Default value is null

    - #### getName

          public java.lang.String getName()

      Optional name for the tab, which can later be used to reference the tab. APIs requiring a reference to a tab will accept the tab's name [including `TabSet.selectTab()`, `TabSet.updateTab()`, `TabSet.removeTab()`].
      This name will also be passed to the `TabSet.tabSelected()` and `TabSet.tabDeselected()` handler functions, if specified.

      This identifier is requred to be locally unique to the TabSet and cannot be used to get a global reference to the Tab. If you want a global reference, set `ID` instead.

      Returns:
        String

    - #### setPaneMargin

          public void setPaneMargin(java.lang.Integer paneMargin)

      Space to leave around the pane within this Tab. If specified, this property takes precedence over `paneMargin`
      Parameters:
        `paneMargin` - Default value is null

    - #### getPaneMargin

          public java.lang.Integer getPaneMargin()

      Space to leave around the pane within this Tab. If specified, this property takes precedence over `paneMargin`
      Returns:
        Integer

    - #### setPickerTitle

          public void setPickerTitle(java.lang.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` - See `HTMLString` . Default value is null
      See Also:
        `TabSet.setShowTabPicker(java.lang.Boolean)`, `setTitle(java.lang.String)`

    - #### getPickerTitle

          public java.lang.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:
        See `HTMLString`
      See Also:
        `TabSet.getShowTabPicker()`, `getTitle()`

    - #### setPrompt

          public void setPrompt(java.lang.String prompt)

      Specifies the prompt to be displayed when the mouse hovers over the tab.
      Parameters:
        `prompt` - See `HTMLString` . Default value is null

    - #### getPrompt

          public java.lang.String getPrompt()

      Specifies the prompt to be displayed when the mouse hovers over the tab.
      Returns:
        See `HTMLString`

    - #### 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` - 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

    - #### addTabDeselectedHandler

          public HandlerRegistration addTabDeselectedHandler(TabDeselectedHandler handler)

      Add a tabDeselected handler.

      Optional handler to fire when a tab is deselected. Returning false will cancel the new selection, leaving this tab selected. As with `TabSet.tabSelected()` this method only fires when the tabset is drawn.

      Specified by:
        `addTabDeselectedHandler` in interface `HasTabDeselectedHandlers`
      Parameters:
        `handler` - the tabDeselected handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### addTabSelectedHandler

          public HandlerRegistration addTabSelectedHandler(TabSelectedHandler handler)

      Add a tabSelected handler.

      Optional handler to fire when a tab is selected. As with `TabSet.tabSelected()` this method only fires when the tabset is drawn.

      Specified by:
        `addTabSelectedHandler` in interface `HasTabSelectedHandlers`
      Parameters:
        `handler` - the tabSelected handler
      Returns:
        `HandlerRegistration` used to remove this handler

    - #### setID

          public void setID(java.lang.String ID)

      Optional ID for the tab, which can later be used to reference the tab. APIs requiring a reference to a tab will accept the tabs ID [including `TabSet.selectTab`, `TabSet.updateTab`, `TabSet.removeTab`].
      The ID will also be passed to the `TabSet.tabSelected` and `TabSet.tabDeselected` 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 java.lang.String getID()

      Optional ID for the tab, which can later be used to reference the tab. APIs requiring a reference to a tab will accept the tabs ID [including `TabSet.selectTab`, `TabSet.updateTab`, `TabSet.removeTab`].
      The ID will also be passed to the `TabSet.tabSelected` and `TabSet.tabDeselected` handler functions, if specified.

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

      Returns:
        String

    - #### setTitle

          public void setTitle(java.lang.String title)

      Specifies the title of the this tab. To change the title after the TabSet has been created, call `TabSet.setTabTitle`.
      Parameters:
        `title` - title Default value is null

    - #### getTitle

          public java.lang.String getTitle()

      Specifies the title of the this tab.
      Returns:
        String

    - #### setDisabled

          public void setDisabled(boolean disabled)

      If specified, this tab will initially be rendered in a disabled state.
      Parameters:
        `disabled` - disabled Default value is null

    - #### getDisabled

          public java.lang.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`, and `TabSet.disableTab` methods.
      Returns:
        Boolean

    - #### setIcon

          public void setIcon(java.lang.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
      See Also:
        Orientation Example

    - #### setIcon

          public void setIcon(java.lang.String icon,
                     int iconWidth,
                     int iconHeight)

      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
        `iconWidth` - the icon width
        `iconHeight` - the icon height
      See Also:
        Orientation Example

    - #### setIcon

          public void setIcon(java.lang.String icon,
                     int iconSize)

      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
        `iconSize` - the icon size
      See Also:
        Orientation Example

    - #### getIcon

          public java.lang.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
      See Also:
        Orientation Example

    - #### setCanClose

          public void setCanClose(boolean canClose)

    - #### setPaneID

          public void setPaneID(java.lang.String paneID)

    - #### setTitleStyle

          public void setTitleStyle(java.lang.String titleStyle)

      Provide a separate style for the title text. If set and the ImgTab is vertical, a "v" will be automatically prepended to the style name (hence "tabTitle" -> "vtabTitle").
      Parameters:
        `titleStyle` - the title style

    - #### getTitleStyle

          public java.lang.String getTitleStyle()

      A separate style for the title text. If set and the ImgTab is vertical, a "v" will be automatically prepended to the style name (hence "tabTitle" -> "vtabTitle").
      Returns:
        the title style

    - #### 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

    - #### 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

    - #### getTabSet

          public TabSet getTabSet()

    - #### setTabSet

          public void setTabSet(TabSet tabSet)

    - #### getTabCanvas

          public StatefulCanvas getTabCanvas()

      Returns the live Canvas used to represent this tab in a tabSet. Will return null if this Tab has not been added to a TabSet or if the tabset is not yet drawn.

      The underlying SmartClient class of the returned canvas depends on `#getUseSimpleTabs`. If this property is false, the returned canvas will be a `ImgTab` instance. If true the canvas will be a `com.smartgwt.client.widgets.tab.Button` instance. Note that you can make use of ImgTab APIs by using the `getJsObj()` and `create()` APIs to "cast" to the appropriate type - for example:
      `ImgTab liveTab = ImgTab.create(myTabSet.getTabCanvas(2).getJsObj());`

      Returns:
        live Canvas for this tab in a tabSet.