Constructor
new TypeHandler()
Abstraction for TypeHandler implementations.
To extend TypeHandler, use:
(function()
{
// TypeHandler for custom "x" tags:
var x = adf.mf.api.amx.TypeHandler.register("http://xmlns.example.com/custom", "x");
x.prototype.render = function(amxNode)
{
var rootElement = document.createElement("div");
rootElement.appendChild(document.createTextNode("Hello World"));
return rootElement;
};
// TypeHandler for custom "y" tags:
var y = adf.mf.api.amx.TypeHandler.register("http://xmlns.example.com/custom", "y");
y.prototype.render = function(amxNode)
{
var rootElement = document.createElement("div");
rootElement.appendChild(document.createTextNode("Goodbye World"));
return rootElement;
};
})();
Methods
-
<static> _experimentalCLHandler(domEvent)
-
DO NOT USE; this method is experimental and will be removed without notice.
Parameters:
Name Type Description domEvent
Object the browser's DOM event object -
<static> register(theNamespace, tagName, precreatedClass) → {function}
-
Register a TypeHandler class with a tag namespace and name.
Parameters:
Name Type Argument Description theNamespace
string the xmlns for the tag tagName
string the name of the tag (no namespace) precreatedClass
adf.mf.api.amx.TypeHandler <optional>
optional pre-created class to register Returns:
the registered adf.mf.api.amx.TypeHandler subclass so that prototype functions can be added- Type
- function
-
__experimentalCLAssociation(amxNode, amxNodeId, eventType, rootElement, useDocument)
-
DO NOT USE; this method is experimental and will be removed without notice.
Parameters:
Name Type Description amxNode
adf.mf.api.amx.AmxNode an object that describes the instance of the component amxNodeId
string the id of this component eventType
string the event type rootElement
HTMLElement the root element of the component useDocument
boolean in some cases, the event node is the document -
_refreshInlineStyle(attributeChanges, element) → {boolean}
-
Called from the refresh function to update the inline style of the root DOM element. This function will use the difference from the old value and the new value to determine what changes to apply. So all style that was added by other code (like the render function of AmxNode) will not be affected.
Parameters:
Name Type Description attributeChanges
adf.mf.api.amx.AmxAttributeChange the changed attributes element
Element the DOM element to which to apply the changes Returns:
true if the changes were made- Type
- boolean
-
_refreshStyleClass(attributeChanges, element) → {boolean}
-
Updates the style class of the root DOM element. This function will use the difference from the old value and the new value to determine what style classes to add and which to remove, so all style classes that were added by other code (like the render function of AmxNode) will not be affected.
Parameters:
Name Type Description attributeChanges
adf.mf.api.amx.AmxAttributeChange the changed attributes element
Element the DOM element to which to apply the changes Returns:
true if the changes were made- Type
- boolean
-
adopt(theRawObject)
-
Adopt the properties of another object as our own.
Parameters:
Name Type Description theRawObject
Object the other object - Inherited From:
-
associateElementWithAmxNode(amxNode, elem)
-
Allows a DOM element to be associated to the AMX node. Necessary for AmxNode.getAmxNodeForElement to function. Calling this method is only necessary if the element is located outside of its parent element or under a different node's element (element is not a direct descendent of a node rendered for the amxNode's root element or its own children elements).
Parameters:
Name Type Description amxNode
adf.mf.api.amx.AmxNode the AMX node elem
object the DOM element -
attributeChangeResult(amxNode, attributeName, attributeChanges) → {number}
-
Checks if the type handler can handle updating the DOM in response to a changed attribute. Called from updateChildren or handleChanges. Currently the base implementation supports styleClass and inlineStyle changes to be handled by the refresh function. Note that if the embedded side is being used to maintain the AMX node hierarchy, it is not valid to be changing it on the client.
Parameters:
Name Type Description amxNode
adf.mf.api.amx.AmxNode AMX node that has changed attributeName
string the name of the attribute to check attributeChanges
adf.mf.api.amx.AmxAttributeChange the changed attributes - See:
-
- #isEmbeddedSideMaintainingHierarchy
Returns:
one of the adf.mf.api.amx.AmxNodeChangeResult constants.- Type
- number
-
clone() → {Object}
-
Returns a clone of this object. The default implementation is a shallow copy. Subclassers can override this method to implement a deep copy.
- Inherited From:
Returns:
a new shallow copy of this object- Type
- Object
-
createCallback(func) → {function}
-
Creates a function instance that will call back the passed in function with the current "this". This is extremely useful for creating callbacks.
Parameters:
Name Type Description func
function the function to proxy - Inherited From:
Returns:
the proxied function- Type
- function
-
equals(object) → {boolean}
-
Indicates whether some other adf.mf.api.AdfObject is "equal to" this one. Method is equivalent to java ".equals()" method.
Parameters:
Name Type Description object
Object the object to compare with - Inherited From:
Returns:
whether the objects are "equal"- Type
- boolean
-
getClass(otherInstance) → {Object}
-
Get the class for an object.
Parameters:
Name Type Description otherInstance
Object optional other object to use - Inherited From:
Returns:
the class of or null if the class cannot be found- Type
- Object
-
getConvertableAttribute(amxNode) → {string|null}
-
Specify what attribute should be converted if the node has a converter set. Defaults to "value" if the value attribute has been set on the tag
Parameters:
Name Type Description amxNode
adf.mf.api.amx.AmxNode the AMX node Returns:
the name of the attribute to use or null to not support a converter- Type
- string | null
-
getInputValueAttribute() → {string|null}
-
Gets the attribute to be used for validation. If a non-null value is returned, the AmxNode's storeModifyableEl method will be called for this attribute, so it is not necessary for the type handler to manually call this method.
Returns:
the name of the attribute to use for validation. By default null is returned.- Type
- string | null
-
getTypeName() → {String}
-
Returns the type name for this instance
- Inherited From:
Returns:
name of the Class- Type
- String
-
handleChanges(amxNode, attributeChanges) → {number}
-
Function that is called when the node has been affected by changes to the node hierarchy in the embedded side May be overridden to make custom changes to the children due to an attribute change. If the sub-class only needs to react to individual attribute changes, it may override only the attributeChangeResult function instead.
Parameters:
Name Type Description amxNode
adf.mf.api.amx.AmxNode AMX node that has changed attributeChanges
adf.mf.api.amx.AmxAttributeChange the changed attributes Returns:
one of the adf.mf.api.amx.AmxNodeChangeResult constants.- Type
- number
-
isEmbeddedSideMaintainingHierarchy() → {boolean}
-
Checks if the AMX node hierarchy is being maintained by the embedded side. If so, the type handler should not be making changes to the nodes and only be handling the rendering changes.
Returns:
true if the node hierchy changes should be handled by the Java tag handlers or false if the JavaScript type handlers are responsible for the changes to the hierarchy- Type
- boolean
-
postInitialize(amxNode)
-
Called after AMX node has been de-serialized from the embedded side, after the children have been created and added to the node. This method is not invoked if the AMX node hierarchy is constructed in the webview.
Parameters:
Name Type Description amxNode
adf.mf.api.amx.AmxNode The AMX node -
preInitialize(amxNode)
-
Called after AMX node has been de-serialized from the embedded side, but before the children have been created. This method is not invoked if the AMX node hierarchy is constructed in the webview.
Parameters:
Name Type Description amxNode
adf.mf.api.amx.AmxNode The AMX node -
refresh(amxNode, attributeChanges, descendentChanges)
-
Called to refresh the HTML of a node. This method is called after the updateChildren method and should be implemented by type handlers that wish to update their DOM in response to a change.
Parameters:
Name Type Description amxNode
adf.mf.api.amx.AmxNode AMX node that has changed attributeChanges
adf.mf.api.amx.AmxAttributeChange the changed attributes descendentChanges
adf.mf.api.amx.AmxDescendentChanges | null the changes for any descendent nodes that need to be refreshed. -
render(amxNode, id)
-
Renders the initial set of DOM for this component.
Parameters:
Name Type Description amxNode
adf.mf.api.amx.AmxNode an object that describes the instance of the component to be rendered id
string the id of this component -
toDebugString() → {String}
-
Get a debug string representation of this object instance. It is not guaranteed to be unique or of a standard format.
- Inherited From:
Returns:
a debug string representation of this object instance- Type
- String
-
toString() → {String}
-
Get a string representation of this object instance. It is not guaranteed to be unique or interesting.
- Inherited From:
Returns:
a string representation of this object instance- Type
- String
-
updateChildren(amxNode, attributeChanges) → {number}
-
Function that checks to see if the attributes that have changed may be handled by the refresh function. May be overridden to make custom changes to the children due to an attribute change. If the sub-class only needs to react to individual attribute changes, it may override only the attributeChangeResult function instead.
Parameters:
Name Type Description amxNode
adf.mf.api.amx.AmxNode AMX node that has changed attributeChanges
adf.mf.api.amx.AmxAttributeChange the changed attributes - Deprecated:
- This method has been replaced with handleChanges which handles changes from the embedded side
Returns:
one of the adf.mf.api.amx.AmxNodeChangeResult constants.- Type
- number
Non-public Methods
-
<protected, static> InitClass()
-
Initializes the TypeHandler class
-
<protected> GetLazyArrayProperty(key, createIfNonexistent, otherInstance) → {Object}
-
Returns the specified array property. If createIfNonexistent is true and the property doesn't exist, it will be created, and returned.
Parameters:
Name Type Description key
Object the key for the property createIfNonexistent
boolean true if a new empty Array should be created and associated otherInstance
Array another object to use instead of this object - Inherited From:
Returns:
the property value associated with the given key- Type
- Object
-
<protected> GetLazyMapProperty(key, createIfNonexistent, otherInstance) → {Object}
-
Returns the specified Map property value. If createIfNonexistent is true and the property doesn't exist, an empty Object will be created, and returned.
Parameters:
Name Type Description key
Object the key for the property createIfNonexistent
boolean true if a new empty Object should be created and associated otherInstance
Object another object to use instead of this object - Inherited From:
Returns:
the property value associated with the given key- Type
- Object
-
<protected> Init()
-
Initializes the instance. Subclasses of adf.mf.api.AdfObject must call their superclass' Init.
- Inherited From: