Class MenuBar

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 MenuBar extends Toolbar
A MenuBar is a bar of buttons used to show a set of menus.
  • Constructor Details

  • Method Details

    • getOrCreateRef

      public static MenuBar 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
    • setEditProxyConstructor

      public MenuBar 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 "MenuEditProxy"
      Returns:
      MenuBar 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 "MenuEditProxy"
      See Also:
    • setMenus

      public MenuBar setMenus(Menu... menus)
      An array of menu object initializers or instantiated menu objects. Buttons for each menu item will automatically be created. See the Menu Widget Class for fundamental menu properties and other properties. Titles for the buttons are derived from the title property of each menu.

      If this method is called after the component has been drawn/initialized: Dynamically reset the set of menus displayed by this menu bar.
      Parameters:
      menus - array of new menus for this menubar. Default value is null
      Returns:
      MenuBar instance, for chaining setter calls
      See Also:
    • setDefaultProperties

      public static void setDefaultProperties(MenuBar menuBarProperties)
      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:
      menuBarProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • addMenus

      public void addMenus(Menu[] menus, int position)
      Dynamically update the menuBar to include additional menus. Will update the visible set of buttons as appropriate.
      Parameters:
      menus - Array of new menus to add
      position - desired starting position of the new menus in the existing menus array
    • showMenu

      public void showMenu(int menuNum)
      Shows (opens) a menu.
      Parameters:
      menuNum - the menu to show
    • setLogicalStructure

      public LogicalStructureObject setLogicalStructure(MenuBarLogicalStructure 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