Package org.opencms.gwt.client.ui
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 ClassesModifier and TypeClassDescriptionstatic 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
ConstructorsConstructorDescriptionThe default constructor for an empty tabbed panel.CmsTabbedPanel
(CmsTabbedPanel.CmsTabbedPanelStyle tabbedPanelStyle) The constructor for an empty tabbed panel. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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
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.getTabById
(String tabId) 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
Inserts a widget into the panel.boolean
isDisabledTab
(int tabIndex) Returnstrue
if the tab with the given index is disabled,false
otherwise.iterator()
Returns an iterator over all tabs.protected void
onLoad()
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
Delegate method.void
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
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 tabtabName
- the name of the tab to display in the tabbar
-
addNamed
Adds a tab with a user-defined id.- Parameters:
tabContent
- the tab contenttabName
- the tab nametabId
- the tab id
-
addWithLeftMargin
Add a new tab with the provided name and content and additional left margin.- Parameters:
tabContent
- the widget to add as a tabtabName
- the name of the tab to display in the tabbar
-
disableTab
Disables the tab with the given index.- Parameters:
tabContent
- the content of the tab that should be disabledreason
- the reason why the tab is disabled
-
enableTab
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
Gets the index of the currently-selected tab.Wrapper function for
TabLayoutPanel.getSelectedIndex()
- Returns:
- the selected index, or -1 if none is selected.
-
getTabBarHeight
Measures the height of the tab bar.- Returns:
- the tab bar height
-
getTabById
Finds a tab with a given id.- Parameters:
tabId
- a tab id- Returns:
- the tab with the given id
-
getTabCount
Gets the number of child widgets in this panel.Wrapper function for
TabLayoutPanel.getWidgetCount()
- Returns:
- the number of children
-
getTabIndex
Returns the index of the tab to the given child element.- Parameters:
child
- the tab child- Returns:
- the tab index
-
getTabText
Returns the tab text for a given tab.- Parameters:
pos
- the index of the tab- Returns:
- the text of the tab
-
getTabWidget
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
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
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 addedtabName
- the text to be shown on its tabbeforeIndex
- the index before which it will be inserted
-
isDisabledTab
Returnstrue
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
Returns an iterator over all tabs. -
onResizeDescendant
Description copied from interface:I_CmsDescendantResizeHandler
This method should be called when a descendant widget changes its size.- Specified by:
onResizeDescendant
in interfaceI_CmsDescendantResizeHandler
- See Also:
-
removeTab
Removes the tab with the given index.- Parameters:
tabIndex
- the index of the tab which should be removed
-
selectTab
Delegate method.- Parameters:
tabWidget
- the tab widget to select- See Also:
-
TabLayoutPanel.selectTab(Widget index)
-
selectTab
Delegate method.- Parameters:
tabWidget
- the tab widget to selectfireEvent
-true
to fire the tab event- See Also:
-
TabLayoutPanel.selectTab(Widget index)
-
selectTab
Delegate method.- Parameters:
tabIndex
- the index of the tab to be selected- See Also:
-
TabLayoutPanel.selectTab(int index)
-
selectTab
Delegate method.- Parameters:
tabIndex
- the index of the tab to be selectedfireEvent
-true
to fire the tab event- See Also:
-
TabLayoutPanel.selectTab(int index)
-
setAutoResize
Enables or disables auto-resizing.- Parameters:
autoResize
- the auto resize flag value
-
setAutoResizeHeightDelta
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
Sets the text of a given tab.- Parameters:
pos
- the index of the tabtext
- the new text for the tab
-
getTabPanel
Returns the tab layout panel.- Returns:
- the tab layout panel
-
onLoad
- Overrides:
onLoad
in classcom.google.gwt.user.client.ui.Widget
- See Also:
-
Widget.onLoad()
-
setOverflowVisibleToContent
Sets the overflow of the tab layout content's parent to visible.
-