public class Tab extends RefDataClass implements HasTabDeselectedHandlers, HasTabSelectedHandlers
id
factoryCreated, factoryProperties
Constructor and Description |
---|
Tab() |
Tab(com.google.gwt.core.client.JavaScriptObject jsObj) |
Tab(java.lang.String title) |
Tab(java.lang.String title,
java.lang.String icon) |
Modifier and Type | Method and Description |
---|---|
com.google.gwt.event.shared.HandlerRegistration |
addTabDeselectedHandler(TabDeselectedHandler handler)
Add a tabDeselected handler.
|
com.google.gwt.event.shared.HandlerRegistration |
addTabSelectedHandler(TabSelectedHandler handler)
Add a tabSelected handler.
|
java.lang.Boolean |
getCanAdaptWidth()
If enabled, the tab will collapse to show just its icon when showing the title would cause overflow of a containing
TabBar . |
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
TabSet.canEditTabTitles
setting, for this one tab only. |
java.lang.Boolean |
getCanReorder()
If
TabSet.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.
|
AdvancedCriteria |
getEnableWhen()
Criteria to be evaluated to determine whether this Tab should be enabled.
|
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 height
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 width
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(com.google.gwt.core.client.JavaScriptObject jsObj) |
Canvas |
getPane()
Specifies the pane associated with this tab.
|
java.lang.Integer |
getPaneMargin()
Space to leave around the pane within this Tab.
|
java.lang.String |
getPickerTitle()
If
TabSet.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 |
setCanAdaptWidth(java.lang.Boolean canAdaptWidth)
If enabled, the tab will collapse to show just its icon when showing the title would cause overflow of a containing
TabBar . |
void |
setCanClose(boolean canClose)
See
setCanClose() . |
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
TabSet.canEditTabTitles
setting, for this one tab only. |
void |
setCanReorder(java.lang.Boolean canReorder)
If
TabSet.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 |
setEnableWhen(AdvancedCriteria enableWhen)
Criteria to be evaluated to determine whether this Tab should be enabled.
|
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 height 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 width 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
TabSet.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.
|
getRef, getRef, internalSetID
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
equals, getJsObj, hashCode, isCreated, setJavaScriptObject, setJsObj
public Tab()
public Tab(com.google.gwt.core.client.JavaScriptObject jsObj)
public Tab(java.lang.String title)
public Tab(java.lang.String title, java.lang.String icon)
public static Tab getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public void setCanAdaptWidth(java.lang.Boolean canAdaptWidth)
TabBar
. While collapsed, the tab will show its title on hover, unless an
explicit hover has been specified such as by prompt
.canAdaptWidth
- New canAdaptWidth value. Default value is falseButton.setCanAdaptWidth(java.lang.Boolean)
,
Canvas.setCanAdaptWidth(java.lang.Boolean)
public java.lang.Boolean getCanAdaptWidth()
TabBar
. While collapsed, the tab will show its title on hover, unless an
explicit hover has been specified such as by prompt
.Button.getCanAdaptWidth()
,
Canvas.getCanAdaptWidth()
public java.lang.Boolean getCanClose()
TabSet.closeTabIcon
by default, but may be overridden by
explicitly specifying closeIcon
. If unset or null, this
property is derived from TabSet.canCloseTabs
.
Note
that setting canClose
means that icon
cannot be used,
because it's used for the closeIcon
- see TabSet.canCloseTabs
for a workaround.
com.smartgwt.client.widgets.tab.TabSet#closeClick
,
Closeable Tabs Examplepublic java.lang.Boolean getCanEditTitle()
TabSet.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.
TabSet.getCanEditTabTitles()
,
User-Editable Titles Examplepublic void setCanReorder(java.lang.Boolean canReorder)
TabSet.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.
canReorder
- New canReorder value. Default value is nullTabSet.setCanReorderTabs(java.lang.Boolean)
public java.lang.Boolean getCanReorder()
TabSet.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.
TabSet.getCanReorderTabs()
public java.lang.String getCloseIcon()
canClose
and TabSet.canCloseTabs
.SCImgURL
public java.lang.Integer getCloseIconSize()
closeIcon
for this tab. If unspecified the icon
will be sized according to TabSet.closeTabIconSize
public java.lang.Boolean getDisabled()
public void setEnableWhen(AdvancedCriteria enableWhen)
tab.ruleScope
changes. It works the same as Canvas.enableWhen
enableWhen
- New enableWhen value. Default value is nullRuleCriteria overview and related methods
public AdvancedCriteria getEnableWhen()
tab.ruleScope
changes. It works the same as Canvas.enableWhen
RuleCriteria overview and related methods
public java.lang.String getIcon()
NOTE: if you enable closeable tabs
, tab.icon
is used for the close
icon. TabSet.canCloseTabs
describes a workaround to
enable both a closeIcon
and a second icon to be shown.
Use TabSet.tabIconClick()
to add an event handler
specifically for clicks on the icon.
If a tab becomes
disabled
, a different icon will be loaded by adding a suffix to the image name (see Button.icon
).
You should specify a size for the icon via iconSize
or iconWidth
and iconHeight
. Without an explicitly specified
size, tabs may be drawn overlapping or with gaps the first time a page is loaded, because the icon is not cached and
therefore its size isn't known.
TabClickEvent
,
SCImgURL
,
Orientation Examplepublic java.lang.Integer getIconHeight()
icon
is specified, this property may be used to specify a height
for the icon.public java.lang.Integer getIconSize()
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
.public java.lang.Integer getIconWidth()
icon
is specified, this property may be used to specify a width
for the icon.public void setName(java.lang.String name)
TabSet.selectTab()
, TabSet.updateTab()
, TabSet.removeTab()
].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.
name
- New name value. Default value is nullTabName
public java.lang.String getName()
TabSet.selectTab()
, TabSet.updateTab()
, TabSet.removeTab()
].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.
TabName
public Canvas getPane()
TabSet.updateTab(int, com.smartgwt.client.widgets.Canvas)
public void setPaneMargin(java.lang.Integer paneMargin)
TabSet.paneMargin
paneMargin
- New paneMargin value. Default value is nullpublic java.lang.Integer getPaneMargin()
TabSet.paneMargin
public java.lang.String getPickerTitle()
TabSet.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.TabSet.getShowTabPicker()
,
getTitle()
,
HTMLString
public java.lang.String getPrompt()
HTMLString
public java.lang.String getTitle()
TabSet.setTabTitle(int, java.lang.String)
,
HTMLString
public int getWidth()
public com.google.gwt.event.shared.HandlerRegistration addTabDeselectedHandler(TabDeselectedHandler handler)
Optional handler to fire when a tab is deselected. Calling TabDeselectedEvent.cancel
will cancel the new selection, leaving this tab
selected. As with TabSet.tabSelected()
this method
only fires when the tabset is drawn.
addTabDeselectedHandler
in interface HasTabDeselectedHandlers
handler
- the tabDeselected handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addTabSelectedHandler(TabSelectedHandler handler)
Optional handler to fire when a tab is selected. As with TabSet.tabSelected()
this method only fires when the
tabset is drawn.
addTabSelectedHandler
in interface HasTabSelectedHandlers
handler
- the tabSelected handlerHandlerRegistration
used to remove this handlerpublic void setID(java.lang.String ID)
TabSet.selectTab
, TabSet.updateTab
, TabSet.removeTab
].TabSet.tabSelected
and TabSet.tabDeselected
handler functions, if specified.
Note that if you provide an ID, it must be globally unique.
ID
- ID Default value is nullpublic java.lang.String getID()
TabSet.selectTab
, TabSet.updateTab
, TabSet.removeTab
].TabSet.tabSelected
and TabSet.tabDeselected
handler functions, if specified.
Note that if you provide an ID, it must be globally unique.
public void setTitle(java.lang.String title)
TabSet.setTabTitle
.title
- title Default value is nullpublic void setDisabled(boolean disabled)
disabled
- disabled Default value is nullpublic void setIcon(java.lang.String icon)
icon
, the URL of a tabs icon will be updated to reflect disabled state.tab
, a pointer to the tab object.icon
- icon Default value is nullpublic void setIcon(java.lang.String icon, int iconWidth, int iconHeight)
icon
, the URL of a tabs icon will be updated to reflect disabled state.tab
, a pointer to the tab object.icon
- icon Default value is nulliconWidth
- the icon widthiconHeight
- the icon heightpublic void setIcon(java.lang.String icon, int iconSize)
icon
, the URL of a tabs icon will be updated to reflect disabled state.tab
, a pointer to the tab object.icon
- icon Default value is nulliconSize
- the icon sizepublic void setIconSize(java.lang.Integer iconSize)
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
.iconSize
- New iconSize value. Default value is 16public void setIconWidth(java.lang.Integer iconWidth)
icon
is specified, this property
may be used to specify a width for the icon.iconWidth
- New iconWidth value. Default value is nullpublic void setIconHeight(java.lang.Integer iconHeight)
icon
is specified, this property
may be used to specify a height for the icon.iconHeight
- New iconHeight value. Default value is nullpublic void setPickerTitle(java.lang.String pickerTitle)
TabSet.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 insteadpickerTitle
- New pickerTitle value. Default value is nullTabSet.setShowTabPicker(java.lang.Boolean)
,
setTitle(java.lang.String)
,
HTMLString
public void setWidth(int width)
width
- New width value. Default value is 100public void setPrompt(java.lang.String prompt)
prompt
- New prompt value. Default value is nullHTMLString
public void setCanEditTitle(java.lang.Boolean canEditTitle)
TabSet.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.
canEditTitle
- New canEditTitle value. Default value is nullTabSet.setCanEditTabTitles(java.lang.Boolean)
,
User-Editable Titles Examplepublic void setCanClose(java.lang.Boolean canClose)
TabSet.closeTabIcon
by
default, but may be overridden by explicitly specifying
closeIcon
.
If unset or null, this property is derived from
TabSet.canCloseTabs
.
Note that setting canClose
means that
icon
cannot be used, because it's
used for the closeIcon
- see
TabSet.canCloseTabs
for a
workaround.
canClose
- New canClose value. Default value is nullcom.smartgwt.client.widgets.tab.TabSet#closeClick
,
Closeable Tabs Examplepublic void setCanClose(boolean canClose)
setCanClose()
.canClose
- New canClose value.public void setCloseIcon(java.lang.String closeIcon)
canClose
and TabSet.canCloseTabs
.closeIcon
- New closeIcon value. Default value is nullSCImgURL
public void setCloseIconSize(java.lang.Integer closeIconSize)
closeIcon
for this
tab. If unspecified the icon will be sized according to
TabSet.closeTabIconSize
closeIconSize
- New closeIconSize value. Default value is nullpublic void setPaneID(java.lang.String paneID)
public void setTitleStyle(java.lang.String titleStyle)
titleStyle
- the title stylepublic java.lang.String getTitleStyle()
public void setPane(Canvas pane)
TabSet.updateTab(int, com.smartgwt.client.widgets.Canvas)
pane
- the tab panepublic void setContextMenu(Menu contextMenu)
contextMenu
- contextMenu Default value is nullpublic Menu getContextMenu()
public TabSet getTabSet()
public void setTabSet(TabSet tabSet)
public StatefulCanvas getTabCanvas()
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());