Basic topic propeties integrated with brix.

This commit is contained in:
Paulo Veiga
2011-09-06 01:03:27 -03:00
parent 85defa2ab9
commit e2da27ebc8
26 changed files with 346 additions and 271 deletions

View File

@@ -21,12 +21,12 @@ mindplot.commands.AddIconToTopicCommand = new Class({
initialize: function(topicId, iconType) {
$assert(topicId, 'topicId can not be null');
$assert(iconType, 'iconType can not be null');
this._topicsIds = topicId;
this._objectsIds = topicId;
this._iconType = iconType;
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
var topic = commandContext.findTopics(this._objectsIds)[0];
var updated = function() {
var iconImg = topic.addIcon(this._iconType, commandContext._designer);
this._iconModel = iconImg.getModel();
@@ -36,7 +36,7 @@ mindplot.commands.AddIconToTopicCommand = new Class({
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
var topic = commandContext.findTopics(this._objectsIds)[0];
var updated = function() {
topic.removeIcon(this._iconModel);
topic._adjustShapes();

View File

@@ -20,12 +20,12 @@ mindplot.commands.AddLinkToTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId, url) {
$assert(topicId, 'topicId can not be null');
this._topicsIds = topicId;
this._objectsIds = topicId;
this._url = url;
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
var topic = commandContext.findTopics(this._objectsIds)[0];
var updated = function() {
topic.addLink(this._url, commandContext._designer);
topic._adjustShapes();
@@ -33,7 +33,7 @@ mindplot.commands.AddLinkToTopicCommand = new Class({
updated.delay(0);
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
var topic = commandContext.findTopics(this._objectsIds)[0];
var updated = function() {
topic.removeLink();
}.bind(this);

View File

@@ -20,20 +20,20 @@ mindplot.commands.AddNoteToTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId, text) {
$assert(topicId, 'topicId can not be null');
this._topicsIds = topicId;
this._textShape = text;
this._objectsIds = topicId;
this._text = text;
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
var topic = commandContext.findTopics(this._objectsIds)[0];
var updated = function() {
topic.addNote(this._textShape);
topic.addNote(this._text);
topic._adjustShapes();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
var topic = commandContext.findTopics(this._objectsIds)[0];
var updated = function() {
topic.removeNote();
}.bind(this);

View File

@@ -18,9 +18,9 @@
mindplot.commands.DeleteCommand = new Class({
Extends:mindplot.Command,
initialize: function(objectIds) {
$assert(objectIds, "objectIds must be defined");
this._topicsIds = objectIds;
initialize: function(topicIds,relIds) {
this._relIds = relIds;
this._topicIds = topicIds;
this._deletedTopicModels = [];
this._parentTopicIds = [];
this._deletedRelationships = [];
@@ -28,7 +28,7 @@ mindplot.commands.DeleteCommand = new Class({
},
execute: function(commandContext) {
var topics = commandContext.findTopics(this._topicsIds.nodes);
var topics = commandContext.findTopics(this._topicIds);
if (topics.length > 0) {
topics.forEach(
function(topic, index) {
@@ -58,7 +58,7 @@ mindplot.commands.DeleteCommand = new Class({
}.bind(this)
);
}
var lines = commandContext.findRelationships(this._topicsIds.relationship);
var lines = commandContext.findRelationships(this._relIds);
if (lines.length > 0) {
lines.forEach(function(line, index) {
if (line.isInWorkspace()) {
@@ -70,7 +70,7 @@ mindplot.commands.DeleteCommand = new Class({
},
undoExecute: function(commandContext) {
var topics = commandContext.findTopics(this._topicsIds);
var topics = commandContext.findTopics(this._topicIds);
var parent = commandContext.findTopics(this._parentTopicIds);
this._deletedTopicModels.forEach(

View File

@@ -21,7 +21,7 @@ mindplot.commands.DragTopicCommand = new Class({
initialize: function(topicIds, position, order, parentTopic) {
$assert(topicIds, "topicIds must be defined");
this._topicsIds = topicIds;
this._objectsIds = topicIds;
if ($defined(parentTopic))
this._parentId = parentTopic.getId();
@@ -31,7 +31,7 @@ mindplot.commands.DragTopicCommand = new Class({
},
execute: function(commandContext) {
var topic = commandContext.findTopics([this._topicsIds])[0];
var topic = commandContext.findTopics([this._objectsIds])[0];
// Save old position ...
var origParentTopic = topic.getOutgoingConnectedTopic();

View File

@@ -23,14 +23,14 @@ mindplot.commands.GenericFunctionCommand = new Class({
$assert(topicsIds, "topicsIds must be defined");
this._value = value;
this._topicsIds = topicsIds;
this._objectsIds = topicsIds;
this._commandFunc = commandFunc;
this._oldValues = [];
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext) {
if (!this.applied) {
var topics = commandContext.findTopics(this._topicsIds);
var topics = commandContext.findTopics(this._objectsIds);
topics.forEach(function(topic) {
var oldValue = this._commandFunc(topic, this._value);
this._oldValues.push(oldValue);
@@ -43,7 +43,7 @@ mindplot.commands.GenericFunctionCommand = new Class({
},
undoExecute: function(commandContext) {
if (this.applied) {
var topics = commandContext.findTopics(this._topicsIds);
var topics = commandContext.findTopics(this._objectsIds);
topics.forEach(function(topic, index) {
this._commandFunc(topic, this._oldValues[index]);

View File

@@ -22,12 +22,12 @@ mindplot.commands.RemoveIconFromTopicCommand = new Class({
{
$assert(topicIds, 'topicIds can not be null');
$assert(iconModel, 'iconModel can not be null');
this._topicsIds = topicIds;
this._objectsIds = topicIds;
this._iconModel = iconModel;
},
execute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicsIds)[0];
var topic = commandContext.findTopics(this._objectsIds)[0];
var updated = function() {
topic.removeIcon(this._iconModel);
topic._adjustShapes();
@@ -36,7 +36,7 @@ mindplot.commands.RemoveIconFromTopicCommand = new Class({
},
undoExecute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicsIds)[0];
var topic = commandContext.findTopics(this._objectsIds)[0];
var updated = function() {
var iconType = this._iconModel.getIconType();
var iconImg = topic.addIcon(iconType, commandContext._designer);

View File

@@ -20,10 +20,10 @@ mindplot.commands.RemoveLinkFromTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId) {
$assert(topicId, 'topicId can not be null');
this._topicsIds = topicId;
this._objectsIds = topicId;
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
var topic = commandContext.findTopics(this._objectsIds)[0];
this._url = topic._link.getUrl();
var updated = function() {
topic.removeLink();
@@ -31,7 +31,7 @@ mindplot.commands.RemoveLinkFromTopicCommand = new Class({
updated.delay(0);
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
var topic = commandContext.findTopics(this._objectsIds)[0];
var updated = function() {
topic.addLink(this._url, commandContext._designer);
topic._adjustShapes();

View File

@@ -21,12 +21,12 @@ mindplot.commands.RemoveNoteFromTopicCommand = new Class({
initialize: function(topicId)
{
$assert(topicId, 'topicId can not be null');
this._topicsIds = topicId;
this._objectsIds = topicId;
},
execute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicsIds)[0];
this._textShape = topic._note.getText();
var topic = commandContext.findTopics(this._objectsIds)[0];
this._text = topic._note.getText();
var updated = function() {
topic.removeNote();
}.bind(this);
@@ -34,9 +34,9 @@ mindplot.commands.RemoveNoteFromTopicCommand = new Class({
},
undoExecute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicsIds)[0];
var topic = commandContext.findTopics(this._objectsIds)[0];
var updated = function() {
topic.addNote(this._textShape,commandContext._designer);
topic.addNote(this._text,commandContext._designer);
topic._adjustShapes();
}.bind(this);
updated.delay(0);