Class ToolStrip

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
Direct Known Subclasses:
RibbonBar

public class ToolStrip extends Layout
Base class for creating toolstrips like those found in browsers and office applications: a mixed set of controls including icon buttons, radio button groups, menus, comboBoxes, spacers, status displays and drop-down selects.

All of the above components are placed in the members array to form a ToolStrip. Note that the FormItems mentioned above (ComboBox and drop-down selects) need to be placed within a DynamicForm as usual.

Instances of the following classes can be used to add special behaviors:

See the ToolStrips Example example.
  • Constructor Details

    • ToolStrip

      public ToolStrip()
    • ToolStrip

      public ToolStrip(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static ToolStrip 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 Layout
    • getFormWrapper

      public DynamicForm getFormWrapper()
      Note : This API is non-functional (always returns null) and exists only to make you aware that this MultiAutoChild exists. See Using AutoChildren for details.

      DynamicForm instance created by addFormItem() to contain form items for display in this toolStrip. Each time addFormItem() is run, a new formWrapper autoChild will be created, picking up properties according to the standard com.smartgwt.client.types.AutoChild pattern.

      Returns:
      null
    • setResizeBarClass

      public ToolStrip setResizeBarClass(String resizeBarClass) throws IllegalStateException
      Customized resizeBar with typical appearance for a ToolStrip.
      Overrides:
      setResizeBarClass in class Layout
      Parameters:
      resizeBarClass - New resizeBarClass value. Default value is "ToolStripResizer"
      Returns:
      ToolStrip instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getResizeBarClass

      public String getResizeBarClass()
      Customized resizeBar with typical appearance for a ToolStrip.
      Overrides:
      getResizeBarClass in class Layout
      Returns:
      Current resizeBarClass value. Default value is "ToolStripResizer"
      See Also:
    • setResizeBarSize

      public ToolStrip setResizeBarSize(int resizeBarSize) throws IllegalStateException
      Thickness of the resizeBars in pixels.

      Note : This is an advanced setting

      Overrides:
      setResizeBarSize in class Layout
      Parameters:
      resizeBarSize - New resizeBarSize value. Default value is 14
      Returns:
      ToolStrip instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getResizeBarSize

      public int getResizeBarSize()
      Thickness of the resizeBars in pixels.
      Overrides:
      getResizeBarSize in class Layout
      Returns:
      Current resizeBarSize value. Default value is 14
    • setSeparatorBreadth

      public ToolStrip setSeparatorBreadth(int separatorBreadth) throws IllegalStateException
      Separator height, when vertical is true, or width otherwise.
      Parameters:
      separatorBreadth - New separatorBreadth value. Default value is 22
      Returns:
      ToolStrip instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getSeparatorBreadth

      public int getSeparatorBreadth()
      Separator height, when vertical is true, or width otherwise.
      Returns:
      Current separatorBreadth value. Default value is 22
    • setSeparatorClass

      public ToolStrip setSeparatorClass(String separatorClass) throws IllegalStateException
      Class to create when the string "separator" appears in members.
      Parameters:
      separatorClass - New separatorClass value. Default value is "ToolStripSeparator"
      Returns:
      ToolStrip instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getSeparatorClass

      public String getSeparatorClass()
      Class to create when the string "separator" appears in members.
      Returns:
      Current separatorClass value. Default value is "ToolStripSeparator"
    • setSeparatorSize

      public ToolStrip setSeparatorSize(int separatorSize) throws IllegalStateException
      Separator thickness in pixels
      Parameters:
      separatorSize - New separatorSize value. Default value is 8
      Returns:
      ToolStrip instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getSeparatorSize

      public int getSeparatorSize()
      Separator thickness in pixels
      Returns:
      Current separatorSize value. Default value is 8
    • setStyleName

      public void setStyleName(String styleName)
      CSS class applied to this toolstrip.

      Note that if vertical is true for this toolStrip, verticalStyleName will be used instead of this value if it is non-null.

      Overrides:
      setStyleName in class Canvas
      Parameters:
      styleName - New styleName value. Default value is "toolStrip"
      See Also:
    • getStyleName

      public String getStyleName()
      CSS class applied to this toolstrip.

      Note that if vertical is true for this toolStrip, verticalStyleName will be used instead of this value if it is non-null.

      Overrides:
      getStyleName in class Canvas
      Returns:
      Current styleName value. Default value is "toolStrip"
      See Also:
    • setVertical

      public ToolStrip setVertical(Boolean vertical) throws IllegalStateException
      Indicates whether the components are drawn horizontally from left to right (false), or vertically from top to bottom (true).
      Overrides:
      setVertical in class Layout
      Parameters:
      vertical - New vertical value. Default value is false
      Returns:
      ToolStrip instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getVertical

      public Boolean getVertical()
      Indicates whether the components are drawn horizontally from left to right (false), or vertically from top to bottom (true).
      Overrides:
      getVertical in class Layout
      Returns:
      Current vertical value. Default value is false
      See Also:
    • setVerticalStyleName

      public ToolStrip setVerticalStyleName(String verticalStyleName) throws IllegalStateException
      Default stylename to use if this.vertical is true. If unset, the standard styleName will be used for both vertical and horizontal toolstrips.

      Note that this property only applies to the widget at init time. To modify the styleName after this widget has been initialized, you should simply call setStyleName() rather than updating this property.

      Parameters:
      verticalStyleName - New verticalStyleName value. Default value is null
      Returns:
      ToolStrip instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getVerticalStyleName

      public String getVerticalStyleName()
      Default stylename to use if this.vertical is true. If unset, the standard styleName will be used for both vertical and horizontal toolstrips.

      Note that this property only applies to the widget at init time. To modify the styleName after this widget has been initialized, you should simply call setStyleName() rather than updating this property.

      Returns:
      Current verticalStyleName value. Default value is null
      See Also:
    • setDefaultProperties

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

      public void addFormItem(FormItem formItem)
      Add a FormItem to the ToolStrip.
      Parameters:
      formItem - the formItem
    • addFormItem

      public void addFormItem(FormItem formItem, int position)
      Add a FormItem to the ToolStrip.
      Parameters:
      formItem - the FormItem
      position - the position in the layout to place newMember (starts with 0); if omitted, it will be added at the last position
    • addButton

      public void addButton(ToolStripButton button)
      Add a button to the ToolStrip.
      Parameters:
      button - the toolstrip button
    • addButton

      public void addButton(ToolStripButton button, int position)
      Add a button to the ToolStrip.
      Parameters:
      button - the button
      position - the position in the layout to place newMember (starts with 0); if omitted, it will be added at the last position
    • addMenuButton

      public void addMenuButton(ToolStripMenuButton button)
      Add a menu button to the ToolStrip.
      Parameters:
      button - the toolstrip menu button
    • addMenuButton

      public void addMenuButton(ToolStripMenuButton button, int position)
      Add a menu button to the ToolStrip.
      Parameters:
      button - the menu button
      position - the position in the layout to place newMember (starts with 0); if omitted, it will be added at the last position
    • addSpacer

      public void addSpacer(int space)
      Add an extra space to the right of the previously added ToolStrip element. This is a shortcut for addSpacer(ToolStripSpacer).
      Parameters:
      space - space
    • addSpacer

      public void addSpacer(ToolStripSpacer toolStripSpacer)
      Add an extra space to the right of the previously added ToolStrip element.
      Parameters:
      toolStripSpacer - the toolstip spacer.
    • addFill

      public void addFill()
      Adds a ToolStripSpacer to the ToolStrip to take up space such like a normal member, without actually drawing anything. This causes the "next" member added to the toolstip to be right / bottom justified depending on the alignment of the ToolStrip.
    • addSeparator

      public void addSeparator()
      Add a separator.
    • addResizer

      public void addResizer()
      Add a resizer
    • setLogicalStructure

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