Class: Composer

Kekule.Editor. Composer

new Composer(parentOrElementOrDocument, editor)

A editor with essential UI for end users.
Parameters:
Name Type Description
parentOrElementOrDocument Variant
editor Kekule.Editor.BaseEditor An editor instance embedded in UI.
Properties:
Name Type Description
editor Kekule.Editor.BaseEditor The editor instance embedded in UI.
commonToolButtons Array buttons in common tool bar. This is a array of predefined strings, e.g.: ['zoomIn', 'zoomOut', 'resetZoom', 'molDisplayType', ...]. If not set, default buttons will be used. In the array, complex hash can also be used to add custom buttons, e.g.:
[
'zoomIn', 'zoomOut',
{'name': 'myCustomButton1', 'widgetClass': 'Kekule.Widget.Button', 'action': actionClass},
{'name': 'myCustomButton2', 'htmlClass': 'MyClass' 'caption': 'My Button', 'hint': 'My Hint', '#execute': function(){ ... }},
]
chemToolButtons Array buttons in chem tool bar. This is a array of predefined strings, e.g.: ['zoomIn', 'zoomOut', 'resetZoom', 'molDisplayType', ...]. If not set, default buttons will be used. Chem tool often has a series of child tool buttons, you can also control to display which child buttons, e.g.: [ {'name': 'bond', 'attached': ['bondSingle', 'bondDouble']},
'atom', 'formula',
]
Note: currently same child button can not be existed in different chem tool buttons. In the array, complex hash can also be used to add custom buttons, e.g.:
[
'atom', 'formula',
{'name': 'myCustomButton1', 'widgetClass': 'Kekule.Widget.Button', 'action': actionClass},
{'name': 'myCustomButton2', 'htmlClass': 'MyClass' 'caption': 'My Button', 'hint': 'My Hint', '#execute': function(){ ... }},
]
styleToolComponentNames Array Array of component names that shows in style tool bar.
enableStyleToolbar Bool
enableObjModifierToolbar Bool
allowedObjModifierCategories Array
showInspector Bool Whether show advanced object inspector and structure view.
autoSetMinDimension Bool
editorConfigs Kekule.Editor.BaseEditorConfigs Configuration of this editor.
enableOperHistory Bool Whether undo/redo is enabled.
operHistory Kekule.OperationHistory History of operations. Used to enable undo/redo function.
renderType Int Display in 2D or 3D. Value from Kekule.Render.RendererType.
chemObj Kekule.ChemObject The root object in editor.
enableOperContext Bool If this property is set to true, object being modified will be drawn in a separate context to accelerate the interface refreshing.
objContext Object Context to draw basic chem objects. Can be 2D or 3D context. Alias of property drawContext
operContext Object Context to draw objects being operated. Can be 2D or 3D context.
uiContext Object Context to draw UI marks. Usually this is a 2D context.
objDrawBridge Object Bridge to draw chem objects. Alias of property drawBridge.
uiDrawBridge Object Bridge to draw UI markers.
selection Array An array of selected basic object.
enableLoadNewFile Bool Whether open a external file to displayer is allowed.
enableCreateNewDoc Bool Whether create new object in editor is allowed.
allowCreateNewChild Bool Whether new direct child of space can be created. Note: if the space is empty, one new child will always be allowed to create.
Source:

Extends

  • Kekule.ChemWidget.AbstractWidget

Classes

Configurator
Settings

Methods

(static) getMinPreferredDimension()

A class method to returns the preferred min dimension of composer widget.
Source:

canRedo() → {Bool}

Check if an undo action can be taken.
Source:
Returns:
Type
Bool

canUndo() → {Bool}

Check if an undo action can be taken.
Source:
Returns:
Type
Bool

exportObj(objClass) → {Object}

Returns exportable object for specified class.
Parameters:
Name Type Description
objClass Class Set null to export default object.
Source:
Returns:
Type
Object

exportObjs(objClass) → {Array}

