| Package | de.mightypirates.asul.style |
| Class | public class StyleSheet |
| Implements | IDisposable, IStyleSheet |
It can be used to parse and store style definitions, as well as to apply the stored definitions to objects.
Supported styles are in CSS format, and most CSS selectors are supported:
| Property | Defined by | ||
|---|---|---|---|
| paths_ : Vector
Used to keep track of known styles.
| StyleSheet | ||
| Method | Defined by | ||
|---|---|---|---|
|
StyleSheet(styleSheet:IStyleSheet = null)
Creates a new styles managing class.
| StyleSheet | ||
|
addAdapter(adapter:IStyleAdapter):void
[static]
Add a new object adapter, which will allow applying styles to objects
the adapter supports.
| StyleSheet | ||
|
addStyles(styles:String):void
Adds a list of styles.
| StyleSheet | ||
|
dispose():void
Cleans upd the object, removing all listeners, timers and references that
might keep the object from being garbage collected.
| StyleSheet | ||
|
getProperties(object:Object):Dictionary
Get a complete list of properties that would be applied to the given
object.
| StyleSheet | ||
|
parseElementStyle(style:String):Dictionary
[static]
Parse an element's styles, e.g.
| StyleSheet | ||
| paths_ | property |
protected var paths_:VectorUsed to keep track of known styles.
This contains objects which represent the root of a known selector path, which is in the most specific (rightmost) selector of a path. They are linked to the preceding selectors and can thus be followed to test if a path is applicable or not.
| StyleSheet | () | constructor |
public function StyleSheet(styleSheet:IStyleSheet = null)Creates a new styles managing class.
ParametersstyleSheet:IStyleSheet (default = null) — if given, all styles from the given stylesheet are copied
into the new one.
|
| addAdapter | () | method |
public static function addAdapter(adapter:IStyleAdapter):voidAdd a new object adapter, which will allow applying styles to objects the adapter supports.
Parametersadapter:IStyleAdapter — the adapter to add.
|
| addStyles | () | method |
public function addStyles(styles:String):voidAdds a list of styles.
Styles must be in CSS format, i.e. the class name or element name
must be followed by curly brackets encapsulating the attribute values,
which must be in attributeName: value format, separated by
semicolons (;).
styles:String — the style definition to parse.
|
| dispose | () | method |
public function dispose():voidCleans upd the object, removing all listeners, timers and references that might keep the object from being garbage collected.
The following should be kept in mind when implementing this method:
Each object should only be destroyed once, i.e. always check if
isDestroyed is true, and if so, return.
| getProperties | () | method |
public function getProperties(object:Object):DictionaryGet a complete list of properties that would be applied to the given object.
Parametersobject:Object — the object for which to check.
|
Dictionary |
| parseElementStyle | () | method |
public static function parseElementStyle(style:String):DictionaryParse an element's styles, e.g. as defined in its style attribute.
Parametersstyle:String |
Dictionary |