Class SCStatefulImgConfig

All Implemented Interfaces:
HasHandlers

public class SCStatefulImgConfig extends DataClass
A configuration object containing image URLs for a set of possible images to display based on the state of some components. See the stateful images overview for more information.

Each attribute in this configuration object maps a state to a target URL.
Each URL may be specified in one of three ways

  • a standard SCImgURL may be used to refer directly to an image file.
  • the "#state:" prefix may be used to display media from another specified state.
  • the "#modifier:" prefix may be used to specify a modifier string to apply to the base image.
    The modifier will be applied to the base file name before the file type suffix.
For example, consider a stateful image config with the following properties:
  {    _base:"button.png",
       Over:"bright_button.png",
       Focused:"#state:Over",
       Selected:"#state:Over",
       Disabled:"#modifier:_Disabled",
       SelectedDisabled:"#state:Selected"
  }
  
In this case
  • the base image URL and the the "Over" state image URL would be determined using the standard SCImgURL rules
  • the "Focused" and "Selected" state images would re-use the "Over" state image ("bright_button.png")
  • the "Disabled" state image would be the base state image with a "_Disabled" suffix applied to the file name ("button_Disabled.png")
  • the "SelectedDisabled" entry would be used for the combined "Selected" and "Disabled" states, and would re-use the "Selected" state image (which in turn maps back to the "Over" state, resolving to "bright_button.png")

The default set of standard states are explicitly documented, but this object format is extensible. A developer may specify additional attributes on a SCStatefulImgConfig beyond the standard documented states and they may be picked up if a custom state is applied to a component (via a call to StatefulCanvas.setState(), for example).

In some cases, an icon may have only custom states - for example, a tree-folder icon is always either opened or closed. In these cases, a _base entry is only required if entries in the object use the #state or #modifier components.

Combined states and missing entries:

The focused and selected states may be applied to a component in combination with other states. For example an ImgButton marked both Selected and Disabled will look for media to represent this combined state. To provide such media in a SCStatefulImgConfig, use the combined state names (in this case SelectedDisabled).
If a component is both Selected and Focused, three-part combined states are also possible (Selected + Focused + Over gives SelectedFocusedOver for example).

The SCStatefulImgConfig format may be sparse - developers may skip providing values for certain states (or combined states) in the SCStatefulImgConfig object. In this case the system will back off to using one of the state image entries that has been explicitly provided, according to the following rules:

State(s) Stateful image attributes to consider (in order of preference)
Focused and Selected If both focused and selected states are applied, the system will use the first (populated) value from the following attribute list:
  • "FocusedSelected"
  • "Focused"
  • "Selected"
Over or Down in combination with Focused / Selected System will check for a combined state attribute with the Focused / Selected state first.
For example for Focused + Selected + Over, consider the following attributes:
  • "FocusedSelectedOver"
  • "FocusedOver"
  • "SelectedOver"
If no combined state entry is specified, back off to considering just the Focused / Selected state:
  • "FocusedSelected"
  • "Focused"
  • "Selected"
If no focused / selected state entry is present in the config object, look for an entry for the unmodified state name
  • "Over"
All other states, including Disabled (in combination with Focused / Selected) Check for a combined state attribute with the Focused / Selected state first.
For example for Focused + Selected + "CustomState", consider the following attributes:
  • "FocusedSelectedCustomState"
  • "FocusedCustomState"
  • "SelectedCustomState"
If no combined state entry is specified, back off to considering just the unmodified state name
  • "CustomState"
If there is no explicit entry for the state name, use the Focused / Selected state without a state name:
  • "FocusedSelected"
  • "Focused"
  • "Selected"

