Merged in christinaKorger/wisemapping-open-source (pull request #3)

clean-up
This commit is contained in:
Ezequiel Bergamaschi 2015-04-04 17:09:06 -03:00
commit 89772a9e6e
2 changed files with 11 additions and 34 deletions

View File

@ -78,14 +78,6 @@ mindplot.Designer = new Class(/** @lends Designer */{
this._clipboard = []; this._clipboard = [];
}, },
/**
* Deactivates the keyboard events so you can enter text into forms
*/
deactivateKeyboard:function () {
mindplot.DesignerKeyboard.getInstance().deactivate();
this.deselectAll();
},
/** /**
* @private * @private
*/ */
@ -121,13 +113,6 @@ mindplot.Designer = new Class(/** @lends Designer */{
}); });
}, },
/**
* Activates the keyboard events so you can enter text into forms
*/
activateKeyboard:function () {
mindplot.DesignerKeyboard.getInstance().activate();
},
/** /**
* @param {String} type the event type * @param {String} type the event type
* @param {Function} listener * @param {Function} listener
@ -694,7 +679,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
for (var i = 0; i < branches.length; i++) { for (var i = 0; i < branches.length; i++) {
// NodeModel -> NodeGraph ... // NodeModel -> NodeGraph ...
var nodeModel = branches[i]; var nodeModel = branches[i];
var nodeGraph = this._nodeModelToNodeGraph(nodeModel); var nodeGraph = this.nodeModelToNodeGraph(nodeModel);
// Update shrink render state... // Update shrink render state...
nodeGraph.setBranchVisibility(true); nodeGraph.setBranchVisibility(true);
@ -737,12 +722,10 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** /**
* @private
* @param {mindplot.model.NodeModel} nodeModel * @param {mindplot.model.NodeModel} nodeModel
* @return {mindplot.Topic} the topic (extends mindplot.NodeGraph) created to the model * @return {mindplot.Topic} the topic (extends mindplot.NodeGraph) created to the model
* @todo marked private but called from mindplot.StandaloneActionDispatcher
*/ */
_nodeModelToNodeGraph:function (nodeModel) { nodeModelToNodeGraph:function (nodeModel) {
$assert(nodeModel, "Node model can not be null"); $assert(nodeModel, "Node model can not be null");
var children = nodeModel.getChildren().slice(); var children = nodeModel.getChildren().slice();
children = children.sort(function (a, b) { children = children.sort(function (a, b) {
@ -756,7 +739,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
for (var i = 0; i < children.length; i++) { for (var i = 0; i < children.length; i++) {
var child = children[i]; var child = children[i];
if ($defined(child)) if ($defined(child))
this._nodeModelToNodeGraph(child); this.nodeModelToNodeGraph(child);
} }
return nodeGraph; return nodeGraph;
@ -786,12 +769,10 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** /**
* @private
* @param {mindplot.model.RelationshipModel} model * @param {mindplot.model.RelationshipModel} model
* @return {mindplot.Relationship} the relationship added to the mindmap * @return {mindplot.Relationship} the relationship added to the mindmap
* @todo marked private but called from mindplot.StandaloneActionDispatcher
*/ */
_addRelationship:function (model) { addRelationship:function (model) {
var mindmap = this.getMindmap(); var mindmap = this.getMindmap();
mindmap.addRelationship(model); mindmap.addRelationship(model);
return this._relationshipModelToRelationship(model); return this._relationshipModelToRelationship(model);
@ -799,11 +780,9 @@ mindplot.Designer = new Class(/** @lends Designer */{
/** /**
* deletes the relationship from the linked topics, DesignerModel, Workspace and Mindmap * deletes the relationship from the linked topics, DesignerModel, Workspace and Mindmap
* @private
* @param {mindplot.Relationship} rel the relationship to delete * @param {mindplot.Relationship} rel the relationship to delete
* @todo marked private but called from mindplot.StandaloneActionDispatcher
*/ */
_deleteRelationship:function (rel) { deleteRelationship:function (rel) {
var sourceTopic = rel.getSourceTopic(); var sourceTopic = rel.getSourceTopic();
sourceTopic.deleteRelationship(rel); sourceTopic.deleteRelationship(rel);
@ -864,19 +843,17 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** /**
* @private
* @param {mindplot.model.Topic} node the topic to remove * @param {mindplot.model.Topic} node the topic to remove
* removes the given topic and its children from Workspace, DesignerModel and NodeModel * removes the given topic and its children from Workspace, DesignerModel and NodeModel
* @todo marked private but called from mindplot.StandaloneActionDispatcher
*/ */
_removeTopic:function (node) { removeTopic:function (node) {
if (!node.isCentralTopic()) { if (!node.isCentralTopic()) {
var parent = node._parent; var parent = node._parent;
node.disconnect(this._workspace); node.disconnect(this._workspace);
//remove children //remove children
while (node.getChildren().length > 0) { while (node.getChildren().length > 0) {
this._removeTopic(node.getChildren()[0]); this.removeTopic(node.getChildren()[0]);
} }
this._workspace.removeChild(node); this._workspace.removeChild(node);

View File

@ -288,13 +288,13 @@ mindplot.CommandContext = new Class(/** @lends CommandContext */{
/** */ /** */
deleteTopic:function (topic) { deleteTopic:function (topic) {
this._designer._removeTopic(topic); this._designer.removeTopic(topic);
}, },
/** */ /** */
createTopic:function (model) { createTopic:function (model) {
$assert(model, "model can not be null"); $assert(model, "model can not be null");
return this._designer._nodeModelToNodeGraph(model); return this._designer.nodeModelToNodeGraph(model);
}, },
/** */ /** */
@ -322,12 +322,12 @@ mindplot.CommandContext = new Class(/** @lends CommandContext */{
/** */ /** */
addRelationship:function (model) { addRelationship:function (model) {
$assert(model, "model cannot be null"); $assert(model, "model cannot be null");
return this._designer._addRelationship(model); return this._designer.addRelationship(model);
}, },
/** */ /** */
deleteRelationship:function (relationship) { deleteRelationship:function (relationship) {
this._designer._deleteRelationship(relationship); this._designer.deleteRelationship(relationship);
}, },
/** */ /** */