Class TabPanelWithDropdowns

  • 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
    Direct Known Subclasses:
    ResizeTabPanel

    @Dependent
    public class TabPanelWithDropdowns
    extends com.google.gwt.user.client.ui.Composite
    A Bootstrap3 TabPanel which supports a mix of normal tabs and tabs that are dropdown menus. Selecting an item from a dropdown menu tab causes that item's associated content to display in the tab panel's content area.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  TabPanelWithDropdowns.DropDownTab
      Container for the menu items that appear when the dropdown tab is clicked.
      • 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 
      Modifier and Type Field Description
      protected org.gwtbootstrap3.client.ui.NavTabs tabBar
      The bar at the top where the tabs sit.
      protected com.google.gwt.user.client.ui.HorizontalPanel tabBarPanel
      The area that contains the tab bar and any additional custom widgets
      protected org.gwtbootstrap3.client.ui.TabContent tabContent
      The content area that shows the content for the currently selected tab.
      protected com.google.gwt.user.client.ui.HorizontalPanel widgetsPanel
      The area where custom widgets can be added to the right end of the tab bar
      • Fields inherited from class com.google.gwt.user.client.ui.UIObject

        DEBUG_ID_PREFIX
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      TabPanelWithDropdowns.DropDownTab addDropdownTab​(String label)
      Adds a new tab to this panel that doesn't have any contents itself, but can contain multiple items that appear in a dropdown menu when the tab is clicked.
      void addDropdownTab​(TabPanelWithDropdowns.DropDownTab contents)
      Adds a pre-made dropdown tab to this tab panel.
      TabPanelEntry addItem​(String label, com.google.gwt.user.client.ui.Widget content)
      Adds a normal tab (not a dropdown) with the given label and contents.
      void addItem​(TabPanelEntry tab)
      Adds a normal tab (not a dropdown) with the given label and contents (at the end of the tab bar).
      com.google.gwt.event.shared.HandlerRegistration addShowHandler​(org.gwtbootstrap3.client.shared.event.TabShowHandler tabShowHandler)
      Registers a handler that is notified just before any tab in this panel (nested under a dropdown or not) is shown.
      com.google.gwt.event.shared.HandlerRegistration addShownHandler​(org.gwtbootstrap3.client.shared.event.TabShownHandler tabShownHandler)
      Registers a handler that is notified just after any tab in this panel (nested under a dropdown or not) is shown.
      void addTabBarWidget​(com.google.gwt.user.client.ui.IsWidget customWidget)  
      void clear()
      Removes all tabs and content from this tab panel.
      TabPanelEntry findEntryForTabWidget​(org.gwtbootstrap3.client.ui.TabListItem tabWidget)
      Finds the TabPanelEntry associated with the given tab widget, even if it's nested in a DropdownTab.
      TabPanelEntry getActiveTab()
      Returns the tab whose contents are currently being displayed.
      int getSelectedTabIndex()
      Returns the tab index associated with the current selected tab.
      org.gwtbootstrap3.client.ui.NavTabs getTabBar()  
      void init()
      Creates an empty tab panel.
      void insertItem​(TabPanelEntry tab, int index)
      Adds a normal tab (not a dropdown) with the given label and contents (in a specific index).
      boolean remove​(TabPanelEntry tab)
      Removes the given tab and its associated contents that were previously added with addItem(String, Widget).
      void selectTabIndex​(int index)  
      • 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, 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, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
    • Field Detail

      • tabBarPanel

        @UiField
        protected com.google.gwt.user.client.ui.HorizontalPanel tabBarPanel
        The area that contains the tab bar and any additional custom widgets
      • tabBar

        @UiField
        protected org.gwtbootstrap3.client.ui.NavTabs tabBar
        The bar at the top where the tabs sit.
      • widgetsPanel

        @UiField
        protected com.google.gwt.user.client.ui.HorizontalPanel widgetsPanel
        The area where custom widgets can be added to the right end of the tab bar
      • tabContent

        @UiField
        protected org.gwtbootstrap3.client.ui.TabContent tabContent
        The content area that shows the content for the currently selected tab.
    • Constructor Detail

      • TabPanelWithDropdowns

        public TabPanelWithDropdowns()
    • Method Detail

      • addShowHandler

        public com.google.gwt.event.shared.HandlerRegistration addShowHandler​(org.gwtbootstrap3.client.shared.event.TabShowHandler tabShowHandler)
        Registers a handler that is notified just before any tab in this panel (nested under a dropdown or not) is shown.
        Parameters:
        tabShowHandler - the handler that will receive the notifications.
      • addShownHandler

        public com.google.gwt.event.shared.HandlerRegistration addShownHandler​(org.gwtbootstrap3.client.shared.event.TabShownHandler tabShownHandler)
        Registers a handler that is notified just after any tab in this panel (nested under a dropdown or not) is shown.
        Parameters:
        tabShownHandler - the handler that will receive the notifications.
      • init

        @PostConstruct
        public void init()
        Creates an empty tab panel.
      • addItem

        public TabPanelEntry addItem​(String label,
                                     com.google.gwt.user.client.ui.Widget content)
        Adds a normal tab (not a dropdown) with the given label and contents.
        Parameters:
        label - the label for the tab itself.
        content - the contents that should appear in the content area when the tab is selected.
        Returns:
        the newly created entry object that ties together the tab widget and its contents.
      • addItem

        public void addItem​(TabPanelEntry tab)
        Adds a normal tab (not a dropdown) with the given label and contents (at the end of the tab bar).
        Parameters:
        tab - the label and contents associated with the new tab.
      • insertItem

        public void insertItem​(TabPanelEntry tab,
                               int index)
        Adds a normal tab (not a dropdown) with the given label and contents (in a specific index).
        Parameters:
        tab - the label and contents associated with the new tab.
      • getTabBar

        public org.gwtbootstrap3.client.ui.NavTabs getTabBar()
      • remove

        public boolean remove​(TabPanelEntry tab)
        Removes the given tab and its associated contents that were previously added with addItem(String, Widget). Has no effect if the item is not currently in this tab panel.
        Parameters:
        tab - the item to remove.
      • addDropdownTab

        public TabPanelWithDropdowns.DropDownTab addDropdownTab​(String label)
        Adds a new tab to this panel that doesn't have any contents itself, but can contain multiple items that appear in a dropdown menu when the tab is clicked. This dropdown menu is initially empty. Items can be added and removed using the TabPanelWithDropdowns.DropDownTab.addItem(String, Widget) and DropDownTab#removeItem(String, Widget) methods.
        Parameters:
        label - The text that should appear on the dropdown tab.
        Returns:
        the container for the items that appear when the tab is clicked.
      • addDropdownTab

        public void addDropdownTab​(TabPanelWithDropdowns.DropDownTab contents)
        Adds a pre-made dropdown tab to this tab panel. This can be used for re-attaching a dropdown tab that was previously added with addDropdownTab(String) and then removed.
        Parameters:
        tab - the tab to add back
      • clear

        public void clear()
        Removes all tabs and content from this tab panel.
      • getActiveTab

        public TabPanelEntry getActiveTab()
        Returns the tab whose contents are currently being displayed. The tab widget itself may be a top-level tab, or nested under a dropdown tab.
        Returns:
        the currently selected (active) tab. If no tab has been displayed yet, returns null.
      • getSelectedTabIndex

        public int getSelectedTabIndex()
        Returns the tab index associated with the current selected tab.
        Returns:
        the currently selected (active) tab index. -1 If there is no active tab
      • selectTabIndex

        public void selectTabIndex​(int index)
      • findEntryForTabWidget

        public TabPanelEntry findEntryForTabWidget​(org.gwtbootstrap3.client.ui.TabListItem tabWidget)
        Finds the TabPanelEntry associated with the given tab widget, even if it's nested in a DropdownTab.
      • addTabBarWidget

        public void addTabBarWidget​(com.google.gwt.user.client.ui.IsWidget customWidget)