Namespace JUL.UI

JUL tools for working with a config tree of component configs
It can be also used as an instantiator (see JUL.UI.Parser method)

Namespace Summary
Constructor Attributes Constructor Name and Description
 
JUL.UI namespace

Method Summary

Namespace Detail

JUL.UI
JUL.UI namespace

Field Detail

<private> <static> {Function} JUL.UI._createElement
Reference to a createElement() function used in Virtual DOM
<private> <static> {Object} JUL.UI._domDocument
May be set to a custom document object to use createDom() for various DOM implementations
<private> <static> {Object} JUL.UI._domParser
It can be set to a user defined DOM Parser instance
<private> <static> {Function} JUL.UI._includeMerger
May be set to a 'include' merging function used globally by the parser. See JUL.UI.include() parameters.
<private> <static> {String} JUL.UI._instanceProperty
Used for debugging purposes
<private> <static> {Object} JUL.UI._jsonPrefixes
Prefixes used when serializing certain objects into JSON.
See:
JUL.UI._usePrefixes property
<private> <static> {Boolean} JUL.UI._keepInstance
Used for debugging purposes
<private> <static> {String} JUL.UI._newlineString
New line delimiter for serialized strings
<private> <static> {Number} JUL.UI._phraseLength
Desired line length of an Array/Object member list in the generated code
<private> <static> {Object} JUL.UI._regExps
Several RegExp patterns used across JUL.UI
<private> <static> {String} JUL.UI._spaceString
Space delimiter for serialized strings
<private> <static> {String} JUL.UI._tabString
Tab delimiter for serialized strings
<private> <static> {Boolean} JUL.UI._useDoubleQuotes
Set to true to generate double quoted JavaScript strings
<private> <static> {Boolean} JUL.UI._usePrefixes
If true, the objects/functions will serialize into JSON using type dependent prefixes.
See:
JUL.UI._jsonPrefixes hash. This doesn't affect the generated JavaScript.
<static> {String} JUL.UI.bindingProperty
The name of the binding property in the config tree
<static> {Boolean} JUL.UI.booleanAttrs
If enabled, boolean config props passed to JUL.UI.createDom() will be regarded as HTML5 boolean attributes
<static> {String} JUL.UI.childrenProperty
The name of the children property in the config tree
<static> {String} JUL.UI.classProperty
The name of the class property in the config tree
<static> {String} JUL.UI.cssProperty
The name of the CSS class property in the config tree
<static> {Function} JUL.UI.customFactory
An optional custom function to instantiate a component
<static> {String} JUL.UI.defaultClass
The name of the default class in the config tree
<static> {String} JUL.UI.htmlProperty
The name of the inner HTML property in the config tree
<static> {String} JUL.UI.idProperty
The name of the ID property in the config tree
<static> {String} JUL.UI.includeProperty
The name of the include property in the config tree
<static> {String} JUL.UI.instantiateProperty
A property that may contain a per-config list of members to instantiate
<static> {Object} JUL.UI.membersMappings
Optional mappings between the component class name and a list of members to instantiate
<static> {Array} JUL.UI.membersProperties
An array of names of the other 'members' properties in the config tree
<static> {String} JUL.UI.parentProperty
The name of the parent property in the config tree. Used if topDown is true
<static> {String} JUL.UI.parserProperty
The name pf the parser config property used as meta information for a branch of the config tree
<static> {String} JUL.UI.referencePrefix
It allows JUL.UI.obj2str() to output the enclosed expression unquoted. It also applies to JUL.UI.creatDom() when setting the element attributes. When using create() method, it will resolve to an object using get() method of the instance.
<static> {String} JUL.UI.tagProperty
The name of the tag property in the config tree
<static> {Boolean} JUL.UI.topDown
Set this to true to have a top-down instantiation instead of the default bottom-up one
<static> {Boolean} JUL.UI.useTags
Whether to use tag property in the config tree
<static> {Object} JUL.UI.xmlNS
Hash containing XML namespaces for several DOM languages

