org.cruxframework.crux.widgets.client.rollingtabs
Class RollingTabBar

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 org.cruxframework.crux.widgets.client.rollingtabs.RollingTabBar
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasBeforeSelectionHandlers<Integer>, com.google.gwt.event.logical.shared.HasSelectionHandlers<Integer>, 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

public class RollingTabBar
extends com.google.gwt.user.client.ui.Composite
implements com.google.gwt.event.logical.shared.HasBeforeSelectionHandlers<Integer>, com.google.gwt.event.logical.shared.HasSelectionHandlers<Integer>

Modified version of GWT TabBar that uses a CustomRollingPanel wrapping its Tabs.

Author:
Thiago da Rosa de Bustamante -

Nested Class Summary
static interface RollingTabBar.Tab
          Set of characteristic interfaces supported by TabBar tabs.
 
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
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addBeforeSelectionHandler(com.google.gwt.event.logical.shared.BeforeSelectionHandler<Integer> handler)
           
 com.google.gwt.event.shared.HandlerRegistration addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler<Integer> handler)
           
 int getSelectedTab()
          Gets the tab that is currently selected.
 RollingTabBar.Tab getTab(int index)
          Gets the given tab.
 int getTabCount()
          Gets the number of tabs present.
 void insertTab(String text, boolean asHTML, int beforeIndex)
          Inserts a new tab at the specified index.
 void insertTab(com.google.gwt.user.client.ui.Widget widget, int beforeIndex)
          Inserts a new tab at the specified index.
protected  void insertTabWidget(com.google.gwt.user.client.ui.Widget widget, int beforeIndex)
          Inserts a new tab at the specified index.
protected  void onEnsureDebugId(String baseID)
          Affected Elements: -tab# = The element containing the contents of the tab.
protected  void removeTab(int index)
          Removes the tab at the specified index.
 boolean selectTab(int index)
          Programmatically selects the specified tab.
 void setTabEnabled(int index, boolean enabled)
          Enable or disable a 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, 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, 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 com.google.gwt.event.shared.HasHandlers
fireEvent
 

Method Detail

addBeforeSelectionHandler

public com.google.gwt.event.shared.HandlerRegistration addBeforeSelectionHandler(com.google.gwt.event.logical.shared.BeforeSelectionHandler<Integer> handler)
Specified by:
addBeforeSelectionHandler in interface com.google.gwt.event.logical.shared.HasBeforeSelectionHandlers<Integer>
See Also:
HasBeforeSelectionHandlers.addBeforeSelectionHandler(com.google.gwt.event.logical.shared.BeforeSelectionHandler)

addSelectionHandler

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

getSelectedTab

public int getSelectedTab()
Gets the tab that is currently selected.

Returns:
the selected tab

getTabCount

public int getTabCount()
Gets the number of tabs present.

Returns:
the tab count

setTabEnabled

public void setTabEnabled(int index,
                          boolean enabled)
Enable or disable a tab. When disabled, users cannot select the tab.

Parameters:
index - the index of the tab to enable or disable
enabled - true to enable, false to disable

getTab

public final RollingTabBar.Tab getTab(int index)
Gets the given tab. This method is final because the Flap interface will expand. Therefore it is highly likely that subclasses which implemented this method would end up breaking.

Parameters:
index - the tab's index
Returns:
the tab wrapper

insertTab

public void insertTab(com.google.gwt.user.client.ui.Widget widget,
                      int beforeIndex)
Inserts a new tab at the specified index.

Parameters:
widget - widget to be used in the new tab
beforeIndex - the index before which this tab will be inserted

insertTab

public void insertTab(String text,
                      boolean asHTML,
                      int beforeIndex)
Inserts a new tab at the specified index.

Parameters:
text - the new tab's text
asHTML - true to treat the specified text as HTML
beforeIndex - the index before which this tab will be inserted

selectTab

public boolean selectTab(int index)
Programmatically selects the specified tab. Use index -1 to specify that no tab should be selected.

Parameters:
index - the index of the tab to be selected
Returns:
true if successful, false if the change is denied by the BeforeSelectionHandler.

insertTabWidget

protected void insertTabWidget(com.google.gwt.user.client.ui.Widget widget,
                               int beforeIndex)
Inserts a new tab at the specified index.

Parameters:
widget - widget to be used in the new tab
beforeIndex - the index before which this tab will be inserted

onEnsureDebugId

protected void onEnsureDebugId(String baseID)
Affected Elements:

Overrides:
onEnsureDebugId in class com.google.gwt.user.client.ui.UIObject
See Also:
UIObject.onEnsureDebugId(String)

removeTab

protected void removeTab(int index)
Removes the tab at the specified index.

Parameters:
index - the index of the tab to be removed


Copyright © 2015. All rights reserved.