Returns all exportable objects for specified class. Descendants can override this method.
Parameters:
Name Type Description
objClass Class Set null to export default object.
Source:
Returns:
Type
Array

getCoordMode() → {Int}

Returns coord mode of editor.
Source:
Returns:
Type
Int

getExportableClasses() → {Array}

Returns array of classes that can be exported (saved) from composer.
Source:
Returns:
Type
Array

hideAssocToolbar()

Hide assoc chem tool bar.
Source:

hideObjModifierToolbar()

Hide obj modifier tool bar.
Source:

hideStyleToolbar()

Hide style tool bar.
Source:

isAssocToolbarShown() → {Bool}

Check if assoc chem tool bar is visible.
Source:
Returns:
Type
Bool

isDirty() → {Bool}

Returns whether the chem object inside editor has been modified since load.
Source:
Returns:
Type
Bool

isObjModifierToolbarShown() → {Bool}

Check if obj modifier tool bar is visible.
Source:
Returns:
Type
Bool

isStyleToolbarShown() → {Bool}

Check if style tool bar is visible.
Source:
Returns:
Type
Bool

load(chemObj)

Load chem object in composer.
Parameters:
Name Type Description
chemObj Kekule.ChemObject
Source:

newDoc()

Create a new object and load it in editor.
Source:

redo()

Redo last operation.
Source:

repaint()

Repaint the objects in editor.
Source:

showAssocToolbar()

Show assoc chem tool bar.
Source:

showObjModifierToolbar()

Show obj modifier tool bar.
Source:

showStyleToolbar()

Show style tool bar.
Source:

undo()

Undo last operation.
Source:

undoAll()

Undo all operations.
Source:

Kekule.Editor. Composer

Classes

Configurator
Settings

Methods

(static) getMinPreferredDimension()

A class method to returns the preferred min dimension of composer widget.
Source:

canRedo() → {Bool}

Check if an undo action can be taken.
Source:
Returns:
Type
Bool

canUndo() → {Bool}

Check if an undo action can be taken.
Source:
Returns:
Type
Bool

exportObj(objClass) → {Object}

Returns exportable object for specified class.
Parameters:
Name Type Description
objClass Class Set null to export default object.
Source:
Returns:
Type
Object

exportObjs(objClass) → {Array}

Returns all exportable objects for specified class. Descendants can override this method.
Parameters:
Name Type Description
objClass Class Set null to export default object.
Source:
Returns:
Type
Array

getCoordMode() → {Int}

Returns coord mode of editor.
Source:
Returns:
Type
Int

getExportableClasses() → {Array}

Returns array of classes that can be exported (saved) from composer.
Source:
Returns:
Type
Array

hideAssocToolbar()

Hide assoc chem tool bar.
Source:

hideObjModifierToolbar()

Hide obj modifier tool bar.
Source:

hideStyleToolbar()

Hide style tool bar.
Source:

isAssocToolbarShown() → {Bool}

Check if assoc chem tool bar is visible.
Source:
Returns:
Type
Bool

isDirty() → {Bool}

Returns whether the chem object inside editor has been modified since load.
Source:
Returns:
Type
Bool

isObjModifierToolbarShown() → {Bool}

Check if obj modifier tool bar is visible.
Source:
Returns:
Type
Bool

isStyleToolbarShown() → {Bool}

Check if style tool bar is visible.
Source:
Returns:
Type
Bool

load(chemObj)

Load chem object in composer.
Parameters:
Name Type Description
chemObj Kekule.ChemObject
Source:

newDoc()

Create a new object and load it in editor.
Source:

redo()

Redo last operation.
Source:

repaint()

Repaint the objects in editor.
Source:

showAssocToolbar()

Show assoc chem tool bar.
Source:

showObjModifierToolbar()

Show obj modifier tool bar.
Source:

showStyleToolbar()

Show style tool bar.
Source:

undo()

Undo last operation.
Source:

undoAll()

Undo all operations.
Source: