Class ImgTab

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

public class ImgTab extends StretchImgButton
Specialized StretchImgButton used by TabSet/TabBar for tabs
  • Constructor Details

  • Method Details

    • getOrCreateRef

      public static ImgTab 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 StretchImgButton
    • setAlign

      public ImgTab setAlign(Alignment align)
      Alignment of title text
      Overrides:
      setAlign in class StretchImgButton
      Parameters:
      align - New align value. Default value is Canvas.CENTER
      Returns:
      ImgTab instance, for chaining setter calls
      See Also:
    • getAlign

      public Alignment getAlign()
      Alignment of title text
      Overrides:
      getAlign in class StretchImgButton
      Returns:
      Current align value. Default value is Canvas.CENTER
      See Also:
    • setBaseStyle

      public ImgTab setBaseStyle(String baseStyle) throws IllegalStateException
      Description copied from class: StretchImgButton
      Base CSS style className applied to the component.

      Note that if specified, this property takes precedence over any specified StatefulCanvas.styleName. If unset, the styleName will be used as a default baseStyle value.

      As the component changes StatefulCanvas.state and/or is selected, suffixes will be added to the base style. In some cases more than one suffix will be appended to reflect a combined state ("Selected" + "Disabled", for example).

      See StatefulCanvas.getStateSuffix() for a description of the default set of suffixes which may be applied to the baseStyle

      Rotated Titles

      The Framework doesn't have built-in support for rotating button titles in a fashion similar to FacetChart.rotateLabels. However, you can manually configure a button to render with a rotated title by applying custom CSS via this property.

      For example, given a button with a height of 120 and a width of 48, if you copied the existing buttonXXX style declarations from skin_styles.css as new, rotatedTitleButtonXXX declarations, and then added the lines:

            -ms-transform:     translate(-38px,0px) rotate(270deg);
            -webkit-transform: translate(-38px,0px) rotate(270deg);
            transform:         translate(-38px,0px) rotate(270deg);
            overflow: hidden;
            text-overflow: ellipsis;
            width:116px;
      in the declaration section beginning:
        .rotatedTitleButton,
        .rotatedTitleButtonSelected,
        .rotatedTitleButtonSelectedOver,
        .rotatedTitleButtonSelectedDown,
        .rotatedTitleButtonSelectedDisabled,
        .rotatedTitleButtonOver,
        .rotatedTitleButtonDown,
        .rotatedTitleButtonDisabled {
      then applying that style to the button with overflow: "clip_h" would yield a vertically-rendered title with overflow via ellipsis as expected, and also wrap with Button.wrap. Note that:
      • The explicit width applied via CSS is needed because rotated elements don't inherit dimensions in their new orientation from the DOM - the transform/rotation occurs independently of layout.
      • The translation transform required along the x-axis is roughly (width - height) / 2, but may need slight offsetting for optimal centering.
      • We've explicitly avoided describing an approach based on CSS "writing-mode", since support is incomplete and bugs are present in popular browsers such as Firefox and Safari that would prevent it from being used without Framework assistance.

      Note on css-margins: Developers should be aware that the css "margin" property is unreliable for certain subclasses of StatefulCanvas, including buttons. Developers may use the explicit Canvas.margin property to specify button margins, or for a button within a layout, consider the layout properties Layout.layoutMargin, Layout.membersMargin

      If this method is called after the component has been drawn/initialized: Sets the base CSS style. As the component changes state and/or is selected, suffixes will be added to the base style.

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

      public String getBaseStyle()
      Description copied from class: StretchImgButton
      Base CSS style className applied to the component.

      Note that if specified, this property takes precedence over any specified StatefulCanvas.styleName. If unset, the styleName will be used as a default baseStyle value.

      As the component changes StatefulCanvas.state and/or is selected, suffixes will be added to the base style. In some cases more than one suffix will be appended to reflect a combined state ("Selected" + "Disabled", for example).

      See StatefulCanvas.getStateSuffix() for a description of the default set of suffixes which may be applied to the baseStyle

      Rotated Titles

      The Framework doesn't have built-in support for rotating button titles in a fashion similar to FacetChart.rotateLabels. However, you can manually configure a button to render with a rotated title by applying custom CSS via this property.

      For example, given a button with a height of 120 and a width of 48, if you copied the existing buttonXXX style declarations from skin_styles.css as new, rotatedTitleButtonXXX declarations, and then added the lines:

            -ms-transform:     translate(-38px,0px) rotate(270deg);
            -webkit-transform: translate(-38px,0px) rotate(270deg);
            transform:         translate(-38px,0px) rotate(270deg);
            overflow: hidden;
            text-overflow: ellipsis;
            width:116px;
      in the declaration section beginning:
        .rotatedTitleButton,
        .rotatedTitleButtonSelected,
        .rotatedTitleButtonSelectedOver,
        .rotatedTitleButtonSelectedDown,
        .rotatedTitleButtonSelectedDisabled,
        .rotatedTitleButtonOver,
        .rotatedTitleButtonDown,
        .rotatedTitleButtonDisabled {
      then applying that style to the button with overflow: "clip_h" would yield a vertically-rendered title with overflow via ellipsis as expected, and also wrap with Button.wrap. Note that:
      • The explicit width applied via CSS is needed because rotated elements don't inherit dimensions in their new orientation from the DOM - the transform/rotation occurs independently of layout.
      • The translation transform required along the x-axis is roughly (width - height) / 2, but may need slight offsetting for optimal centering.
      • We've explicitly avoided describing an approach based on CSS "writing-mode", since support is incomplete and bugs are present in popular browsers such as Firefox and Safari that would prevent it from being used without Framework assistance.

      Note on css-margins: Developers should be aware that the css "margin" property is unreliable for certain subclasses of StatefulCanvas, including buttons. Developers may use the explicit Canvas.margin property to specify button margins, or for a button within a layout, consider the layout properties Layout.layoutMargin, Layout.membersMargin

      Overrides:
      getBaseStyle in class StretchImgButton
      Returns:
      Current baseStyle value. Default value is "tab"
      See Also:
    • setCapSize

      public ImgTab setCapSize(int capSize)
      How big are the end pieces by default
      Overrides:
      setCapSize in class StretchImgButton
      Parameters:
      capSize - New capSize value. Default value is 2
      Returns:
      ImgTab instance, for chaining setter calls
      See Also:
    • getCapSize

      public int getCapSize()
      How big are the end pieces by default
      Overrides:
      getCapSize in class StretchImgButton
      Returns:
      Current capSize value. Default value is 2
      See Also:
    • setLabelSkinImgDir

      public ImgTab setLabelSkinImgDir(String labelSkinImgDir)
      Base path for images shown within this ImgTab's label. This will be used for icons (such as the close icon) by default.
      Overrides:
      setLabelSkinImgDir in class StretchImgButton
      Parameters:
      labelSkinImgDir - New labelSkinImgDir value. Default value is "images/"
      Returns:
      ImgTab instance, for chaining setter calls
      See Also:
    • getLabelSkinImgDir

      public String getLabelSkinImgDir()
      Base path for images shown within this ImgTab's label. This will be used for icons (such as the close icon) by default.
      Overrides:
      getLabelSkinImgDir in class StretchImgButton
      Returns:
      Current labelSkinImgDir value. Default value is "images/"
      See Also:
    • setShowFocused

      public ImgTab setShowFocused(Boolean showFocused)
      Should we visibly change state when the tab receives keyboard focus?
      Overrides:
      setShowFocused in class StretchImgButton
      Parameters:
      showFocused - New showFocused value. Default value is true
      Returns:
      ImgTab instance, for chaining setter calls
      See Also:
    • getShowFocused

      public Boolean getShowFocused()
      Should we visibly change state when the tab receives keyboard focus?
      Overrides:
      getShowFocused in class StretchImgButton
      Returns:
      Current showFocused value. Default value is true
      See Also:
    • setShowRollOver

      public ImgTab setShowRollOver(Boolean showRollOver)
      Should we visibly change state when the mouse goes over this tab
      Overrides:
      setShowRollOver in class StretchImgButton
      Parameters:
      showRollOver - New showRollOver value. Default value is false
      Returns:
      ImgTab instance, for chaining setter calls
      See Also:
    • getShowRollOver

      public Boolean getShowRollOver()
      Should we visibly change state when the mouse goes over this tab
      Overrides:
      getShowRollOver in class StretchImgButton
      Returns:
      Current showRollOver value. Default value is false
      See Also:
    • setSkinImgDir

      public ImgTab setSkinImgDir(String skinImgDir)
      Base path for the images. Note that when used within a TabSet, the TabSet.tabBarPosition is appended as an additional path segment, yielding "images/Tab/top/" et al.
      Overrides:
      setSkinImgDir in class Canvas
      Parameters:
      skinImgDir - New skinImgDir value. Default value is "images/Tab/"
      Returns:
      ImgTab instance, for chaining setter calls
      See Also:
    • getSkinImgDir

      public String getSkinImgDir()
      Base path for the images. Note that when used within a TabSet, the TabSet.tabBarPosition is appended as an additional path segment, yielding "images/Tab/top/" et al.
      Overrides:
      getSkinImgDir in class Canvas
      Returns:
      Current skinImgDir value. Default value is "images/Tab/"
      See Also:
    • setSrc

      public ImgTab setSrc(String src)
      Base URL for tab images
      Overrides:
      setSrc in class StretchImgButton
      Parameters:
      src - New src value. Default value is "[SKIN]tab.gif"
      Returns:
      ImgTab instance, for chaining setter calls
      See Also:
    • getSrc

      public String getSrc()
      Base URL for tab images
      Overrides:
      getSrc in class StretchImgButton
      Returns:
      Current src value. Default value is "[SKIN]tab.gif"
      See Also:
    • setTitleStyle

      public ImgTab setTitleStyle(String titleStyle) throws IllegalStateException
      Like StretchImgButton.titleStyle, can set to provide a separate style for the title text.

      If set and the ImgTab is vertical, a "v" will be automatically prepended to the style name (hence "tabTitle" -> "vtabTitle").

      Overrides:
      setTitleStyle in class StretchImgButton
      Parameters:
      titleStyle - New titleStyle value. Default value is null
      Returns:
      ImgTab instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getTitleStyle

      public String getTitleStyle()
      Like StretchImgButton.titleStyle, can set to provide a separate style for the title text.

      If set and the ImgTab is vertical, a "v" will be automatically prepended to the style name (hence "tabTitle" -> "vtabTitle").

      Overrides:
      getTitleStyle in class StretchImgButton
      Returns:
      Current titleStyle value. Default value is null
      See Also:
    • setDefaultProperties

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

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