Class SCStatefulImgConfig
- All Implemented Interfaces:
HasHandlers
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 thebase image
.
The modifier will be applied to the base file name before the file type suffix.
{ _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:
Thefocused
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:
|
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:
|
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:
|
If no entry can be found for the specified state / combined states using the above approach, the
"_base"
attribute will be used.-
Field Summary
Fields inherited from class com.smartgwt.client.core.DataClass
factoryCreated, factoryProperties
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget_base()
The base filename for the image.Image to display when the component isdisabled
.getDown()
Image to display onmouseDown
.Image to display when the component isfocused
.Image to display when the component isfocused
onmouse down
.static SCStatefulImgConfig
getOrCreateRef
(JavaScriptObject jsObj) getOver()
Image to display onroll over
.Image to display when the component isselected
.Image to display when the component isselected
onmouse down
.The base filename for the image.setDisabled
(String Disabled) Image to display when the component isdisabled
.Image to display onmouseDown
.setFocused
(String Focused) Image to display when the component isfocused
.setFocusedDown
(String FocusedDown) Image to display when the component isfocused
onmouse down
.setFocusedOver
(String FocusedOver) Image to display onroll over
.setSelected
(String Selected) Image to display when the component isselected
.setSelectedDisabled
(String SelectedDisabled) setSelectedDown
(String SelectedDown) Image to display when the component isselected
onmouse down
.setSelectedFocused
(String SelectedFocused) setSelectedFocusedDown
(String SelectedFocusedDown) setSelectedFocusedOver
(String SelectedFocusedOver) setSelectedOver
(String SelectedOver) Methods inherited from class com.smartgwt.client.core.DataClass
applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated
-
Constructor Details
-
SCStatefulImgConfig
public SCStatefulImgConfig() -
SCStatefulImgConfig
-
-
Method Details
-
getOrCreateRef
-
set_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
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
Image to display when the component isdisabled
.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"
SCStatefulImgConfig overview
for further information.- Parameters:
Disabled
- New Disabled value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getDisabled
Image to display when the component isdisabled
.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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current Disabled value. Default value is null
- A
-
setDown
Image to display onmouseDown
.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"
SCStatefulImgConfig overview
for further information.- Parameters:
Down
- New Down value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getDown
Image to display onmouseDown
.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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current Down value. Default value is null
- A
-
setFocused
Image to display when the component isfocused
.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"
SCStatefulImgConfig overview
for further information.- Parameters:
Focused
- New Focused value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getFocused
Image to display when the component isfocused
.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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current Focused value. Default value is null
- A
-
setFocusedDown
Image to display when the component isfocused
onmouse 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"
SCStatefulImgConfig overview
for further information.- Parameters:
FocusedDown
- New FocusedDown value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getFocusedDown
Image to display when the component isfocused
onmouse 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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current FocusedDown value. Default value is null
- A
-
setFocusedOver
Image to display when the component isfocused
onroll 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"
SCStatefulImgConfig overview
for further information.- Parameters:
FocusedOver
- New FocusedOver value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getFocusedOver
Image to display when the component isfocused
onroll 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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current FocusedOver value. Default value is null
- A
-
setOver
Image to display onroll 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"
SCStatefulImgConfig overview
for further information.- Parameters:
Over
- New Over value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getOver
Image to display onroll 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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current Over value. Default value is null
- A
-
setSelected
Image to display when the component isselected
.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"
SCStatefulImgConfig overview
for further information.- Parameters:
Selected
- New Selected value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getSelected
Image to display when the component isselected
.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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current Selected value. Default value is null
- A
-
setSelectedDisabled
Image to display when the component isselected
anddisabled
.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"
SCStatefulImgConfig overview
for further information.- Parameters:
SelectedDisabled
- New SelectedDisabled value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getSelectedDisabled
Image to display when the component isselected
anddisabled
.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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current SelectedDisabled value. Default value is null
- A
-
setSelectedDown
Image to display when the component isselected
onmouse 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"
SCStatefulImgConfig overview
for further information.- Parameters:
SelectedDown
- New SelectedDown value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getSelectedDown
Image to display when the component isselected
onmouse 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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current SelectedDown value. Default value is null
- A
-
setSelectedFocused
Image to display when the component isselected
andfocused
.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"
SCStatefulImgConfig overview
for further information.- Parameters:
SelectedFocused
- New SelectedFocused value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getSelectedFocused
Image to display when the component isselected
andfocused
.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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current SelectedFocused value. Default value is null
- A
-
setSelectedFocusedDown
Image to display when the component isselected
andfocused
onmouse 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"
SCStatefulImgConfig overview
for further information.- Parameters:
SelectedFocusedDown
- New SelectedFocusedDown value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getSelectedFocusedDown
Image to display when the component isselected
andfocused
onmouse 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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current SelectedFocusedDown value. Default value is null
- A
-
setSelectedFocusedOver
Image to display when the component isselected
andfocused
onroll 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"
SCStatefulImgConfig overview
for further information.- Parameters:
SelectedFocusedOver
- New SelectedFocusedOver value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getSelectedFocusedOver
Image to display when the component isselected
andfocused
onroll 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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current SelectedFocusedOver value. Default value is null
- A
-
setSelectedOver
Image to display when the component isselected
onroll 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"
SCStatefulImgConfig overview
for further information.- Parameters:
SelectedOver
- New SelectedOver value. Default value is null- Returns:
SCStatefulImgConfig
instance, for chaining setter calls
- A
-
getSelectedOver
Image to display when the component isselected
onroll 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"
SCStatefulImgConfig overview
for further information.- Returns:
- Current SelectedOver value. Default value is null
- A
-