#LayoutUtility Utility class for famous-flex.
##class: LayoutUtility ⏏ Members
- class: LayoutUtility ⏏
- LayoutUtility.normalizeMargins(margins)
- LayoutUtility.cloneSpec(spec)
- LayoutUtility.isEqualSpec(spec1, spec2)
- LayoutUtility.getSpecDiffText(spec1, spec2)
- LayoutUtility.error(message)
- LayoutUtility.warning(message)
- LayoutUtility.log(args)
- LayoutUtility.combineOptions(options1, options2, [forceClone])
- LayoutUtility.registerHelper(name, Helper)
- LayoutUtility.unregisterHelper(name)
- LayoutUtility.getRegisteredHelper(name)
###LayoutUtility.normalizeMargins(margins) Normalizes the margins argument.
Params
- margins
Array.Number
###LayoutUtility.cloneSpec(spec) Makes a (shallow) copy of a spec.
Params
- spec
Spec
- Spec to clone
Returns: Spec
- cloned spec
###LayoutUtility.isEqualSpec(spec1, spec2)
Compares two specs for equality.
Params
- spec1
Spec
- Spec to compare - spec2
Spec
- Spec to compare
Returns: Boolean
- true/false
###LayoutUtility.getSpecDiffText(spec1, spec2)
Helper function that returns a string containing the differences
between two specs.
Params
- spec1
Spec
- Spec to compare - spec2
Spec
- Spec to compare
Returns: String
- text
###LayoutUtility.error(message)
Helper function to call whenever a critical error has occurred.
Params
- message
String
- error-message
###LayoutUtility.warning(message) Helper function to call whenever a warning error has occurred.
Params
- message
String
- warning-message
###LayoutUtility.log(args) Helper function to log 1 or more arguments. All the arguments are concatenated to produce a single string which is logged.
Params
- args
String
|Array
|Object
- arguments to stringify and concatenate
###LayoutUtility.combineOptions(options1, options2, [forceClone]) Combines two sets of options into a single set.
Params
- options1
Object
- base set of options - options2
Object
- set of options to merge intooptions1
- [forceClone]
Bool
- ensures that a clone is returned rather that one of the original options objects
Returns: Object
- Combined options
###LayoutUtility.registerHelper(name, Helper)
Registers a layout-helper so it can be used as a layout-literal for
a layout-controller. The LayoutHelper instance must support the parse
function, which is fed the layout-literal content.
Example:
Layout.registerHelper('dock', LayoutDockHelper);
var layoutController = new LayoutController({
layout: { dock: [,
['top', 'header', 50],
['bottom', 'footer', 50],
['fill', 'content'],
]},
dataSource: {
header: new Surface({content: 'Header'}),
footer: new Surface({content: 'Footer'}),
content: new Surface({content: 'Content'}),
}
})
Params
- name
String
- name of the helper (e.g. 'dock') - Helper
function
- Helper to register (e.g. LayoutDockHelper)
###LayoutUtility.unregisterHelper(name) Unregisters a layout-helper.
Params
- name
String
- name of the layout-helper
###LayoutUtility.getRegisteredHelper(name) Gets a registered layout-helper by its name.
Params
- name
String
- name of the layout-helper
Returns: function
- layout-helper or undefined