Utility class for famous-flex.
- LayoutUtility
- LayoutUtility ⏏
- .normalizeMargins(margins)
- .cloneSpec(spec) ⇒
Spec
- .isEqualSpec(spec1, spec2) ⇒
Boolean
- .getSpecDiffText(spec1, spec2) ⇒
String
- .error(message)
- .warning(message)
- .log(args)
- .combineOptions(options1, options2, [forceClone]) ⇒
Object
- .registerHelper(name, Helper)
- .unregisterHelper(name)
- .getRegisteredHelper(name) ⇒
function
- LayoutUtility ⏏
Normalizes the margins argument.
Kind: static method of LayoutUtility
Param | Type |
---|---|
margins | Array.Number |
Makes a (shallow) copy of a spec.
Kind: static method of LayoutUtility
Returns: Spec
- cloned spec
Param | Type | Description |
---|---|---|
spec | Spec |
Spec to clone |
Compares two specs for equality.
Kind: static method of LayoutUtility
Returns: Boolean
- true/false
Param | Type | Description |
---|---|---|
spec1 | Spec |
Spec to compare |
spec2 | Spec |
Spec to compare |
Helper function that returns a string containing the differences between two specs.
Kind: static method of LayoutUtility
Returns: String
- text
Param | Type | Description |
---|---|---|
spec1 | Spec |
Spec to compare |
spec2 | Spec |
Spec to compare |
Helper function to call whenever a critical error has occurred.
Kind: static method of LayoutUtility
Param | Type | Description |
---|---|---|
message | String |
error-message |
Helper function to call whenever a warning error has occurred.
Kind: static method of LayoutUtility
Param | Type | Description |
---|---|---|
message | String |
warning-message |
Helper function to log 1 or more arguments. All the arguments are concatenated to produce a single string which is logged.
Kind: static method of LayoutUtility
Param | Type | Description |
---|---|---|
args | String | Array | Object |
arguments to stringify and concatenate |
Combines two sets of options into a single set.
Kind: static method of LayoutUtility
Returns: Object
- Combined options
Param | Type | Description |
---|---|---|
options1 | Object |
base set of options |
options2 | Object |
set of options to merge into options1 |
[forceClone] | Bool |
ensures that a clone is returned rather that one of the original options objects |
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'}),
}
})
Kind: static method of LayoutUtility
Param | Type | Description |
---|---|---|
name | String |
name of the helper (e.g. 'dock') |
Helper | function |
Helper to register (e.g. LayoutDockHelper) |
Unregisters a layout-helper.
Kind: static method of LayoutUtility
Param | Type | Description |
---|---|---|
name | String |
name of the layout-helper |
Gets a registered layout-helper by its name.
Kind: static method of LayoutUtility
Returns: function
- layout-helper or undefined
Param | Type | Description |
---|---|---|
name | String |
name of the layout-helper |