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
,java.lang.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, java.lang.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 class
CmsTabbedPanel.CmsTabbedPanelStyle
Enumeration with layout keys.protected class
CmsTabbedPanel.TabPanel
Extending the TabLayoutPanel class to allow height adjustments to the tab bar.
-
Constructor Summary
Constructors Constructor Description CmsTabbedPanel()
The default constructor for an empty tabbed panel.CmsTabbedPanel(CmsTabbedPanel.CmsTabbedPanelStyle tabbedPanelStyle)
The constructor for an empty tabbed panel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(E tabContent, java.lang.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<java.lang.Integer> handler)
Add the before selection handler to the tabbed panel.void
addNamed(E tabContent, java.lang.String tabName, java.lang.String tabId)
Adds a tab with a user-defined id.com.google.gwt.event.shared.HandlerRegistration
addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler<java.lang.Integer> handler)
Adds a SelectionEvent handler to the tabbed panel.void
addWithLeftMargin(E tabContent, java.lang.String tabName)
Add a new tab with the provided name and content and additional left margin.void
disableTab(E tabContent, java.lang.String reason)
Disables the tab with the given index.void
enableTab(E tabContent)
Enables the tab with the given index.java.lang.String
getSelectedId()
Returns the id of the selected tab.int
getSelectedIndex()
Gets the index of the currently-selected tab.int
getTabBarHeight()
Measures the height of the tab bar.E
getTabById(java.lang.String tabId)
Finds a tab with a given id.int
getTabCount()
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
getTabPanel()
Returns the tab layout panel.java.lang.String
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.E
getWidget(int tabIndex)
Gets the child widget at the specified index.void
insert(E tabContent, java.lang.String tabName, int beforeIndex)
Inserts a widget into the panel.boolean
isDisabledTab(int tabIndex)
Returnstrue
if the tab with the given index is disabled,false
otherwise.java.util.Iterator<E>
iterator()
Returns an iterator over all tabs.protected void
onLoad()
void
onResizeDescendant()
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
setOverflowVisibleToContent()
Sets the overflow of the tab layout content's parent to visible.void
setTabText(int pos, java.lang.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
-
-
-
-
Constructor Detail
-
CmsTabbedPanel
public CmsTabbedPanel()
The default constructor for an empty tabbed panel.
-
CmsTabbedPanel
public CmsTabbedPanel(CmsTabbedPanel.CmsTabbedPanelStyle tabbedPanelStyle)
The constructor for an empty tabbed panel.- Parameters:
tabbedPanelStyle
- the pre-defined height of the tabbar, can be "small" or "standard"
-
-
Method Detail
-
add
public void add(E tabContent, java.lang.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 tabtabName
- 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<java.lang.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, java.lang.String tabName, java.lang.String tabId)
Adds a tab with a user-defined id.- Parameters:
tabContent
- the tab contenttabName
- the tab nametabId
- the tab id
-
addSelectionHandler
public com.google.gwt.event.shared.HandlerRegistration addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler<java.lang.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, java.lang.String tabName)
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
public void disableTab(E tabContent, java.lang.String reason)
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
public void enableTab(E tabContent)
Enables the tab with the given index.- Parameters:
tabContent
- the content of the tab that should be enabled
-
getSelectedId
public java.lang.String 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(java.lang.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 java.lang.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, java.lang.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 addedtabName
- the text to be shown on its tabbeforeIndex
- the index before which it will be inserted
-
isDisabledTab
public boolean isDisabledTab(int tabIndex)
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
public java.util.Iterator<E> iterator()
Returns an iterator over all tabs.- Specified by:
iterator
in interfacejava.lang.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 interfaceI_CmsDescendantResizeHandler
- See Also:
I_CmsDescendantResizeHandler.onResizeDescendant()
-
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 selectfireEvent
-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 selectedfireEvent
-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, java.lang.String text)
Sets the text of a given tab.- Parameters:
pos
- the index of the tabtext
- 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 classcom.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.
-
-