-
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:
-
appendScalarAttrib(scalar)
-
Append a scalar object to scalarAttribs array.
Parameters:
- Source:
-
assign(srcObj, withId)
-
Assign data in srcObj to this object.
Parameters:
Name |
Type |
Description |
srcObj |
ObjectEx
|
|
withId |
Bool
|
If set to true, id of srcObj will be copied to this object,
otherwise this object's id will be cleared. |
- Source:
-
assignTo(targetObj, withId)
-
Assign data in this object to targetObj.
Parameters:
Name |
Type |
Description |
targetObj |
ObjectEx
|
|
withId |
Bool
|
If set to true, id of current object will be copied to targetObj,
otherwise targetObj's id will be cleared. |
- 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:
-
clearIds()
-
Set id property to null on this object and all its children.
- Source:
-
-
Returns a cloned object.
Parameters:
Name |
Type |
Description |
withId |
Bool
|
If set to true, id of this object will cloned to new object,
otherwise id of new object will be cleared. |
- Source:
Returns:
-
Type
-
Kekule.ChemObject
-
copyPropsTo(dest)
-
Copy property values to dest object. Dest must be a desendant of
ObjectEx.
Parameters:
- Inherited From:
- Source:
-
defineEvent(eventName) → {Object}
-
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
-
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:
-
-
Get list of all properties in this class, including ones inherited from parent class.
- Inherited From:
- Source:
Returns:
-
Type
-
Class.PropList
-
getChildAt(index) → {Variant}
-
Get child object at index.
To a simple chem object without any child, this method will always return null.
Descendants need to override this method if they has children.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Source:
Returns:
-
Type
-
Variant
-
getChildCount() → {Int}
-
Get count of child objects.
To a simple chem object without any child, this method will always return 0.
Descendants need to override this method if they has children.
- Source:
Returns:
-
Type
-
Int
-
getClass() → {Object}
-
Get class of this object.
- Inherited From:
- Source:
Returns:
Class object.
-
Type
-
Object
-
getClassName() → {String}
-
Get class name of this object, usually returns CLASS_NAME field.
- Inherited From:
- Source:
Returns:
Class name of object.
-
Type
-
String
-
-
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
-
getInfoKeys() → {Array}
-
Returns all keys in Kekule.ChemObject#info property.
- Source:
Returns:
-
Type
-
Array
-
getInfoValue(key)
-
Get item value from info hash.
Parameters:
Name |
Type |
Description |
key |
|
Key of information item. |
- Source:
-
-
Returns nearest selectable chem object.
Usually this method will return this object, but if this object is not selectable,
parent object will be returned instead.
- Source:
Returns:
-
Type
-
Kekule.ChemObject
-
getNextSibling() → {Object}
-
Returns next sibling object in parent.
If parent not set, null will be returned.
- Source:
Returns:
-
Type
-
Object
-
-
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:
-
Type
-
String
-
getPropInfo(propName) → {Object}
-
Get property info object from the property list of current class.
Parameters:
Name |
Type |
Description |
propName |
String
|
Name of property. |
- 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:
- 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
-
getPrototype() → {Object}
-
Get prototype of this object.
- Inherited From:
- Source:
Returns:
-
Type
-
Object
-
getScalarAttribAt(index) → {Kekule.Scalar}
-
Get scalar attrib object at index.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Source:
Returns:
-
Type
-
Kekule.Scalar
-
getScalarAttribCount() → {Int}
-
Get count of scalar attributes.
- Source:
Returns:
-
Type
-
Int
-
getSerializationName() → {String}
-
Returns a name to be used in serialization. Descendants can override this.
- Inherited From:
- Source:
Returns:
-
Type
-
String
-
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
-
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
-
indexOfChild(obj) → {Int}
-
Get the index of obj in children list.
To a simple chem object without any child, this method will always return -1.
Descendants need to override this method if they has children.
Parameters:
Name |
Type |
Description |
obj |
Variant
|
|
- Source:
Returns:
Index of obj or -1 when not found.
-
Type
-
Int
-
initPropValues()
-
Set initial value of properties.
Desendants can override this method.
- Inherited From:
- 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:
-
isChildOf(obj)
-
Check if this object is a child (direct or indirect) of another object.
Parameters:
Name |
Type |
Description |
obj |
|
|
- Source:
-
isEmpty() → {Bool}
-
Check if this object contains no data.
- Source:
Returns:
-
Type
-
Bool
-
isEventHandlerList(value) → {bool}
-
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:
-
isSelectable()
-
Check whether this object can be selected in editor.
- Source:
-
isUpdating()
-
Check if object is in updating state.
- Inherited From:
- Source:
-
loaded()
-
Called after this object is loaded by a serialization system. Descendants may override this.
- Inherited From:
- Source:
-
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:
-
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:
-
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:
-
removeScalarAttrib(scalar) → {Kekule.Scalar}
-
Remove scalar in scalarAttribs array.
Parameters:
- Source:
Returns:
Object removed or null.
-
Type
-
Kekule.Scalar
-
removeScalarAttribAt(index) → {Kekule.Scalar}
-
Remove scalar at index in scalarAttribs array.
Parameters:
Name |
Type |
Description |
index |
Int
|
|
- Source:
Returns:
Object removed or null.
-
Type
-
Kekule.Scalar
-
removeSelf()
-
Remove current object away from parent and owner.
- 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:
-
setInfoValue(key, value)
-
Set an item value in info hash. If key already exists, its value will be overwritten.
Parameters:
Name |
Type |
Description |
key |
|
Key of information item. |
value |
|
Value of information item. |
- 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:
-
stopEventPropagation(event)
-
Stop propagation of event, disallow it to bubble to higher level.
Parameters:
Name |
Type |
Description |
event |
Object
|
|
- Inherited From:
- Source: