Class WTabSet

    • Field Detail

      • TYPE_TOP

        public static final WTabSet.TabSetType TYPE_TOP
        A tab-set where tab buttons are placed above the content.
      • TYPE_LEFT

        public static final WTabSet.TabSetType TYPE_LEFT
        A tab-set where tab buttons are placed to the left of the content.
      • TYPE_RIGHT

        public static final WTabSet.TabSetType TYPE_RIGHT
        A tab-set where tab buttons are placed to the right of the content.
      • TYPE_ACCORDION

        public static final WTabSet.TabSetType TYPE_ACCORDION
        An "accordion" type tab-set, that supports having multiple open tabs.
      • TYPE_APPLICATION

        public static final WTabSet.TabSetType TYPE_APPLICATION
        Deprecated.
        1.2.0
        An "application" type tab-set, defined only in a theme.
      • TAB_MODE_SERVER

        @Deprecated
        public static final WTabSet.TabMode TAB_MODE_SERVER
        Deprecated.
        Use TAB_MODE_DYNAMIC instead as a like-for-like replacement or any other mode if it is more appropriate to the individual use case.
        A synonym for TabMode.TAB_MODE_DYNAMIC.
      • TAB_MODE_LAZY

        public static final WTabSet.TabMode TAB_MODE_LAZY
        A tab mode where invoking the tab will perform an ajax request the first time the tab is requested.
      • TAB_MODE_CLIENT

        public static final WTabSet.TabMode TAB_MODE_CLIENT
        A tab mode where tab content is always rendered, and invoking the tab only results in a client-side switch.
      • TAB_MODE_DYNAMIC

        public static final WTabSet.TabMode TAB_MODE_DYNAMIC
        A tab mode where invoking the tab will perform an ajax request every time the tab is requested.
      • TAB_MODE_EAGER

        public static final WTabSet.TabMode TAB_MODE_EAGER
        A tab mode where invoking the tab will perform an ajax request immediately after the page is loaded.
    • Constructor Detail

      • WTabSet

        public WTabSet()
        Creates a WTabSet with the tabs positioned on the top.
      • WTabSet

        public WTabSet​(WTabSet.TabSetType type)
        Creates a WTabSet of the given type.
        Parameters:
        type - the tab set type.
    • Method Detail

      • setMargin

        public void setMargin​(Margin margin)
        Set the margin for the component, or null for no margin.
        Specified by:
        setMargin in interface Marginable
        Parameters:
        margin - the margin for the component
      • getMargin

        public Margin getMargin()
        Get the margin for the component, or null if not set.
        Specified by:
        getMargin in interface Marginable
        Returns:
        the margin for the component, or null if not set
      • setContentHeight

        public void setContentHeight​(String contentHeight)
        Sets the content height of the tab set. This is primarily used for tab sets where the tabs are positioned on the left or right, to limit the height of the tab set.
        Parameters:
        contentHeight - the content height, measured in a valid CSS unit, e.g. "10em".
      • getContentHeight

        public String getContentHeight()
        Returns:
        the tab set's content height, if set, otherwise null.
      • addTab

        public WTab addTab​(WComponent content,
                           String tabName)
        Adds a tab to the tab set with a TabMode of LAZY.
        Parameters:
        content - the tab set content.
        tabName - the tab name.
        Returns:
        the tab which was added to the tab set.
      • addTab

        public WTab addTab​(WComponent content,
                           WDecoratedLabel label)
        Adds a LAZY mode tab to the tab set.
        Parameters:
        content - the tab set content.
        label - the tab's label, which can contain rich content (images or other components).
        Returns:
        the tab which was added to the tab set.
      • addTab

        public WTab addTab​(WComponent content,
                           String tabName,
                           WTabSet.TabMode mode)
        Adds a tab to the tab set.
        Parameters:
        content - the tab set content.
        tabName - the tab name.
        mode - the tab mode.
        Returns:
        the tab which was added to the tab set.
      • addTab

        public WTab addTab​(WComponent content,
                           String tabName,
                           WTabSet.TabMode mode,
                           char accessKey)
        Adds a tab to the tab set.
        Parameters:
        content - the tab set content.
        tabName - the tab name.
        mode - the tab mode.
        accessKey - the access key used to activate the tab.
        Returns:
        the tab which was added to the tab set.
      • addTab

        public WTab addTab​(WComponent content,
                           String tabName,
                           char accessKey)
        Adds a LAZY tab with a given access key to the tab set.
        Parameters:
        content - the tab set content.
        tabName - the tab name.
        accessKey - the access key used to activate the tab.
        Returns:
        the tab which was added to the tab set.
      • addTab

        public WTab addTab​(WComponent content,
                           WDecoratedLabel label,
                           WTabSet.TabMode mode)
        Adds a tab to the tab set.
        Parameters:
        content - the tab set content.
        label - the tab's label, which can contain rich content (images or other components).
        mode - the tab mode.
        Returns:
        the tab which was added to the tab set.
      • addTab

        public WTab addTab​(WComponent content,
                           WDecoratedLabel label,
                           WTabSet.TabMode mode,
                           char accessKey)
        Adds a tab to the tab set.
        Parameters:
        content - the tab set content.
        label - the tab's label, which can contain rich content (images or other components).
        mode - the tab mode.
        accessKey - the access key used to activate the tab.
        Returns:
        the tab which was added to the tab set.
      • addTab

        public WTab addTab​(WComponent content,
                           WDecoratedLabel label,
                           char accessKey)
        Adds a LAZY tab with a given access key to the tab set.
        Parameters:
        content - the tab set content.
        label - the tab's label, which can contain rich content (images or other components).
        accessKey - the access key used to activate the tab.
        Returns:
        the tab which was added to the tab set.
      • addSeparator

        @Deprecated
        public void addSeparator()
        Deprecated.
        separators are not available to tabsets as it does not conform with a11y requirements.
        Adds a separator to the tab set.
      • addTab

        protected WTab addTab​(WTab tab)
        Adds a WTab to the tab set.
        Parameters:
        tab - the tab to add.
        Returns:
        the tab which was added to the tab set.
      • add

        @Deprecated
        public void add​(WTabGroup group)
        Deprecated.
        Do not use TabGroups
        Adds a tab group to the tab set.
        Parameters:
        group - the group to add.
      • add

        @Deprecated
        public void add​(WSeparator separator)
        Deprecated.
        separators are not available to tabsets as it does not conform with a11y requirements.
        Adds a separator to the tab set.
        Parameters:
        separator - the separator to add.
      • getTotalTabs

        public int getTotalTabs()
        Retrieves the total number of tabs in this tab set.
        Returns:
        the number of tabs in this tab set.
      • getActiveIndex

        public int getActiveIndex()
        Returns the default active index. Note that some tab sets support multiple active tabs, see getActiveIndices().

        If there are no active tabs, then the first tab will be returned as the default tab.

        Returns:
        the default active tab index.
      • getActiveIndices

        public List<Integer> getActiveIndices()
        Returns the active indices (as seen by the given context/session).
        Returns:
        the active tab indices (may be an empty list).
      • getActiveTab

        public WTab getActiveTab()
        Returns the active tab (as seen by the given context/session). Note that some tab sets support multiple active tabs, see getActiveTabs().
        Returns:
        the active tab (as seen by the given context/session).
      • getActiveTabs

        public List<WTab> getActiveTabs()
        Returns the active tabs (as seen by the given context/session).
        Returns:
        the active tabs (as seen by the given context/session).
      • setActiveIndex

        public void setActiveIndex​(int activeIndex)
        Sets the active index(as seen by the given context/session).
        Parameters:
        activeIndex - the index of the tab to mark as the active one.
      • setActiveIndices

        public void setActiveIndices​(int[] indices)
        Sets the active tab indices (as seen by the given context/session).
        Parameters:
        indices - the tab indices to set
      • setActiveTab

        public void setActiveTab​(WComponent content)
        Sets the active tab using tab content.
        Parameters:
        content - the active tab's content.
      • setActiveTab

        public void setActiveTab​(WTab tab)
        Sets the active tab.
        Parameters:
        tab - the active tab.
      • setTabVisible

        public void setTabVisible​(int idx,
                                  boolean visible)
        Sets the visibility of the tab at the given index.
        Parameters:
        idx - the index of the WTab to get.
        visible - true to set the tab visible, false to set invisible.
      • setTabVisible

        public void setTabVisible​(WComponent tabContent,
                                  boolean visible)
        Sets the visibility of the tab which holds the given content.
        Parameters:
        tabContent - the tab content.
        visible - true to set the tab visible, false to set invisible.
      • setTabVisible

        public void setTabVisible​(WTab tab,
                                  boolean visible)
        Sets the visibility of the tab.
        Parameters:
        tab - the tab.
        visible - true to set the tab visible, false to set invisible.
      • isTabVisible

        public boolean isTabVisible​(int idx)
        Indicates whether the tab at the given index is visible.
        Parameters:
        idx - the index of the WTab to test.
        Returns:
        true if the tab at the given index is visible, false if it is invisible.
      • isTabVisible

        public boolean isTabVisible​(WComponent tabContent)
        Indicates whether the tab which holds the given content is visible.
        Parameters:
        tabContent - the tab content.
        Returns:
        true if the tab at the given index is visible, false if it is invisible.
      • isTabVisible

        public boolean isTabVisible​(WTab tab)
        Indicates whether the tab which holds the given content is visible.
        Parameters:
        tab - the tab content.
        Returns:
        true if the tab at the given index is visible, false if it is invisible.
      • isActive

        public boolean isActive​(WComponent tab)
        Indicates whether the tab is active (selected).
        Parameters:
        tab - the WTab to check.
        Returns:
        true if the tab is active, false otherwise.
      • isActive

        public boolean isActive​(WTab tab)
        Indicates whether the tab is active (selected).
        Parameters:
        tab - the WTab to check.
        Returns:
        true if the tab is active, false otherwise.
      • getTabIndex

        public int getTabIndex​(WComponent content)
        Retrieves the tab index for the given tab content.
        Parameters:
        content - the tab content
        Returns:
        the tab index, or -1 if the content is not in a tab in this tab set.
      • getTabIndex

        public int getTabIndex​(WTab tab)
        Retrieves the tab index for the given tab.
        Parameters:
        tab - the tab
        Returns:
        the tab index, or -1 if the tab is not in this tab set.
      • getTab

        public WTab getTab​(int index)
        Returns the tab at the given index. Bounds checking is not performed.
        Parameters:
        index - the tab index.
        Returns:
        the tab at the selected index.
      • handleRequest

        public void handleRequest​(Request request)
        Override handleRequest in order to perform processing specific to this component.
        Specified by:
        handleRequest in interface WComponent
        Overrides:
        handleRequest in class AbstractWComponent
        Parameters:
        request - the request being responded to.
      • isDisabled

        public boolean isDisabled()
        Indicates whether the WTabSet is disabled in the given context.
        Specified by:
        isDisabled in interface Disableable
        Returns:
        true if the input is disabled, otherwise false.
      • setDisabled

        public void setDisabled​(boolean disabled)
        Sets whether the WTabSet is disabled.
        Specified by:
        setDisabled in interface Disableable
        Parameters:
        disabled - if true, the input is disabled. If false, it is enabled.
      • remove

        public void remove​(WComponent child)
      • setActionOnChange

        @Deprecated
        public void setActionOnChange​(Action action)
        Deprecated.
        an action on changing tab is a side-effect and should not be implemented.
        Sets the action to be executed when the tab selection of this tabset changes.
        Parameters:
        action - the action to execute
      • getActionOnChange

        @Deprecated
        public Action getActionOnChange()
        Deprecated.
        an action on changing tab is a side-effect and should not be implemented.
        Gets the action that is executed when the tab selection of this tabset changes.
        Returns:
        The action associated with this tabset.
      • setShowHeadOnly

        @Deprecated
        public void setShowHeadOnly​(boolean showHeadOnly)
        Deprecated.
        1.4.7 an irrelevant hangover from a bad design decision - never implemented.
        Sets whether only the "head" portion of a tab's decorated label should be visible. At present, this only has a visible effect on WTabSet.TabSetType.APPLICATION tab sets.
        Parameters:
        showHeadOnly - true if only the "head" part of the tab label should be shown.
      • isShowHeadOnly

        @Deprecated
        public boolean isShowHeadOnly()
        Deprecated.
        1.4.7 an irrelevant hangover from a bad design decision - never implemented.
        Indicates whether only the "head" portion of a tab's decorated label should be visible. At present, this only has a visible effect on WTabSet.TabSetType.APPLICATION tab sets.
        Returns:
        true if only the "head" part of the tab label should be shown.
      • setSingle

        public void setSingle​(boolean single)
        Parameters:
        single - true if only one tab should be open at a time for an accordion tabset
      • isSingle

        public boolean isSingle()
        Returns:
        true if only one tab should be open at a time for an accordion tabset
      • getGroupName

        public String getGroupName()
        The "collapsible" group name that this tabset belongs to.
        Returns:
        the collapsible group name
      • toString

        public String toString()
        Description copied from class: AbstractWComponent
        Creates a String representation of this component; usually for debugging purposes.
        Overrides:
        toString in class AbstractWComponent
        Returns:
        a String representation of this component, for debugging purposes.
      • getComponentModel

        protected WTabSet.TabSetModel getComponentModel()
        Returns the effective component model for this component. Subclass may override this method to narrow the return type to their specific model type.
        Overrides:
        getComponentModel in class AbstractWComponent
        Returns:
        the effective component model
      • getOrCreateComponentModel

        protected WTabSet.TabSetModel getOrCreateComponentModel()
        Retrieves the model for this component so that it can be modified. If this method is called during request processing, and a session specific model does not yet exist, then a new model is created. Subclasses may override this method to narrow the return type to their specific model type.
        Overrides:
        getOrCreateComponentModel in class AbstractWComponent
        Returns:
        the model for this component