Class TabSheet
-
- All Implemented Interfaces:
ContextClickEvent.ContextClickNotifier
,FieldEvents.BlurNotifier
,FieldEvents.FocusNotifier
,MethodEventSource
,ClientConnector
,Sizeable
,Connector
,Component
,Component.Focusable
,ComponentContainer
,HasComponents
,HasComponents.ComponentAttachDetachNotifier
,SelectiveRenderer
,Serializable
,Iterable<Component>
- Direct Known Subclasses:
Accordion
public class TabSheet extends AbstractComponentContainer implements Component.Focusable, FieldEvents.FocusNotifier, FieldEvents.BlurNotifier, SelectiveRenderer
TabSheet component. Tabs are typically identified by the component contained on the tab (seeComponentContainer
), and tab metadata (including caption, icon, visibility, enabledness, closability etc.) is kept in separateTabSheet.Tab
instances. Tabs added withaddComponent(Component)
get the caption and the icon of the component at the time when the component is created, and these are not automatically updated after tab creation. A tab sheet can have multiple tab selection listeners and one tab close handler (TabSheet.CloseHandler
), which by default removes the tab from the TabSheet. TheTabSheet
can be styled with the .v-tabsheet, .v-tabsheet-tabs and .v-tabsheet-content styles. Themes may also have pre-defined variations of the tab sheet presentation, such asReindeer.TABSHEET_BORDERLESS
,Runo.TABSHEET_SMALL
and several other styles inReindeer
. The current implementation does not load the tabs to the UI before the first time they are shown, but this may change in future releases.- Since:
- 3.0
- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TabSheet.CloseHandler
CloseHandler is used to process tab closing events.static class
TabSheet.SelectedTabChangeEvent
Selected tab change event.static interface
TabSheet.SelectedTabChangeListener
Selected tab change event listener.static interface
TabSheet.Tab
Tab meta-data for a component in aTabSheet
.protected class
TabSheet.TabsheetServerRpcImpl
Client to server RPC implementation for TabSheet.class
TabSheet.TabSheetTabImpl
TabSheet's implementation ofTabSheet.Tab
- tab metadata.-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
-
Nested classes/interfaces inherited from interface com.vaadin.ui.HasComponents
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
-
Field Summary
-
Fields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXT
-
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addBlurListener(FieldEvents.BlurListener listener)
Adds aBlurListener
to the Component which gets fired when aField
loses keyboard focus.void
addComponent(Component c)
Adds a new tab into TabSheet.void
addFocusListener(FieldEvents.FocusListener listener)
Adds aFocusListener
to the Component which gets fired when aField
receives keyboard focus.void
addListener(FieldEvents.BlurListener listener)
Deprecated.As of 7.0, replaced byaddBlurListener(BlurListener)
void
addListener(FieldEvents.FocusListener listener)
Deprecated.As of 7.0, replaced byaddFocusListener(FocusListener)
void
addListener(TabSheet.SelectedTabChangeListener listener)
Deprecated.As of 7.0, replaced byaddSelectedTabChangeListener(SelectedTabChangeListener)
void
addSelectedTabChangeListener(TabSheet.SelectedTabChangeListener listener)
Adds a tab selection listenerTabSheet.Tab
addTab(Component c)
Adds a new tab into TabSheet.TabSheet.Tab
addTab(Component component, int position)
Adds a new tab into TabSheet.TabSheet.Tab
addTab(Component c, String caption)
Adds a new tab into TabSheet.TabSheet.Tab
addTab(Component c, String caption, Resource icon)
Adds a new tab into TabSheet.TabSheet.Tab
addTab(Component tabComponent, String caption, Resource icon, int position)
Adds a new tab into TabSheet.boolean
areTabsHidden()
Deprecated.as of 7.5, useisTabsVisible()
insteadprotected void
fireSelectedTabChange()
Sends an event that the currently selected tab has changed.void
focus()
Sets the focus for this component if the component isComponent.Focusable
.int
getComponentCount()
Gets the number of contained components (tabs).protected Collection<String>
getCustomAttributes()
Returns a collection of attributes that should not be handled by the basic implementation of theAbstractComponent.readDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)
andAbstractComponent.writeDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)
methods.Component
getSelectedTab()
Gets the selected tab content component.protected TabsheetState
getState()
Returns the shared state bean with information to be sent from the server to the client.protected TabsheetState
getState(boolean markAsDirty)
Returns the shared state for this connector.TabSheet.Tab
getTab(int position)
Returns theTabSheet.Tab
(metadata) for a component.TabSheet.Tab
getTab(Component c)
Returns theTabSheet.Tab
(metadata) for a component.int
getTabIndex()
Gets the tabulator index of theFocusable
component.int
getTabPosition(TabSheet.Tab tab)
Gets the position of the tabvoid
hideTabs(boolean tabsHidden)
Deprecated.as of 7.5, usesetTabsVisible(boolean)
insteadboolean
isRendered(Component childComponent)
Checks if the child component should be rendered (sent to the client side).boolean
isTabCaptionsAsHtml()
Checks whether HTML is allowed in the tab captions.boolean
isTabsVisible()
Checks if the tab selection part should be shown in the UIIterator<Component>
iterator()
Gets the component container iterator for going through all the components (tab contents).void
moveComponentsFrom(ComponentContainer source)
Moves all components from another container to this container.void
readDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Reads the component state from the given design.void
removeBlurListener(FieldEvents.BlurListener listener)
Removes aBlurListener
from the Component.void
removeComponent(Component component)
Removes a component and its corresponding tab.void
removeFocusListener(FieldEvents.FocusListener listener)
Removes aFocusListener
from the Component.void
removeListener(FieldEvents.BlurListener listener)
Deprecated.As of 7.0, replaced byremoveBlurListener(BlurListener)
void
removeListener(FieldEvents.FocusListener listener)
Deprecated.As of 7.0, replaced byremoveFocusListener(FocusListener)
void
removeListener(TabSheet.SelectedTabChangeListener listener)
Deprecated.As of 7.0, replaced byremoveSelectedTabChangeListener(SelectedTabChangeListener)
void
removeSelectedTabChangeListener(TabSheet.SelectedTabChangeListener listener)
Removes a tab selection listenervoid
removeTab(TabSheet.Tab tab)
Removes aTabSheet.Tab
and the component associated with it, as previously added withaddTab(Component)
,addTab(Component, String, Resource)
oraddComponent(Component)
.void
replaceComponent(Component oldComponent, Component newComponent)
Replaces a component (tab content) with another.protected int
selectedTabIndexAfterTabRemove(int removedTabIndex)
Called when a selected tab is removed to specify the new tab to select.void
setCloseHandler(TabSheet.CloseHandler handler)
Provide a customTabSheet.CloseHandler
for this TabSheet if you wish to perform some additional tasks when a user clicks on a tabs close button, e.g.void
setSelectedTab(int position)
Sets the selected tab, identified by its position.void
setSelectedTab(Component c)
Sets the selected tab.void
setSelectedTab(TabSheet.Tab tab)
Sets the selected tab.void
setTabCaptionsAsHtml(boolean tabCaptionsAsHtml)
Sets whether HTML is allowed in the tab captions.void
setTabIndex(int tabIndex)
Sets the tabulator index of theFocusable
component.void
setTabPosition(TabSheet.Tab tab, int position)
Sets the position of the tab.void
setTabsVisible(boolean tabsVisible)
Sets whether the tab selection part should be shown in the UIvoid
writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Writes the component state to the given design.-
Methods inherited from class com.vaadin.ui.AbstractComponentContainer
addComponentAttachListener, addComponentDetachListener, addComponents, addListener, addListener, fireComponentAttachEvent, fireComponentDetachEvent, getComponentIterator, removeAllComponents, removeComponentAttachListener, removeComponentDetachListener, removeListener, removeListener, setHeight, setWidth
-
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isImmediate, isOrHasAncestor, isReadOnly, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setLocale, setParent, setPrimaryStyleName, setReadOnly, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidthUndefined
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined
-
-
-
-
Constructor Detail
-
TabSheet
public TabSheet()
Constructs a new TabSheet. A TabSheet is immediate by default, and the default close handler removes the tab being closed.
-
TabSheet
public TabSheet(Component... components)
Constructs a new TabSheet containing the given components.- Parameters:
components
- The components to add to the tab sheet. Each component will be added to a separate tab.
-
-
Method Detail
-
iterator
public Iterator<Component> iterator()
Gets the component container iterator for going through all the components (tab contents).- Specified by:
iterator
in interfaceHasComponents
- Specified by:
iterator
in interfaceIterable<Component>
- Returns:
- the unmodifiable Iterator of the tab content components
-
getComponentCount
public int getComponentCount()
Gets the number of contained components (tabs). Consistent with the iterator returned byAbstractComponentContainer.getComponentIterator()
.- Specified by:
getComponentCount
in interfaceComponentContainer
- Returns:
- the number of contained components
-
removeComponent
public void removeComponent(Component component)
Removes a component and its corresponding tab. If the tab was selected, the first eligible (visible and enabled) remaining tab is selected.- Specified by:
removeComponent
in interfaceComponentContainer
- Overrides:
removeComponent
in classAbstractComponentContainer
- Parameters:
component
- the component to be removed.- See Also:
ComponentContainer.removeComponent(Component)
-
selectedTabIndexAfterTabRemove
protected int selectedTabIndexAfterTabRemove(int removedTabIndex)
Called when a selected tab is removed to specify the new tab to select. Can be overridden to provide another algorithm that calculates the new selection. Current implementation will choose the first enabled tab to the right of the removed tab if it's not the last one, otherwise will choose the closer enabled tab to the left.- Parameters:
removedTabIndex
- the index of the selected tab which was just remove.- Returns:
- the index of the tab to be selected or -1 if there are no more enabled tabs to select.
- Since:
- 7.4
-
removeTab
public void removeTab(TabSheet.Tab tab)
Removes aTabSheet.Tab
and the component associated with it, as previously added withaddTab(Component)
,addTab(Component, String, Resource)
oraddComponent(Component)
.If the tab was selected, the first eligible (visible and enabled) remaining tab is selected.
- Parameters:
tab
- the Tab to remove- See Also:
addTab(Component)
,addTab(Component, String, Resource)
,addComponent(Component)
,removeComponent(Component)
-
addComponent
public void addComponent(Component c)
Adds a new tab into TabSheet. Component caption and icon are copied to the tab metadata at creation time.- Specified by:
addComponent
in interfaceComponentContainer
- Overrides:
addComponent
in classAbstractComponentContainer
- Parameters:
c
- the component to be added.- See Also:
addTab(Component)
-
addTab
public TabSheet.Tab addTab(Component c, String caption)
Adds a new tab into TabSheet. The first tab added to a tab sheet is automatically selected and a tab selection event is fired. If the component is already present in the tab sheet, changes its caption and returns the corresponding (old) tab, preserving other tab metadata.- Parameters:
c
- the component to be added onto tab - should not be null.caption
- the caption to be set for the component and used rendered in tab bar- Returns:
- the created
TabSheet.Tab
-
addTab
public TabSheet.Tab addTab(Component c, String caption, Resource icon)
Adds a new tab into TabSheet. The first tab added to a tab sheet is automatically selected and a tab selection event is fired. If the component is already present in the tab sheet, changes its caption and icon and returns the corresponding (old) tab, preserving other tab metadata.- Parameters:
c
- the component to be added onto tab - should not be null.caption
- the caption to be set for the component and used rendered in tab baricon
- the icon to be set for the component and used rendered in tab bar- Returns:
- the created
TabSheet.Tab
-
addTab
public TabSheet.Tab addTab(Component tabComponent, String caption, Resource icon, int position)
Adds a new tab into TabSheet. The first tab added to a tab sheet is automatically selected and a tab selection event is fired. If the component is already present in the tab sheet, changes its caption and icon and returns the corresponding (old) tab, preserving other tab metadata like the position.- Parameters:
tabComponent
- the component to be added onto tab - should not be null.caption
- the caption to be set for the component and used rendered in tab baricon
- the icon to be set for the component and used rendered in tab barposition
- the position at where the the tab should be added.- Returns:
- the created
TabSheet.Tab
-
addTab
public TabSheet.Tab addTab(Component c)
Adds a new tab into TabSheet. Component caption and icon are copied to the tab metadata at creation time. If the tab sheet already contains the component, its tab is returned.- Parameters:
c
- the component to be added onto tab - should not be null.- Returns:
- the created
TabSheet.Tab
-
addTab
public TabSheet.Tab addTab(Component component, int position)
Adds a new tab into TabSheet. Component caption and icon are copied to the tab metadata at creation time. If the tab sheet already contains the component, its tab is returned.- Parameters:
component
- the component to be added onto tab - should not be null.position
- The position where the tab should be added- Returns:
- the created
TabSheet.Tab
-
moveComponentsFrom
public void moveComponentsFrom(ComponentContainer source)
Moves all components from another container to this container. The components are removed from the other container. If the source container is aTabSheet
, component captions and icons are copied from it.- Specified by:
moveComponentsFrom
in interfaceComponentContainer
- Overrides:
moveComponentsFrom
in classAbstractComponentContainer
- Parameters:
source
- the container components are removed from.
-
areTabsHidden
@Deprecated public boolean areTabsHidden()
Deprecated.as of 7.5, useisTabsVisible()
insteadAre the tab selection parts ("tabs") hidden.- Returns:
- true if the tabs are hidden in the UI
-
hideTabs
@Deprecated public void hideTabs(boolean tabsHidden)
Deprecated.as of 7.5, usesetTabsVisible(boolean)
insteadHides or shows the tab selection parts ("tabs").- Parameters:
tabsHidden
- true if the tabs should be hidden
-
setTabsVisible
public void setTabsVisible(boolean tabsVisible)
Sets whether the tab selection part should be shown in the UI- Parameters:
tabsVisible
- true if the tabs should be shown in the UI, false otherwise- Since:
- 7.5
-
isTabsVisible
public boolean isTabsVisible()
Checks if the tab selection part should be shown in the UI- Returns:
- true if the tabs are shown in the UI, false otherwise
- Since:
- 7.5
-
getTab
public TabSheet.Tab getTab(Component c)
Returns theTabSheet.Tab
(metadata) for a component. TheTabSheet.Tab
object can be used for setting caption,icon, etc for the tab.- Parameters:
c
- the component- Returns:
- The tab instance associated with the given component, or null if the tabsheet does not contain the component.
-
getTab
public TabSheet.Tab getTab(int position)
Returns theTabSheet.Tab
(metadata) for a component. TheTabSheet.Tab
object can be used for setting caption,icon, etc for the tab.- Parameters:
position
- the position of the tab- Returns:
- The tab in the given position, or null if the position is out of bounds.
-
setSelectedTab
public void setSelectedTab(Component c)
Sets the selected tab. The tab is identified by the tab content component. Does nothing if the tabsheet doesn't contain the component.- Parameters:
c
-
-
setSelectedTab
public void setSelectedTab(TabSheet.Tab tab)
Sets the selected tab. The tab is identified by the correspondingTab
instance. Does nothing if the tabsheet doesn't contain the given tab.- Parameters:
tab
-
-
setSelectedTab
public void setSelectedTab(int position)
Sets the selected tab, identified by its position. Does nothing if the position is out of bounds.- Parameters:
position
-
-
getSelectedTab
public Component getSelectedTab()
Gets the selected tab content component.- Returns:
- the selected tab contents
-
replaceComponent
public void replaceComponent(Component oldComponent, Component newComponent)
Replaces a component (tab content) with another. This can be used to change tab contents or to rearrange tabs. The tab position and some metadata are preserved when moving components within the sameTabSheet
. If the oldComponent is not present in the tab sheet, the new one is added at the end. If the oldComponent is already in the tab sheet but the newComponent isn't, the old tab is replaced with a new one, and the caption and icon of the old one are copied to the new tab. If both old and new components are present, their positions are swapped. Replaces the component in the container with another one without changing position.This method replaces component with another one is such way that the new component overtakes the position of the old component. If the old component is not in the container, the new component is added to the container. If the both component are already in the container, their positions are swapped. Component attach and detach events should be taken care as with add and remove.
- Specified by:
replaceComponent
in interfaceComponentContainer
- Parameters:
oldComponent
- the old component that will be replaced.newComponent
- the new component to be replaced.
-
addSelectedTabChangeListener
public void addSelectedTabChangeListener(TabSheet.SelectedTabChangeListener listener)
Adds a tab selection listener- Parameters:
listener
- the Listener to be added.
-
addListener
@Deprecated public void addListener(TabSheet.SelectedTabChangeListener listener)
Deprecated.As of 7.0, replaced byaddSelectedTabChangeListener(SelectedTabChangeListener)
-
removeSelectedTabChangeListener
public void removeSelectedTabChangeListener(TabSheet.SelectedTabChangeListener listener)
Removes a tab selection listener- Parameters:
listener
- the Listener to be removed.
-
removeListener
@Deprecated public void removeListener(TabSheet.SelectedTabChangeListener listener)
Deprecated.As of 7.0, replaced byremoveSelectedTabChangeListener(SelectedTabChangeListener)
-
fireSelectedTabChange
protected void fireSelectedTabChange()
Sends an event that the currently selected tab has changed.
-
setCloseHandler
public void setCloseHandler(TabSheet.CloseHandler handler)
Provide a customTabSheet.CloseHandler
for this TabSheet if you wish to perform some additional tasks when a user clicks on a tabs close button, e.g. show a confirmation dialogue before removing the tab. To remove the tab, if you provide your own close handler, you must callremoveComponent(Component)
yourself. The default CloseHandler for TabSheet will only remove the tab.- Parameters:
handler
-
-
setTabPosition
public void setTabPosition(TabSheet.Tab tab, int position)
Sets the position of the tab.- Parameters:
tab
- The tabposition
- The new position of the tab
-
getTabPosition
public int getTabPosition(TabSheet.Tab tab)
Gets the position of the tab- Parameters:
tab
- The tab- Returns:
-
focus
public void focus()
Description copied from class:AbstractComponent
Sets the focus for this component if the component isComponent.Focusable
.- Specified by:
focus
in interfaceComponent.Focusable
- Overrides:
focus
in classAbstractComponent
- See Also:
FieldEvents
,FieldEvents.FocusEvent
,FieldEvents.FocusListener
,FieldEvents.BlurEvent
,FieldEvents.BlurListener
-
getTabIndex
public int getTabIndex()
Description copied from interface:Component.Focusable
Gets the tabulator index of theFocusable
component.- Specified by:
getTabIndex
in interfaceComponent.Focusable
- Returns:
- tab index set for the
Focusable
component - See Also:
Component.Focusable.setTabIndex(int)
-
setTabIndex
public void setTabIndex(int tabIndex)
Description copied from interface:Component.Focusable
Sets the tabulator index of theFocusable
component. The tab index property is used to specify the order in which the fields are focused when the user presses the Tab key. Components with a defined tab index are focused sequentially first, and then the components with no tab index.Form loginBox = new Form(); loginBox.setCaption("Login"); layout.addComponent(loginBox); // Create the first field which will be focused TextField username = new TextField("User name"); loginBox.addField("username", username); // Set focus to the user name username.focus(); TextField password = new TextField("Password"); loginBox.addField("password", password); Button login = new Button("Login"); loginBox.getFooter().addComponent(login); // An additional component which natural focus order would // be after the button. CheckBox remember = new CheckBox("Remember me"); loginBox.getFooter().addComponent(remember); username.setTabIndex(1); password.setTabIndex(2); remember.setTabIndex(3); // Different than natural place login.setTabIndex(4);
After all focusable user interface components are done, the browser can begin again from the component with the smallest tab index, or it can take the focus out of the page, for example, to the location bar.
If the tab index is not set (is set to zero), the default tab order is used. The order is somewhat browser-dependent, but generally follows the HTML structure of the page.
A negative value means that the component is completely removed from the tabulation order and can not be reached by pressing the Tab key at all.
- Specified by:
setTabIndex
in interfaceComponent.Focusable
- Parameters:
tabIndex
- the tab order of this component. Indexes usually start from 1. Zero means that default tab order should be used. A negative value means that the field should not be included in the tabbing sequence.- See Also:
Component.Focusable.getTabIndex()
-
addBlurListener
public void addBlurListener(FieldEvents.BlurListener listener)
Description copied from interface:FieldEvents.BlurNotifier
Adds aBlurListener
to the Component which gets fired when aField
loses keyboard focus.- Specified by:
addBlurListener
in interfaceFieldEvents.BlurNotifier
- See Also:
FieldEvents.BlurListener
-
addListener
@Deprecated public void addListener(FieldEvents.BlurListener listener)
Deprecated.As of 7.0, replaced byaddBlurListener(BlurListener)
- Specified by:
addListener
in interfaceFieldEvents.BlurNotifier
-
removeBlurListener
public void removeBlurListener(FieldEvents.BlurListener listener)
Description copied from interface:FieldEvents.BlurNotifier
Removes aBlurListener
from the Component.- Specified by:
removeBlurListener
in interfaceFieldEvents.BlurNotifier
- See Also:
FieldEvents.BlurListener
-
removeListener
@Deprecated public void removeListener(FieldEvents.BlurListener listener)
Deprecated.As of 7.0, replaced byremoveBlurListener(BlurListener)
- Specified by:
removeListener
in interfaceFieldEvents.BlurNotifier
-
addFocusListener
public void addFocusListener(FieldEvents.FocusListener listener)
Description copied from interface:FieldEvents.FocusNotifier
Adds aFocusListener
to the Component which gets fired when aField
receives keyboard focus.- Specified by:
addFocusListener
in interfaceFieldEvents.FocusNotifier
- See Also:
FieldEvents.FocusListener
-
addListener
@Deprecated public void addListener(FieldEvents.FocusListener listener)
Deprecated.As of 7.0, replaced byaddFocusListener(FocusListener)
- Specified by:
addListener
in interfaceFieldEvents.FocusNotifier
-
removeFocusListener
public void removeFocusListener(FieldEvents.FocusListener listener)
Description copied from interface:FieldEvents.FocusNotifier
Removes aFocusListener
from the Component.- Specified by:
removeFocusListener
in interfaceFieldEvents.FocusNotifier
- See Also:
FieldEvents.FocusListener
-
removeListener
@Deprecated public void removeListener(FieldEvents.FocusListener listener)
Deprecated.As of 7.0, replaced byremoveFocusListener(FocusListener)
- Specified by:
removeListener
in interfaceFieldEvents.FocusNotifier
-
isRendered
public boolean isRendered(Component childComponent)
Description copied from interface:SelectiveRenderer
Checks if the child component should be rendered (sent to the client side). This method allows hiding a child component from updates and communication to and from the client. It is mostly useful for parents which show only a limited number of their children at any given time and want to allow updates only for the visible children (e.g. TabSheet has one tab open at a time).This method can only prevent updates from reaching the client, not force child components to reach the client. If the child is set to visible, returning false will prevent the child from being sent to the client. If a child is set to invisible, this method has no effect.
- Specified by:
isRendered
in interfaceSelectiveRenderer
- Parameters:
childComponent
- The child component to check- Returns:
- true if the child component may be sent to the client, false otherwise
-
getState
protected TabsheetState getState(boolean markAsDirty)
Description copied from class:AbstractClientConnector
Returns the shared state for this connector.- Overrides:
getState
in classAbstractComponent
- Parameters:
markAsDirty
- true if the connector should automatically be marked dirty, false otherwise- Returns:
- The shared state for this connector. Never null.
- See Also:
AbstractClientConnector.getState()
-
getState
protected TabsheetState getState()
Description copied from class:AbstractComponent
Returns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().- Overrides:
getState
in classAbstractComponent
- Returns:
- updated component shared state
-
readDesign
public void readDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Description copied from interface:Component
Reads the component state from the given design.The component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
- Specified by:
readDesign
in interfaceComponent
- Overrides:
readDesign
in classAbstractComponent
- Parameters:
design
- The element to obtain the state fromdesignContext
- The DesignContext instance used for parsing the design
-
getCustomAttributes
protected Collection<String> getCustomAttributes()
Description copied from class:AbstractComponent
Returns a collection of attributes that should not be handled by the basic implementation of theAbstractComponent.readDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)
andAbstractComponent.writeDesign(org.jsoup.nodes.Element,com.vaadin.ui.declarative.DesignContext)
methods. Typically these are handled in a custom way in the overridden versions of the above methods- Overrides:
getCustomAttributes
in classAbstractComponent
- Returns:
- the collection of attributes that are not handled by the basic implementation
-
writeDesign
public void writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Description copied from interface:Component
Writes the component state to the given design.The component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
- Specified by:
writeDesign
in interfaceComponent
- Overrides:
writeDesign
in classAbstractComponent
- Parameters:
design
- The element to write the component state to. Any previous attributes or child nodes are not cleared.designContext
- The DesignContext instance used for writing the design
-
setTabCaptionsAsHtml
public void setTabCaptionsAsHtml(boolean tabCaptionsAsHtml)
Sets whether HTML is allowed in the tab captions.If set to true, the captions are rendered in the browser as HTML and the developer is responsible for ensuring no harmful HTML is used. If set to false, the content is rendered in the browser as plain text.
The default is false, i.e. render tab captions as plain text
- Parameters:
tabCaptionsAsHtml
- true if the tab captions are rendered as HTML, false if rendered as plain text- Since:
- 7.4
-
isTabCaptionsAsHtml
public boolean isTabCaptionsAsHtml()
Checks whether HTML is allowed in the tab captions.The default is false, i.e. render tab captions as plain text
- Returns:
- true if the tab captions are rendered as HTML, false if rendered as plain text
- Since:
- 7.4
-
-