Class mindmaps.MindMapModel
Defined in: MindMapModel.js.
Constructor Attributes | Constructor Name and Description |
---|---|
mindmaps.MindMapModel(eventBus, commandRegistry)
Creates a new MindMapModel. |
Method Attributes | Method Name and Description |
---|---|
changeNodeCaption(node, caption)
Changes the caption for the passed node or for the selected one if node
is null.
|
|
createNode(node, parent)
Attaches a new node the mind map.
|
|
deleteNode(node)
Deletes a node or the currently selected one if no argument is passed.
|
|
executeAction(action)
Executes a node action.
|
|
Gets the current document.
|
|
Gets the current mind map associated with the document.
|
|
<private> |
init()
Initialise.
|
selectNode(node)
Sets the node as the currently selected.
|
|
setDocument(doc)
Sets the current document and will publish a DOCUMENT_OPENED or
DOCUMENT_CLOSED event.
|
Event Attributes | Event Name and Description |
---|---|
undoEvent(undoFunc, redoFunc)
Event that is fired when a new undo operation should be recorded.
|
Class Detail
mindmaps.MindMapModel(eventBus, commandRegistry)
Creates a new MindMapModel. This object represents the underlying mind map model and provides access to the document, the mind map and the currently selected node. All changes to the mind map pass through this object, either through calling methods directly or using the executeAction() method to perform NodeActions.
- Parameters:
- {mindmaps.EventBus} eventBus
- {mindmaps.CommandRegistry} commandRegistry
Method Detail
changeNodeCaption(node, caption)
Changes the caption for the passed node or for the selected one if node
is null.
- Parameters:
- {mindmaps.Node} node
- {String} caption
createNode(node, parent)
Attaches a new node the mind map. If invoked without arguments, it will
add a new child to the selected node with an automatically generated
position.
- Parameters:
- {mindmaps.Node} node
- the new node
- {mindmaps.Node} parent
deleteNode(node)
Deletes a node or the currently selected one if no argument is passed.
- Parameters:
- {mindmaps.Node} node Optional
- defaults to currently selected.
executeAction(action)
Executes a node action. An executed action might raise an event over the
event bus and cause an undo event to be emitted via MindMapModel#undoAction.
- Parameters:
- {mindmaps.Action} action
{mindmaps.Document}
getDocument()
Gets the current document.
- Returns:
- {mindmaps.Document} the current document.
{mindmaps.MindMap}
getMindMap()
Gets the current mind map associated with the document.
- Returns:
- {mindmaps.MindMap} the mind map or null
<private>
init()
Initialise.
selectNode(node)
Sets the node as the currently selected.
- Parameters:
- {mindmaps.Node} node
setDocument(doc)
Sets the current document and will publish a DOCUMENT_OPENED or
DOCUMENT_CLOSED event.
- Parameters:
- {mindmaps.Document} doc
- or pass null to close the document
Event Detail
undoEvent(undoFunc, redoFunc)
Event that is fired when a new undo operation should be recorded.
- Parameters:
- {Function} undoFunc
- {Function} redoFunc Optional