org.exoplatform.gwtframework.ui.client.tablayout
Class TabPanel

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.google.gwt.user.client.ui.ResizeComposite
                  extended by org.exoplatform.gwtframework.ui.client.tablayout.TabPanel
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasSelectionHandlers<java.lang.Integer>, com.google.gwt.event.shared.EventHandler, 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, com.google.gwt.user.client.ui.RequiresResize, CloseTabHandler, HasCloseTabHandler, HasTabClosedHandler, Scrollable

public class TabPanel
extends com.google.gwt.user.client.ui.ResizeComposite
implements CloseTabHandler, HasCloseTabHandler, HasTabClosedHandler, Scrollable, com.google.gwt.event.logical.shared.HasSelectionHandlers<java.lang.Integer>

Wrapped and restyled TabLayoutPanel. Since standard components do not provide a way to manipulate the tabs, such as closing the tab by clicking the mouse and scrolling tabs when the tabs of more than can't fit Tab container. This component was added this functionality.
Also Component can also draw additional controls in the tabs, see addTabButton(Widget)

Version:
$Id: Oct 6, 2011 evgen $
Author:
Evgen Vidolob

Nested Class Summary
 
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
TabPanel()
           
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addCloseTabHandler(CloseTabHandler closeTabHandler)
          Adds CloseTabHandler.
 com.google.gwt.event.shared.HandlerRegistration addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler<java.lang.Integer> handler)
           
 void addTab(java.lang.String tabId, com.google.gwt.user.client.ui.Image icon, java.lang.String tabText, com.google.gwt.user.client.ui.Widget widget, boolean canClose)
          Add new Tab
 void addTabButton(com.google.gwt.user.client.ui.Widget button)
          Adds user defined button to this TabPanel.
 com.google.gwt.event.shared.HandlerRegistration addTabClosedHandler(TabClosedHandler tabClosedHandler)
           
 int getSelectedTab()
           
 java.lang.String getTabIdByIndex(int tabIndex)
          Gets tab's ID through its index.
 com.google.gwt.user.client.ui.Widget getWidget(int i)
          Get widget associate with tab index
 void onCloseTab(CloseTabEvent event)
           
 void onResize()
           
 boolean remove(int index)
          Remove tab by this index
 void removeTab(java.lang.String tabId)
          Removes tab with specified Tab Id.
 void removeTabButton(com.google.gwt.user.client.ui.Widget tabButton)
          Removes user defined button from this TabPanel.
 void scrollLeft()
          Scrolls to the left.
 void scrollRight()
          Scrolls to the right.
 void selectTab(java.lang.String tabId)
          Selects tab with specified ID.
 void setTabIcon(java.lang.String tabId, com.google.gwt.user.client.ui.Image icon)
          Change tab icon
 void setTabTitle(java.lang.String tabId, java.lang.String title)
          Change tab title
 
Methods inherited from class com.google.gwt.user.client.ui.ResizeComposite
initWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, isAttached, onAttach, onBrowserEvent, onDetach, performDetachedInitialization, render, render, resolvePotentialElement, setWidget, wrapElement
 
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
 
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, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

TabPanel

public TabPanel()
Method Detail

onResize

public void onResize()
Specified by:
onResize in interface com.google.gwt.user.client.ui.RequiresResize
Overrides:
onResize in class com.google.gwt.user.client.ui.ResizeComposite
See Also:
ResizeComposite.onResize()

addTab

public void addTab(java.lang.String tabId,
                   com.google.gwt.user.client.ui.Image icon,
                   java.lang.String tabText,
                   com.google.gwt.user.client.ui.Widget widget,
                   boolean canClose)
Add new Tab

Parameters:
tabId - id of a tab
icon - Icon of tab
tabText - tab title
widget - content of the tab
canClose - is tab can close

onCloseTab

public void onCloseTab(CloseTabEvent event)
Specified by:
onCloseTab in interface CloseTabHandler
See Also:
CloseTabHandler.onCloseTab(org.exoplatform.gwtframework.ui.client.tab.event.CloseTabEvent)

selectTab

public void selectTab(java.lang.String tabId)
Selects tab with specified ID.

Parameters:
tabId - ID of tab which will be selected.

remove

public boolean remove(int index)
Remove tab by this index

Parameters:
index -
Returns:

setTabIcon

public void setTabIcon(java.lang.String tabId,
                       com.google.gwt.user.client.ui.Image icon)
Change tab icon

Parameters:
tabId - id of the tab
icon - new icon

setTabTitle

public void setTabTitle(java.lang.String tabId,
                        java.lang.String title)
Change tab title

Parameters:
tabId - is of the tab
title - new tab title

removeTab

public void removeTab(java.lang.String tabId)
Removes tab with specified Tab Id.

Parameters:
tabId -

addTabButton

public void addTabButton(com.google.gwt.user.client.ui.Widget button)
Adds user defined button to this TabPanel.

Parameters:
button - new button

removeTabButton

public void removeTabButton(com.google.gwt.user.client.ui.Widget tabButton)
Removes user defined button from this TabPanel.

Parameters:
tabButton -

getTabIdByIndex

public java.lang.String getTabIdByIndex(int tabIndex)
Gets tab's ID through its index.

Parameters:
tabIndex -
Returns:

addTabClosedHandler

public com.google.gwt.event.shared.HandlerRegistration addTabClosedHandler(TabClosedHandler tabClosedHandler)
Specified by:
addTabClosedHandler in interface HasTabClosedHandler
See Also:
HasTabClosedHandler.addTabClosedHandler(org.exoplatform.gwtframework.ui.client.tab.event.TabClosedHandler)

addCloseTabHandler

public com.google.gwt.event.shared.HandlerRegistration addCloseTabHandler(CloseTabHandler closeTabHandler)
Adds CloseTabHandler.

Specified by:
addCloseTabHandler in interface HasCloseTabHandler
See Also:
HasCloseTabHandler.addCloseTabHandler(org.exoplatform.gwtframework.ui.client.tab.event.CloseTabHandler)

getSelectedTab

public int getSelectedTab()
Returns:

scrollLeft

public void scrollLeft()
Description copied from interface: Scrollable
Scrolls to the left.

Specified by:
scrollLeft in interface Scrollable
See Also:
Scrollable.scrollLeft()

scrollRight

public void scrollRight()
Description copied from interface: Scrollable
Scrolls to the right.

Specified by:
scrollRight in interface Scrollable
See Also:
Scrollable.scrollRight()

addSelectionHandler

public com.google.gwt.event.shared.HandlerRegistration addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler<java.lang.Integer> handler)
Specified by:
addSelectionHandler in interface com.google.gwt.event.logical.shared.HasSelectionHandlers<java.lang.Integer>
See Also:
HasSelectionHandlers.addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler)

getWidget

public com.google.gwt.user.client.ui.Widget getWidget(int i)
Get widget associate with tab index

Parameters:
i - tab index
Returns:
widget


Copyright © 2012 eXo Platform SAS. All Rights Reserved.