StyleSet¶
Definition¶
Extends¶
Extended By¶
None
Description¶
Represents a set of attributes that makes up a style
Method Summary¶
| Owner | Name | Return Type | Description |
|---|---|---|---|
| Object | getClassName() | String | Returns the string name of this object's class type. |
| StyleSet | getColorVarNames() | Set | Returns the names of every color variable declared by this style or any style it inherits from, each including the leading '$'. The set does not vary by color mode, a var declared for only one mode is still listed. Use resolveVar() to read a value for the active mode. |
| StyleSet | getDefinition(key) | StyleOptionDefinition | Returns the definition for a particular style option, including type, name and constaints. |
| StyleSet | getParent() | StyleSet | Returns the style that this style set inherits from. |
| StyleSet | getResolvedValue(key) | Object | Returns the value associated with the supplied style key, considering inherited parent styles if its not defined by this style. The returned value will be null only when the key is invalid. |
| StyleSet | getStyleId() | String | Returns the style id. |
| StyleSet | getValue(key) | Object | Returns the value associated with the supplied style key or null if the value is not defined for this key. |
| StyleSet | reset() | Boolean | Resets all values on this style to the default (values configured via the gui). Always succeeds. |
| StyleSet | resetValue(key) | Boolean | Resets value for the given key on this style to the default (values configured via the gui). Returns true if operation succeeds, false if key is invalid. |
| StyleSet | resolveVar(varName) | Object | Returns the literal value of a color variable, such as "$surface1", for the active color mode, considering inherited parent styles. Returns null if the name does not begin with '$', or if the variable has no value defined for the active color mode. Use with getColorVarNames() to write a style's palette into custom html, which does not get $var substitution. |
| StyleSet | setParent(parentStyle) | Boolean | Sets the parent style. |
| StyleSet | setValue(key, value) | Object | Sets the value associated with the supplied style, if value is null, then the value will use the parent's inherited value. Setting null on the root style will return false. Returns true if the set succeeded, such that the key exists and the value is valid for the given key, false otherwise. |
| Object | toJson() | String | Returns a string of a json representation of this object. |
Method Definitions¶
getClassName()¶
Description¶
Returns the string name of this object's class type.
getColorVarNames()¶
Set StyleSet::getColorVarNames()
Description¶
Returns the names of every color variable declared by this style or any style it inherits from, each including the leading '$'. The set does not vary by color mode, a var declared for only one mode is still listed. Use resolveVar() to read a value for the active mode.
getDefinition(key)¶
StyleOptionDefinition StyleSet::getDefinition(String key)
Description¶
Returns the definition for a particular style option, including type, name and constaints.
Parameter Definition¶
| Name | Type | Description |
|---|---|---|
| key | String |
getParent()¶
StyleSet StyleSet::getParent()
Description¶
Returns the style that this style set inherits from.
getResolvedValue(key)¶
Object StyleSet::getResolvedValue(String key)
Description¶
Returns the value associated with the supplied style key, considering inherited parent styles if its not defined by this style. The returned value will be null only when the key is invalid.
Parameter Definition¶
| Name | Type | Description |
|---|---|---|
| key | String |
getStyleId()¶
Description¶
Returns the style id.
getValue(key)¶
Object StyleSet::getValue(String key)
Description¶
Returns the value associated with the supplied style key or null if the value is not defined for this key.
Parameter Definition¶
| Name | Type | Description |
|---|---|---|
| key | String |
reset()¶
Description¶
Resets all values on this style to the default (values configured via the gui). Always succeeds.
resetValue(key)¶
Boolean StyleSet::resetValue(String key)
Description¶
Resets value for the given key on this style to the default (values configured via the gui). Returns true if operation succeeds, false if key is invalid.
Parameter Definition¶
| Name | Type | Description |
|---|---|---|
| key | String |
resolveVar(varName)¶
Object StyleSet::resolveVar(String varName)
Description¶
Returns the literal value of a color variable, such as "$surface1", for the active color mode, considering inherited parent styles. Returns null if the name does not begin with '$', or if the variable has no value defined for the active color mode. Use with getColorVarNames() to write a style's palette into custom html, which does not get $var substitution.
Parameter Definition¶
| Name | Type | Description |
|---|---|---|
| varName | String | The color variable name, including the leading '$' |
setParent(parentStyle)¶
Boolean StyleSet::setParent(String parentStyle)
Description¶
Sets the parent style.
Parameter Definition¶
| Name | Type | Description |
|---|---|---|
| parentStyle | String |
setValue(key,value)¶
Object StyleSet::setValue(String key, Object value)
Description¶
Sets the value associated with the supplied style, if value is null, then the value will use the parent's inherited value. Setting null on the root style will return false. Returns true if the set succeeded, such that the key exists and the value is valid for the given key, false otherwise.
Parameter Definition¶
| Name | Type | Description |
|---|---|---|
| key | String | |
| value | Object |
toJson()¶
Description¶
Returns a string of a json representation of this object.