qnx.fuse.ui.utils.StyleUtils

StyleUtils

Methods


Packageqnx.fuse.ui.utils
Classpublic class StyleUtils
InheritanceStyleUtils Inheritance Object

A collection of utility methods useful for parsing and applying styles to objects.

Class information:
BlackBerry 10 Version:   10.0.0
Found in:  qnxui.swc



Public Methods

 MethodDefined By
  
[static] Creates a method that can be used to apply CSS styles to a UIComponent.
StyleUtils
  
applyStyleToObject(object:Object):Function
[static] Creates a method that can be usd to apply CSS styles to an Object.
StyleUtils
  
applyStyleToTextFormat(component:UIComponent, format:TextFormat):Function
[static] Creates a method that can be used to apply CSS styles to a TextFormat.
StyleUtils
  
createStyleApplier(... appliers):Function
[static] Takes a variable number of functions as it's argument, and returns a function that calls the functions in order.
StyleUtils

Method Detail

applyStyleToComponent()


public static function applyStyleToComponent(component:UIComponent):Function

Creates a method that can be used to apply CSS styles to a UIComponent.

Parameters

component:UIComponent — The UIComponent that styles will be applied to.

Returns

Function — A method with the signature funciton(name:String, val:String):void that sets the property name on to the supplied object with a value of val. The value is transformed to a Number from a String using StyleUtils.parseValue if possible.

applyStyleToObject()


public static function applyStyleToObject(object:Object):Function

Creates a method that can be usd to apply CSS styles to an Object.

If the property name of the style doesn't exist on the Object it is passed over and not applied.

Parameters

object:Object — The Object that styles will be applied to.

Returns

Function — A method with the signature funciton(name:String, val:String):void. Properties that are parsed by this style applier should be prefixed with text- to indicate they apply to TextFormats. The value is transformed to a Number from a String using StyleUtils.parseValue if possible.

applyStyleToTextFormat()


public static function applyStyleToTextFormat(component:UIComponent, format:TextFormat):Function

Creates a method that can be used to apply CSS styles to a TextFormat.

Parameters

component:UIComponent — The TextFormat that styles will be applied to.
format:TextFormat

Returns

Function — A method with the signature funciton(name:String, val:String):void. Properties that are parsed by this style applier should be prefixed with text- to indicate they apply to TextFormats. The value is transformed to a Number from a String using StyleUtils.parseValue if possible.

createStyleApplier()


public static function createStyleApplier(... appliers):Function

Takes a variable number of functions as it's argument, and returns a function that calls the functions in order. This is useful when you need to do a variable number of tasks in a loop, and dont want to iterate through the items multiple times.

var fn1 : Function = function(...args) : void { trace("first"); };
var fn2 : Function = function(...args) : void { trace("second"); };
var applier : Function = StyleUtils.createStyleApplier(fn1, fn2);
applier();
// traces:
// first
// second
         

Parameters

... appliers — A list of style applier functions.

Returns

Function — A function that when called, calls the supplied list of functions in order.




comments powered by Disqus