Class CmsTabbedPanel<E extends com.google.gwt.user.client.ui.Widget>

java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Composite
org.opencms.gwt.client.ui.CmsTabbedPanel<E>
Type Parameters:
E - the tab widget type
All Implemented Interfaces:
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.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget, Iterable<E>, I_CmsDescendantResizeHandler

public class CmsTabbedPanel<E extends com.google.gwt.user.client.ui.Widget> extends com.google.gwt.user.client.ui.Composite implements I_CmsDescendantResizeHandler, Iterable<E>
Wrapper class for @see com.google.user.client.ui.TabLayoutPanel.

Layout class for a panel with several tabs. The tabbed panel should be set inside a widget with given width and height. For table based layouts the height of the parent cell should be set explicitly. As layout options two height for the tabbar are provided: 32px("standard") and 25px("small").

Since:
8.0.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Enumeration with layout keys.
    protected class 
    Extending the TabLayoutPanel class to allow height adjustments to the tab bar.

    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
  • Field Summary

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

    DEBUG_ID_PREFIX
  • Constructor Summary

    Constructors
    Constructor
    Description
    The default constructor for an empty tabbed panel.
    The constructor for an empty tabbed panel.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(E tabContent, String tabName)
    Add a new tab with the provided name and content.
    com.google.gwt.event.shared.HandlerRegistration
    addBeforeSelectionHandler(com.google.gwt.event.logical.shared.BeforeSelectionHandler<Integer> handler)
    Add the before selection handler to the tabbed panel.
    void
    addNamed(E tabContent, String tabName, String tabId)
    Adds a tab with a user-defined id.
    com.google.gwt.event.shared.HandlerRegistration
    addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler<Integer> handler)
    Adds a SelectionEvent handler to the tabbed panel.
    void
    addWithLeftMargin(E tabContent, String tabName)
    Add a new tab with the provided name and content and additional left margin.
    void
    disableTab(E tabContent, String reason)
    Disables the tab with the given index.
    void
    enableTab(E tabContent)
    Enables the tab with the given index.
    Returns the id of the selected tab.
    int
    Gets the index of the currently-selected tab.
    int
    Measures the height of the tab bar.
    Finds a tab with a given id.
    int
    Gets the number of child widgets in this panel.
    int
    getTabIndex(com.google.gwt.dom.client.Element child)
    Returns the index of the tab to the given child element.
    protected com.google.gwt.user.client.ui.TabLayoutPanel
    Returns the tab layout panel.
    getTabText(int pos)
    Returns the tab text for a given tab.
    com.google.gwt.user.client.ui.Widget
    getTabWidget(int index)
    Returns the tab widget.
    getWidget(int tabIndex)
    Gets the child widget at the specified index.
    void
    insert(E tabContent, String tabName, int beforeIndex)
    Inserts a widget into the panel.
    boolean
    isDisabledTab(int tabIndex)
    Returns true if the tab with the given index is disabled, false otherwise.
    Returns an iterator over all tabs.
    protected void
     
    void
    This method should be called when a descendant widget changes its size.
    void
    removeTab(int tabIndex)
    Removes the tab with the given index.
    void
    selectTab(int tabIndex)
    Delegate method.
    void
    selectTab(int tabIndex, boolean fireEvent)
    Delegate method.
    void
    selectTab(E tabWidget)
    Delegate method.
    void
    selectTab(E tabWidget, boolean fireEvent)
    Delegate method.
    void
    setAutoResize(boolean autoResize)
    Enables or disables auto-resizing.
    void
    setAutoResizeHeightDelta(int heightDelta)
    Sets a value which is added to the height of a tab content to change the tabbed panel height.
    protected void
    Sets the overflow of the tab layout content's parent to visible.
    void
    setTabText(int pos, String text)
    Sets the text of a given tab.

    Methods inherited from class com.google.gwt.user.client.ui.Composite

    claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget

    Methods inherited from class com.google.gwt.user.client.ui.Widget

    addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, 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, 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
  • Constructor Details

    • CmsTabbedPanel

      public CmsTabbedPanel()
      The default constructor for an empty tabbed panel.

    • CmsTabbedPanel

      The constructor for an empty tabbed panel.

      Parameters:
      tabbedPanelStyle - the pre-defined height of the tabbar, can be "small" or "standard"
  • Method Details

    • add

      public void add(E tabContent, String tabName)
      Add a new tab with the provided name and content.

      Wrapper function for TabLayoutPanel.add(Widget, String)

      Parameters:
      tabContent - the widget to add as a tab
      tabName - the name of the tab to display in the tabbar
    • addBeforeSelectionHandler

      public com.google.gwt.event.shared.HandlerRegistration addBeforeSelectionHandler(com.google.gwt.event.logical.shared.BeforeSelectionHandler<Integer> handler)
      Add the before selection handler to the tabbed panel.

      Wrapper function for TabLayoutPanel.addBeforeSelectionHandler(BeforeSelectionHandler)

      Parameters:
      handler - the before selection handler
      Returns:
      the registration for the event
    • addNamed

      public void addNamed(E tabContent, String tabName, String tabId)
      Adds a tab with a user-defined id.

      Parameters:
      tabContent - the tab content
      tabName - the tab name
      tabId - the tab id
    • addSelectionHandler

      public com.google.gwt.event.shared.HandlerRegistration addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler<Integer> handler)
      Adds a SelectionEvent handler to the tabbed panel.

      Wrapper function for TabLayoutPanel.addSelectionHandler(SelectionHandler)

      Parameters:
      handler - the selection handler
      Returns:
      the registration for the event
    • addWithLeftMargin

      public void addWithLeftMargin(E tabContent, String tabName)
      Add a new tab with the provided name and content and additional left margin.

      Parameters:
      tabContent - the widget to add as a tab
      tabName - the name of the tab to display in the tabbar
    • disableTab

      public void disableTab(E tabContent, String reason)
      Disables the tab with the given index.

      Parameters:
      tabContent - the content of the tab that should be disabled
      reason - the reason why the tab is disabled
    • enableTab

      public void enableTab(E tabContent)
      Enables the tab with the given index.

      Parameters:
      tabContent - the content of the tab that should be enabled
    • getSelectedId

      Returns the id of the selected tab.

      Returns:
      the selected tab id
    • getSelectedIndex

      public int getSelectedIndex()
      Gets the index of the currently-selected tab.

      Wrapper function for TabLayoutPanel.getSelectedIndex()

      Returns:
      the selected index, or -1 if none is selected.
    • getTabBarHeight

      public int getTabBarHeight()
      Measures the height of the tab bar.

      Returns:
      the tab bar height
    • getTabById

      public E getTabById(String tabId)
      Finds a tab with a given id.

      Parameters:
      tabId - a tab id
      Returns:
      the tab with the given id
    • getTabCount

      public int getTabCount()
      Gets the number of child widgets in this panel.

      Wrapper function for TabLayoutPanel.getWidgetCount()

      Returns:
      the number of children
    • getTabIndex

      public int getTabIndex(com.google.gwt.dom.client.Element child)
      Returns the index of the tab to the given child element.

      Parameters:
      child - the tab child
      Returns:
      the tab index
    • getTabText

      public String getTabText(int pos)
      Returns the tab text for a given tab.

      Parameters:
      pos - the index of the tab
      Returns:
      the text of the tab
    • getTabWidget

      public com.google.gwt.user.client.ui.Widget getTabWidget(int index)
      Returns the tab widget.

      This will not be the tab content but the tab itself.

      Parameters:
      index - the tab index
      Returns:
      the tab widget
    • getWidget

      public E getWidget(int tabIndex)
      Gets the child widget at the specified index.

      Wrapper function for TabLayoutPanel.getWidget(int)

      Parameters:
      tabIndex - the child widget's index
      Returns:
      the child widget
    • insert

      public void insert(E tabContent, String tabName, int beforeIndex)
      Inserts a widget into the panel. If the Widget is already attached, it will be moved to the requested index.

      Wrapper function for TabLayoutPanel.insert(Widget, String, int)

      Parameters:
      tabContent - the widget to be added
      tabName - the text to be shown on its tab
      beforeIndex - the index before which it will be inserted
    • isDisabledTab

      public boolean isDisabledTab(int tabIndex)
      Returns true if the tab with the given index is disabled, false otherwise.

      Parameters:
      tabIndex - the tab index
      Returns:
      true if the tab with the given index is disabled, false otherwise
    • iterator

      public Iterator<E> iterator()
      Returns an iterator over all tabs.

      Specified by:
      iterator in interface Iterable<E extends com.google.gwt.user.client.ui.Widget>
      Returns:
      the iterator
    • onResizeDescendant

      public void onResizeDescendant()
      Description copied from interface: I_CmsDescendantResizeHandler
      This method should be called when a descendant widget changes its size.

      Specified by:
      onResizeDescendant in interface I_CmsDescendantResizeHandler
      See Also:
    • removeTab

      public void removeTab(int tabIndex)
      Removes the tab with the given index.

      Parameters:
      tabIndex - the index of the tab which should be removed
    • selectTab

      public void selectTab(E tabWidget)
      Delegate method.

      Parameters:
      tabWidget - the tab widget to select
      See Also:
      • TabLayoutPanel.selectTab(Widget index)
    • selectTab

      public void selectTab(E tabWidget, boolean fireEvent)
      Delegate method.

      Parameters:
      tabWidget - the tab widget to select
      fireEvent - true to fire the tab event
      See Also:
      • TabLayoutPanel.selectTab(Widget index)
    • selectTab

      public void selectTab(int tabIndex)
      Delegate method.

      Parameters:
      tabIndex - the index of the tab to be selected
      See Also:
      • TabLayoutPanel.selectTab(int index)
    • selectTab

      public void selectTab(int tabIndex, boolean fireEvent)
      Delegate method.

      Parameters:
      tabIndex - the index of the tab to be selected
      fireEvent - true to fire the tab event
      See Also:
      • TabLayoutPanel.selectTab(int index)
    • setAutoResize

      public void setAutoResize(boolean autoResize)
      Enables or disables auto-resizing.

      Parameters:
      autoResize - the auto resize flag value
    • setAutoResizeHeightDelta

      public void setAutoResizeHeightDelta(int heightDelta)
      Sets a value which is added to the height of a tab content to change the tabbed panel height.

      Parameters:
      heightDelta - the height difference
    • setTabText

      public void setTabText(int pos, String text)
      Sets the text of a given tab.

      Parameters:
      pos - the index of the tab
      text - the new text for the tab
    • getTabPanel

      protected com.google.gwt.user.client.ui.TabLayoutPanel getTabPanel()
      Returns the tab layout panel.

      Returns:
      the tab layout panel
    • onLoad

      protected void onLoad()
      Overrides:
      onLoad in class com.google.gwt.user.client.ui.Widget
      See Also:
      • Widget.onLoad()
    • setOverflowVisibleToContent

      protected void setOverflowVisibleToContent()
      Sets the overflow of the tab layout content's parent to visible.