Class ImgSectionHeader

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, HasSectionHeaderTitleHoverHandlers

public class ImgSectionHeader extends HLayout implements HasSectionHeaderTitleHoverHandlers
SectionHeader class based on an HLayout with StretchImg background.
  • Constructor Details

    • ImgSectionHeader

      public ImgSectionHeader()
    • ImgSectionHeader

      public ImgSectionHeader(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static ImgSectionHeader 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 HLayout
    • getBackground

      public StretchImg getBackground() throws IllegalStateException
      Background of the section header, based on a StretchImg.

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

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

      public ImgSectionHeader 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:
      ImgSectionHeader 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 ImgSectionHeader 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:
      ImgSectionHeader 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.
    • setIcon

      public ImgSectionHeader setIcon(String icon)
      Optional icon to be shown with the button title text.

      Specify as the partial URL to an image, relative to the imgDir of this component. A sprited image can be specified using the SCSpriteConfig format.

      Note that the string "blank" is a valid setting for this attribute and will always result in the system blank image, with no state suffixes applied. Typically, this might be used when an iconStyle is also specified and the iconStyle renders the icon via a stateful background-image or other CSS approach.

      If this method is called after the component has been drawn/initialized: Change the icon being shown for the header.

      Parameters:
      icon - URL of new icon. Default value is null
      Returns:
      ImgSectionHeader instance, for chaining setter calls
      See Also:
    • getIcon

      public String getIcon()
      Optional icon to be shown with the button title text.

      Specify as the partial URL to an image, relative to the imgDir of this component. A sprited image can be specified using the SCSpriteConfig format.

      Note that the string "blank" is a valid setting for this attribute and will always result in the system blank image, with no state suffixes applied. Typically, this might be used when an iconStyle is also specified and the iconStyle renders the icon via a stateful background-image or other CSS approach.

      Returns:
      Current icon value. Default value is null
      See Also:
    • setIconAlign

      public ImgSectionHeader setIconAlign(String iconAlign) throws IllegalStateException
      If this button is showing an icon should it be right or left aligned?
      Parameters:
      iconAlign - New iconAlign value. Default value is null
      Returns:
      ImgSectionHeader instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getIconAlign

      public String getIconAlign()
      If this button is showing an icon should it be right or left aligned?
      Returns:
      Current iconAlign value. Default value is null
      See Also:
    • setIconHeight

      public ImgSectionHeader setIconHeight(Integer iconHeight) throws IllegalStateException
      Height in pixels of the icon image.

      If unset, defaults to iconSize.

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

      public Integer getIconHeight()
      Height in pixels of the icon image.

      If unset, defaults to iconSize.

      Returns:
      Current iconHeight value. Default value is null
      See Also:
    • setIconOrientation

      public ImgSectionHeader setIconOrientation(String iconOrientation) throws IllegalStateException
      If this button is showing an icon should it appear to the left or right of the title? valid options are "left" and "right".

      If this method is called after the component has been drawn/initialized: If this header is showing an icon should it appear to the left or right of the title? Valid options are "left" and "right".
      Parameters:
      iconOrientation - the new orientation. Default value is "left"
      Returns:
      ImgSectionHeader instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getIconOrientation

      public String getIconOrientation()
      If this button is showing an icon should it appear to the left or right of the title? valid options are "left" and "right".
      Returns:
      Current iconOrientation value. Default value is "left"
      See Also:
    • setIconSize

      public ImgSectionHeader setIconSize(int iconSize) throws IllegalStateException
      Size in pixels of the icon image.

      The iconWidth and iconHeight properties can be used to configure width and height separately.

      Note: When configuring the properties of a StatefulCanvas (or derivative) AutoChild, it is best to set the iconWidth and iconHeight to the same value rather than setting an iconSize. This is because certain skins or customizations thereto might set the iconWidth and iconHeight, making the customization of the AutoChild's iconSize ineffective.

      Parameters:
      iconSize - New iconSize value. Default value is 16
      Returns:
      ImgSectionHeader instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getIconSize

      public int getIconSize()
      Size in pixels of the icon image.

      The iconWidth and iconHeight properties can be used to configure width and height separately.

      Note: When configuring the properties of a StatefulCanvas (or derivative) AutoChild, it is best to set the iconWidth and iconHeight to the same value rather than setting an iconSize. This is because certain skins or customizations thereto might set the iconWidth and iconHeight, making the customization of the AutoChild's iconSize ineffective.

      Returns:
      Current iconSize value. Default value is 16
      See Also:
    • setIconWidth

      public ImgSectionHeader setIconWidth(Integer iconWidth) throws IllegalStateException
      Width in pixels of the icon image.

      If unset, defaults to iconSize.

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

      public Integer getIconWidth()
      Width in pixels of the icon image.

      If unset, defaults to iconSize.

      Returns:
      Current iconWidth value. Default value is null
      See Also:
    • setNoDoubleClicks

      public ImgSectionHeader 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:
      ImgSectionHeader 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
    • setPrompt

      public ImgSectionHeader setPrompt(String prompt)
      Prompt displayed in hover canvas if showHover is true.

      If this method is called after the component has been drawn/initialized: Sets the text shown as a tooltip for the header.
      Overrides:
      setPrompt in class Canvas
      Parameters:
      prompt - the new tooltip. Default value is null
      Returns:
      ImgSectionHeader instance, for chaining setter calls
      See Also:
    • getPrompt

      public String getPrompt()
      Prompt displayed in hover canvas if showHover is true.
      Overrides:
      getPrompt in class Canvas
      Returns:
      Current prompt value. Default value is null
      See Also:
    • setShowClippedTitleOnHover

      public ImgSectionHeader setShowClippedTitleOnHover(Boolean showClippedTitleOnHover)
      If true and the title is clipped, then a hover containing the full title of this section header is enabled.
      Parameters:
      showClippedTitleOnHover - New showClippedTitleOnHover value. Default value is true
      Returns:
      ImgSectionHeader 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.
      Returns:
      Current showClippedTitleOnHover value. Default value is true
    • setTitle

      public void setTitle(String title)
      Title to show for the section
      Overrides:
      setTitle in class Canvas
      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 Canvas
      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
    • setAlign

      public void setAlign(String align)
      Sets the horizontal alignment of the title.
      Parameters:
      align - the new alignment
    • titleClipped

      public boolean titleClipped()
      Is the title of this section header clipped by section controls or the edge of the header?
      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 ImgSectionHeader.showClippedTitleOnHover is true, the default behavior is to show a hover canvas containing the HTML returned by ImgSectionHeader.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.

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

      public static void setDefaultProperties(ImgSectionHeader imgSectionHeaderProperties)
      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:
      imgSectionHeaderProperties - 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).
    • setLogicalStructure

      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 HLayout