Packagecom.flexicious.utils
Classpublic class UIUtils
InheritanceUIUtils Inheritance Object

A Utility class that contains generic functions needed in multiple places.



Public Properties
 PropertyDefined By
  expressionCache : Object
[static]
UIUtils
Public Methods
 MethodDefined By
  
addChild(parent:Object, child:Object):void
[static] Adds a child to the provided display object.
UIUtils
  
addPopUp(window:IFlexDisplayObject, parent:DisplayObject, modal:Boolean = false, childList:String = null, triggerEvent:MouseEvent = null, moduleFactory:Object = null):void
[static]
UIUtils
  
areArraysEqual(a1:Array, a2:Array):Boolean
[static] Iterates through each array and returns false if either contains an element not contained within the other.
UIUtils
  
average(dataProvider:Object, fld:String):Number
[static] Returns the average of all items the specified data provider
UIUtils
  
concatenateList(list:ArrayCollection, propertyName:String, delimiter:String = , ):String
[static] Generates single string from collection of items, delimited by delimiter
UIUtils
  
createDateFilter(description:String, fld:String, dateRange:String, start:Date = null, end:Date = null):Filter
[static] For prebuilt filters, short cut method to create date filter
UIUtils
  
createListFilter(description:String, fld:String, values:Array):Filter
[static] For prebuilt filters, short cut method to create list based filters (ComboBox, MSCB)
UIUtils
  
createRenderer(renderer:Class, properties:Object):IFactory
[static] Used to create a filter renderer along with initialization properties
UIUtils
  
dataGridFormatCurrencyLabelFunction(item:Object, dgColumn:Object):String
[static] Datagrid function to format the currency column in a grid.
UIUtils
  
dataGridFormatDateLabelFunction(item:Object, dgColumn:Object):String
[static] Datagrid function to format the date column in a grid.
UIUtils
  
dataGridFormatYesNoLabelFunction(item:Object, dgColumn:Object):String
[static] Datagrid function to format the yes no column in a grid.
UIUtils
  
dictionaryToArrayCollection(obj:Object):ArrayCollection
[static] Converts a dictionary (a Java Hashmap) into a bindable name value array collection
UIUtils
  
doesArrayContainObjectValue(array:Object, valFld:String, compareVal:Object):Object
[static] Iterates through an array to see if the "valFld" property of any of the items in the a1 array equals "compareVal"
UIUtils
  
doesArrayContainStringValue(array:Object, compareVal:String):Object
[static] Iterates through an array to see if the "toString" methods of any of the items in the a1 array equals "compareVal"
UIUtils
  
doesArrayContainValue(array:Object, valFld:String, compareVal:String):Object
[static] Iterates through an array to see if the toString of the "valFld" property of any of the items in the array array equals "compareVal"
UIUtils
  
emptyIfNull(val:Object):String
[static]
UIUtils
  
ensureWithinView(popup:IFlexDisplayObject, parent:IUIComponent):void
[static]
UIUtils
  
extractPropertyValues(source:Object, propertyToExtract:String):ArrayCollection
[static] Given an array collection of complex objects, and a property, returns an array collection of the propertyToExtract values of each object within the array collection
UIUtils
  
formatBoolean(val:Boolean):String
[static] Takes in a boolean, returns a Yes or No
UIUtils
  
formatCurrency(val:Number, currencySymbol:String):String
[static] Takes in a number, and returns it formatted as Currency
UIUtils
  
formatDate(date:Date, formatString:String = MMM-DD-YYYY):String
[static] Takes in a date, and returns it formatted as MM/DD/YY
UIUtils
  
fromPersistenceString(host:String):*
[static] Takes in a specifically formatted strings and spits out an object that was used to make that string.
UIUtils
  
getArrayCollection(val:*):ArrayCollection
[static] If passed in value is array collection, returns it, else if it is an array returns an arraycollection wrapping the array else throws invalid input exception.
UIUtils
  
