mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +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() {
|
||||
|
@ -16,18 +16,15 @@
|
||||
* 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);
|
||||
|
@ -16,18 +16,15 @@
|
||||
* 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);
|
||||
@ -35,8 +32,7 @@ mindplot.commands.AddLinkToTopicCommand =new Class(
|
||||
}.bind(this);
|
||||
updated.delay(0);
|
||||
},
|
||||
undoExecute: function(commandContext)
|
||||
{
|
||||
undoExecute: function(commandContext) {
|
||||
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
|
||||
var updated = function() {
|
||||
topic.removeLink();
|
||||
|
@ -16,18 +16,15 @@
|
||||
* 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);
|
||||
@ -35,8 +32,7 @@ mindplot.commands.AddNoteToTopicCommand = new Class(
|
||||
}.bind(this);
|
||||
updated.delay(0);
|
||||
},
|
||||
undoExecute: function(commandContext)
|
||||
{
|
||||
undoExecute: function(commandContext) {
|
||||
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
|
||||
var updated = function() {
|
||||
topic.removeNote();
|
||||
|
@ -15,26 +15,22 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.commands.AddRelationshipCommand = new Class(
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -19,23 +19,20 @@
|
||||
mindplot.commands.AddTopicCommand = new Class(
|
||||
{
|
||||
Extends:mindplot.Command,
|
||||
initialize: function(model, parentTopicId, animated)
|
||||
{
|
||||
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)
|
||||
{
|
||||
execute: function(commandContext) {
|
||||
// Add a new topic ...
|
||||
|
||||
var topic = commandContext.createTopic(this._model, !this._animated);
|
||||
|
||||
// Connect to topic ...
|
||||
if ($defined(this._parentId))
|
||||
{
|
||||
if ($defined(this._parentId)) {
|
||||
var parentTopic = commandContext.findTopics(this._parentId)[0];
|
||||
commandContext.connect(topic, parentTopic, !this._animated);
|
||||
}
|
||||
@ -52,8 +49,7 @@ mindplot.commands.AddTopicCommand = new Class(
|
||||
} else
|
||||
doneFn.attempt();
|
||||
},
|
||||
undoExecute: function(commandContext)
|
||||
{
|
||||
undoExecute: function(commandContext) {
|
||||
// Finally, delete the topic from the workspace ...
|
||||
var topicId = this._model.getId();
|
||||
var topic = commandContext.findTopics(topicId)[0];
|
||||
|
@ -16,11 +16,9 @@
|
||||
* 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);
|
||||
|
@ -16,11 +16,9 @@
|
||||
* 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,13 +26,11 @@ 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)
|
||||
{
|
||||
function(topic, index) {
|
||||
var model = topic.getModel().clone();
|
||||
|
||||
//delete relationships
|
||||
@ -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,7 +55,8 @@ 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) {
|
||||
@ -71,21 +67,18 @@ mindplot.commands.DeleteTopicCommand = new Class(
|
||||
}.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)
|
||||
{
|
||||
function(model, index) {
|
||||
var topic = commandContext.createTopic(model);
|
||||
|
||||
// Was the topic connected?
|
||||
var parentTopic = parent[index];
|
||||
if (parentTopic != null)
|
||||
{
|
||||
if (parentTopic != null) {
|
||||
commandContext.connect(topic, parentTopic);
|
||||
}
|
||||
|
||||
|
@ -16,11 +16,9 @@
|
||||
* 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];
|
||||
|
||||
@ -47,45 +44,38 @@ mindplot.commands.DragTopicCommand = new Class(
|
||||
// }
|
||||
|
||||
// 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) {
|
||||
@ -93,16 +83,14 @@ mindplot.commands.DragTopicCommand = new Class(
|
||||
});
|
||||
|
||||
},
|
||||
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
|
||||
}
|
||||
});
|
@ -16,11 +16,9 @@
|
||||
* 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.";
|
||||
}
|
||||
}
|
||||
|
@ -15,11 +15,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.commands.MoveControlPointCommand = new Class(
|
||||
{
|
||||
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;
|
||||
@ -40,8 +38,7 @@ 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) {
|
||||
case 0:
|
||||
@ -64,8 +61,7 @@ mindplot.commands.MoveControlPointCommand = new Class(
|
||||
}
|
||||
this._line.getLine().updateLine(this._point);
|
||||
},
|
||||
undoExecute: function(commandContext)
|
||||
{
|
||||
undoExecute: function(commandContext) {
|
||||
var line = this._line;
|
||||
var model = line.getModel();
|
||||
switch (this._point) {
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -16,16 +16,13 @@
|
||||
* 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,8 +30,7 @@ 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);
|
||||
|
@ -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