mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-23 03:43:48 +01:00
Commands fixed.
This commit is contained in:
parent
b5987d1b89
commit
6a4a0f68fc
@ -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.";
|
||||
}
|
||||
});
|
||||
|
72
mindplot/src/main/javascript/LocalCommandDispatcher.js
Normal file
72
mindplot/src/main/javascript/LocalCommandDispatcher.js
Normal file
@ -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.";
|
||||
}
|
||||
});
|
||||
|
@ -48,10 +48,12 @@ mindplot.MindmapDesigner = new Class({
|
||||
|
||||
// Register handlers..
|
||||
this._registerEvents();
|
||||
|
||||
this._relationships = {};
|
||||
|
||||
this._events = {};
|
||||
|
||||
// Action !
|
||||
|
||||
|
||||
},
|
||||
|
||||
_getTopics : function() {
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
});
|
||||
});
|
@ -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);
|
||||
|
@ -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 = [];
|
||||
|
@ -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
|
||||
}
|
||||
});
|
@ -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.";
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -16,8 +16,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
mindplot.commands.RemoveNoteFromTopicCommand = new Class(
|
||||
{
|
||||
mindplot.commands.RemoveNoteFromTopicCommand = new Class({
|
||||
Extends:mindplot.Command,
|
||||
initialize: function(topicId)
|
||||
{
|
||||
|
47
wise-doc/src/main/webapp/html/collab.html
Normal file
47
wise-doc/src/main/webapp/html/collab.html
Normal file
@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" src="http://docs.google.com/brix/static/api/js/jsapi.nocache.js"></script>
|
||||
<script type="text/javascript">
|
||||
var collabOnLoad = function() {
|
||||
app = new goog.collab.CollaborativeApp();
|
||||
app.start();
|
||||
|
||||
app.addListener('modelLoad', function(model) {
|
||||
var root = app.getModel().getRoot();
|
||||
if (!root.get("mindmap7")) {
|
||||
|
||||
console.log("Creating empty map ...");
|
||||
|
||||
// var topics = app.getModel().create("List");
|
||||
root.put("mindmap7", "start_");
|
||||
}
|
||||
|
||||
root.addListener('valueChanged', function(e) {
|
||||
console.log("New item added ...:");
|
||||
console.log(app.getModel().getRoot().get("mindmap7"));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function addTopic() {
|
||||
|
||||
console.log("Adding new item ver:2 ...");
|
||||
|
||||
var root = app.getModel().getRoot();
|
||||
var topics = root.get("mindmap7");
|
||||
|
||||
// var topic = app.getModel().create("Map");
|
||||
// topic.put("id", "topic_x");
|
||||
// topic.put("text", "topic X text");
|
||||
// topics.add(topic);
|
||||
|
||||
// root.put("mindmap7", topics);
|
||||
root.put("mindmap7", app.getModel().getRoot().get("mindmap7") + "_algo");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Este es este no ?
|
||||
<input style="font-size:20px;width:50px;height:50px;" type="button" value=" " id="a2" onclick="addTopic(this)"/>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user