If no entry can be found for the specified state / combined states using the above approach, the "_base" attribute will be used.
  • Constructor Details

    • SCStatefulImgConfig

      public SCStatefulImgConfig()
    • SCStatefulImgConfig

      public SCStatefulImgConfig(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static SCStatefulImgConfig getOrCreateRef(JavaScriptObject jsObj)
    • set_base

      public SCStatefulImgConfig set_base(String _base)
      The base filename for the image. This will be used if no state is applied to the stateful component displaying this image, or if no explicit entry exists for a state that is applied.
      It will also be used as a base file name for entries specified using the "#modifier:some_value" format.

      In some cases, an icon may have only custom states - for example, a tree-folder icon is always either opened or closed, so a _base entry is not required unless entries in the object use the #state or #modifier components - in this case, a warning will be logged if no _base is set.

      See SCStatefulImgConfig overview for further information.

      Parameters:
      _base - New _base value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
      See Also:
    • get_base

      public String get_base()
      The base filename for the image. This will be used if no state is applied to the stateful component displaying this image, or if no explicit entry exists for a state that is applied.
      It will also be used as a base file name for entries specified using the "#modifier:some_value" format.

      In some cases, an icon may have only custom states - for example, a tree-folder icon is always either opened or closed, so a _base entry is not required unless entries in the object use the #state or #modifier components - in this case, a warning will be logged if no _base is set.

      See SCStatefulImgConfig overview for further information.

      Returns:
      Current _base value. Default value is null
      See Also:
    • setDisabled

      public SCStatefulImgConfig setDisabled(String Disabled)
      Image to display when the component is disabled.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      Disabled - New Disabled value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getDisabled

      public String getDisabled()
      Image to display when the component is disabled.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current Disabled value. Default value is null
    • setDown

      public SCStatefulImgConfig setDown(String Down)
      Image to display on mouseDown.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      Down - New Down value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getDown

      public String getDown()
      Image to display on mouseDown.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current Down value. Default value is null
    • setFocused

      public SCStatefulImgConfig setFocused(String Focused)
      Image to display when the component is focused.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      Focused - New Focused value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getFocused

      public String getFocused()
      Image to display when the component is focused.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current Focused value. Default value is null
    • setFocusedDown

      public SCStatefulImgConfig setFocusedDown(String FocusedDown)
      Image to display when the component is focused on mouse down.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      FocusedDown - New FocusedDown value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getFocusedDown

      public String getFocusedDown()
      Image to display when the component is focused on mouse down.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current FocusedDown value. Default value is null
    • setFocusedOver

      public SCStatefulImgConfig setFocusedOver(String FocusedOver)
      Image to display when the component is focused on roll over.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      FocusedOver - New FocusedOver value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getFocusedOver

      public String getFocusedOver()
      Image to display when the component is focused on roll over.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current FocusedOver value. Default value is null
    • setOver

      public SCStatefulImgConfig setOver(String Over)
      Image to display on roll over.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      Over - New Over value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getOver

      public String getOver()
      Image to display on roll over.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current Over value. Default value is null
    • setSelected

      public SCStatefulImgConfig setSelected(String Selected)
      Image to display when the component is selected.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      Selected - New Selected value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getSelected

      public String getSelected()
      Image to display when the component is selected.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current Selected value. Default value is null
    • setSelectedDisabled

      public SCStatefulImgConfig setSelectedDisabled(String SelectedDisabled)
      Image to display when the component is selected and disabled.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      SelectedDisabled - New SelectedDisabled value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getSelectedDisabled

      public String getSelectedDisabled()
      Image to display when the component is selected and disabled.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current SelectedDisabled value. Default value is null
    • setSelectedDown

      public SCStatefulImgConfig setSelectedDown(String SelectedDown)
      Image to display when the component is selected on mouse down.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      SelectedDown - New SelectedDown value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getSelectedDown

      public String getSelectedDown()
      Image to display when the component is selected on mouse down.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current SelectedDown value. Default value is null
    • setSelectedFocused

      public SCStatefulImgConfig setSelectedFocused(String SelectedFocused)
      Image to display when the component is selected and focused.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      SelectedFocused - New SelectedFocused value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getSelectedFocused

      public String getSelectedFocused()
      Image to display when the component is selected and focused.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current SelectedFocused value. Default value is null
    • setSelectedFocusedDown

      public SCStatefulImgConfig setSelectedFocusedDown(String SelectedFocusedDown)
      Image to display when the component is selected and focused on mouse down.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      SelectedFocusedDown - New SelectedFocusedDown value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getSelectedFocusedDown

      public String getSelectedFocusedDown()
      Image to display when the component is selected and focused on mouse down.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current SelectedFocusedDown value. Default value is null
    • setSelectedFocusedOver

      public SCStatefulImgConfig setSelectedFocusedOver(String SelectedFocusedOver)
      Image to display when the component is selected and focused on roll over.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      SelectedFocusedOver - New SelectedFocusedOver value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getSelectedFocusedOver

      public String getSelectedFocusedOver()
      Image to display when the component is selected and focused on roll over.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current SelectedFocusedOver value. Default value is null
    • setSelectedOver

      public SCStatefulImgConfig setSelectedOver(String SelectedOver)
      Image to display when the component is selected on roll over.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Parameters:
      SelectedOver - New SelectedOver value. Default value is null
      Returns:
      SCStatefulImgConfig instance, for chaining setter calls
    • getSelectedOver

      public String getSelectedOver()
      Image to display when the component is selected on roll over.

      May be specified as

      • A SCImgURL indicating the media to load
      • A reference to another entry in this SCStatefulImgConfig via the format "#state:otherStateName"
      • A modifier to apply to the _base media via the format "#modifier:modifierString"
      See SCStatefulImgConfig overview for further information.
      Returns:
      Current SelectedOver value. Default value is null