Packagede.mightypirates.asul.style
Classpublic class StyleSheet
ImplementsIDisposable, IStyleSheet

This class provides management and evaluation of styles.

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:



Protected Properties
 PropertyDefined by
  paths_ : Vector
Used to keep track of known styles.
StyleSheet
Public Methods
 MethodDefined 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
Property detail
paths_property
protected var paths_:Vector

Used 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.

Constructor detail
StyleSheet()constructor
public function StyleSheet(styleSheet:IStyleSheet = null)

Creates a new styles managing class.

Parameters
styleSheet:IStyleSheet (default = null) — if given, all styles from the given stylesheet are copied into the new one.
Method detail
addAdapter()method
public static function addAdapter(adapter:IStyleAdapter):void

Add a new object adapter, which will allow applying styles to objects the adapter supports.

Parameters
adapter:IStyleAdapter — the adapter to add.
addStyles()method 
public function addStyles(styles:String):void

Adds 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 (;).

Parameters
styles:String — the style definition to parse.
dispose()method 
public function dispose():void

Cleans 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):Dictionary

Get a complete list of properties that would be applied to the given object.

Parameters
object:Object — the object for which to check.

Returns
Dictionary
parseElementStyle()method 
public static function parseElementStyle(style:String):Dictionary

Parse an element's styles, e.g. as defined in its style attribute.

Parameters
style:String

Returns
Dictionary