getGroupForColumn(grid:Object, col:Object):Object
[static] Goes through columns of the passed in grid (or level for Ultimate) and checks to see if the given column is in a columnGroup.
UIUtils
  
getLength(arr:Object):int
[static] If arr is XML or XMLList, returns length() else returns length;
UIUtils
  
getObjectProperty(data:Object, property:String):Object
[static] Returns property or subproperty (dot delimited) of an object
UIUtils
  
getRandom(minNum:Number, maxNum:Number):Number
[static]
UIUtils
  
getScreen(parent:IUIComponent):Rectangle
[static] Gets the screen object for the current ui comp.
UIUtils
  
getServerUrl():String
[static] Gets the current browser URL
UIUtils
  
[static] Returns the top level application.
UIUtils
  
isChildRecursive(grp:Object, col:Object):Boolean
[static] Is col a child of grp or any of its children? Added for Printing support of column groups
UIUtils
  
isPrimitive(input:*):Boolean
[static] Returns true if passed in object is a boolean, number or string
UIUtils
  
isStringNumeric(str:String):Boolean
[static] Checks to see if the passed in value is a string representation of a numeric value
UIUtils
  
labelObjectProperty(item:Object, column:Object):String
[static] Parses the value of a complex property and return its String equivalent
UIUtils
  
labelObjectPropertyList(item:Object, column:Object):String
[static] Parses the value of a complex list property, concatenating string values of all elements.
UIUtils
  
max(dataProvider:Object, fld:String, comparisionType:String = auto):Object
[static] Returns the maximum value in the specified data provider
UIUtils
  
min(dataProvider:Object, fld:String, comparisionType:String = auto):Object
[static] Returns the minimum value in the specified data provider
UIUtils
  
openBrowserPopup(url:String, options:String = width=800,height=600,lef t=0,top=0, toolbar=No,location=No,scrollbars=Yes,status=No,resizable=No,fullscreen=No, useNew:Boolean = true):void
[static] Opens a browser popup
UIUtils
  
pasteToClipBoard(strToPaste:String):void
[static] Pastes the passed in data to the clipboard.
UIUtils
  
positionBelow(popup:IFlexDisplayObject, parent:IUIComponent, leftOffset:Number = 0, topOffset:Number = 0, offScreenMath:Boolean = true, where:String = left):void
[static] Positions the provided popup window below the provided parent object.
UIUtils
  
removeAllChildren(parent:Object):void
[static] Removes all children
UIUtils
  
removeChild(parent:Object, child:Object):void
[static]
UIUtils
  
removeFromArray(array:Array, itemToRemove:Object):Array
[static] Removes the supplied item from the supplied array, and returns that array
UIUtils
  
removePopUp(window:IFlexDisplayObject):void
[static] Removes the popup
UIUtils
  
resolveExpression(host:Object, expression:String):Object
[static] Resolves expressions in format x.y[2]
UIUtils
  
showConfirm(msg:String, result:Function, callingComponent:Object, title:String = Confirm, flags:uint = 3, parent:Sprite = null):void
[static] A utility function that encapsulates the task of showing a confirmation popup.
UIUtils
  
showError(errorMessage:String, errorTitle:String = Error Occurred):void
[static] Shows a popup with an error message
UIUtils
  
showMessage(message:String, title:String = Message):void
[static] Shows a popup with an informational message
UIUtils
  
showValidationErrors(errors:Array, errorTitle:String = Please correct the following errors:):void
[static] If you pass in an array of Validation Result Events, loops through the validation result objects, concatenates them to make a string and displays them in the Alert control
UIUtils
  
sum(dataProvider:Object, fld:String):Number
[static] Returns the sum of all items the specified data provider
UIUtils
  
toPersistenceString(host:Object):String
[static] Returns a specially formatted string that stores information about the type.
UIUtils
  
toString(host:Object):String
[static] Returns the string value of the passed in object, or if null, returns an empty string.
UIUtils
  
transferPrimitiveProps(from:Object, to:Object, propsToExclude:Array = null):void
[static]
UIUtils
  
