Merge branch 'master' into db-purge

Conflicts:
	wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties
This commit is contained in:
Paulo Gustavo Veiga
2012-11-05 20:40:54 -03:00
32 changed files with 220 additions and 362 deletions

View File

@@ -167,39 +167,40 @@ mindplot.Designer = new Class({
}
// Enable drag events ...
Element.NativeEvents.dragenter = 2;
Element.NativeEvents.dragexit = 2;
Element.NativeEvents.dragover = 2;
Element.NativeEvents.drop = 2;
screenManager.addEvent('dragenter', noopHandler);
screenManager.addEvent('dragexit', noopHandler);
screenManager.addEvent('dragover', noopHandler);
screenManager.addEvent('drop', function (evt) {
evt.stopPropagation();
evt.preventDefault();
// @Todo: Images support on progress ...
// Element.NativeEvents.dragenter = 2;
// Element.NativeEvents.dragexit = 2;
// Element.NativeEvents.dragover = 2;
// Element.NativeEvents.drop = 2;
//
var files = evt.event.dataTransfer.files;
console.log(event);
var count = files.length;
// Only call the handler if 1 or more files was dropped.
if (count > 0) {
var model = this.getMindmap().createNode();
model.setImageSize(80, 43);
model.setMetadata("{'media':'video,'url':'http://www.youtube.com/watch?v=P3FrXftyuzw&feature=g-vrec&context=G2b4ab69RVAAAAAAAAAA'}");
model.setImageUrl("images/logo-small.png");
model.setShapeType(mindplot.model.TopicShape.IMAGE);
var position = screenManager.getWorkspaceMousePosition(evt);
model.setPosition(position.x, position.y);
model.setPosition(100, 100);
this._actionDispatcher.addTopics([model]);
}
}.bind(this));
// screenManager.addEvent('dragenter', noopHandler);
// screenManager.addEvent('dragexit', noopHandler);
// screenManager.addEvent('dragover', noopHandler);
// screenManager.addEvent('drop', function (evt) {
// evt.stopPropagation();
// evt.preventDefault();
////
// var files = evt.event.dataTransfer.files;
// console.log(event);
//
// var count = files.length;
//
// // Only call the handler if 1 or more files was dropped.
// if (count > 0) {
//
// var model = this.getMindmap().createNode();
// model.setImageSize(80, 43);
// model.setMetadata("{'media':'video,'url':'http://www.youtube.com/watch?v=P3FrXftyuzw&feature=g-vrec&context=G2b4ab69RVAAAAAAAAAA'}");
// model.setImageUrl("images/logo-small.png");
// model.setShapeType(mindplot.model.TopicShape.IMAGE);
//
// var position = screenManager.getWorkspaceMousePosition(evt);
// model.setPosition(position.x, position.y);
// model.setPosition(100, 100);
//
// this._actionDispatcher.addTopics([model]);
// }
// }.bind(this));
},

View File

@@ -83,6 +83,7 @@ mindplot.DesignerModel = new Class({
addTopic:function (topic) {
$assert(topic, "topic can not be null");
$assert(typeof topic.getId() == "number", "id is not a number:" + topic.getId());
this._topics.push(topic);
},

View File

@@ -38,6 +38,7 @@ mindplot.NodeGraph = new Class({
},
setId : function(id) {
$assert(typeof topic.getId() == "number", "id is not a number:" + id);
this.getModel().setId(id);
},

View File

@@ -54,7 +54,6 @@ mindplot.StandaloneActionDispatcher = new Class({
};
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicId, position);
command.desc = "move topic";
this.execute(command);
},
@@ -72,7 +71,6 @@ mindplot.StandaloneActionDispatcher = new Class({
return result;
};
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds);
command.desc = "changeFontStyleToTopic";
this.execute(command);
},
@@ -85,9 +83,9 @@ mindplot.StandaloneActionDispatcher = new Class({
topic.setText(value);
return result;
};
commandFunc.commandType = "changeTextToTopic";
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, text);
command.desc = "changeTextToTopic";
this.execute(command);
},
@@ -105,8 +103,6 @@ mindplot.StandaloneActionDispatcher = new Class({
};
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicIds, fontFamily);
command.desc = "changeFontFamilyToTopic";
this.execute(command);
},
@@ -122,7 +118,6 @@ mindplot.StandaloneActionDispatcher = new Class({
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
command.discardDuplicated = "fontColorCommandId";
command.desc = "changeFontColorToTopic";
this.execute(command);
},
@@ -138,8 +133,6 @@ mindplot.StandaloneActionDispatcher = new Class({
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
command.discardDuplicated = "backColor";
command.desc = "changeBackgroundColorToTopic";
this.execute(command);
},
@@ -155,8 +148,6 @@ mindplot.StandaloneActionDispatcher = new Class({
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
command.discardDuplicated = "borderColorCommandId";
command.desc = "changeBorderColorToTopic";
this.execute(command);
},
@@ -173,8 +164,6 @@ mindplot.StandaloneActionDispatcher = new Class({
};
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, size);
command.desc = "changeFontSizeToTopic";
this.execute(command);
},
@@ -189,8 +178,6 @@ mindplot.StandaloneActionDispatcher = new Class({
};
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, shapeType);
command.desc = "changeShapeTypeToTopic";
this.execute(command);
},
@@ -207,8 +194,6 @@ mindplot.StandaloneActionDispatcher = new Class({
};
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds);
command.desc = "changeFontWeightToTopic";
this.execute(command);
},
@@ -221,8 +206,6 @@ mindplot.StandaloneActionDispatcher = new Class({
};
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, collapse);
command.desc = "shrinkBranch";
this.execute(command, false);
},
@@ -268,7 +251,7 @@ mindplot.CommandContext = new Class({
var ids = designerTopics.map(function (topic) {
return topic.getId();
});
$assert(result.length == topicsIds.length, "Could not find topic. Result:" + result + ", Filter Criteria:" + topicsIds + ", Current Topics: " + ids);
$assert(result.length == topicsIds.length, "Could not find topic. Result:" + result + ", Filter Criteria:" + topicsIds + ", Current Topics: [" + ids + "]");
}
return result;
},

View File

@@ -32,19 +32,27 @@ mindplot.commands.GenericFunctionCommand = new Class({
execute:function (commandContext) {
if (!this.applied) {
// @Todo: Debug hack. Remove
var topics;
var topics = null;
try {
topics = commandContext.findTopics(this._topicsId);
} catch (e) {
throw new Error(e + "," + this._commandFunc + "," + this._commandFunc.desc);
if (this._commandFunc.commandType != "changeTextToTopic") {
// Workaround: For some reason, there is a combination of events that involves
// making some modification and firing out of focus event. This is causing
// that a remove node try to be removed. In some other life, I will come with the solution.
// Almost aways occurs with IE9. I could be related with some change of order in sets o something similar.
throw e;
}
}
topics.each(function (topic) {
var oldValue = this._commandFunc(topic, this._value);
this._oldValues.push(oldValue);
}.bind(this));
if (topics != null) {
topics.each(function (topic) {
var oldValue = this._commandFunc(topic, this._value);
this._oldValues.push(oldValue);
}.bind(this));
}
this.applied = true;
} else {
throw "Command can not be applied two times in a row.";
}