com.vaadin.ui.
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:
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 (see
ComponentContainer
), 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. 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:
-
-
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 a
TabSheet
.protected class
TabSheet.TabsheetServerRpcImpl
Client to server RPC implementation for TabSheet.
class
TabSheet.TabSheetTabImpl
TabSheet's implementation of
TabSheet.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 Modifier and Type Field Description protected KeyMapper<Component>
keyMapper
Mapper between server-side component instances (tab contents) and keys given to the client that identify tabs.
-
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 Modifier and Type Method Description Registration
addBlurListener(FieldEvents.BlurListener listener)
Adds a
BlurListener
to the Component which gets fired when aField
loses keyboard focus.void
addComponent(Component c)
Adds a new tab into TabSheet.
Registration
addFocusListener(FieldEvents.FocusListener listener)
Adds a
FocusListener
to the Component which gets fired when aField
receives keyboard focus.Registration
addSelectedTabChangeListener(TabSheet.SelectedTabChangeListener listener)
Adds a tab selection listener.
TabSheet.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()
Deprecated.
usefireSelectedTabChange(boolean)
to indicate the origin of the eventprotected void
fireSelectedTabChange(boolean userOriginated)
Sends an event that the currently selected tab has changed.
void
focus()
Sets the focus for this component if the component is
Component.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 the
AbstractComponent.readDesign(Element, DesignContext)
andAbstractComponent.writeDesign(Element, 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 index)
Returns the
TabSheet.Tab
(metadata) with the given index.TabSheet.Tab
getTab(Component c)
Returns the
TabSheet.Tab
(metadata) for a component.int
getTabIndex()
Gets the tabulator index of the
Focusable
component.int
getTabPosition(TabSheet.Tab tab)
Gets the position of the tab.
void
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 UI.
Iterator<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
removeComponent(Component component)
Removes a component and its corresponding tab.
void
removeSelectedTabChangeListener(TabSheet.SelectedTabChangeListener listener)
Deprecated.
As of 8.0, replaced byRegistration.remove()
in the registration object returned fromremoveSelectedTabChangeListener(SelectedTabChangeListener)
.void
removeTab(TabSheet.Tab tab)
Removes a
TabSheet.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 custom
TabSheet.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 index)
Sets the selected tab, identified by its index.
void
setSelectedTab(Component component)
Sets the selected tab.
void
setSelectedTab(Component component, boolean userOriginated)
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 the
Focusable
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 UI.
void
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, fireComponentAttachEvent, fireComponentDetachEvent, getComponentIterator, removeAllComponents, removeComponentAttachListener, removeComponentDetachListener, 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, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidthFull, setWidthUndefined
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, 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, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
-
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, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull, 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 by
AbstractComponentContainer.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:
-
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 a
TabSheet.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 removeSee 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
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 barReturns:
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 barReturns:
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 addedReturns:
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 a
TabSheet
, 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 otherwiseSince:
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 the
TabSheet.Tab
(metadata) for a component. TheTabSheet.Tab
object can be used for setting caption,icon, etc for the tab.Parameters:
c
- the componentReturns:
The tab instance associated with the given component, or null if the tabsheet does not contain the component.
-
getTab
public TabSheet.Tab getTab(int index)
Returns the
TabSheet.Tab
(metadata) with the given index. TheTabSheet.Tab
object can be used for setting caption,icon, etc for the tab.Parameters:
index
- the index of the tabReturns:
The tab with the given index, or null if the index is out of bounds.
-
setSelectedTab
public void setSelectedTab(Component component)
Sets the selected tab. The tab is identified by the tab content component. Does nothing if the tabsheet doesn't contain the component.
Parameters:
component
- the component of the tab to select
-
setSelectedTab
public void setSelectedTab(Component component, boolean userOriginated)
Sets the selected tab. The tab is identified by the tab content component. Does nothing if the tabsheet doesn't contain the component.
Parameters:
component
- the component of the tab to selectuserOriginated
-true
if the event originates from the client side,false
otherwiseSince:
8.1
-
setSelectedTab
public void setSelectedTab(TabSheet.Tab tab)
Sets the selected tab. The tab is identified by the corresponding
Tab
instance. Does nothing if the tabsheet doesn't contain the given tab.Parameters:
tab
- the tab to select
-
setSelectedTab
public void setSelectedTab(int index)
Sets the selected tab, identified by its index. Does nothing if the position is out of bounds.
Parameters:
index
- the index of the tab to select
-
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 same
TabSheet
. 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 Registration addSelectedTabChangeListener(TabSheet.SelectedTabChangeListener listener)
Adds a tab selection listener.
Parameters:
listener
- the Listener to be added, not nullReturns:
a registration object for removing the listener
Since:
8.0
See Also:
-
removeSelectedTabChangeListener
@Deprecated public void removeSelectedTabChangeListener(TabSheet.SelectedTabChangeListener listener)
Deprecated.As of 8.0, replaced byRegistration.remove()
in the registration object returned fromremoveSelectedTabChangeListener(SelectedTabChangeListener)
.Removes a tab selection listener.
Parameters:
listener
- the Listener to be removed.
-
fireSelectedTabChange
@Deprecated protected void fireSelectedTabChange()
Deprecated.usefireSelectedTabChange(boolean)
to indicate the origin of the eventSends an event originating from the server, telling that the currently selected tab has changed.
-
fireSelectedTabChange
protected void fireSelectedTabChange(boolean userOriginated)
Sends an event that the currently selected tab has changed.
Parameters:
userOriginated
-true
if the event originates from the client side,false
otherwiseSince:
8.1
-
setCloseHandler
public void setCloseHandler(TabSheet.CloseHandler handler)
Provide a custom
TabSheet.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
- the close handler that should be used
-
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 tabReturns:
the index of the given tab, or -1 if there is no such tab in this tabsheet
-
focus
public void focus()
Description copied from class:
AbstractComponent
Sets the focus for this component if the component is
Component.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 the
Focusable
component.Specified by:
getTabIndex
in interfaceComponent.Focusable
Returns:
tab index set for the
Focusable
componentSee Also:
-
setTabIndex
public void setTabIndex(int tabIndex)
Description copied from interface:
Component.Focusable
Sets the tabulator index of the
Focusable
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:
-
addBlurListener
public Registration addBlurListener(FieldEvents.BlurListener listener)
Description copied from interface:
FieldEvents.BlurNotifier
Adds a
BlurListener
to the Component which gets fired when aField
loses keyboard focus.Specified by:
addBlurListener
in interfaceFieldEvents.BlurNotifier
Parameters:
listener
- the blur listener to add, not nullReturns:
a registration object for removing the listener
See Also:
-
addFocusListener
public Registration addFocusListener(FieldEvents.FocusListener listener)
Description copied from interface:
FieldEvents.FocusNotifier
Adds a
FocusListener
to the Component which gets fired when aField
receives keyboard focus.Specified by:
addFocusListener
in interfaceFieldEvents.FocusNotifier
Parameters:
listener
- the focus listener to add, not nullReturns:
a registration object for removing the listener
See Also:
-
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 checkReturns:
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 classAbstractComponentContainer
Parameters:
markAsDirty
- true if the connector should automatically be marked dirty, false otherwiseReturns:
The shared state for this connector. Never null.
See Also:
-
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 classAbstractComponentContainer
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 the
AbstractComponent.readDesign(Element, DesignContext)
andAbstractComponent.writeDesign(Element, DesignContext)
methods. Typically these are handled in a custom way in the overridden versions of the above methodsOverrides:
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 textSince:
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
-
-