transferProps(from:Object, to:Object, propsToTransfer:Array = null):void
[static]
UIUtils
  
transferStyles(from:Object, to:Object, stylesToTransfer:Array = null):void
[static]
UIUtils
Property Detail
expressionCacheproperty
public static var expressionCache:Object

Method Detail
addChild()method
public static function addChild(parent:Object, child:Object):void

Adds a child to the provided display object. Takes into account the scenario where the parent is a Spark application.

Parameters

parent:Object
 
child:Object

addPopUp()method 
public static function addPopUp(window:IFlexDisplayObject, parent:DisplayObject, modal:Boolean = false, childList:String = null, triggerEvent:MouseEvent = null, moduleFactory:Object = null):void

Parameters

window:IFlexDisplayObject
 
parent:DisplayObject
 
modal:Boolean (default = false)
 
childList:String (default = null)
 
triggerEvent:MouseEvent (default = null)
 
moduleFactory:Object (default = null)

areArraysEqual()method 
public static function areArraysEqual(a1:Array, a2:Array):Boolean

Iterates through each array and returns false if either contains an element not contained within the other.

Parameters

a1:Array
 
a2:Array

Returns
Boolean
average()method 
public static function average(dataProvider:Object, fld:String):Number

Returns the average of all items the specified data provider

Parameters

dataProvider:Object
 
fld:String

Returns
Number
concatenateList()method 
public static function concatenateList(list:ArrayCollection, propertyName:String, delimiter:String = , ):String

Generates single string from collection of items, delimited by delimiter

Parameters

list:ArrayCollection — array of objects
 
propertyName:String — name of a property to be included, may be a complex "." delimited property name
 
delimiter:String (default = , ) — a delimiter between elements in the string, by default it's ", "

Returns
String
createDateFilter()method 
public static function createDateFilter(description:String, fld:String, dateRange:String, start:Date = null, end:Date = null):Filter

For prebuilt filters, short cut method to create date filter

Parameters

description:String — Name of the filter (to show in filter dropdown)
 
fld:String — DataField of the column to apply filter to
 
dateRange:String — One of the DateRange constants (See the DateRange object)
 
start:Date (default = null) — If you specify DateRange=Custom, the start date for the custom range
 
end:Date (default = null) — If you specify DateRange=Custom, the end date for the custom range

Returns
Filter — A Filter object that contains the passed in fld and date range in the arguments collection.
createListFilter()method 
public static function createListFilter(description:String, fld:String, values:Array):Filter

For prebuilt filters, short cut method to create list based filters (ComboBox, MSCB)

Parameters

description:String — Name of the filter (to show in filter dropdown)
 
fld:String — DataField of the column to apply filter to
 
values:Array — An array of strings that represents the dataField of the filter list control

Returns
Filter — A Filter object that contains the passed in fld and values in the arguments collection.
createRenderer()method 
public static function createRenderer(renderer:Class, properties:Object):IFactory

Used to create a filter renderer along with initialization properties

Parameters

renderer:Class — Class factory to be used as the generator
 
properties:Object — Initialization properties.

Returns
IFactory — The created renderer factory
dataGridFormatCurrencyLabelFunction()method 
public static function dataGridFormatCurrencyLabelFunction(item:Object, dgColumn:Object):String

Datagrid function to format the currency column in a grid.

Parameters

item:Object
 
dgColumn:Object

Returns
String — A formatted currency string
dataGridFormatDateLabelFunction()method 
public static function dataGridFormatDateLabelFunction(item:Object, dgColumn:Object):String

Datagrid function to format the date column in a grid.

Parameters

item:Object
 
dgColumn:Object

Returns
String — A formatted date string
dataGridFormatYesNoLabelFunction()method 
public static function dataGridFormatYesNoLabelFunction(item:Object, dgColumn:Object):String

Datagrid function to format the yes no column in a grid.

Parameters

item:Object
 
dgColumn:Object

