diff --git a/mindplot/src/main/javascript/BaseCommandDispatcher.js b/mindplot/src/main/javascript/BaseCommandDispatcher.js index 95c62904..696f89bd 100644 --- a/mindplot/src/main/javascript/BaseCommandDispatcher.js +++ b/mindplot/src/main/javascript/BaseCommandDispatcher.js @@ -20,31 +20,52 @@ mindplot.BaseCommandDispatcher = new Class({ initialize: function() { }, - addIconToTopic: function() { + + addIconToTopic: function(topicId, iconType) { throw "method must be implemented."; }, - addLinkToTopic: function() { + + addLinkToTopic: function(topicId, url) { throw "method must be implemented."; }, - addNoteToTopic: function() { + + addNoteToTopic: function(topicId, text) { throw "method must be implemented."; - },addRelationship: function() { + }, + + addRelationship: function(model, mindmap) { throw "method must be implemented."; - },addTopic: function() { + }, + + addTopic: function(model, parentTopicId, animated) { throw "method must be implemented."; - },changeIcon: function() { + }, + + changeIcon: function(topicId, iconId, iconType) { throw "method must be implemented."; - },deleteTopic: function() { + }, + + deleteTopic: function(topicsIds) { throw "method must be implemented."; - },dragTopic: function() { + }, + + dragTopic: function(topicId) { throw "method must be implemented."; - },moveControllPoint: function() { + }, + + moveControlPoint: function(trlPointController, point) { throw "method must be implemented."; - } ,removeIconFromTopic: function() { + }, + + removeIconFromTopic: function(topicId, iconModel) { throw "method must be implemented."; - },removeLinkFromTopic: function() { + }, + + removeLinkFromTopic: function(topicId) { throw "method must be implemented."; - },removeNodeFromTopic: function() { + }, + + removeNodeFromTopic: function(topicId) { throw "method must be implemented."; } }); diff --git a/mindplot/src/main/javascript/LocalCommandDispatcher.js b/mindplot/src/main/javascript/LocalCommandDispatcher.js new file mode 100644 index 00000000..696f89bd --- /dev/null +++ b/mindplot/src/main/javascript/LocalCommandDispatcher.js @@ -0,0 +1,72 @@ +/* + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +mindplot.BaseCommandDispatcher = new Class({ + + initialize: function() { + }, + + addIconToTopic: function(topicId, iconType) { + throw "method must be implemented."; + }, + + addLinkToTopic: function(topicId, url) { + throw "method must be implemented."; + }, + + addNoteToTopic: function(topicId, text) { + throw "method must be implemented."; + }, + + addRelationship: function(model, mindmap) { + throw "method must be implemented."; + }, + + addTopic: function(model, parentTopicId, animated) { + throw "method must be implemented."; + }, + + changeIcon: function(topicId, iconId, iconType) { + throw "method must be implemented."; + }, + + deleteTopic: function(topicsIds) { + throw "method must be implemented."; + }, + + dragTopic: function(topicId) { + throw "method must be implemented."; + }, + + moveControlPoint: function(trlPointController, point) { + throw "method must be implemented."; + }, + + removeIconFromTopic: function(topicId, iconModel) { + throw "method must be implemented."; + }, + + removeLinkFromTopic: function(topicId) { + throw "method must be implemented."; + }, + + removeNodeFromTopic: function(topicId) { + throw "method must be implemented."; + } +}); + diff --git a/mindplot/src/main/javascript/MindmapDesigner.js b/mindplot/src/main/javascript/MindmapDesigner.js index 5ec86c02..63871ea5 100644 --- a/mindplot/src/main/javascript/MindmapDesigner.js +++ b/mindplot/src/main/javascript/MindmapDesigner.js @@ -48,10 +48,12 @@ mindplot.MindmapDesigner = new Class({ // Register handlers.. this._registerEvents(); - this._relationships = {}; - this._events = {}; + + // Action ! + + }, _getTopics : function() { diff --git a/mindplot/src/main/javascript/commands/AddIconToTopicCommand.js b/mindplot/src/main/javascript/commands/AddIconToTopicCommand.js index a6eb2dff..b079fd7d 100644 --- a/mindplot/src/main/javascript/commands/AddIconToTopicCommand.js +++ b/mindplot/src/main/javascript/commands/AddIconToTopicCommand.js @@ -1,33 +1,30 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -mindplot.commands.AddIconToTopicCommand = new Class( -{ +mindplot.commands.AddIconToTopicCommand = new Class({ Extends:mindplot.Command, - initialize: function(topicId, iconType) - { + initialize: function(topicId, iconType) { $assert(topicId, 'topicId can not be null'); $assert(iconType, 'iconType can not be null'); this._selectedObjectsIds = topicId; this._iconType = iconType; }, - execute: function(commandContext) - { + execute: function(commandContext) { var topic = commandContext.findTopics(this._selectedObjectsIds)[0]; var updated = function() { var iconImg = topic.addIcon(this._iconType, commandContext._designer); @@ -36,8 +33,7 @@ mindplot.commands.AddIconToTopicCommand = new Class( }.bind(this); updated.delay(0); }, - undoExecute: function(commandContext) - { + undoExecute: function(commandContext) { var topic = commandContext.findTopics(this._selectedObjectsIds)[0]; var updated = function() { topic.removeIcon(this._iconModel); diff --git a/mindplot/src/main/javascript/commands/AddLinkToTopicCommand.js b/mindplot/src/main/javascript/commands/AddLinkToTopicCommand.js index 408cd233..5d2f881f 100644 --- a/mindplot/src/main/javascript/commands/AddLinkToTopicCommand.js +++ b/mindplot/src/main/javascript/commands/AddLinkToTopicCommand.js @@ -1,42 +1,38 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -mindplot.commands.AddLinkToTopicCommand =new Class( -{ +mindplot.commands.AddLinkToTopicCommand = new Class({ Extends:mindplot.Command, - initialize: function(topicId,url) - { + initialize: function(topicId, url) { $assert(topicId, 'topicId can not be null'); this._selectedObjectsIds = topicId; this._url = url; this._id = mindplot.Command._nextUUID(); }, - execute: function(commandContext) - { + execute: function(commandContext) { var topic = commandContext.findTopics(this._selectedObjectsIds)[0]; var updated = function() { - topic.addLink(this._url,commandContext._designer); + topic.addLink(this._url, commandContext._designer); topic.updateNode(); }.bind(this); updated.delay(0); }, - undoExecute: function(commandContext) - { + undoExecute: function(commandContext) { var topic = commandContext.findTopics(this._selectedObjectsIds)[0]; var updated = function() { topic.removeLink(); diff --git a/mindplot/src/main/javascript/commands/AddNoteToTopicCommand.js b/mindplot/src/main/javascript/commands/AddNoteToTopicCommand.js index 05bfe16b..b685ccac 100644 --- a/mindplot/src/main/javascript/commands/AddNoteToTopicCommand.js +++ b/mindplot/src/main/javascript/commands/AddNoteToTopicCommand.js @@ -1,42 +1,38 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -mindplot.commands.AddNoteToTopicCommand = new Class( -{ +mindplot.commands.AddNoteToTopicCommand = new Class({ Extends:mindplot.Command, - initialize: function(topicId,text) - { + initialize: function(topicId, text) { $assert(topicId, 'topicId can not be null'); this._selectedObjectsIds = topicId; this._text = text; this._id = mindplot.Command._nextUUID(); }, - execute: function(commandContext) - { + execute: function(commandContext) { var topic = commandContext.findTopics(this._selectedObjectsIds)[0]; var updated = function() { - topic.addNote(this._text,commandContext._designer); + topic.addNote(this._text, commandContext._designer); topic.updateNode(); }.bind(this); updated.delay(0); }, - undoExecute: function(commandContext) - { + undoExecute: function(commandContext) { var topic = commandContext.findTopics(this._selectedObjectsIds)[0]; var updated = function() { topic.removeNote(); diff --git a/mindplot/src/main/javascript/commands/AddRelationshipCommand.js b/mindplot/src/main/javascript/commands/AddRelationshipCommand.js index 6b37b6c7..b5c637ba 100644 --- a/mindplot/src/main/javascript/commands/AddRelationshipCommand.js +++ b/mindplot/src/main/javascript/commands/AddRelationshipCommand.js @@ -1,40 +1,36 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -mindplot.commands.AddRelationshipCommand = new Class( -{ + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +mindplot.commands.AddRelationshipCommand = new Class({ Extends:mindplot.Command, - initialize: function(model, mindmap) - { + initialize: function(model, mindmap) { $assert(model, 'Relationship model can not be null'); this._model = model; this._mindmap = mindmap; this._id = mindplot.Command._nextUUID(); }, - execute: function(commandContext) - { + execute: function(commandContext) { var relationship = commandContext.createRelationship(this._model); // Finally, focus ... var designer = commandContext._designer; designer.onObjectFocusEvent.attempt(relationship, designer); relationship.setOnFocus(true); }, - undoExecute: function(commandContext) - { + undoExecute: function(commandContext) { var relationship = commandContext.removeRelationship(this._model); this._mindmap.removeRelationship(this._model); } diff --git a/mindplot/src/main/javascript/commands/AddTopicCommand.js b/mindplot/src/main/javascript/commands/AddTopicCommand.js index 8c6877cc..78817fa4 100644 --- a/mindplot/src/main/javascript/commands/AddTopicCommand.js +++ b/mindplot/src/main/javascript/commands/AddTopicCommand.js @@ -1,69 +1,65 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ mindplot.commands.AddTopicCommand = new Class( -{ - Extends:mindplot.Command, - initialize: function(model, parentTopicId, animated) { - $assert(model, 'Model can not be null'); - this._model = model; - this._parentId = parentTopicId; - this._id = mindplot.Command._nextUUID(); - this._animated = $defined(animated)?animated:false; - }, - execute: function(commandContext) - { - // Add a new topic ... + Extends:mindplot.Command, + initialize: function(model, parentTopicId, animated) { + $assert(model, 'Model can not be null'); + this._model = model; + this._parentId = parentTopicId; + this._id = mindplot.Command._nextUUID(); + this._animated = $defined(animated) ? animated : false; + }, + execute: function(commandContext) { + // Add a new topic ... - var topic = commandContext.createTopic(this._model, !this._animated); + var topic = commandContext.createTopic(this._model, !this._animated); - // Connect to topic ... - if ($defined(this._parentId)) - { - var parentTopic = commandContext.findTopics(this._parentId)[0]; - commandContext.connect(topic, parentTopic, !this._animated); + // Connect to topic ... + if ($defined(this._parentId)) { + var parentTopic = commandContext.findTopics(this._parentId)[0]; + commandContext.connect(topic, parentTopic, !this._animated); + } + + var doneFn = function() { + // Finally, focus ... + var designer = commandContext._designer; + designer.onObjectFocusEvent.attempt(topic, designer); + topic.setOnFocus(true); + }; + + if (this._animated) { + core.Utils.setVisibilityAnimated([topic,topic.getOutgoingLine()], true, doneFn); + } else + doneFn.attempt(); + }, + undoExecute: function(commandContext) { + // Finally, delete the topic from the workspace ... + var topicId = this._model.getId(); + var topic = commandContext.findTopics(topicId)[0]; + var doneFn = function() { + commandContext.deleteTopic(topic); + }; + if (this._animated) { + core.Utils.setVisibilityAnimated([topic,topic.getOutgoingLine()], false, doneFn); + } + else + doneFn.attempt(); } - - var doneFn = function(){ - // Finally, focus ... - var designer = commandContext._designer; - designer.onObjectFocusEvent.attempt(topic, designer); - topic.setOnFocus(true); - }; - - if(this._animated){ - core.Utils.setVisibilityAnimated([topic,topic.getOutgoingLine()],true,doneFn); - } else - doneFn.attempt(); - }, - undoExecute: function(commandContext) - { - // Finally, delete the topic from the workspace ... - var topicId = this._model.getId(); - var topic = commandContext.findTopics(topicId)[0]; - var doneFn = function(){ - commandContext.deleteTopic(topic); - }; - if(this._animated){ - core.Utils.setVisibilityAnimated([topic,topic.getOutgoingLine()],false, doneFn); - } - else - doneFn.attempt(); - } -}); \ No newline at end of file + }); \ No newline at end of file diff --git a/mindplot/src/main/javascript/commands/ChangeIconFromTopicCommand.js b/mindplot/src/main/javascript/commands/ChangeIconFromTopicCommand.js index 4b7ae24f..4d1c6587 100644 --- a/mindplot/src/main/javascript/commands/ChangeIconFromTopicCommand.js +++ b/mindplot/src/main/javascript/commands/ChangeIconFromTopicCommand.js @@ -1,26 +1,24 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -mindplot.commands.ChangeIconFromTopicCommand = new Class( -{ +mindplot.commands.ChangeIconFromTopicCommand = new Class({ Extends:mindplot.Command, - initialize: function(topicId, iconId, iconType) - { + initialize: function(topicId, iconId, iconType) { $assert(topicId, 'topicId can not be null'); $assert(iconId, 'iconId can not be null'); $assert(iconType, 'iconType can not be null'); @@ -28,8 +26,7 @@ mindplot.commands.ChangeIconFromTopicCommand = new Class( this._iconModel = iconId; this._iconType = iconType; }, - execute: function(commandContext) - { + execute: function(commandContext) { var topic = commandContext.findTopics(this._selectedObjectsIds)[0]; var updated = function() { topic.removeIcon(this._iconModel); @@ -37,8 +34,7 @@ mindplot.commands.ChangeIconFromTopicCommand = new Class( }.bind(this); updated.delay(0); }, - undoExecute: function(commandContext) - { + undoExecute: function(commandContext) { var topic = commandContext.findTopics(this._selectedObjectsIds)[0]; var updated = function() { topic.addIcon(this._iconModel, commandContext._designer); diff --git a/mindplot/src/main/javascript/commands/DeleteTopicCommand.js b/mindplot/src/main/javascript/commands/DeleteTopicCommand.js index 6a7a3f33..9db432e4 100644 --- a/mindplot/src/main/javascript/commands/DeleteTopicCommand.js +++ b/mindplot/src/main/javascript/commands/DeleteTopicCommand.js @@ -1,26 +1,24 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -mindplot.commands.DeleteTopicCommand = new Class( -{ +mindplot.commands.DeleteTopicCommand = new Class({ Extends:mindplot.Command, - initialize: function(topicsIds) - { + initialize: function(topicsIds) { $assert(topicsIds, "topicsIds must be defined"); this._selectedObjectsIds = topicsIds; this._deletedTopicModels = []; @@ -28,18 +26,16 @@ mindplot.commands.DeleteTopicCommand = new Class( this._deletedRelationships = []; this._id = mindplot.Command._nextUUID(); }, - execute: function(commandContext) - { + execute: function(commandContext) { var topics = commandContext.findTopics(this._selectedObjectsIds.nodes); - if(topics.length>0){ - topics.forEach( - function(topic, index) - { + if (topics.length > 0) { + topics.forEach( + function(topic, index) { var model = topic.getModel().clone(); - //delete relationships + //delete relationships var relationships = topic.getRelationships(); - while(relationships.length>0){ + while (relationships.length > 0) { var relationship = relationships[0]; this._deletedRelationships.push(relationship.getModel().clone()); commandContext.removeRelationship(relationship.getModel()); @@ -50,8 +46,7 @@ mindplot.commands.DeleteTopicCommand = new Class( // Is connected?. var outTopic = topic.getOutgoingConnectedTopic(); var outTopicId = null; - if (outTopic != null) - { + if (outTopic != null) { outTopicId = outTopic.getId(); } this._parentTopicIds.push(outTopicId); @@ -60,41 +55,39 @@ mindplot.commands.DeleteTopicCommand = new Class( commandContext.deleteTopic(topic); }.bind(this) - ); } + ); + } var lines = commandContext.findRelationships(this._selectedObjectsIds.relationshipLines); - if(lines.length>0){ - lines.forEach(function(line,index){ - if(line.isInWorkspace()){ + if (lines.length > 0) { + lines.forEach(function(line, index) { + if (line.isInWorkspace()) { this._deletedRelationships.push(line.getModel().clone()); - commandContext.removeRelationship(line.getModel()); + commandContext.removeRelationship(line.getModel()); } }.bind(this)); } }, - undoExecute: function(commandContext) - { + undoExecute: function(commandContext) { var topics = commandContext.findTopics(this._selectedObjectsIds); var parent = commandContext.findTopics(this._parentTopicIds); this._deletedTopicModels.forEach( - function(model, index) - { - var topic = commandContext.createTopic(model); + function(model, index) { + var topic = commandContext.createTopic(model); - // Was the topic connected? - var parentTopic = parent[index]; - if (parentTopic != null) - { - commandContext.connect(topic, parentTopic); - } + // Was the topic connected? + var parentTopic = parent[index]; + if (parentTopic != null) { + commandContext.connect(topic, parentTopic); + } - }.bind(this) - ); + }.bind(this) + ); this._deletedRelationships.forEach( - function(relationship, index){ - commandContext.createRelationship(relationship); - }.bind(this)); + function(relationship, index) { + commandContext.createRelationship(relationship); + }.bind(this)); this._deletedTopicModels = []; this._parentTopicIds = []; diff --git a/mindplot/src/main/javascript/commands/DragTopicCommand.js b/mindplot/src/main/javascript/commands/DragTopicCommand.js index 427773d3..1206dbf0 100644 --- a/mindplot/src/main/javascript/commands/DragTopicCommand.js +++ b/mindplot/src/main/javascript/commands/DragTopicCommand.js @@ -1,26 +1,24 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -mindplot.commands.DragTopicCommand = new Class( -{ +mindplot.commands.DragTopicCommand = new Class({ Extends:mindplot.Command, - initialize: function(topicId) - { + initialize: function(topicId) { $assert(topicId, "topicId must be defined"); this._selectedObjectsIds = topicId; this._parentTopic = null; @@ -28,8 +26,7 @@ mindplot.commands.DragTopicCommand = new Class( this._order = null; this._id = mindplot.Command._nextUUID(); }, - execute: function(commandContext) - { + execute: function(commandContext) { var topic = commandContext.findTopics([this._selectedObjectsIds])[0]; @@ -39,70 +36,61 @@ mindplot.commands.DragTopicCommand = new Class( var origPosition = null; // if (topic.getType() == mindplot.NodeModel.MAIN_TOPIC_TYPE && origParentTopic != null && origParentTopic.getType() == mindplot.NodeModel.MAIN_TOPIC_TYPE) // { - // In this case, topics are positioned using order ... - origOrder = topic.getOrder(); + // In this case, topics are positioned using order ... + origOrder = topic.getOrder(); // } else // { - origPosition = topic.getPosition().clone(); + origPosition = topic.getPosition().clone(); // } // Disconnect topic .. - if ($defined(origParentTopic)) - { + if ($defined(origParentTopic)) { commandContext.disconnect(topic); } // Set topic order ... - if (this._order != null) - { + if (this._order != null) { topic.setOrder(this._order); - } else if (this._position != null) - { + } else if (this._position != null) { // Set position ... topic.setPosition(this._position); - } else - { + } else { $assert("Illegal commnad state exception."); } this._order = origOrder; this._position = origPosition; // Finally, connect topic ... - if ($defined(this._parentId)) - { + if ($defined(this._parentId)) { var parentTopic = commandContext.findTopics([this._parentId])[0]; commandContext.connect(topic, parentTopic); } // Backup old parent id ... this._parentId = null; - if ($defined(origParentTopic)) - { + if ($defined(origParentTopic)) { this._parentId = origParentTopic.getId(); } }, - undoExecute: function(commandContext) - { + undoExecute: function(commandContext) { this.execute(commandContext); var selectedRelationships = commandContext.getSelectedRelationshipLines(); - selectedRelationships.forEach(function(relationshipLine,index){ + selectedRelationships.forEach(function(relationshipLine, index) { relationshipLine.redraw(); }); }, - setPosition: function(point) - { + setPosition: function(point) { this._position = point; }, setParetTopic: function(topic) { this._parentId = topic.getId(); }, - setOrder: function(order) - { + setOrder: function(order) { this._order = order } }); \ No newline at end of file diff --git a/mindplot/src/main/javascript/commands/GenericFunctionCommand.js b/mindplot/src/main/javascript/commands/GenericFunctionCommand.js index 6b01287b..c17be85d 100644 --- a/mindplot/src/main/javascript/commands/GenericFunctionCommand.js +++ b/mindplot/src/main/javascript/commands/GenericFunctionCommand.js @@ -1,26 +1,24 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -mindplot.commands.GenericFunctionCommand =new Class( -{ +mindplot.commands.GenericFunctionCommand = new Class({ Extends:mindplot.Command, - initialize: function(commandFunc,value,topicsIds) - { + initialize: function(commandFunc, value, topicsIds) { $assert(commandFunc, "commandFunc must be defined"); $assert(topicsIds, "topicsIds must be defined"); this._value = value; @@ -29,38 +27,30 @@ mindplot.commands.GenericFunctionCommand =new Class( this._oldValues = []; this._id = mindplot.Command._nextUUID(); }, - execute: function(commandContext) - { - if (!this.applied) - { + execute: function(commandContext) { + if (!this.applied) { var topics = commandContext.findTopics(this._selectedObjectsIds); - topics.forEach(function(topic) - { + topics.forEach(function(topic) { var oldValue = this._commandFunc(topic, this._value); this._oldValues.push(oldValue); }.bind(this)); this.applied = true; - } else - { + } else { throw "Command can not be applied two times in a row."; } }, - undoExecute: function(commandContext) - { - if (this.applied) - { + undoExecute: function(commandContext) { + if (this.applied) { var topics = commandContext.findTopics(this._selectedObjectsIds); - topics.forEach(function(topic,index) - { + topics.forEach(function(topic, index) { this._commandFunc(topic, this._oldValues[index]); }.bind(this)); this.applied = false; this._oldValues = []; - } else - { + } else { throw "undo can not be applied."; } } diff --git a/mindplot/src/main/javascript/commands/MoveControlPointCommand.js b/mindplot/src/main/javascript/commands/MoveControlPointCommand.js index a5be49c8..a92b2524 100644 --- a/mindplot/src/main/javascript/commands/MoveControlPointCommand.js +++ b/mindplot/src/main/javascript/commands/MoveControlPointCommand.js @@ -1,33 +1,31 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -mindplot.commands.MoveControlPointCommand = new Class( -{ + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +mindplot.commands.MoveControlPointCommand = new Class({ Extends:mindplot.Command, - initialize: function(ctrlPointController, point) - { + initialize: function(ctrlPointController, point) { $assert(ctrlPointController, 'line can not be null'); this._ctrlPointControler = ctrlPointController; this._line = ctrlPointController._line; var model = this._line.getModel(); this._controlPoint = this._ctrlPointControler.getControlPoint(point).clone(); - this._oldControlPoint= this._ctrlPointControler.getOriginalCtrlPoint(point).clone(); + this._oldControlPoint = this._ctrlPointControler.getOriginalCtrlPoint(point).clone(); this._originalEndPoint = this._ctrlPointControler.getOriginalEndPoint(point).clone(); - switch (point){ + switch (point) { case 0: this._wasCustom = this._line.getLine().isSrcControlPointCustom(); this._endPoint = this._line.getLine().getFrom().clone(); @@ -40,10 +38,9 @@ mindplot.commands.MoveControlPointCommand = new Class( this._id = mindplot.Command._nextUUID(); this._point = point; }, - execute: function(commandContext) - { + execute: function(commandContext) { var model = this._line.getModel(); - switch (this._point){ + switch (this._point) { case 0: model.setSrcCtrlPoint(this._controlPoint.clone()); this._line.setFrom(this._endPoint.x, this._endPoint.y); @@ -58,36 +55,35 @@ mindplot.commands.MoveControlPointCommand = new Class( this._line.setDestControlPoint(this._controlPoint.clone()); break; } - if(this._line.isOnFocus()){ + if (this._line.isOnFocus()) { this._line._refreshSelectedShape(); this._ctrlPointControler.setLine(this._line); } this._line.getLine().updateLine(this._point); }, - undoExecute: function(commandContext) - { + undoExecute: function(commandContext) { var line = this._line; var model = line.getModel(); - switch (this._point){ + switch (this._point) { case 0: - if($defined(this._oldControlPoint)){ + if ($defined(this._oldControlPoint)) { line.setFrom(this._originalEndPoint.x, this._originalEndPoint.y); model.setSrcCtrlPoint(this._oldControlPoint.clone()); line.setSrcControlPoint(this._oldControlPoint.clone()); line.setIsSrcControlPointCustom(this._wasCustom); } - break; + break; case 1: - if($defined(this._oldControlPoint)){ + if ($defined(this._oldControlPoint)) { line.setTo(this._originalEndPoint.x, this._originalEndPoint.y); model.setDestCtrlPoint(this._oldControlPoint.clone()); line.setDestControlPoint(this._oldControlPoint.clone()); line.setIsDestControlPointCustom(this._wasCustom); } - break; + break; } this._line.getLine().updateLine(this._point); - if(this._line.isOnFocus()){ + if (this._line.isOnFocus()) { this._ctrlPointControler.setLine(line); line._refreshSelectedShape(); } diff --git a/mindplot/src/main/javascript/commands/RemoveIconFromTopicCommand.js b/mindplot/src/main/javascript/commands/RemoveIconFromTopicCommand.js index 344c7fa7..a265c8ce 100644 --- a/mindplot/src/main/javascript/commands/RemoveIconFromTopicCommand.js +++ b/mindplot/src/main/javascript/commands/RemoveIconFromTopicCommand.js @@ -16,8 +16,7 @@ * limitations under the License. */ -mindplot.commands.RemoveIconFromTopicCommand = new Class( -{ +mindplot.commands.RemoveIconFromTopicCommand = new Class({ Extends:mindplot.Command, initialize: function(topicId, iconModel) { diff --git a/mindplot/src/main/javascript/commands/RemoveLinkFromTopicCommand.js b/mindplot/src/main/javascript/commands/RemoveLinkFromTopicCommand.js index 71e9cad0..2289ac30 100644 --- a/mindplot/src/main/javascript/commands/RemoveLinkFromTopicCommand.js +++ b/mindplot/src/main/javascript/commands/RemoveLinkFromTopicCommand.js @@ -1,31 +1,28 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -mindplot.commands.RemoveLinkFromTopicCommand =new Class( -{ +mindplot.commands.RemoveLinkFromTopicCommand = new Class({ Extends:mindplot.Command, - initialize: function(topicId) - { + initialize: function(topicId) { $assert(topicId, 'topicId can not be null'); this._selectedObjectsIds = topicId; }, - execute: function(commandContext) - { + execute: function(commandContext) { var topic = commandContext.findTopics(this._selectedObjectsIds)[0]; this._url = topic._link.getUrl(); var updated = function() { @@ -33,11 +30,10 @@ mindplot.commands.RemoveLinkFromTopicCommand =new Class( }.bind(this); updated.delay(0); }, - undoExecute: function(commandContext) - { + undoExecute: function(commandContext) { var topic = commandContext.findTopics(this._selectedObjectsIds)[0]; var updated = function() { - topic.addLink(this._url,commandContext._designer); + topic.addLink(this._url, commandContext._designer); topic.updateNode(); }.bind(this); updated.delay(0); diff --git a/mindplot/src/main/javascript/commands/RemoveNoteFromTopicCommand.js b/mindplot/src/main/javascript/commands/RemoveNoteFromTopicCommand.js index 8594719d..0840d903 100644 --- a/mindplot/src/main/javascript/commands/RemoveNoteFromTopicCommand.js +++ b/mindplot/src/main/javascript/commands/RemoveNoteFromTopicCommand.js @@ -16,8 +16,7 @@ * limitations under the License. */ -mindplot.commands.RemoveNoteFromTopicCommand = new Class( -{ +mindplot.commands.RemoveNoteFromTopicCommand = new Class({ Extends:mindplot.Command, initialize: function(topicId) { diff --git a/wise-doc/src/main/webapp/html/collab.html b/wise-doc/src/main/webapp/html/collab.html new file mode 100644 index 00000000..b4e47abb --- /dev/null +++ b/wise-doc/src/main/webapp/html/collab.html @@ -0,0 +1,47 @@ + +
+ + + +Este es este no ? + + + \ No newline at end of file