Class TabBar

All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, LogicalStructure, HasClearHandlers, HasClickHandlers, HasDoubleClickHandlers, HasDragMoveHandlers, HasDragRepositionMoveHandlers, HasDragRepositionStartHandlers, HasDragRepositionStopHandlers, HasDragResizeMoveHandlers, HasDragResizeStartHandlers, HasDragResizeStopHandlers, HasDragStartHandlers, HasDragStopHandlers, HasDropHandlers, HasDropMoveHandlers, HasDropOutHandlers, HasDropOverHandlers, HasFocusChangedHandlers, HasHoverHandlers, HasHoverHiddenHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseStillDownHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasMovedHandlers, HasParentMovedHandlers, HasResizedHandlers, HasRightMouseDownHandlers, HasRuleContextChangedHandlers, HasScrolledHandlers, HasShowContextMenuHandlers, HasVisibilityChangedHandlers, HasMembersChangedHandlers, HasItemClickHandlers, HasItemDragResizedHandlers

public class TabBar extends Toolbar
Shows a set of Tabs. TabBars are automatically created by TabSets and shouldn't be used directly. The TabBar is documented for skinning purposes.
  • Constructor Details

  • Method Details

    • getOrCreateRef

      public static TabBar getOrCreateRef(JavaScriptObject jsObj)
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, Canvas defaults)
      Changes the defaults for Canvas AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - Canvas defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, FormItem defaults)
      Changes the defaults for FormItem AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - FormItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • create

      protected JavaScriptObject create()
      Overrides:
      create in class Toolbar
    • setBaseLineCapSize

      public TabBar setBaseLineCapSize(int baseLineCapSize) throws IllegalStateException
      Set StretchImg.capSize for the BaseLine stretchImg.
      Parameters:
      baseLineCapSize - New baseLineCapSize value. Default value is 2
      Returns:
      TabBar instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getBaseLineCapSize

      public int getBaseLineCapSize()
      Set StretchImg.capSize for the BaseLine stretchImg.
      Returns:
      Current baseLineCapSize value. Default value is 2
      See Also:
    • setBaseLineSrc

      public TabBar setBaseLineSrc(String baseLineSrc) throws IllegalStateException
      Sets StretchImg.src for the BaseLine StretchImg.
      Parameters:
      baseLineSrc - New baseLineSrc value. Default value is "[SKIN]baseline.gif"
      Returns:
      TabBar instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getBaseLineSrc

      public String getBaseLineSrc()
      Sets StretchImg.src for the BaseLine StretchImg.
      Returns:
      Current baseLineSrc value. Default value is "[SKIN]baseline.gif"
      See Also:
    • setBaseLineThickness

      public TabBar setBaseLineThickness(int baseLineThickness) throws IllegalStateException
      Thickness of the baseLine, in pixels. This should be set to match the media specified by baseLineSrc. The baseLineThickness also determines the degree of overlap with the TabSet's paneContainer when using decorative edges - see TabSet.paneContainer for details.
      Parameters:
      baseLineThickness - New baseLineThickness value. Default value is 1
      Returns:
      TabBar instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getBaseLineThickness

      public int getBaseLineThickness()
      Thickness of the baseLine, in pixels. This should be set to match the media specified by baseLineSrc. The baseLineThickness also determines the degree of overlap with the TabSet's paneContainer when using decorative edges - see TabSet.paneContainer for details.
      Returns:
      Current baseLineThickness value. Default value is 1
      See Also:
    • setBreadth

      public TabBar setBreadth(int breadth)
      Breadth of the tabBar (including baseline breadth)
      Parameters:
      breadth - New breadth value. Default value is 21
      Returns:
      TabBar instance, for chaining setter calls
    • getBreadth

      public int getBreadth()
      Breadth of the tabBar (including baseline breadth)
      Returns:
      Current breadth value. Default value is 21
    • setCloseTabKeys

      public TabBar setCloseTabKeys(KeyIdentifier... closeTabKeys) throws IllegalStateException
      An array of shortcut keyboard commands which will close the currently selected tab, if the currently selected tab is closeable. Either this TabBar or the currently selected tab must have keyboard focus.

      By default, this is an array of two KeyIdentifiers: Alt+Delete, which is the keyboard command recommended by WAI-ARIA Authoring Practices, and Ctrl+W. Notes:

      • On Mac, the Alt+Delete keyboard command is accomplished via Fn-Option-Delete.
      • Alt+Delete is a JAWS Keystroke to "Say Active Cursor". If using JAWS, pressing Alt+Shift+Delete will close the tab.
      • In Chrome, Firefox, and Internet Explorer on Windows, Ctrl+W will also close the browser tab/window if focus is not within a TabBar. If Ctrl+W will be used frequently by the application's users, it may be useful to register this key to cancel it by default:
        final KeyIdentifier ctrlWKey = new KeyIdentifier();
         ctrlWKey.setCtrlKey(true);
         ctrlWKey.setKeyName("W");
         Page.registerKey(ctrlWKey, new PageKeyHandler() {
             @Override
             public void execute(String keyName) {
                 cancel();
             }
         });

      Note : This is an advanced setting

      Parameters:
      closeTabKeys - New closeTabKeys value. Default value is see below
      Returns:
      TabBar instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getCloseTabKeys

      public KeyIdentifier[] getCloseTabKeys()
      An array of shortcut keyboard commands which will close the currently selected tab, if the currently selected tab is closeable. Either this TabBar or the currently selected tab must have keyboard focus.

      By default, this is an array of two KeyIdentifiers: Alt+Delete, which is the keyboard command recommended by WAI-ARIA Authoring Practices, and Ctrl+W. Notes:

      • On Mac, the Alt+Delete keyboard command is accomplished via Fn-Option-Delete.
      • Alt+Delete is a JAWS Keystroke to "Say Active Cursor". If using JAWS, pressing Alt+Shift+Delete will close the tab.
      • In Chrome, Firefox, and Internet Explorer on Windows, Ctrl+W will also close the browser tab/window if focus is not within a TabBar. If Ctrl+W will be used frequently by the application's users, it may be useful to register this key to cancel it by default:
        final KeyIdentifier ctrlWKey = new KeyIdentifier();
         ctrlWKey.setCtrlKey(true);
         ctrlWKey.setKeyName("W");
         Page.registerKey(ctrlWKey, new PageKeyHandler() {
             @Override
             public void execute(String keyName) {
                 cancel();
             }
         });
      Returns:
      Current closeTabKeys value. Default value is see below
    • setDefaultTabSize

      public TabBar setDefaultTabSize(int defaultTabSize) throws IllegalStateException
      Default size (length) in pixels for tabs within this tabBar
      Parameters:
      defaultTabSize - New defaultTabSize value. Default value is 80
      Returns:
      TabBar instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getDefaultTabSize

      public int getDefaultTabSize()
      Default size (length) in pixels for tabs within this tabBar
      Returns:
      Current defaultTabSize value. Default value is 80
    • setEditProxyConstructor

      public TabBar setEditProxyConstructor(String editProxyConstructor) throws IllegalStateException
      Default class used to construct the EditProxy for this component when the component is first placed into edit mode.
      Overrides:
      setEditProxyConstructor in class Layout
      Parameters:
      editProxyConstructor - New editProxyConstructor value. Default value is "TabBarEditProxy"
      Returns:
      TabBar instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getEditProxyConstructor

      public String getEditProxyConstructor()
      Default class used to construct the EditProxy for this component when the component is first placed into edit mode.
      Overrides:
      getEditProxyConstructor in class Layout
      Returns:
      Current editProxyConstructor value. Default value is "TabBarEditProxy"
      See Also:
    • setMoreTab

      public TabBar setMoreTab(Tab moreTab) throws IllegalStateException
      Tab to show as the "more" tab when showMoreTab is enabled and the number of tabs to show exceeds moreTabCount.
      Parameters:
      moreTab - New moreTab value. Default value is null
      Returns:
      TabBar instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getMoreTab

      public Tab getMoreTab()
      Tab to show as the "more" tab when showMoreTab is enabled and the number of tabs to show exceeds moreTabCount.
      Returns:
      Current moreTab value. Default value is null
    • setMoreTabCount

      public TabBar setMoreTabCount(int moreTabCount) throws IllegalStateException
      This property defines the number tab buttons that should be shown before automatically adding a "more" button to handle the remaining tabs. This property is only used when showMoreTab is enabled.
      Parameters:
      moreTabCount - New moreTabCount value. Default value is 5
      Returns:
      TabBar instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getMoreTabCount

      public int getMoreTabCount()
      This property defines the number tab buttons that should be shown before automatically adding a "more" button to handle the remaining tabs. This property is only used when showMoreTab is enabled.
      Returns:
      Current moreTabCount value. Default value is 5
    • setShowMoreTab

      public TabBar setShowMoreTab(Boolean showMoreTab) throws IllegalStateException
      Should tabs exceeding moreTabCount be shown on a "more" tab?

      This setting is used to emulate an iPhone-style tab bar "more" button.

      Parameters:
      showMoreTab - New showMoreTab value. Default value is null
      Returns:
      TabBar instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getShowMoreTab

      public Boolean getShowMoreTab()
      Should tabs exceeding moreTabCount be shown on a "more" tab?

      This setting is used to emulate an iPhone-style tab bar "more" button.

      Returns:
      Current showMoreTab value. Default value is null
    • selectTab

      public void selectTab(int tabNum)
      Select a tab
      Parameters:
      tabNum - index of tab to select
    • setDefaultProperties

      public static void setDefaultProperties(TabBar tabBarProperties)
      Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.

      Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.

      Parameters:
      tabBarProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • setLogicalStructure

      public LogicalStructureObject setLogicalStructure(TabBarLogicalStructure s)
      Setter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
    • getLogicalStructure

      public LogicalStructureObject getLogicalStructure()
      Getter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
      Specified by:
      getLogicalStructure in interface LogicalStructure
      Overrides:
      getLogicalStructure in class Toolbar