Method Detail

  • <private> <static> JUL.UI._createXml(sXml)
    Utility wrapper of browser's XML parser
    Parameters:
    sXml
  • <private> <static> JUL.UI._jsonize(oData, _sKey)
    Copies an object to a format suitable for JSON.stringify(). Used only for old JSON engines
    Parameters:
    oData
    _sKey
  • <private> <static> JUL.UI._jsonReplacer(sKey, oValue)
    Callback used internally by the serializer
    Parameters:
    sKey
    oValue
  • <static> {Object} JUL.UI.compact(oData, bAuto, _nLength)
    Compacts a config tree converting suitable 'childrenProperty' items into 'membersProperties' properties
    Parameters:
    {Object} oData
    Config tree
    {Boolean} bAuto
    Autodetect compactable items and add their names to the 'membersProperties' array of the parser
    {Number} _nLength Optional
    For internal use
    Returns:
    {Object} Compacted config tree
  • <static> {Object} JUL.UI.create(oTree, oBindings, oParent, bSparse)
    Creates a tree of runtime objects specified by a config tree
    Object instances are created bottom-up by default with children instances put in the parent config, or top-down with parent instance put in the children configs
    Parameters:
    {Object} oTree
    Config tree root or array of root configs
    {Object|Array} oBindings Optional
    Config tree logic that will apply to the corresponding nodes
    {Object} oParent Optional
    Optional parent object of the root instance when instantiating top-down
    {Boolean} bSparse Optional
    This allows parsing a ‘sparse’ tree, i.e. a tree where some component nodes are not direct children of other components. Every node which has a class or a tag set will be instantiated, regardless of its membership. The ‘defaultClass’ property of the parser does not apply in this mode.
    Returns:
    {Object} Tree root instance or array of root instances
  • <static> {Object} JUL.UI.createComponent(oConfig)
    Creates a single component given its config
    If the ID property is a dotted path, the component is published (made available) under that path
    Parameters:
    {Object} oConfig
    Component config
    Returns:
    {Object} Component instance
  • <static> {Object} JUL.UI.createDom(oConfig, oWidget)
    Custom factory for DOM languages
    To use it, set the 'customFactory' property of the parser to JUL.UI.createDom
    Parameters:
    {Object} oConfig
    Config object
    {Object} oWidget Optional
    Optional element instance. If present, the element will not be created, but it will be applied the passed config.
    Returns:
    {Object} Element instance
  • <static> {Object} JUL.UI.createVDom(oConfig)
    Uses a variant of createElement(sClass, oProps, aChildren) like in React or Vue.js to create a V-DOM node. createElement() must be present in the outer environment or the _domDocument parser property must be set t to an object with the appropriate method.
    Parameters:
    {Object} oConfig
    Config object
    Returns:
    {Object} V-DOM node
  • <static> {Object} JUL.UI.expand(oData)
    Expands a compacted config tree converting all 'membersProperties' properties into 'childrenProperty' items
    Parameters:
    {Object} oData
    Compacted config tree
    Returns:
    {Object} Expanded config tree
  • <static> {Object} JUL.UI.factory(sClass, oArgs)
    Default factory method that creates an object of a certain class
    Parameters:
    {String} sClass
    Dotted path of the class constructor i.e. class full name
    {Object} oArgs
    Constructor arguments as a config object (excluding class name)
    Returns:
    {Object} The new created object
  • <static> {Array} JUL.UI.getMembers(oConfig)
    Gets a list of members to instantiate that may depend on the supplied config node. It takes into account all members settings and mappings.
    Parameters:
    {Object} oConfig Optional
    Configuration object
    Returns:
    {Array} List of member names to instantiate (for the given config)
  • <static> {Object|Array} JUL.UI.html2jul(oXml, bReturnString, bTextNodes)
    Converts a HTML string/DOM to a JUL.UI config tree or to JavaScript code, using the current document
    Parameters:
    {Object} oXml
    DOM XML object or XML string to convert
    {Boolean} bReturnString Optional
    Whether to serialize converted object to JavaScript code
    {Boolean} bTextNodes Optional
    Whether to export text nodes as standalone JUL objects
    Returns:
    {Object|Array} JUL.UI config tree or its JavaScript code
  • <static> {Object} JUL.UI.include(oData, fMerger)
    Does explicit object inheritance based on a predefined object property
    Parameters:
    {Object} oData
    Config object containing an include property i.e. a dotted path to another object
    {Function} fMerger Optional
    Callback function to do a custom object merging. it has two parameters:
    • oSource - the current object to be affected
    • oAdd - the object to be merged with oSource
    If not present, the merging is done using JUL.apply()
    Returns:
    {Object} Object with recursively applied inherited properties where not already present
  • <static> {String} JUL.UI.obj2str(oData, bQuote, fDecorator)
    Recursively converts a config object to JavaScript or to JSON
    Parameters:
    {Object} oData
    Config object
    {Boolean} bQuote Optional
    Set it to true for getting valid JSON instead of JavaScript
    {Function} fDecorator Optional
    Postprocessing the code fragment corresponding to each inner member, up to the next delimiter. Only available for the JavaScript generated code. Parameters:
    • sContent: the code fragment
    • sPath: the dotted path to the current member relative to the root object
    • sIndent: the current indentation in the generated code
    The call is made in the context of the root object. You should return the unchanged fragment when not processing.
    Returns:
    {String} JavaScript code or JSON string
  • <static> {Object} JUL.UI.xml2jul(oXml, bReturnString, bTextNodes, bLowerTags)
    Converts a XML string/DOM to a JUL.UI config tree or to JavaScript code
    Parameters:
    {Object} oXml
    DOM XML object or XML string to convert
    {Boolean} bReturnString Optional
    Whether to serialize converted object to JavaScript code
    {Boolean} bTextNodes Optional
    Whether to export text nodes as standalone JUL objects
    {Boolean} bLowerTags Optional
    Force tag names to be converted to lowercase
    Returns:
    {Object} JUL.UI config tree or its JavaScript code