com.vaadin.ui
Interface TabSheet.Tab

All Superinterfaces:
Serializable
All Known Implementing Classes:
TabSheet.TabSheetTabImpl
Enclosing class:
TabSheet

public static interface TabSheet.Tab
extends Serializable

Tab meta-data for a component in a TabSheet. The meta-data includes the tab caption, icon, visibility and enabledness, closability, description (tooltip) and an optional component error shown in the tab. Tabs are identified by the component contained on them in most cases, and the meta-data can be obtained with TabSheet.getTab(Component).


Method Summary
 String getCaption()
          Gets the caption for the tab.
 Component getComponent()
          Get the component related to the Tab
 ErrorMessage getComponentError()
          Gets the current error message shown for the tab.
 String getDescription()
          Gets the description for the tab.
 Resource getIcon()
          Gets the icon for the tab.
 String getStyleName()
          Gets the user-defined CSS style name of the tab.
 boolean isClosable()
          Returns the closability status for the tab.
 boolean isEnabled()
          Returns the enabled status for the tab.
 boolean isVisible()
          Returns the visible status for the tab.
 void setCaption(String caption)
          Sets the caption for the tab.
 void setClosable(boolean closable)
          Sets the closability status for the tab.
 void setComponentError(ErrorMessage componentError)
          Sets an error indicator to be shown in the tab.
 void setDescription(String description)
          Sets the description for the tab.
 void setEnabled(boolean enabled)
          Sets the enabled status for the tab.
 void setIcon(Resource icon)
          Sets the icon for the tab.
 void setStyleName(String styleName)
          Sets a style name for the tab.
 void setVisible(boolean visible)
          Sets the visible status for the tab.
 

Method Detail

isVisible

boolean isVisible()
Returns the visible status for the tab. An invisible tab is not shown in the tab bar and cannot be selected.

Returns:
true for visible, false for hidden

setVisible

void setVisible(boolean visible)
Sets the visible status for the tab. An invisible tab is not shown in the tab bar and cannot be selected, selection is changed automatically when there is an attempt to select an invisible tab.

Parameters:
visible - true for visible, false for hidden

isClosable

boolean isClosable()
Returns the closability status for the tab.

Returns:
true if the tab is allowed to be closed by the end user, false for not allowing closing

setClosable

void setClosable(boolean closable)
Sets the closability status for the tab. A closable tab can be closed by the user through the user interface. This also controls if a close button is shown to the user or not.

Note! Currently only supported by TabSheet, not Accordion.

Parameters:
visible - true if the end user is allowed to close the tab, false for not allowing to close. Should default to false.

isEnabled

boolean isEnabled()
Returns the enabled status for the tab. A disabled tab is shown as such in the tab bar and cannot be selected.

Returns:
true for enabled, false for disabled

setEnabled

void setEnabled(boolean enabled)
Sets the enabled status for the tab. A disabled tab is shown as such in the tab bar and cannot be selected.

Parameters:
enabled - true for enabled, false for disabled

setCaption

void setCaption(String caption)
Sets the caption for the tab.

Parameters:
caption - the caption to set

getCaption

String getCaption()
Gets the caption for the tab.


getIcon

Resource getIcon()
Gets the icon for the tab.


setIcon

void setIcon(Resource icon)
Sets the icon for the tab.

Parameters:
icon - the icon to set

getDescription

String getDescription()
Gets the description for the tab. The description can be used to briefly describe the state of the tab to the user, and is typically shown as a tooltip when hovering over the tab.

Returns:
the description for the tab

setDescription

void setDescription(String description)
Sets the description for the tab. The description can be used to briefly describe the state of the tab to the user, and is typically shown as a tooltip when hovering over the tab.

Parameters:
description - the new description string for the tab.

setComponentError

void setComponentError(ErrorMessage componentError)
Sets an error indicator to be shown in the tab. This can be used e.g. to communicate to the user that there is a problem in the contents of the tab.

Parameters:
componentError - error message or null for none
See Also:
AbstractComponent.setComponentError(ErrorMessage)

getComponentError

ErrorMessage getComponentError()
Gets the current error message shown for the tab. TODO currently not sent to the client

See Also:
AbstractComponent.setComponentError(ErrorMessage)

getComponent

Component getComponent()
Get the component related to the Tab


setStyleName

void setStyleName(String styleName)
Sets a style name for the tab. The style name will be rendered as a HTML class name, which can be used in a CSS definition.
 Tab tab = tabsheet.addTab(tabContent, "Tab text");
 tab.setStyleName("mystyle");
 

The used style name will be prefixed with " v-tabsheet-tabitemcell-". For example, if you give a tab the style "mystyle", the tab will get a " v-tabsheet-tabitemcell-mystyle" style. You could then style the component with:

 .v-tabsheet-tabitemcell-mystyle {font-style: italic;}
 

This method will trigger a RepaintRequestEvent on the TabSheet to which the Tab belongs.

Parameters:
styleName - the new style to be set for tab
See Also:
getStyleName()

getStyleName

String getStyleName()
Gets the user-defined CSS style name of the tab. Built-in style names defined in Vaadin or GWT are not returned.

Returns:
the style name or of the tab
See Also:
setStyleName(String)


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.