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 enumEnumeration with layout keys.protected classExtending 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 TypeMethodDescriptionvoidAdd a new tab with the provided name and content.com.google.gwt.event.shared.HandlerRegistrationaddBeforeSelectionHandler(com.google.gwt.event.logical.shared.BeforeSelectionHandler<Integer> handler) Add the before selection handler to the tabbed panel.voidAdds a tab with a user-defined id.com.google.gwt.event.shared.HandlerRegistrationaddSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler<Integer> handler) Adds a SelectionEvent handler to the tabbed panel.voidaddWithLeftMargin(E tabContent, String tabName) Add a new tab with the provided name and content and additional left margin.voiddisableTab(E tabContent, String reason) Disables the tab with the given index.voidEnables the tab with the given index.Returns the id of the selected tab.intGets the index of the currently-selected tab.intMeasures the height of the tab bar.getTabById(String tabId) Finds a tab with a given id.intGets the number of child widgets in this panel.intgetTabIndex(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.TabLayoutPanelReturns the tab layout panel.getTabText(int pos) Returns the tab text for a given tab.com.google.gwt.user.client.ui.WidgetgetTabWidget(int index) Returns the tab widget.getWidget(int tabIndex) Gets the child widget at the specified index.voidInserts a widget into the panel.booleanisDisabledTab(int tabIndex) Returnstrueif the tab with the given index is disabled,falseotherwise.iterator()Returns an iterator over all tabs.protected voidonLoad()voidThis method should be called when a descendant widget changes its size.voidremoveTab(int tabIndex) Removes the tab with the given index.voidselectTab(int tabIndex) Delegate method.voidselectTab(int tabIndex, boolean fireEvent) Delegate method.voidDelegate method.voidDelegate method.voidsetAutoResize(boolean autoResize) Enables or disables auto-resizing.voidsetAutoResizeHeightDelta(int heightDelta) Sets a value which is added to the height of a tab content to change the tabbed panel height.protected voidSets the overflow of the tab layout content's parent to visible.voidsetTabText(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, setWidgetMethods 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, unsinkEventsMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
Returnstrueif the tab with the given index is disabled,falseotherwise.- Parameters:
tabIndex- the tab index- Returns:
trueif the tab with the given index is disabled,falseotherwise
-
iterator
Returns an iterator over all tabs. -
onResizeDescendant
Description copied from interface:I_CmsDescendantResizeHandlerThis method should be called when a descendant widget changes its size.- Specified by:
onResizeDescendantin 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:
-
selectTab
Delegate method.- Parameters:
tabWidget- the tab widget to selectfireEvent-trueto fire the tab event- See Also:
-
selectTab
Delegate method.- Parameters:
tabIndex- the index of the tab to be selected- See Also:
-
selectTab
Delegate method.- Parameters:
tabIndex- the index of the tab to be selectedfireEvent-trueto fire the tab event- See Also:
-
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:
onLoadin classcom.google.gwt.user.client.ui.Widget- See Also:
-
setOverflowVisibleToContent
Sets the overflow of the tab layout content's parent to visible.
-