Package com.vaadin.client.ui
Class VTabsheet.Tab
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.Panel
-
- com.google.gwt.user.client.ui.SimplePanel
-
- com.vaadin.client.ui.VTabsheet.Tab
-
- All Implemented Interfaces:
com.google.gwt.event.dom.client.HasBlurHandlers,com.google.gwt.event.dom.client.HasFocusHandlers,com.google.gwt.event.dom.client.HasKeyDownHandlers,com.google.gwt.event.dom.client.HasMouseDownHandlers,com.google.gwt.event.logical.shared.HasAttachHandlers,com.google.gwt.event.shared.HasHandlers,com.google.gwt.user.client.EventListener,com.google.gwt.user.client.ui.AcceptsOneWidget,com.google.gwt.user.client.ui.HasOneWidget,com.google.gwt.user.client.ui.HasVisibility,com.google.gwt.user.client.ui.HasWidgets,com.google.gwt.user.client.ui.HasWidgets.ForIsWidget,com.google.gwt.user.client.ui.IsWidget,Iterable<com.google.gwt.user.client.ui.Widget>
- Enclosing class:
- VTabsheet
public static class VTabsheet.Tab extends com.google.gwt.user.client.ui.SimplePanel implements com.google.gwt.event.dom.client.HasFocusHandlers, com.google.gwt.event.dom.client.HasBlurHandlers, com.google.gwt.event.dom.client.HasMouseDownHandlers, com.google.gwt.event.dom.client.HasKeyDownHandlersRepresentation of a single "tab" shown in theVTabsheet.TabBar.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.gwt.event.shared.HandlerRegistrationaddBlurHandler(com.google.gwt.event.dom.client.BlurHandler handler)voidaddClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)Adds aClickEventhandler to the tab caption.com.google.gwt.event.shared.HandlerRegistrationaddFocusHandler(com.google.gwt.event.dom.client.FocusHandler handler)com.google.gwt.event.shared.HandlerRegistrationaddKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler handler)com.google.gwt.event.shared.HandlerRegistrationaddMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler handler)voidblur()Removes focus from the tab.voidfocus()Scrolls the tab into view and focuses it.protected com.google.gwt.user.client.ElementgetContainerElement()VTabsheetgetTabsheet()Returns the tab sheet instance where this tab is attached to.TooltipInfogetTooltipInfo()Returns the tab caption's tooltip info if it has been configured.booleanhasTooltip()Returns whether the tab caption has a configured tooltip or not.booleanisClosable()Returns whether the tab can be closed or not.booleanisEnabledOnServer()Returns whether the tab is enabled on server (there is no client-side disabling, but the naming convention matchesisHiddenOnServer()).booleanisHiddenOnServer()Returns whether the tab is hidden on server (as opposed to simply hidden because it's scrolled out of view).voidonClose()Handles a request to close this tab.voidrecalculateCaptionWidth()Recalculates the required caption width and sets it as the new width.voidremoveAssistiveDescription()Removes thearia-describedbyattribute from this tab element.voidsetAssistiveDescription(String descriptionId)Sets thearia-describedbyattribute for this tab element to the referenced id.voidsetCloseHandler(com.vaadin.client.ui.VTabsheet.VCloseHandler closeHandler)Sets the close handler for this tab.voidsetEnabledOnServer(boolean enabled)Set tab enabled state on server (there is no client-side disabling, but the naming convention matchessetHiddenOnServer(boolean)).voidsetHiddenOnServer(boolean hiddenOnServer)Set tab hidden state on server (as opposed to simply hidden because it's scrolled out of view).voidsetStyleNames(boolean selected, boolean first)Toggles the style names for the Tab.voidsetStyleNames(boolean selected, boolean first, boolean keyboardFocus)Sets the style names for this tab according to the given parameters.voidsetTabulatorIndex(int tabIndex)Sets the index that represents the tab's position in the browser's focus cycle.-
Methods inherited from class com.google.gwt.user.client.ui.SimplePanel
add, getWidget, iterator, remove, setWidget, setWidget
-
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
-
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
-
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
isHiddenOnServer
public boolean isHiddenOnServer()
Returns whether the tab is hidden on server (as opposed to simply hidden because it's scrolled out of view).- Returns:
trueif hidden on server,falseotherwise
-
setHiddenOnServer
public void setHiddenOnServer(boolean hiddenOnServer)
Set tab hidden state on server (as opposed to simply hidden because it's scrolled out of view).- Parameters:
hiddenOnServer-trueif hidden on server,falseotherwise
-
getContainerElement
protected com.google.gwt.user.client.Element getContainerElement()
- Overrides:
getContainerElementin classcom.google.gwt.user.client.ui.SimplePanel
-
isEnabledOnServer
public boolean isEnabledOnServer()
Returns whether the tab is enabled on server (there is no client-side disabling, but the naming convention matchesisHiddenOnServer()).- Returns:
trueif enabled on server,falseotherwise
-
setEnabledOnServer
public void setEnabledOnServer(boolean enabled)
Set tab enabled state on server (there is no client-side disabling, but the naming convention matchessetHiddenOnServer(boolean)).- Parameters:
enabled-trueif enabled on server,falseotherwise
-
addClickHandler
public void addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
Adds aClickEventhandler to the tab caption.- Parameters:
handler- the click handler
-
setCloseHandler
public void setCloseHandler(com.vaadin.client.ui.VTabsheet.VCloseHandler closeHandler)
Sets the close handler for this tab. This handler should be called whenever closing of a tab is requested (by clicking the close button or pressing the close key).- Parameters:
closeHandler- the close handler- See Also:
VTabsheet.getCloseTabKey()
-
setStyleNames
public void setStyleNames(boolean selected, boolean first)Toggles the style names for the Tab.- Parameters:
selected-trueif the Tab is selected,falseotherwisefirst-trueif the Tab is the first visible Tab,falseotherwise
-
setStyleNames
public void setStyleNames(boolean selected, boolean first, boolean keyboardFocus)Sets the style names for this tab according to the given parameters.- Parameters:
selected-trueif the tab is selected,falseotherwisefirst-trueif the tab is the first one from the left,falseotherwisekeyboardFocus-trueif the tab should display keyboard navigation focus styles,falseotherwise -- the focus style name is used by the compatibility themes likereindeer(valorelies on:focuspseudo-class)
-
setTabulatorIndex
public void setTabulatorIndex(int tabIndex)
Sets the index that represents the tab's position in the browser's focus cycle. Negative index means that this tab element is not reachable via tabulator navigation.By default only the selected tab has a non-negative tabulator index, and represents the entire tab sheet. If there are any other navigable tabs in the same tab sheet those can be navigated into with next/previous buttons, which does not update the selection until confirmed with a selection key press.
- Parameters:
tabIndex- the tabulator index- See Also:
VTabsheet.getNextTabKey(),VTabsheet.getPreviousTabKey(),VTabsheet.getSelectTabKey()
-
isClosable
public boolean isClosable()
Returns whether the tab can be closed or not.- Returns:
trueif the tab is closable,falseotherwise- See Also:
VTabsheet.TabCaption.setClosable(boolean)
-
onClose
public void onClose()
Handles a request to close this tab. Closability should be checked before calling this method. The close request will be delivered to the server, where the actual closing is handled.- See Also:
isClosable()
-
getTabsheet
public VTabsheet getTabsheet()
Returns the tab sheet instance where this tab is attached to.- Returns:
- the current tab sheet
-
recalculateCaptionWidth
public void recalculateCaptionWidth()
Recalculates the required caption width and sets it as the new width. Also updates the tab width bookkeeping of the tab bar if needed. The default implementation for the bookkeeping logic attempts to account for different margins and paddings in the first tab element and its caption element versus the same values in the next visible tab.
-
addFocusHandler
public com.google.gwt.event.shared.HandlerRegistration addFocusHandler(com.google.gwt.event.dom.client.FocusHandler handler)
- Specified by:
addFocusHandlerin interfacecom.google.gwt.event.dom.client.HasFocusHandlers
-
addBlurHandler
public com.google.gwt.event.shared.HandlerRegistration addBlurHandler(com.google.gwt.event.dom.client.BlurHandler handler)
- Specified by:
addBlurHandlerin interfacecom.google.gwt.event.dom.client.HasBlurHandlers
-
addMouseDownHandler
public com.google.gwt.event.shared.HandlerRegistration addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler handler)
- Specified by:
addMouseDownHandlerin interfacecom.google.gwt.event.dom.client.HasMouseDownHandlers
-
addKeyDownHandler
public com.google.gwt.event.shared.HandlerRegistration addKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler handler)
- Specified by:
addKeyDownHandlerin interfacecom.google.gwt.event.dom.client.HasKeyDownHandlers
-
focus
public void focus()
Scrolls the tab into view and focuses it.
-
blur
public void blur()
Removes focus from the tab.
-
hasTooltip
public boolean hasTooltip()
Returns whether the tab caption has a configured tooltip or not.- Returns:
trueif the tab caption has a tooltip,falseotherwise
-
getTooltipInfo
public TooltipInfo getTooltipInfo()
Returns the tab caption's tooltip info if it has been configured.- Returns:
- the tooltip info, or
nullif no tooltip configuration found
-
setAssistiveDescription
public void setAssistiveDescription(String descriptionId)
Sets thearia-describedbyattribute for this tab element to the referenced id. This should be called when this tab receives focus and has a tooltip configured.- Parameters:
descriptionId- the unique id of the tooltip element
-
removeAssistiveDescription
public void removeAssistiveDescription()
Removes thearia-describedbyattribute from this tab element. This should be called when this tab loses focus.
-
-