Returns
String — A formatted boolean string
dictionaryToArrayCollection()method 
public static function dictionaryToArrayCollection(obj:Object):ArrayCollection

Converts a dictionary (a Java Hashmap) into a bindable name value array collection

Parameters

obj:Object — Dictionary to convert

Returns
ArrayCollection
doesArrayContainObjectValue()method 
public static function doesArrayContainObjectValue(array:Object, valFld:String, compareVal:Object):Object

Iterates through an array to see if the "valFld" property of any of the items in the a1 array equals "compareVal"

Parameters

array:Object — Array to search
 
valFld:String — Property of the objects in the array
 
compareVal:Object — The value to compare against.

Returns
Object — The first object that matches the search criteria, null if no match
doesArrayContainStringValue()method 
public static function doesArrayContainStringValue(array:Object, compareVal:String):Object

Iterates through an array to see if the "toString" methods of any of the items in the a1 array equals "compareVal"

Parameters

array:Object — Array to search
 
compareVal:String — The value to compare against.

Returns
Object — The first object that matches the search criteria, null if no match
doesArrayContainValue()method 
public static function doesArrayContainValue(array:Object, valFld:String, compareVal:String):Object

Iterates through an array to see if the toString of the "valFld" property of any of the items in the array array equals "compareVal"

Parameters

array:Object — Array to search
 
valFld:String — Property of the objects in the array
 
compareVal:String — The value to compare against.

Returns
Object
emptyIfNull()method 
public static function emptyIfNull(val:Object):String

Parameters

val:Object

Returns
String
ensureWithinView()method 
public static function ensureWithinView(popup:IFlexDisplayObject, parent:IUIComponent):void

Parameters

popup:IFlexDisplayObject
 
parent:IUIComponent

extractPropertyValues()method 
public static function extractPropertyValues(source:Object, propertyToExtract:String):ArrayCollection

Given an array collection of complex objects, and a property, returns an array collection of the propertyToExtract values of each object within the array collection

Parameters

source:Object — A list of objects that contain the property to extract
 
propertyToExtract:String — The name of the property to extract

Returns
ArrayCollection — An array collection of the extracted property values
formatBoolean()method 
public static function formatBoolean(val:Boolean):String

Takes in a boolean, returns a Yes or No

Parameters

val:Boolean — Boolean indicator to format

Returns
String — The formatted yes or no string
formatCurrency()method 
public static function formatCurrency(val:Number, currencySymbol:String):String

Takes in a number, and returns it formatted as Currency

Parameters

val:Number — The number to format
 
currencySymbol:String

Returns
String — The formatted currency string
formatDate()method 
public static function formatDate(date:Date, formatString:String = MMM-DD-YYYY):String

Takes in a date, and returns it formatted as MM/DD/YY

Parameters

date:Date — The date to format
 
formatString:String (default = MMM-DD-YYYY)

Returns
String — The formatted date string
fromPersistenceString()method 
public static function fromPersistenceString(host:String):*

Takes in a specifically formatted strings and spits out an object that was used to make that string.

Parameters

host:String

Returns
*
getArrayCollection()method 
public static function getArrayCollection(val:*):ArrayCollection

If passed in value is array collection, returns it, else if it is an array returns an arraycollection wrapping the array else throws invalid input exception.

Parameters

val:*

Returns
ArrayCollection
getGroupForColumn()method 
public static function getGroupForColumn(grid:Object, col:Object):Object

Goes through columns of the passed in grid (or level for Ultimate) and checks to see if the given column is in a columnGroup. If yes, returns the top level Column Group for it. Added for Printing support of column groups

Parameters

grid:Object — EADG, FDG or FDGCL
 
col:Object — EADGC or FDGC

Returns
Object — ADGCG or FDGCG
getLength()method 
public static function getLength(arr:Object):int

If arr is XML or XMLList, returns length() else returns length;

Parameters

arr:Object

Returns
int
getObjectProperty()method 
public static function getObjectProperty(data:Object, property:String):Object

Returns property or subproperty (dot delimited) of an object

