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.HasKeyDownHandlers

    Representation of a single "tab" shown in the VTabsheet.TabBar.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

        com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
      • Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets

        com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
    • Field Summary

      • Fields inherited from class com.google.gwt.user.client.ui.UIObject

        DEBUG_ID_PREFIX
    • Method Summary

      All Methods
      Modifier and Type Method Description
      com.google.gwt.event.shared.HandlerRegistration addBlurHandler​(com.google.gwt.event.dom.client.BlurHandler handler)  
      void addClickHandler​(com.google.gwt.event.dom.client.ClickHandler handler)

      Adds a ClickEvent handler to the tab caption.

      com.google.gwt.event.shared.HandlerRegistration addFocusHandler​(com.google.gwt.event.dom.client.FocusHandler handler)  
      com.google.gwt.event.shared.HandlerRegistration addKeyDownHandler​(com.google.gwt.event.dom.client.KeyDownHandler handler)  
      com.google.gwt.event.shared.HandlerRegistration addMouseDownHandler​(com.google.gwt.event.dom.client.MouseDownHandler handler)  
      void blur()

      Removes focus from the tab.

      void focus()

      Scrolls the tab into view and focuses it.

      protected com.google.gwt.user.client.Element getContainerElement()  
      VTabsheet getTabsheet()

      Returns the tab sheet instance where this tab is attached to.

      TooltipInfo getTooltipInfo()

      Returns the tab caption's tooltip info if it has been configured.

      boolean hasTooltip()

      Returns whether the tab caption has a configured tooltip or not.

      boolean isClosable()

      Returns whether the tab can be closed or not.

      boolean isEnabledOnServer()

      Returns whether the tab is enabled on server (there is no client-side disabling, but the naming convention matches isHiddenOnServer()).

      boolean isHiddenOnServer()

      Returns whether the tab is hidden on server (as opposed to simply hidden because it's scrolled out of view).

      void onClose()

      Handles a request to close this tab.

      void recalculateCaptionWidth()

      Recalculates the required caption width and sets it as the new width.

      void removeAssistiveDescription()

      Removes the aria-describedby attribute from this tab element.

      void setAssistiveDescription​(String descriptionId)

      Sets the aria-describedby attribute for this tab element to the referenced id.

      void setCloseHandler​(com.vaadin.client.ui.VTabsheet.VCloseHandler closeHandler)

      Sets the close handler for this tab.

      void setEnabledOnServer​(boolean enabled)

      Set tab enabled state on server (there is no client-side disabling, but the naming convention matches setHiddenOnServer(boolean)).

      void setHiddenOnServer​(boolean hiddenOnServer)

      Set tab hidden state on server (as opposed to simply hidden because it's scrolled out of view).

      void setStyleNames​(boolean selected, boolean first)

      Toggles the style names for the Tab.

      void setStyleNames​(boolean selected, boolean first, boolean keyboardFocus)

      Sets the style names for this tab according to the given parameters.

      void setTabulatorIndex​(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 interface com.google.gwt.event.shared.HasHandlers

        fireEvent
    • 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:

        true if hidden on server, false otherwise

      • 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 - true if hidden on server, false otherwise

      • getContainerElement

        protected com.google.gwt.user.client.Element getContainerElement()

        Overrides:

        getContainerElement in class com.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 matches isHiddenOnServer()).

        Returns:

        true if enabled on server, false otherwise

      • setEnabledOnServer

        public void setEnabledOnServer​(boolean enabled)

        Set tab enabled state on server (there is no client-side disabling, but the naming convention matches setHiddenOnServer(boolean)).

        Parameters:

        enabled - true if enabled on server, false otherwise

      • addClickHandler

        public void addClickHandler​(com.google.gwt.event.dom.client.ClickHandler handler)

        Adds a ClickEvent handler 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 - true if the Tab is selected, false otherwise

        first - true if the Tab is the first visible Tab, false otherwise

      • setStyleNames

        public void setStyleNames​(boolean selected,
                                  boolean first,
                                  boolean keyboardFocus)

        Sets the style names for this tab according to the given parameters.

        Parameters:

        selected - true if the tab is selected, false otherwise

        first - true if the tab is the first one from the left, false otherwise

        keyboardFocus - true if the tab should display keyboard navigation focus styles, false otherwise -- the focus style name is used by the compatibility themes like reindeer (valo relies on :focus pseudo-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()

      • 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:

        addFocusHandler in interface com.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:

        addBlurHandler in interface com.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:

        addMouseDownHandler in interface com.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:

        addKeyDownHandler in interface com.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:

        true if the tab caption has a tooltip, false otherwise

      • getTooltipInfo

        public TooltipInfo getTooltipInfo()

        Returns the tab caption's tooltip info if it has been configured.

        Returns:

        the tooltip info, or null if no tooltip configuration found

      • setAssistiveDescription

        public void setAssistiveDescription​(String descriptionId)

        Sets the aria-describedby attribute 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 the aria-describedby attribute from this tab element. This should be called when this tab loses focus.