-
addEventListener(eventName, listener, thisArg) → {Object}
-
Add an event handler.
Parameters:
Name |
Type |
Description |
eventName |
String
|
Name of event. |
listener |
function
|
Handler function. |
thisArg |
Object
|
The scope object applied when the handler is called. |
- Inherited From:
- Source:
Returns:
Handler info object on success, null on fail.
-
Type
-
Object
-
addOnceEventListener(eventName, listener, thisArg) → {Object}
-
Add an event handler that will only be evoked once.
Parameters:
Name |
Type |
Description |
eventName |
String
|
Name of event. |
listener |
function
|
Handler function. |
thisArg |
Object
|
The scope object applied when the handler is called. |
- Inherited From:
- Source:
Returns:
Handler info object on success, null on fail.
-
Type
-
Object
-
afterInitialization()
-
Do jobs after initialization, desendants can override this method
- Inherited From:
- Source:
-
appendAnchorNode(node)
-
Add anchor node of connection table. If node not in nodes, nothing will be done.
Parameters:
- Source:
-
appendBond(nodesOrIndexes, bondOrder, bondType) → {Kekule.Bond}
-
A util method to create a new bond object connected with nodes and append to current connection table.
Parameters:
Name |
Type |
Description |
nodesOrIndexes |
Array
|
Array of connected nodes or indexes of those nodes |
bondOrder |
Int
|
Order of bond. |
bondType |
Int
|
Type of bond. |
- Source:
Returns:
-
Type
-
Kekule.Bond
-
appendConnector(connector)
-
Add connector to connection table.
Parameters:
- Source:
-
appendNode(node)
-
Add node to connection table. If node already inside, nothing will be done.
Parameters:
- Source:
-
assign(srcObj)
-
Assign data in srcObj to this object.
Parameters:
- Inherited From:
- Source:
-
assignTo(targetObj)
-
Assign data in this object to targetObj.
Parameters:
Name |
Type |
Description |
targetObj |
ObjectEx
|
|
- Inherited From:
- Source:
-
beginUpdate()
-
Begin to update multiple properties of object. In update state, all changed properties
will not invoke propertySet event until method endUpdate is called.
- Inherited From:
- Source:
-
-
Calculate molecular formula from this connection table.
- Source:
Returns:
-
Type
-
Kekule.MolecularFormula
-
clear()
-
Clear all nodes, anchor nodes and connectors in connection table.
- Source:
-
clearAnchorNodes()
-
Remove all anchor nodes from connection table.
- Source:
-
clearConnectors()
-
Remove all connectors from connection table.
- Source:
-
clearNodes()
-
Remove all nodes from connection table.
- Source:
-
-
Returns a cloned object.
- Inherited From:
- Source:
Returns:
-
Type
-
ObjectEx
-
copyPropsTo(dest)
-
Copy property values to dest object. Dest must be a desendant of
ObjectEx.
Parameters:
- Inherited From:
- Source:
-
defineEvent(eventName) → {Object}
-
Define an event in class. Event is actually a special property with type Class.EventHandlerList
Parameters:
Name |
Type |
Description |
eventName |
String
|
Name of event. |
- Inherited From:
- Deprecated:
- Source:
Returns:
Property info object created.
-
Type
-
Object
-
defineProp(propName, options) → {Object}
-
Define a property in class.
Parameters:
Name |
Type |
Description |
propName |
String
|
Name of property, case sensitive. |
options |
Object
|
A hash object, may contains the following fields:
{
dataType: type of property data, a string constant in DataType or a class name.
//storeField: field in object to store property value, // not allowed for running speed
getter: getter function,
setter: setter function, if set to null, the property will be read-only,
serializable: boolean, whether the property should be save or restore in serialization. Default is true.
defaultValue: default value of property, can only be simple type (number, string, bool...)
} |
- Inherited From:
- Source:
Returns:
Property info object added to property list.
-
Type
-
Object
-
deleteChildObj(childObj, cascadeDelete)
-
Remove and free childObj from connection table.
Parameters:
Name |
Type |
Description |
childObj |
Variant
|
A child node or connector. |
cascadeDelete |
Bool
|
Whether delete related objects (e.g., bond connected to an atom). |
- Source:
-
doEndUpdate()
-
Actual work of endUpdate, just invoke all property change events.
- Inherited From:
- Source:
-
doPropChanged(propName, newValue)
-
Do some job when a property value is changed. Descendants can override this.
Parameters:
Name |
Type |
Description |
propName |
String
|
Name of property. |
newValue |
Variant
|
New value of the property. |
- Inherited From:
- Source:
-
endUpdate()
-
Update end and notify all properties changed after calling of beginUpdate.
- Inherited From:
- Source:
-
finalize()
-
Free resources used. Like finalize method in Java.
- Inherited From:
- Source:
-
-
Returns the direct node/substructure that contains originObj.
originObj may be a child node or connector of substructure in this ctab.
If originObj is actually not in this ctab, null will be returned.
Parameters:
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
getAllChildConnectors() → {Array}
-
Return all bonds in structure as well as in sub structure.
- Source:
Returns:
Array of {Kekule.ChemStructureConnector}.
-
Type
-
Array
-
getAllContainingConnectors() → {Array}
-
Return all bonds in structure as well as in sub structure.
- Source:
Returns:
Array of {Kekule.ChemStructureConnector}.
-
Type
-
Array
-
getAllPropList() → {Class.PropList}
-
Get list of all properties in this class, including ones inherited from parent class.
- Inherited From:
- Source:
Returns:
-
Type
-
Class.PropList
-
-
Get anchor node at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
getAnchorNodeCount() → {Int}
-
Return count of anchorNodes.
- Source:
Returns:
-
Type
-
Int
-
getChildAt(index) → {Variant}
-
Get child object (including both nodes and connectors) at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Source:
Returns:
-
Type
-
Variant
-
-
Get child object at indexStack.
For example, indexStack is [2, 3, 1], then this.getChildAt(2).getChildAt(3).getChildAt(1) will be returned.
Parameters:
Name |
Type |
Description |
indexStack |
Array
|
Array of integers. |
- Source:
Returns:
-
Type
-
Kekule.ChemStructureObject
-
getChildCount() → {Int}
-
Get count of child objects (including both nodes and connectors).
- Source:
Returns:
-
Type
-
Int
-
getClass() → {Object}
-
Get class of this object.
- Inherited From:
- Source:
Returns:
Class object.
-
Type
-
Object
-
getClassLocalName() → {String}
-
Get last part of class name of this object.
For example, 'Atom' will be returned by instance of class 'Kekule.Atom'.
- Inherited From:
- Source:
Returns:
Last part of class name of object.
-
Type
-
String
-
getClassName() → {String}
-
Get class name of this object, usually returns CLASS_NAME field.
- Inherited From:
- Source:
Returns:
Class name of object.
-
Type
-
String
-
-
Get connector at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Source:
Returns:
-
Type
-
Kekule.ChemStructureConnector
-
-
Get connector at indexStack.
For example, indexStack is [2, 3, 1], then this.getNodeAt(2).getNodeAt(3).getConnectorAt(1) will be returned.
Parameters:
Name |
Type |
Description |
indexStack |
Array
|
Array of integers. |
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
-
Get a structure connector object with a specified id.
Parameters:
Name |
Type |
Description |
id |
String
|
|
- Source:
Returns:
-
Type
-
Kekule.ChemStructureConnector
-
getConnectorCount() → {Int}
-
Return count of connectors.
- Source:
Returns:
-
Type
-
Int
-
getContainerBox(coordMode, allowCoordBorrow) → {Hash}
-
Calculate the box to fit all nodes in CTable of molecule.
Parameters:
Name |
Type |
Description |
coordMode |
Int
|
Determine to calculate 2D or 3D box. Value from Kekule.CoordMode. |
allowCoordBorrow |
Bool
|
|
- Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
-
Type
-
Hash
-
getContainerBox2D(allowCoordBorrow) → {Hash}
-
Calculate the 2D box to fit all nodes in CTable.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Source:
Returns:
2D box information. {x1, y1, x2, y2, width, height}.
-
Type
-
Hash
-
getContainerBox3D(allowCoordBorrow) → {Hash}
-
Calculate the 3D box to fit all nodes in CTable.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Source:
Returns:
3D box information. {x1, y1, z1, x2, y2, z2, deltaX, deltaY, deltaZ}.
-
Type
-
Hash
-
getEventHandlerList(eventName) → {Class.EventHandlerList}
-
Get the handler list of a event.
Parameters:
Name |
Type |
Description |
eventName |
String
|
Name of event. |
- Inherited From:
- Source:
Returns:
Handler list of event. If this event does not exist, null is returned.
-
Type
-
Class.EventHandlerList
-
getLeafNodes() → {Array}
-
Get all leaf nodes (node that do not have children, usually atom).
Note if a sub group has no children, it will be regarded as leaf node too.
- Source:
Returns:
-
Type
-
Array
-
getNextSiblingOfChild(childObj) → {Variant}
-
Returns next sibling node or connector to childObj.
Parameters:
Name |
Type |
Description |
childObj |
Variant
|
Node or connector. |
- Source:
Returns:
-
Type
-
Variant
-
-
Get node at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
-
Get node at indexStack.
For example, indexStack is [2, 3, 1], then this.getNodeAt(2).getNodeAt(3).getNodeAt(1) will be returned.
Parameters:
Name |
Type |
Description |
indexStack |
Array
|
Array of integers. |
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
-
Get a structure node object with a specified id.
Parameters:
Name |
Type |
Description |
id |
String
|
|
- Source:
Returns:
-
Type
-
Kekule.ChemStructureNode
-
getNodeCount() → {Int}
-
Return count of nodes.
- Source:
Returns:
-
Type
-
Int
-
getNodesContainBox(nodes, coordMode, allowCoordBorrow) → {Hash}
-
Calculate the absolute box to fit all nodes.
Parameters:
Name |
Type |
Description |
nodes |
Array
|
|
coordMode |
Int
|
Determine to calculate 2D or 3D box. Value from Kekule.CoordMode. |
allowCoordBorrow |
Bool
|
|
- Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
-
Type
-
Hash
-
-
Get a structure node or connector object with a specified id.
Parameters:
Name |
Type |
Description |
id |
String
|
|
- Source:
Returns:
-
Type
-
Kekule.ChemStructureObject
-
getOwnPropList() → {Class.PropList}
-
Get property list of this class. The properties inherited from parent class will not be returned.
- Inherited From:
- Source:
Returns:
-
Type
-
Class.PropList
-
getPropertyDataType(propName) → {String}
-
Returns type constants of property.
Parameters:
Name |
Type |
Description |
propName |
String
|
|
- Inherited From:
- Source:
Returns:
Values from DataType.
-
Type
-
String
-
getPropInfo(propName, ownPropertyOnly) → {Object}
-
Get property info object from the property list of current class.
Parameters:
Name |
Type |
Description |
propName |
String
|
Name of property. |
ownPropertyOnly |
Bool
|
If true, only property defined in this class will be checked. |
- Inherited From:
- Source:
Returns:
Property info object found. If there is no such a property, null is returned.
-
Type
-
Object
-
getPropListOfScopes(scopes) → {Class.PropList}
-
Get list of all properties of certain scopes in this class, including ones inherited from parent class.
Parameters:
Name |
Type |
Description |
scopes |
Array
|
Array item from Class.PropertyScope. |
- Inherited From:
- Source:
Returns:
-
Type
-
Class.PropList
-
getPropStoreFieldValue(propName) → {Variant}
-
Get value of a property's store field. Use this method to get property value and avoid
the call of property getter.
Note: if the property has no store field, this method may returns null or undefined.
Parameters:
Name |
Type |
Description |
propName |
String
|
Name of property. |
- Inherited From:
- Source:
Returns:
Value of property. If property does not exists, null is returned.
-
Type
-
Variant
-
getPropValue(propName) → {Variant}
-
Get value of a property.
Parameters:
Name |
Type |
Description |
propName |
String
|
Name of property. |
- Inherited From:
- Source:
Returns:
Value of property. If property does not exists, null is returned.
-
Type
-
Variant
-
getPropValues(propNames) → {Hash}
-
Returns values of a series of properties.
Parameters:
Name |
Type |
Description |
propNames |
Variant
|
Can be an array of property names, also can be an object while the
direct field names of object will be regarded as property names. |
- Inherited From:
- Source:
Returns:
Stores all property name-value pair.
-
Type
-
Hash
-
getPrototype() → {Object}
-
Get prototype of this object.
- Inherited From:
- Source:
Returns:
-
Type
-
Object
-
getSerializationName() → {String}
-
Returns a name to be used in serialization. Descendants can override this.
- Inherited From:
- Source:
Returns:
-
Type
-
String
-
getSubFragments() → {Array}
-
Get all sub fragments (node that have children, usually SubGroup).
Note if a sub group has no children, it will not be regarded as sub fragment.
- Source:
Returns:
-
Type
-
Array
-
getSuperClass() → {Object}
-
Get super class of this object.
- Inherited From:
- Source:
Returns:
Class object.
-
Type
-
Object
-
getSuperClassPrototype() → {Object}
-
Get prototype of super class.
- Inherited From:
- Source:
Returns:
If there is no super class, null is returned.
-
Type
-
Object
-
hasChildObj(childObj) → {Bool}
-
Check if childObj is a child node or connector of this ctab.
Parameters:
- Source:
Returns:
-
Type
-
Bool
-
hasConnector(connector, checkNestedStructure) → {Bool}
-
Check if a connector exists in structure.
Parameters:
Name |
Type |
Description |
connector |
Kekule.ChemStructureConnector
|
Connector to seek. |
checkNestedStructure |
Bool
|
If true the nested sub groups will also be checked. |
- Source:
Returns:
-
Type
-
Bool
-
hasDirectProperty(propName) → {Boolean}
-
Check if property is defined in current class (not inherited from super class).
Parameters:
Name |
Type |
Description |
propName |
String
|
Name of property. |
- Inherited From:
- Source:
Returns:
-
Type
-
Boolean
-
hasNode(node, checkNestedStructure) → {Bool}
-
Check if a node exists in structure.
Parameters:
Name |
Type |
Description |
node |
Kekule.ChemStructureNode
|
Node to seek. |
checkNestedStructure |
Bool
|
If true the nested sub groups will also be checked. |
- Source:
Returns:
-
Type
-
Bool
-
hasProperty(propName) → {Boolean}
-
Check if property exists in current class.
Parameters:
Name |
Type |
Description |
propName |
String
|
Name of property. |
- Inherited From:
- Source:
Returns:
-
Type
-
Boolean
-
hasSubFragments() → {Bool}
-
Returns whether there are sub fragment(s) (node that have children, usually SubGroup) in this ctab.
Note if a sub group has no children, it will not be regarded as sub fragment.
- Source:
Returns:
-
Type
-
Bool
-
indexOfAnchorNode(node) → {Int}
-
Get index of node in anchorNodes list.
Parameters:
- Source:
Returns:
-
Type
-
Int
-
indexOfChild(obj) → {Int}
-
Get the index of obj in children list.
Parameters:
Name |
Type |
Description |
obj |
Variant
|
|
- Source:
Returns:
Index of obj or -1 when not found.
-
Type
-
Int
-
indexOfConnector(connector) → {Int}
-
Get index of connector in connectors list.
Parameters:
- Source:
Returns:
-
Type
-
Int
-
indexOfNode(node) → {Int}
-
Get index of node in nodes list.
Parameters:
- Source:
Returns:
-
Type
-
Int
-
-
Get child object at indexStack.
For example, indexStack is [2, 3, 1], then this.getNodeAt(2).getNodeAt(3).getChildAt(1) will be returned.
Parameters:
Name |
Type |
Description |
indexStack |
Array
|
Array of integers. |
- Source:
Returns:
-
Type
-
Kekule.ChemStructureObject
-
indexStackOfConnector(connector) → {Variant}
-
Returns index of connector. If connector exists in nested sub group, index in sub group will be pushed to stack as well.
Parameters:
- Source:
Returns:
If connector is the direct child of this structure, returns {Int}, otherwise stack {Array} will be returned.
-
Type
-
Variant
-
indexStackOfNode(node) → {Variant}
-
Returns index of node. If node exists in nested sub group, index in sub group will be pushed to stack as well.
Parameters:
- Source:
Returns:
If node is the direct child of this structure, returns {Int}, otherwise stack {Array} will be returned.
-
Type
-
Variant
-
insertBefore(obj, refChild) → {Int}
-
Insert obj before refChild in node or connector list. If refChild is null or does not exists, obj will be append to tail of list.
Parameters:
Name |
Type |
Description |
obj |
Variant
|
A node or connector. |
refChild |
Variant
|
Ref node or connector |
- Source:
Returns:
Index of obj after inserting.
-
Type
-
Int
-
insertConnectorAt(connector, index)
-
Insert connector to index. If index is not set, node will be inserted as the first connector of ctab.
Parameters:
- Source:
-
insertNodeAt(node, index)
-
Insert node to index. If index is not set, node will be inserted to the tail of node list of ctab.
Parameters:
- Source:
-
invokeEvent(eventName, event)
-
Invoke an event and call all corresponding handlers (listeners).
Parameters:
Name |
Type |
Description |
eventName |
String
|
Event to be invoked. |
event |
Object
|
A hash object with information about event.
At least should include the following fields:
{
name: name of event,
target: which object invoke this event, generally this object
}
If this parameter is not set, the default value {eventName, this} will be used. |
- Inherited From:
- Source:
-
isEmpty() → {Bool}
-
Returns if this fragment has no formula or ctab, or ctab has no nodes or connectors.
- Source:
Returns:
-
Type
-
Bool
-
isEventHandlerList(value) → {bool}
-
Check if a object is Class.EventHandlerList.
Parameters:
Name |
Type |
Description |
value |
Object
|
|
- Inherited From:
- Source:
Returns:
True or false.
-
Type
-
bool
-
isPropertySerializable(propName) → {Bool}
-
Returns if property is serializable.
Parameters:
Name |
Type |
Description |
propName |
String
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Bool
-
isPropUpdated(propName)
-
Check whether property is changed in begin/endUpdate procedure.
Parameters:
Name |
Type |
Description |
propName |
Object
|
|
- Inherited From:
- Source:
-
isSubFragment(node) → {Bool}
-
Check if a node has a sub structure (has child nodes).
Note if a sub group has no children, it will not be regarded as sub fragment.
Parameters:
- Source:
Returns:
-
Type
-
Bool
-
isUpdating()
-
Check if object is in updating state.
- Inherited From:
- Source:
-
loadObj(srcNode, serializerOrName)
-
load current object from srcNode.
Parameters:
Name |
Type |
Description |
srcNode |
Object
|
Storage node to load object. Different serializer requires different node. |
serializerOrName |
Variant
|
A ObjSerializer instance or name registered in ObjSerializerFactory.
Can be null to use the default serializer. |
- Inherited From:
- Source:
-
nodesHasCoord2D(allowCoordBorrow) → {Bool}
-
Check if child nodes has 2D coord.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Source:
Returns:
-
Type
-
Bool
-
nodesHasCoord3D(allowCoordBorrow) → {Bool}
-
Check if child nodes has 3D coord.
Parameters:
Name |
Type |
Description |
allowCoordBorrow |
Bool
|
|
- Source:
Returns:
-
Type
-
Bool
-
notifyPropSet(propName, newValue)
-
Notify that a property value is set
Parameters:
Name |
Type |
Description |
propName |
String
|
Name of property. |
newValue |
Variant
|
New value of the property. |
- Inherited From:
- Source:
-
objectChange()
-
Called when object is changed.
- Inherited From:
- Source:
-
off(eventName, listener, thisArg)
-
Remove an event handler, shortcut for (@link ObjectEx.removeEventListener}.
Parameters:
Name |
Type |
Description |
eventName |
String
|
Name of event. |
listener |
function
|
Handler function. |
thisArg |
Object
|
The scope object applied when the handler is called.
If not set, all listenr function in list will be removed. |
- Inherited From:
- Source:
-
on(eventName, listener, thisArg) → {Object}
-
Add an event handler, shortcut for ObjectEx.addEventListener.
Parameters:
Name |
Type |
Description |
eventName |
String
|
Name of event. |
listener |
function
|
Handler function. |
thisArg |
Object
|
The scope object applied when the handler is called. |
- Inherited From:
- Source:
Returns:
Handler info object on success, null on fail.
-
Type
-
Object
-
once(eventName, listener, thisArg) → {Object}
-
Add an event handler that will only be evoked once, shortcut for ObjectEx.addOnceEventListener.
Parameters:
Name |
Type |
Description |
eventName |
String
|
Name of event. |
listener |
function
|
Handler function. |
thisArg |
Object
|
The scope object applied when the handler is called. |
- Inherited From:
- Source:
Returns:
Handler info object on success, null on fail.
-
Type
-
Object
-
overwriteMethod(methodName, newMethod) → {ObjectEx}
-
Overwrite method of object instance (rather than prototype) with a new one.
Parameters:
Name |
Type |
Description |
methodName |
String
|
|
newMethod |
Func
|
New function.
The arguments of function should be same as overwritten one plus a extra leading param stores the old method.
e.g. Overwrite getPropValue method:
var obj = new ObjectEx();
obj.overwriteMethod('getPropValue', function($old, propName)
{
console.log('new method');
return $old(propName);
}); |
- Inherited From:
- Source:
Returns:
-
Type
-
ObjectEx
-
relayEvent(eventName, event)
-
Relay event from child of this object.
Parameters:
Name |
Type |
Description |
eventName |
String
|
Event to be invoked. |
event |
Object
|
A hash object with information about event. |
- Inherited From:
- Source:
-
removeAnchorNode(node)
-
Remove a node in anchorNodes.
Parameters:
- Source:
-
removeAnchorNodeAt(index)
-
Remove node at index of anchorNodes.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Source:
-
removeChild(childObj)
-
Remove child obj directly from connection table.
Parameters:
Name |
Type |
Description |
childObj |
Variant
|
A child node or connector. |
- Source:
-
removeChildObj(childObj, cascadeRemove, freeRemoved)
-
Remove childObj from connection table.
Parameters:
Name |
Type |
Description |
childObj |
Variant
|
A child node or connector. |
cascadeRemove |
Bool
|
Whether remove related objects (e.g., bond connected to an atom). |
freeRemoved |
Bool
|
Whether free all removed objects. |
- Source:
-
removeConnector(connector, preserveConnectedObjs)
-
Remove a connector in connection table.
Parameters:
Name |
Type |
Description |
connector |
Kekule.ChemStructureConnector
|
|
preserveConnectedObjs |
Bool
|
Whether delte relations between this connector and related nodes. |
- Source:
-
removeConnectorAt(index, preserveConnectedObjs)
-
Remove connector at index of connectors.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
preserveConnectedObjs |
Bool
|
Whether delte relations between this connector and related nodes. |
- Source:
-
removeEventListener(eventName, listener, thisArg)
-
Remove an event handler.
Parameters:
Name |
Type |
Description |
eventName |
String
|
Name of event. |
listener |
function
|
Handler function. |
thisArg |
Object
|
The scope object applied when the handler is called.
If not set, all listenr function in list will be removed. |
- Inherited From:
- Source:
-
removeNode(node, preserveLinkedConnectors)
-
Remove a node in connection table.
Parameters:
Name |
Type |
Description |
node |
Kekule.ChemStructureNode
|
|
preserveLinkedConnectors |
Bool
|
Whether remove relations between this node and linked connectors. |
- Source:
-
removeNodeAt(index, preserveLinkedConnectors)
-
Remove node at index in connection table.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
preserveLinkedConnectors |
Bool
|
Whether remove relations between this node and linked connectors. |
- Source:
-
replaceNode(oldNode, newNode)
-
Replace oldNode with new one, preserve coords and all linked connectors.
Parameters:
- Source:
-
saved()
-
Called after this object is saved through a serialization system. Descendants may override this.
- Inherited From:
- Source:
-
saveObj(destNode, serializerOrName, options)
-
Save current object to destNode.
Parameters:
Name |
Type |
Description |
destNode |
Object
|
Storage node to save object. Different serializer requires different node. |
serializerOrName |
Variant
|
A ObjSerializer instance or name registered in ObjSerializerFactory.
Can be null to use the default serializer. |
options |
Hash
|
|
- Inherited From:
- Source:
-
setConnectorIndex(connector, index)
-
Change index of connector.
Parameters:
- Source:
-
setNodeIndex(node, index)
-
Change index of node.
Parameters:
- Source:
-
setPropStoreFieldValue(propName) → {Variant}
-
Set value of a property's store field. Use this method to set property value and avoid
the call of property setter. Readonly property can also be changed in this method.
Note: if the property has no store field, this method will has no effect on property.
Parameters:
Name |
Type |
Description |
propName |
String
|
Name of property. |
- Inherited From:
- Source:
Returns:
Value of property. If property does not exists, null is returned.
-
Type
-
Variant
-
setPropValue(propName, value, ignoreReadOnly)
-
Set value of a property.
Parameters:
Name |
Type |
Description |
propName |
String
|
Name of property. |
value |
Variant
|
Value of the property. |
ignoreReadOnly |
bool
|
Try set the value directly through store field
even if the property is a readonly one (without a setter). |
- Inherited From:
- Source:
-
setPropValues(hash, ignoreReadOnly)
-
Set a series of property.
Parameters:
Name |
Type |
Description |
hash |
Hash
|
A hash object, its key and values will be used to set property value. |
ignoreReadOnly |
bool
|
Try set the value directly through store field
even if the property is a readonly one (without a setter). |
- Inherited From:
- Source:
-
setPropValueX()
-
Set value of a property. Similar to ObjectEx.setPropValue but can pass in multiple params.
The first param is always the property name while the rest will be put into setter method (setXXX).
- Inherited From:
- Source:
-
sortConnectors(sortFunc)
-
Sort direct child connectors in ctab.
Parameters:
Name |
Type |
Description |
sortFunc |
function
|
Function to determine the priority of connectors. |
- Source:
-
sortNodes(sortFunc)
-
Sort direct child nodes in ctab.
Parameters:
Name |
Type |
Description |
sortFunc |
function
|
Function to determine the priority of nodes. |
- Source:
-
stopEventPropagation(event)
-
Stop propagation of event, disallow it to bubble to higher level.
Parameters:
Name |
Type |
Description |
event |
Object
|
|
- Inherited From:
- Source:
-
traverse(callback, startingNode, breadthFirst, partialNodes) → {Hash}
-
Traverse the nodes in connection tab through a depth or breadth first spanning tree algorithm.
Parameters:
Name |
Type |
Description |
callback |
Func
|
Function called when meet a new node or connector, has two params: callback(currNodeOrConnector, isConnector) |
startingNode |
Kekule.StructureNode
|
Starting position of travers. |
breadthFirst |
Bool
|
Set to true to use breadth first algorithm or false to use depth first algorithm. |
partialNodes |
Array
|
If this param is set, only part of the structure will be traversed. |
- Source:
Returns:
A hash object containing all the nodes and connectors sequence traversed. {nodes, connectors}.
Note that all nodes but not all connectors (e.g., the one in ring) may be traversed.
-
Type
-
Hash