Parameters

data:Object — The source object
 
property:String — The name of the property with the path if dot-delimited

Returns
Object
getRandom()method 
public static function getRandom(minNum:Number, maxNum:Number):Number

Parameters

minNum:Number
 
maxNum:Number

Returns
Number
getScreen()method 
public static function getScreen(parent:IUIComponent):Rectangle

Gets the screen object for the current ui comp.

Parameters

parent:IUIComponent

Returns
Rectangle
getServerUrl()method 
public static function getServerUrl():String

Gets the current browser URL

Returns
String
getTopLevelApplication()method 
public static function getTopLevelApplication():Object

Returns the top level application.

Returns
Object
isChildRecursive()method 
public static function isChildRecursive(grp:Object, col:Object):Boolean

Is col a child of grp or any of its children? Added for Printing support of column groups

Parameters

grp:Object
 
col:Object

Returns
Boolean
isPrimitive()method 
public static function isPrimitive(input:*):Boolean

Returns true if passed in object is a boolean, number or string

Parameters

input:*

Returns
Boolean
isStringNumeric()method 
public static function isStringNumeric(str:String):Boolean

Checks to see if the passed in value is a string representation of a numeric value

Parameters

str:String — The string representation to check

Returns
Boolean — True if str is a string representation of a number value
labelObjectProperty()method 
public static function labelObjectProperty(item:Object, column:Object):String

Parses the value of a complex property and return its String equivalent

Parameters

item:Object — the source object
 
column:Object — the DataGridColumn object. Its dataField property gets the property path with name

Returns
String
labelObjectPropertyList()method 
public static function labelObjectPropertyList(item:Object, column:Object):String

Parses the value of a complex list property, concatenating string values of all elements. To specify field name and display field name use dataField="dataField/displayPropertyName/delimiter", where "dataField" is the field name, and "displayPropertyName" is the display field of elements in the list, and "delimiter" is the delimiter string to be used (optional).

Parameters

item:Object — the source object
 
column:Object — the DataGridColumn object. Its dataField property gets the property path with name

Returns
String
max()method 
public static function max(dataProvider:Object, fld:String, comparisionType:String = auto):Object

Returns the maximum value in the specified data provider

Parameters

dataProvider:Object
 
fld:String
 
comparisionType:String (default = auto)

Returns
Object
min()method 
public static function min(dataProvider:Object, fld:String, comparisionType:String = auto):Object

Returns the minimum value in the specified data provider

Parameters

dataProvider:Object
 
fld:String
 
comparisionType:String (default = auto)

Returns
Object
openBrowserPopup()method 
public static function openBrowserPopup(url:String, options:String = width=800,height=600,lef t=0,top=0, toolbar=No,location=No,scrollbars=Yes,status=No,resizable=No,fullscreen=No, useNew:Boolean = true):void

Opens a browser popup

Parameters

url:String — The URL to open
 
options:String (default = width=800,height=600,lef t=0,top=0, toolbar=No,location=No,scrollbars=Yes,status=No,resizable=No,fullscreen=No) — Options string, defaults to width=800,height=600,lef t=0,top=0, toolbar=No,location=No,scrollbars=Yes,status=No,resizable=No,fullscreen=No
 
useNew:Boolean (default = true) — If true, creates a new window, else reuses the existing one. Defaults to true

pasteToClipBoard()method 
public static function pasteToClipBoard(strToPaste:String):void

Pastes the passed in data to the clipboard.

Parameters

strToPaste:String

positionBelow()method 
public static function positionBelow(popup:IFlexDisplayObject, parent:IUIComponent, leftOffset:Number = 0, topOffset:Number = 0, offScreenMath:Boolean = true, where:String = left):void

Positions the provided popup window below the provided parent object. Used by the Dynamic Filter Popup

Parameters

popup:IFlexDisplayObject — The popup that you wish to position
 
parent:IUIComponent — The control that you wish to position the popup relative to
 
leftOffset:Number (default = 0) — Whether to shift the popup left after calculating the positions, for customizing the actual position
 
topOffset:Number (default = 0) — Whether to shift the popup top after calculating the positions, for customizing the actual position
 
offScreenMath:Boolean (default = true) — Whether or not to adjust the popup if it appears off screen
 
where:String (default = left) — One of three values, left, right or none. If left, positions to bottom left, if right, positions to bottom right, if none, positions right below.

removeAllChildren()method 
public static function removeAllChildren(parent:Object):void

Removes all children

Parameters

parent:Object

removeChild()method 
public static function removeChild(parent:Object, child:Object):void

Parameters

parent:Object
 
child:Object

removeFromArray()method 
public static function removeFromArray(array:Array, itemToRemove:Object):Array

Removes the supplied item from the supplied array, and returns that array

Parameters

array:Array — The array to remove the item from
 
itemToRemove:Object — The item to remove

Returns
Array
removePopUp()method 
public static function removePopUp(window:IFlexDisplayObject):void

Removes the popup

Parameters

window:IFlexDisplayObject

resolveExpression()method 
public static function resolveExpression(host:Object, expression:String):Object

Resolves expressions in format x.y[2]

Parameters

host:Object
 
expression:String

Returns
Object — The result of the expression
showConfirm()method 
public static function showConfirm(msg:String, result:Function, callingComponent:Object, title:String = Confirm, flags:uint = 3, parent:Sprite = null):void

A utility function that encapsulates the task of showing a confirmation popup.

Parameters

msg:String — Text string that appears in the Alert control.
 
result:Function — Event handler that is called when any button on the Alert control is pressed.
 
callingComponent:Object — The component that is passed into the result function, so you can call methods on it.
 
title:String (default = Confirm) — Text string that appears in the title bar.
 
flags:uint (default = 3) — Which buttons to place in the Alert control.
 
parent:Sprite (default = null) — Object upon which the Alert control centers itself.

showError()method 
public static function showError(errorMessage:String, errorTitle:String = Error Occurred):void

Shows a popup with an error message

Parameters

errorMessage:String — Text string that appears in the Alert control.
 
errorTitle:String (default = Error Occurred) — Text string that appears in the title bar.

showMessage()method 
public static function showMessage(message:String, title:String = Message):void

Shows a popup with an informational message

Parameters

message:String — Text string that appears in the Alert control.
 
title:String (default = Message) — Text string that appears in the title bar.

showValidationErrors()method 
public static function showValidationErrors(errors:Array, errorTitle:String = Please correct the following errors:):void

If you pass in an array of Validation Result Events, loops through the validation result objects, concatenates them to make a string and displays them in the Alert control

Parameters

errors:Array — The errors to display. Can be a list of strings or ValidationResultEvents
 
errorTitle:String (default = Please correct the following errors:) — Text string that appears in the title bar.

sum()method 
public static function sum(dataProvider:Object, fld:String):Number

Returns the sum of all items the specified data provider

Parameters

dataProvider:Object
 
fld:String

Returns
Number
toPersistenceString()method 
public static function toPersistenceString(host:Object):String

Returns a specially formatted string that stores information about the type. Used by preference persistence serialization, can handle array, arraycollection and primitives.

Parameters

host:Object

Returns
String
toString()method 
public static function toString(host:Object):String

Returns the string value of the passed in object, or if null, returns an empty string.

Parameters

host:Object

Returns
String
transferPrimitiveProps()method 
public static function transferPrimitiveProps(from:Object, to:Object, propsToExclude:Array = null):void

Parameters

from:Object
 
to:Object
 
propsToExclude:Array (default = null)

transferProps()method 
public static function transferProps(from:Object, to:Object, propsToTransfer:Array = null):void

Parameters

from:Object
 
to:Object
 
propsToTransfer:Array (default = null)

transferStyles()method 
public static function transferStyles(from:Object, to:Object, stylesToTransfer:Array = null):void

Parameters

from:Object
 
to:Object
 
stylesToTransfer:Array (default = null)