Class SectionHeader

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, HasIconClickHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseStillDownHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasMovedHandlers, HasParentMovedHandlers, HasResizedHandlers, HasRightMouseDownHandlers, HasRuleContextChangedHandlers, HasScrolledHandlers, HasShowContextMenuHandlers, HasTitleHoverHandlers, HasVisibilityChangedHandlers, HasSectionHeaderTitleHoverHandlers

public class SectionHeader extends Label implements HasSectionHeaderTitleHoverHandlers
Simple SectionHeader class based on a Label with an icon, skinnable via CSS.
  • Constructor Details

    • SectionHeader

      public SectionHeader()
    • SectionHeader

      public SectionHeader(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static SectionHeader 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 Label
    • setBaseStyle

      public SectionHeader setBaseStyle(String baseStyle) throws IllegalStateException
      CSS class for the section header.

      Note : This is an advanced setting

      Overrides:
      setBaseStyle in class Button
      Parameters:
      baseStyle - New baseStyle value. Default value is "sectionHeader"
      Returns:
      SectionHeader instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getBaseStyle

      public String getBaseStyle()
      CSS class for the section header.
      Overrides:
      getBaseStyle in class Button
      Returns:
      Current baseStyle value. Default value is "sectionHeader"
      See Also:
    • setClipTitle

      public SectionHeader setClipTitle(Boolean clipTitle) throws IllegalStateException
      If the title for this section header is too large for the available space, should the title be clipped?

      This feature is supported only in browsers that support the CSS UI text-overflow property (IE6+, Firefox 7+, Safari, Chrome, Opera 9+).

      Parameters:
      clipTitle - New clipTitle value. Default value is true
      Returns:
      SectionHeader instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getClipTitle

      public Boolean getClipTitle()
      If the title for this section header is too large for the available space, should the title be clipped?

      This feature is supported only in browsers that support the CSS UI text-overflow property (IE6+, Firefox 7+, Safari, Chrome, Opera 9+).

      Returns:
      Current clipTitle value. Default value is true
    • setControls

      public SectionHeader setControls(Canvas... controls) throws IllegalStateException
      Custom controls to be shown on top of this section header.

      These controls are shown in the controlsLayout.

      Note that this is an init-time property. If you need to dynamically change what controls are displayed to the user, we would recommend embedding the controls in a Layout or similar container. This will allow you to show/hide or add/remove members at runtime by manipulating the existing control(s) set up at init time.

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

      public Layout getControlsLayout() throws IllegalStateException
      A Layout containing specified controls if any. Sets Layout.membersMargin:5, Layout.defaultLayoutAlign:"center", and RTL-sensitive Layout.align (right by default).

      This component is an AutoChild named "controlsLayout". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current controlsLayout value. Default value is null
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • setDefiningProperty

      public SectionHeader setDefiningProperty(String definingProperty)
      This attribute denotes the name of a property to use as a getDefiningPropertyName() for this property when generating and resolving AutoTest locators with search segments.

      Note : This is an advanced setting

      Overrides:
      setDefiningProperty in class Button
      Parameters:
      definingProperty - New definingProperty value. Default value is "title"
      Returns:
      SectionHeader instance, for chaining setter calls
    • getDefiningProperty

      public String getDefiningProperty()
      This attribute denotes the name of a property to use as a getDefiningPropertyName() for this property when generating and resolving AutoTest locators with search segments.
      Overrides:
      getDefiningProperty in class Button
      Returns:
      Current definingProperty value. Default value is "title"
    • setEditProxyConstructor

      public SectionHeader 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 Label
      Parameters:
      editProxyConstructor - New editProxyConstructor value. Default value is "SectionStackSectionEditProxy"
      Returns:
      SectionHeader 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 Label
      Returns:
      Current editProxyConstructor value. Default value is "SectionStackSectionEditProxy"
      See Also:
    • setIcon

      public SectionHeader setIcon(String icon) throws IllegalStateException
      Base filename of the icon that represents open and closed states. The default settings also change the icon for disabled sections, so a total of four images are required (opened, closed, Disabled_opened, Disabled_closed).

      Not shown if SectionStackSection.canCollapse is false.

      Note : This is an advanced setting

      Overrides:
      setIcon in class Label
      Parameters:
      icon - New icon value. Default value is "[SKIN]SectionHeader/opener.gif"
      Returns:
      SectionHeader instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getIcon

      public String getIcon()
      Base filename of the icon that represents open and closed states. The default settings also change the icon for disabled sections, so a total of four images are required (opened, closed, Disabled_opened, Disabled_closed).

      Not shown if SectionStackSection.canCollapse is false.

      Overrides:
      getIcon in class Label
      Returns:
      Current icon value. Default value is "[SKIN]SectionHeader/opener.gif"
      See Also:
    • setNoDoubleClicks

      public SectionHeader setNoDoubleClicks(Boolean noDoubleClicks) throws IllegalStateException
      By default doubleClicks are disabled for SectionHeaders. All mouse click events will be handled as single clicks. Set this property to false to enable standard double-click handling.

      Note : This is an advanced setting

      Overrides:
      setNoDoubleClicks in class Canvas
      Parameters:
      noDoubleClicks - New noDoubleClicks value. Default value is true
      Returns:
      SectionHeader instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getNoDoubleClicks

      public Boolean getNoDoubleClicks()
      By default doubleClicks are disabled for SectionHeaders. All mouse click events will be handled as single clicks. Set this property to false to enable standard double-click handling.
      Overrides:
      getNoDoubleClicks in class Canvas
      Returns:
      Current noDoubleClicks value. Default value is true
    • setShowClippedTitleOnHover

      public SectionHeader setShowClippedTitleOnHover(Boolean showClippedTitleOnHover)
      If true and the title is clipped, then a hover containing the full title of this section header is enabled.
      Overrides:
      setShowClippedTitleOnHover in class Button
      Parameters:
      showClippedTitleOnHover - New showClippedTitleOnHover value. Default value is true
      Returns:
      SectionHeader instance, for chaining setter calls
    • getShowClippedTitleOnHover

      public Boolean getShowClippedTitleOnHover()
      If true and the title is clipped, then a hover containing the full title of this section header is enabled.
      Overrides:
      getShowClippedTitleOnHover in class Button
      Returns:
      Current showClippedTitleOnHover value. Default value is true
    • setTitle

      public void setTitle(String title)
      Title to show for the section
      Overrides:
      setTitle in class Button
      Parameters:
      title - New title value. Default value is null
      See Also:
    • getTitle

      public String getTitle()
      Title to show for the section
      Overrides:
      getTitle in class Button
      Returns:
      Current title value. Default value is null
      See Also:
    • getSectionStack

      public SectionStack getSectionStack()
      For a SectionHeader embedded in a SectionStack, this method will return a pointer to the SectionStack in which this section header is embedded.
      Returns:
      Section Stack containing this section header
    • titleClipped

      public boolean titleClipped()
      Is the title of this section header clipped by section controls or the edge of the header?
      Overrides:
      titleClipped in class Button
      Returns:
      whether the title is clipped.
      See Also:
    • addSectionHeaderTitleHoverHandler

      public HandlerRegistration addSectionHeaderTitleHoverHandler(SectionHeaderTitleHoverHandler handler)
      Add a sectionHeaderTitleHover handler.

      Optional stringMethod to fire when the user hovers over this section header and the title is clipped. If SectionHeader.showClippedTitleOnHover is true, the default behavior is to show a hover canvas containing the HTML returned by SectionHeader.titleHoverHTML(). Call SectionHeaderTitleHoverEvent.cancel() from within SectionHeaderTitleHoverHandler.onSectionHeaderTitleHover(com.smartgwt.client.widgets.layout.events.SectionHeaderTitleHoverEvent) to suppress this default behavior.

      Specified by:
      addSectionHeaderTitleHoverHandler in interface HasSectionHeaderTitleHoverHandlers
      Parameters:
      handler - the sectionHeaderTitleHover handler
      Returns:
      HandlerRegistration used to remove this handler
    • titleHoverHTML

      public String titleHoverHTML(String defaultHTML)
      Returns the HTML that is displayed by the default titleHover handler. Return null or an empty string to cancel the hover.

      Use setTitleHoverFormatter() to provide a custom implementation.

      Overrides:
      titleHoverHTML in class Button
      Parameters:
      defaultHTML - the HTML that would have been displayed by default. See HTMLString
      Returns:
      HTML to be displayed in the hover. If an empty string, then the hover is canceled. If null, then the default HTML is used. See HTMLString
      See Also:
    • setDefaultProperties

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

      public SectionStackSection getSection()
      Retrieve the SectionStackSection associated with this header
      Returns:
      the SectionStackSection for the section header
    • setTitleHoverFormatter

      public void setTitleHoverFormatter(TitleHoverFormatter formatter)
      Provide a custom implementation of titleHoverHTML(java.lang.String).
      Overrides:
      setTitleHoverFormatter in class Button
    • setLogicalStructure

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