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.Tabinstances. 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. TheTabSheetcan 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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceTabSheet.CloseHandlerCloseHandler is used to process tab closing events.static classTabSheet.SelectedTabChangeEventSelected tab change event.static interfaceTabSheet.SelectedTabChangeListenerSelected tab change event listener.static interfaceTabSheet.TabTab meta-data for a component in aTabSheet.protected classTabSheet.TabsheetServerRpcImplClient to server RPC implementation for TabSheet.classTabSheet.TabSheetTabImplTabSheet'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 Modifier and Type Field Description protected KeyMapper<Component>keyMapperMapper 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 Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RegistrationaddBlurListener(FieldEvents.BlurListener listener)Adds aBlurListenerto the Component which gets fired when aFieldloses keyboard focus.voidaddComponent(Component c)Adds a new tab into TabSheet.RegistrationaddFocusListener(FieldEvents.FocusListener listener)Adds aFocusListenerto the Component which gets fired when aFieldreceives keyboard focus.RegistrationaddSelectedTabChangeListener(TabSheet.SelectedTabChangeListener listener)Adds a tab selection listener.TabSheet.TabaddTab(Component c)Adds a new tab into TabSheet.TabSheet.TabaddTab(Component component, int position)Adds a new tab into TabSheet.TabSheet.TabaddTab(Component c, String caption)Adds a new tab into TabSheet.TabSheet.TabaddTab(Component c, String caption, Resource icon)Adds a new tab into TabSheet.TabSheet.TabaddTab(Component tabComponent, String caption, Resource icon, int position)Adds a new tab into TabSheet.booleanareTabsHidden()Deprecated.as of 7.5, useisTabsVisible()insteadprotected voidfireSelectedTabChange()Deprecated.usefireSelectedTabChange(boolean)to indicate the origin of the eventprotected voidfireSelectedTabChange(boolean userOriginated)Sends an event that the currently selected tab has changed.voidfocus()Sets the focus for this component if the component isComponent.Focusable.intgetComponentCount()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(Element, DesignContext)andAbstractComponent.writeDesign(Element, DesignContext)methods.ComponentgetSelectedTab()Gets the selected tab content component.protected TabsheetStategetState()Returns the shared state bean with information to be sent from the server to the client.protected TabsheetStategetState(boolean markAsDirty)Returns the shared state for this connector.TabSheet.TabgetTab(int index)Returns theTabSheet.Tab(metadata) with the given index.TabSheet.TabgetTab(Component c)Returns theTabSheet.Tab(metadata) for a component.intgetTabIndex()Gets the tabulator index of theFocusablecomponent.intgetTabPosition(TabSheet.Tab tab)Gets the position of the tab.voidhideTabs(boolean tabsHidden)Deprecated.as of 7.5, usesetTabsVisible(boolean)insteadbooleanisRendered(Component childComponent)Checks if the child component should be rendered (sent to the client side).booleanisTabCaptionsAsHtml()Checks whether HTML is allowed in the tab captions.booleanisTabsVisible()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).voidmoveComponentsFrom(ComponentContainer source)Moves all components from another container to this container.voidreadDesign(org.jsoup.nodes.Element design, DesignContext designContext)Reads the component state from the given design.voidremoveComponent(Component component)Removes a component and its corresponding tab.voidremoveSelectedTabChangeListener(TabSheet.SelectedTabChangeListener listener)Deprecated.As of 8.0, replaced byRegistration.remove()in the registration object returned fromremoveSelectedTabChangeListener(SelectedTabChangeListener).voidremoveTab(TabSheet.Tab tab)Removes aTabSheet.Taband the component associated with it, as previously added withaddTab(Component),addTab(Component, String, Resource)oraddComponent(Component).voidreplaceComponent(Component oldComponent, Component newComponent)Replaces a component (tab content) with another.protected intselectedTabIndexAfterTabRemove(int removedTabIndex)Called when a selected tab is removed to specify the new tab to select.voidsetCloseHandler(TabSheet.CloseHandler handler)Provide a customTabSheet.CloseHandlerfor 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.voidsetSelectedTab(int index)Sets the selected tab, identified by its index.voidsetSelectedTab(Component component)Sets the selected tab.voidsetSelectedTab(Component component, boolean userOriginated)Sets the selected tab.voidsetSelectedTab(TabSheet.Tab tab)Sets the selected tab.voidsetTabCaptionsAsHtml(boolean tabCaptionsAsHtml)Sets whether HTML is allowed in the tab captions.voidsetTabIndex(int tabIndex)Sets the tabulator index of theFocusablecomponent.voidsetTabPosition(TabSheet.Tab tab, int position)Sets the position of the tab.voidsetTabsVisible(boolean tabsVisible)Sets whether the tab selection part should be shown in the UI.voidwriteDesign(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:
iteratorin interfaceHasComponents- Specified by:
iteratorin 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:
getComponentCountin 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:
removeComponentin interfaceComponentContainer- Overrides:
removeComponentin 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.Taband 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:
addComponentin interfaceComponentContainer- Overrides:
addComponentin 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:
moveComponentsFromin interfaceComponentContainer- Overrides:
moveComponentsFromin 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.Tabobject 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 index)
Returns theTabSheet.Tab(metadata) with the given index. TheTabSheet.Tabobject can be used for setting caption,icon, etc for the tab.- Parameters:
index- the index of the tab- Returns:
- 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-trueif the event originates from the client side,falseotherwise- Since:
- 8.1
-
setSelectedTab
public void setSelectedTab(TabSheet.Tab tab)
Sets the selected tab. The tab is identified by the correspondingTabinstance. 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 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:
replaceComponentin 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 null- Returns:
- a registration object for removing the listener
- Since:
- 8.0
- See Also:
Registration
-
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-trueif the event originates from the client side,falseotherwise- Since:
- 8.1
-
setCloseHandler
public void setCloseHandler(TabSheet.CloseHandler handler)
Provide a customTabSheet.CloseHandlerfor 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 tab- Returns:
- 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:AbstractComponentSets the focus for this component if the component isComponent.Focusable.- Specified by:
focusin interfaceComponent.Focusable- Overrides:
focusin classAbstractComponent- See Also:
FieldEvents,FieldEvents.FocusEvent,FieldEvents.FocusListener,FieldEvents.BlurEvent,FieldEvents.BlurListener
-
getTabIndex
public int getTabIndex()
Description copied from interface:Component.FocusableGets the tabulator index of theFocusablecomponent.- Specified by:
getTabIndexin interfaceComponent.Focusable- Returns:
- tab index set for the
Focusablecomponent - See Also:
Component.Focusable.setTabIndex(int)
-
setTabIndex
public void setTabIndex(int tabIndex)
Description copied from interface:Component.FocusableSets the tabulator index of theFocusablecomponent. 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:
setTabIndexin 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 Registration addBlurListener(FieldEvents.BlurListener listener)
Description copied from interface:FieldEvents.BlurNotifierAdds aBlurListenerto the Component which gets fired when aFieldloses keyboard focus.- Specified by:
addBlurListenerin interfaceFieldEvents.BlurNotifier- Parameters:
listener- the blur listener to add, not null- Returns:
- a registration object for removing the listener
- See Also:
FieldEvents.BlurListener,Registration
-
addFocusListener
public Registration addFocusListener(FieldEvents.FocusListener listener)
Description copied from interface:FieldEvents.FocusNotifierAdds aFocusListenerto the Component which gets fired when aFieldreceives keyboard focus.- Specified by:
addFocusListenerin interfaceFieldEvents.FocusNotifier- Parameters:
listener- the focus listener to add, not null- Returns:
- a registration object for removing the listener
- See Also:
FieldEvents.FocusListener,Registration
-
isRendered
public boolean isRendered(Component childComponent)
Description copied from interface:SelectiveRendererChecks 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:
isRenderedin 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:AbstractClientConnectorReturns the shared state for this connector.- Overrides:
getStatein classAbstractComponentContainer- 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:AbstractComponentReturns 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:
getStatein classAbstractComponentContainer- Returns:
- updated component shared state
-
readDesign
public void readDesign(org.jsoup.nodes.Element design, DesignContext designContext)Description copied from interface:ComponentReads 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:
readDesignin interfaceComponent- Overrides:
readDesignin 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:AbstractComponentReturns a collection of attributes that should not be handled by the basic implementation of theAbstractComponent.readDesign(Element, DesignContext)andAbstractComponent.writeDesign(Element, DesignContext)methods. Typically these are handled in a custom way in the overridden versions of the above methods- Overrides:
getCustomAttributesin 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:ComponentWrites 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:
writeDesignin interfaceComponent- Overrides:
writeDesignin 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
-
-