mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-25 23:44:54 +01:00
- Add support for copy and paste.
This commit is contained in:
parent
a5acdc7bb7
commit
8175eea928
@ -27,7 +27,7 @@ mindplot.ActionDispatcher = new Class({
|
||||
throw "method must be implemented.";
|
||||
},
|
||||
|
||||
addTopic: function(nodeModel, parentTopicId, animated) {
|
||||
addTopics: function(models, parentTopicId) {
|
||||
throw "method must be implemented.";
|
||||
},
|
||||
|
||||
|
@ -61,7 +61,7 @@ mindplot.BrixActionDispatcher = new Class({
|
||||
return mindplot.collaboration.CollaborationManager.getInstance().getCollaborativeFramework();
|
||||
},
|
||||
|
||||
addTopic : function(nodeModel, parentTopicId, animated) {
|
||||
addTopics : function(nodeModel, parentTopicId) {
|
||||
var framework = this._getFramework();
|
||||
var cmindmap = framework.getModel();
|
||||
|
||||
|
@ -65,6 +65,7 @@ mindplot.Designer = new Class({
|
||||
this.setViewPort(options.viewPort);
|
||||
|
||||
mindplot.TopicEventDispatcher.configure(this.isReadOnly());
|
||||
this._clipboard = [];
|
||||
},
|
||||
|
||||
/**
|
||||
@ -131,7 +132,7 @@ mindplot.Designer = new Class({
|
||||
|
||||
var centralTopic = this.getModel().getCentralTopic();
|
||||
var model = this._createChildModel(centralTopic, mousePos);
|
||||
this._actionDispatcher.addTopic(model, centralTopic.getId());
|
||||
this._actionDispatcher.addTopics([model], [centralTopic.getId()]);
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
@ -347,6 +348,41 @@ mindplot.Designer = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
copyToClipboard:function () {
|
||||
var topics = this.getModel().filterSelectedTopics();
|
||||
if (topics.length <= 0) {
|
||||
// If there are more than one node selected,
|
||||
$notify($msg('AT_LEAST_ONE_TOPIC_MUST_BE_SELECTED'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Exclude central topic ..
|
||||
topics = topics.filter(function (topic) {
|
||||
return topic.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE
|
||||
});
|
||||
|
||||
this._clipboard = topics.map(function (topic) {
|
||||
var nodeModel = topic.getModel().deepCopy();
|
||||
|
||||
// Change position to make the new topic evident...
|
||||
var pos = nodeModel.getPosition();
|
||||
nodeModel.setPosition(pos.x + (60 * Math.sign(pos.x)), pos.y + 30);
|
||||
|
||||
return nodeModel;
|
||||
});
|
||||
|
||||
$notify($msg('SELECTION_COPIED_TO_CLIPBOARD'));
|
||||
},
|
||||
|
||||
pasteClipboard:function () {
|
||||
if (this._clipboard.length == 0) {
|
||||
$notify($msg('CLIPBOARD_IS_EMPTY'));
|
||||
return;
|
||||
}
|
||||
this._actionDispatcher.addTopics(this._clipboard);
|
||||
this._clipboard = [];
|
||||
},
|
||||
|
||||
getModel:function () {
|
||||
return this._model;
|
||||
},
|
||||
@ -387,7 +423,7 @@ mindplot.Designer = new Class({
|
||||
var childModel = this._createChildModel(parentTopic);
|
||||
|
||||
// Execute event ...
|
||||
this._actionDispatcher.addTopic(childModel, parentTopicId, true);
|
||||
this._actionDispatcher.addTopics([childModel], [parentTopicId]);
|
||||
|
||||
},
|
||||
|
||||
@ -415,7 +451,7 @@ mindplot.Designer = new Class({
|
||||
// Position far from the visual area ...
|
||||
model.setPosition(1000, 1000);
|
||||
|
||||
this._actionDispatcher.addTopic(model, null, false);
|
||||
this._actionDispatcher.addTopics([model]);
|
||||
var topic = this.getModel().findTopicById(model.getId());
|
||||
|
||||
// Simulate a mouse down event to start the dragging ...
|
||||
@ -452,7 +488,7 @@ mindplot.Designer = new Class({
|
||||
}
|
||||
|
||||
var parentTopicId = parentTopic.getId();
|
||||
this._actionDispatcher.addTopic(siblingModel, parentTopicId, true);
|
||||
this._actionDispatcher.addTopics([siblingModel], [parentTopicId]);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -93,6 +93,35 @@ mindplot.DesignerKeyboard = new Class({
|
||||
|
||||
}.bind(this),
|
||||
|
||||
'ctrl+c':function () {
|
||||
event.preventDefault(event);
|
||||
event.stopPropagation();
|
||||
designer.copyToClipboard();
|
||||
}.bind(this),
|
||||
|
||||
'meta+c':function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
designer.copyToClipboard();
|
||||
|
||||
}.bind(this),
|
||||
|
||||
'ctrl+v':function () {
|
||||
event.preventDefault(event);
|
||||
event.stopPropagation();
|
||||
|
||||
designer.pasteClipboard();
|
||||
}.bind(this),
|
||||
|
||||
'meta+v':function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
designer.pasteClipboard();
|
||||
|
||||
}.bind(this),
|
||||
|
||||
'ctrl+z+shift':function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
@ -86,8 +86,12 @@ mindplot.Messages.BUNDLES = {
|
||||
CENTRAL_TOPIC:'Central Topic',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'Children can not be collapsed. One topic must be selected.',
|
||||
SHORTCUTS:'Keyboard Shortcuts',
|
||||
ENTITIES_COULD_NOT_BE_DELETED: 'Could not delete topic or relation. At least one map entity must be selected.',
|
||||
CENTRAL_TOPIC_CAN_NOT_BE_DELETED: 'Central topic can not be deleted.'
|
||||
|
||||
// @Todo: pending ...
|
||||
ENTITIES_COULD_NOT_BE_DELETED:'Could not delete topic or relation. At least one map entity must be selected.',
|
||||
CENTRAL_TOPIC_CAN_NOT_BE_DELETED:'Central topic can not be deleted.',
|
||||
SELECTION_COPIED_TO_CLIPBOARD:'Topics copied to the clipboard',
|
||||
CLIPBOARD_IS_EMPTY:'Nothing to copy. Clipboard is empty'
|
||||
},
|
||||
'es':{
|
||||
DISCARD_CHANGES:'Descartar Cambios',
|
||||
|
@ -29,8 +29,8 @@ mindplot.StandaloneActionDispatcher = new Class({
|
||||
},
|
||||
|
||||
|
||||
addTopic:function (nodeModel, parentTopicId, animated) {
|
||||
var command = new mindplot.commands.AddTopicCommand(nodeModel, parentTopicId, animated);
|
||||
addTopics:function (models, parentTopicsId) {
|
||||
var command = new mindplot.commands.AddTopicCommand(models, parentTopicsId);
|
||||
this.execute(command);
|
||||
},
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
mindplot.Topic = new Class({
|
||||
Extends:mindplot.NodeGraph,
|
||||
initialize : function(model, options) {
|
||||
initialize:function (model, options) {
|
||||
this.parent(model, options);
|
||||
this._children = [];
|
||||
this._parent = null;
|
||||
@ -39,12 +39,12 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_registerEvents : function() {
|
||||
_registerEvents:function () {
|
||||
|
||||
this.setMouseEventsEnabled(true);
|
||||
|
||||
// Prevent click on the topics being propagated ...
|
||||
this.addEvent('click', function(event) {
|
||||
this.addEvent('click', function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
@ -54,15 +54,15 @@ mindplot.Topic = new Class({
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
setShapeType : function(type) {
|
||||
setShapeType:function (type) {
|
||||
this._setShapeType(type, true);
|
||||
},
|
||||
|
||||
getParent : function() {
|
||||
getParent:function () {
|
||||
return this._parent;
|
||||
},
|
||||
|
||||
_setShapeType : function(type, updateModel) {
|
||||
_setShapeType:function (type, updateModel) {
|
||||
// Remove inner shape figure ...
|
||||
var model = this.getModel();
|
||||
if ($defined(updateModel) && updateModel) {
|
||||
@ -103,7 +103,7 @@ mindplot.Topic = new Class({
|
||||
|
||||
},
|
||||
|
||||
getShapeType : function() {
|
||||
getShapeType:function () {
|
||||
var model = this.getModel();
|
||||
var result = model.getShapeType();
|
||||
if (!$defined(result)) {
|
||||
@ -112,7 +112,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
_removeInnerShape : function() {
|
||||
_removeInnerShape:function () {
|
||||
var group = this.get2DElement();
|
||||
var innerShape = this.getInnerShape();
|
||||
group.removeChild(innerShape);
|
||||
@ -120,7 +120,7 @@ mindplot.Topic = new Class({
|
||||
return innerShape;
|
||||
},
|
||||
|
||||
getInnerShape : function() {
|
||||
getInnerShape:function () {
|
||||
if (!$defined(this._innerShape)) {
|
||||
// Create inner box.
|
||||
this._innerShape = this._buildShape(mindplot.Topic.INNER_RECT_ATTRIBUTES, this.getShapeType());
|
||||
@ -144,7 +144,7 @@ mindplot.Topic = new Class({
|
||||
return this._innerShape;
|
||||
},
|
||||
|
||||
_buildShape : function(attributes, shapeType) {
|
||||
_buildShape:function (attributes, shapeType) {
|
||||
$assert(attributes, "attributes can not be null");
|
||||
$assert(shapeType, "shapeType can not be null");
|
||||
|
||||
@ -160,11 +160,11 @@ mindplot.Topic = new Class({
|
||||
result.setHref(url);
|
||||
result.setSize(size.width, size.height);
|
||||
|
||||
result.getSize = function() {
|
||||
result.getSize = function () {
|
||||
return model.getImageSize();
|
||||
};
|
||||
|
||||
result.setPosition = function() {
|
||||
result.setPosition = function () {
|
||||
};
|
||||
}
|
||||
else if (shapeType == mindplot.model.TopicShape.ELLIPSE) {
|
||||
@ -174,8 +174,8 @@ mindplot.Topic = new Class({
|
||||
result = new web2d.Rect(0.3, attributes);
|
||||
}
|
||||
else if (shapeType == mindplot.model.TopicShape.LINE) {
|
||||
result = new web2d.Line({strokeColor:"#495879",strokeWidth:1});
|
||||
result.setSize = function(width, height) {
|
||||
result = new web2d.Line({strokeColor:"#495879", strokeWidth:1});
|
||||
result.setSize = function (width, height) {
|
||||
this.size = {width:width, height:height};
|
||||
result.setFrom(0, height);
|
||||
result.setTo(width, height);
|
||||
@ -185,18 +185,18 @@ mindplot.Topic = new Class({
|
||||
result.setStroke(1, 'solid', stokeColor);
|
||||
};
|
||||
|
||||
result.getSize = function() {
|
||||
result.getSize = function () {
|
||||
return this.size;
|
||||
};
|
||||
|
||||
result.setPosition = function() {
|
||||
result.setPosition = function () {
|
||||
};
|
||||
|
||||
result.setFill = function() {
|
||||
result.setFill = function () {
|
||||
|
||||
};
|
||||
|
||||
result.setStroke = function() {
|
||||
result.setStroke = function () {
|
||||
|
||||
};
|
||||
}
|
||||
@ -208,7 +208,7 @@ mindplot.Topic = new Class({
|
||||
},
|
||||
|
||||
|
||||
setCursor : function(type) {
|
||||
setCursor:function (type) {
|
||||
var innerShape = this.getInnerShape();
|
||||
innerShape.setCursor(type);
|
||||
|
||||
@ -219,7 +219,7 @@ mindplot.Topic = new Class({
|
||||
textShape.setCursor(type);
|
||||
},
|
||||
|
||||
getOuterShape : function() {
|
||||
getOuterShape:function () {
|
||||
if (!$defined(this._outerShape)) {
|
||||
var rect = this._buildShape(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES, mindplot.model.TopicShape.ROUNDED_RECT);
|
||||
rect.setPosition(-2, -3);
|
||||
@ -230,7 +230,7 @@ mindplot.Topic = new Class({
|
||||
return this._outerShape;
|
||||
},
|
||||
|
||||
getTextShape : function() {
|
||||
getTextShape:function () {
|
||||
if (!$defined(this._text)) {
|
||||
this._text = this._buildTextShape(false);
|
||||
|
||||
@ -242,7 +242,7 @@ mindplot.Topic = new Class({
|
||||
return this._text;
|
||||
},
|
||||
|
||||
getOrBuildIconGroup : function() {
|
||||
getOrBuildIconGroup:function () {
|
||||
if (!$defined(this._iconsGroup)) {
|
||||
this._iconsGroup = this._buildIconGroup();
|
||||
var group = this.get2DElement();
|
||||
@ -252,11 +252,11 @@ mindplot.Topic = new Class({
|
||||
return this._iconsGroup;
|
||||
},
|
||||
|
||||
getIconGroup : function() {
|
||||
getIconGroup:function () {
|
||||
return this._iconsGroup;
|
||||
},
|
||||
|
||||
_buildIconGroup : function() {
|
||||
_buildIconGroup:function () {
|
||||
var textHeight = this.getTextShape().getFontHeight();
|
||||
var result = new mindplot.IconGroup(this.getId(), textHeight);
|
||||
var padding = this._getInnerPadding();
|
||||
@ -274,7 +274,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
addFeature : function(type, attributes) {
|
||||
addFeature:function (type, attributes) {
|
||||
var iconGroup = this.getOrBuildIconGroup();
|
||||
this.closeEditors();
|
||||
|
||||
@ -291,12 +291,12 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
findFeatureById : function(id) {
|
||||
findFeatureById:function (id) {
|
||||
var model = this.getModel();
|
||||
return model.findFeatureById(id);
|
||||
},
|
||||
|
||||
removeFeature : function(featureModel) {
|
||||
removeFeature:function (featureModel) {
|
||||
$assert(featureModel, "featureModel could not be null");
|
||||
|
||||
//Removing the icon from MODEL
|
||||
@ -311,19 +311,19 @@ mindplot.Topic = new Class({
|
||||
this._adjustShapes();
|
||||
},
|
||||
|
||||
addRelationship : function(relationship) {
|
||||
addRelationship:function (relationship) {
|
||||
this._relationships.push(relationship);
|
||||
},
|
||||
|
||||
deleteRelationship : function(relationship) {
|
||||
deleteRelationship:function (relationship) {
|
||||
this._relationships.erase(relationship);
|
||||
},
|
||||
|
||||
getRelationships : function() {
|
||||
getRelationships:function () {
|
||||
return this._relationships;
|
||||
},
|
||||
|
||||
_buildTextShape : function(readOnly) {
|
||||
_buildTextShape:function (readOnly) {
|
||||
var result = new web2d.Text();
|
||||
var family = this.getFontFamily();
|
||||
var size = this.getFontSize();
|
||||
@ -346,11 +346,11 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
_getInnerPadding : function() {
|
||||
_getInnerPadding:function () {
|
||||
throw "this must be implemented";
|
||||
},
|
||||
|
||||
setFontFamily : function(value, updateModel) {
|
||||
setFontFamily:function (value, updateModel) {
|
||||
var textShape = this.getTextShape();
|
||||
textShape.setFontFamily(value);
|
||||
if ($defined(updateModel) && updateModel) {
|
||||
@ -360,7 +360,7 @@ mindplot.Topic = new Class({
|
||||
this._adjustShapes(updateModel);
|
||||
},
|
||||
|
||||
setFontSize : function(value, updateModel) {
|
||||
setFontSize:function (value, updateModel) {
|
||||
|
||||
var textShape = this.getTextShape();
|
||||
textShape.setSize(value);
|
||||
@ -373,7 +373,7 @@ mindplot.Topic = new Class({
|
||||
|
||||
},
|
||||
|
||||
setFontStyle : function(value, updateModel) {
|
||||
setFontStyle:function (value, updateModel) {
|
||||
var textShape = this.getTextShape();
|
||||
textShape.setStyle(value);
|
||||
if ($defined(updateModel) && updateModel) {
|
||||
@ -383,7 +383,7 @@ mindplot.Topic = new Class({
|
||||
this._adjustShapes(updateModel);
|
||||
},
|
||||
|
||||
setFontWeight : function(value, updateModel) {
|
||||
setFontWeight:function (value, updateModel) {
|
||||
var textShape = this.getTextShape();
|
||||
textShape.setWeight(value);
|
||||
if ($defined(updateModel) && updateModel) {
|
||||
@ -393,7 +393,7 @@ mindplot.Topic = new Class({
|
||||
this._adjustShapes();
|
||||
},
|
||||
|
||||
getFontWeight : function() {
|
||||
getFontWeight:function () {
|
||||
var model = this.getModel();
|
||||
var result = model.getFontWeight();
|
||||
if (!$defined(result)) {
|
||||
@ -403,7 +403,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
getFontFamily : function() {
|
||||
getFontFamily:function () {
|
||||
var model = this.getModel();
|
||||
var result = model.getFontFamily();
|
||||
if (!$defined(result)) {
|
||||
@ -413,7 +413,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
getFontColor : function() {
|
||||
getFontColor:function () {
|
||||
var model = this.getModel();
|
||||
var result = model.getFontColor();
|
||||
if (!$defined(result)) {
|
||||
@ -423,7 +423,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
getFontStyle : function() {
|
||||
getFontStyle:function () {
|
||||
var model = this.getModel();
|
||||
var result = model.getFontStyle();
|
||||
if (!$defined(result)) {
|
||||
@ -433,7 +433,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
getFontSize : function() {
|
||||
getFontSize:function () {
|
||||
var model = this.getModel();
|
||||
var result = model.getFontSize();
|
||||
if (!$defined(result)) {
|
||||
@ -443,7 +443,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
setFontColor : function(value, updateModel) {
|
||||
setFontColor:function (value, updateModel) {
|
||||
var textShape = this.getTextShape();
|
||||
textShape.setColor(value);
|
||||
if ($defined(updateModel) && updateModel) {
|
||||
@ -452,7 +452,7 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_setText : function(text, updateModel) {
|
||||
_setText:function (text, updateModel) {
|
||||
var textShape = this.getTextShape();
|
||||
textShape.setText(text == null ? this._defaultText() : text);
|
||||
|
||||
@ -462,7 +462,7 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
setText : function(text) {
|
||||
setText:function (text) {
|
||||
// Avoid empty nodes ...
|
||||
if (text.trim().length == 0) {
|
||||
text = null;
|
||||
@ -472,7 +472,7 @@ mindplot.Topic = new Class({
|
||||
this._adjustShapes();
|
||||
},
|
||||
|
||||
getText : function() {
|
||||
getText:function () {
|
||||
var model = this.getModel();
|
||||
var result = model.getText();
|
||||
if (!$defined(result)) {
|
||||
@ -481,11 +481,11 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
setBackgroundColor : function(color) {
|
||||
setBackgroundColor:function (color) {
|
||||
this._setBackgroundColor(color, true);
|
||||
},
|
||||
|
||||
_setBackgroundColor : function(color, updateModel) {
|
||||
_setBackgroundColor:function (color, updateModel) {
|
||||
var innerShape = this.getInnerShape();
|
||||
innerShape.setFill(color);
|
||||
|
||||
@ -500,7 +500,7 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
getBackgroundColor : function() {
|
||||
getBackgroundColor:function () {
|
||||
var model = this.getModel();
|
||||
var result = model.getBackgroundColor();
|
||||
if (!$defined(result)) {
|
||||
@ -509,11 +509,11 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
setBorderColor : function(color) {
|
||||
setBorderColor:function (color) {
|
||||
this._setBorderColor(color, true);
|
||||
},
|
||||
|
||||
_setBorderColor : function(color, updateModel) {
|
||||
_setBorderColor:function (color, updateModel) {
|
||||
var innerShape = this.getInnerShape();
|
||||
innerShape.setAttribute('strokeColor', color);
|
||||
|
||||
@ -528,7 +528,7 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
getBorderColor : function() {
|
||||
getBorderColor:function () {
|
||||
var model = this.getModel();
|
||||
var result = model.getBorderColor();
|
||||
if (!$defined(result)) {
|
||||
@ -537,8 +537,8 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
_buildTopicShape : function() {
|
||||
var groupAttributes = {width: 100, height:100,coordSizeWidth:100,coordSizeHeight:100};
|
||||
_buildTopicShape:function () {
|
||||
var groupAttributes = {width:100, height:100, coordSizeWidth:100, coordSizeHeight:100};
|
||||
var group = new web2d.Group(groupAttributes);
|
||||
this._set2DElement(group);
|
||||
|
||||
@ -567,15 +567,15 @@ mindplot.Topic = new Class({
|
||||
this._registerDefaultListenersToElement(group, this);
|
||||
},
|
||||
|
||||
_registerDefaultListenersToElement : function(elem, topic) {
|
||||
var mouseOver = function(event) {
|
||||
_registerDefaultListenersToElement:function (elem, topic) {
|
||||
var mouseOver = function (event) {
|
||||
if (topic.isMouseEventsEnabled()) {
|
||||
topic.handleMouseOver(event);
|
||||
}
|
||||
};
|
||||
elem.addEvent('mouseover', mouseOver);
|
||||
|
||||
var outout = function(event) {
|
||||
var outout = function (event) {
|
||||
if (topic.isMouseEventsEnabled()) {
|
||||
topic.handleMouseOut(event);
|
||||
}
|
||||
@ -583,7 +583,7 @@ mindplot.Topic = new Class({
|
||||
elem.addEvent('mouseout', outout);
|
||||
|
||||
// Focus events ...
|
||||
elem.addEvent('mousedown', function(event) {
|
||||
elem.addEvent('mousedown', function (event) {
|
||||
if (!this.isReadOnly()) {
|
||||
// Disable topic selection of readOnly mode ...
|
||||
var value = true;
|
||||
@ -602,12 +602,12 @@ mindplot.Topic = new Class({
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
areChildrenShrunken : function() {
|
||||
areChildrenShrunken:function () {
|
||||
var model = this.getModel();
|
||||
return model.areChildrenShrunken();
|
||||
},
|
||||
|
||||
isCollapsed : function() {
|
||||
isCollapsed:function () {
|
||||
var result = false;
|
||||
|
||||
var current = this.getParent();
|
||||
@ -618,7 +618,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
setChildrenShrunken : function(value) {
|
||||
setChildrenShrunken:function (value) {
|
||||
// Update Model ...
|
||||
var model = this.getModel();
|
||||
model.setChildrenShrunken(value);
|
||||
@ -632,7 +632,7 @@ mindplot.Topic = new Class({
|
||||
// Do some fancy animation ....
|
||||
var elements = this._flatten2DElements(this);
|
||||
var fade = new mindplot.util.FadeEffect(elements, !value);
|
||||
fade.addEvent('complete', function() {
|
||||
fade.addEvent('complete', function () {
|
||||
|
||||
});
|
||||
fade.start();
|
||||
@ -640,7 +640,7 @@ mindplot.Topic = new Class({
|
||||
|
||||
},
|
||||
|
||||
getShrinkConnector : function() {
|
||||
getShrinkConnector:function () {
|
||||
var result = this._connector;
|
||||
if (this._connector == null) {
|
||||
this._connector = new mindplot.ShirinkConnector(this);
|
||||
@ -651,28 +651,28 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
handleMouseOver : function() {
|
||||
handleMouseOver:function () {
|
||||
var outerShape = this.getOuterShape();
|
||||
outerShape.setOpacity(1);
|
||||
},
|
||||
|
||||
handleMouseOut : function() {
|
||||
handleMouseOut:function () {
|
||||
var outerShape = this.getOuterShape();
|
||||
if (!this.isOnFocus()) {
|
||||
outerShape.setOpacity(0);
|
||||
}
|
||||
},
|
||||
|
||||
showTextEditor : function(text) {
|
||||
showTextEditor:function (text) {
|
||||
this._getTopicEventDispatcher().show(this, {text:text});
|
||||
},
|
||||
|
||||
showNoteEditor : function() {
|
||||
showNoteEditor:function () {
|
||||
|
||||
var topicId = this.getId();
|
||||
var model = this.getModel();
|
||||
var editorModel = {
|
||||
getValue : function() {
|
||||
getValue:function () {
|
||||
var notes = model.findFeatureByType(mindplot.TopicFeature.Note.id);
|
||||
var result;
|
||||
if (notes.length > 0)
|
||||
@ -681,7 +681,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
setValue : function(value) {
|
||||
setValue:function (value) {
|
||||
var dispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
var notes = model.findFeatureByType(mindplot.TopicFeature.Note.id);
|
||||
if (!$defined(value)) {
|
||||
@ -703,12 +703,12 @@ mindplot.Topic = new Class({
|
||||
editor.show();
|
||||
},
|
||||
|
||||
showLinkEditor : function() {
|
||||
showLinkEditor:function () {
|
||||
|
||||
var topicId = this.getId();
|
||||
var model = this.getModel();
|
||||
var editorModel = {
|
||||
getValue : function() {
|
||||
getValue:function () {
|
||||
var links = model.findFeatureByType(mindplot.TopicFeature.Link.id);
|
||||
var result;
|
||||
if (links.length > 0)
|
||||
@ -717,7 +717,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
setValue : function(value) {
|
||||
setValue:function (value) {
|
||||
var dispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
var links = model.findFeatureByType(mindplot.TopicFeature.Link.id);
|
||||
if (!$defined(value)) {
|
||||
@ -740,18 +740,18 @@ mindplot.Topic = new Class({
|
||||
editor.show();
|
||||
},
|
||||
|
||||
closeEditors : function() {
|
||||
closeEditors:function () {
|
||||
this._getTopicEventDispatcher().close(true);
|
||||
},
|
||||
|
||||
_getTopicEventDispatcher : function() {
|
||||
_getTopicEventDispatcher:function () {
|
||||
return mindplot.TopicEventDispatcher.getInstance();
|
||||
},
|
||||
|
||||
/**
|
||||
* Point: references the center of the rect shape.!!!
|
||||
*/
|
||||
setPosition : function(point) {
|
||||
setPosition:function (point) {
|
||||
$assert(point, "position can not be null");
|
||||
point.x = Math.ceil(point.x);
|
||||
point.y = Math.ceil(point.y);
|
||||
@ -777,11 +777,11 @@ mindplot.Topic = new Class({
|
||||
this.invariant();
|
||||
},
|
||||
|
||||
getOutgoingLine : function() {
|
||||
getOutgoingLine:function () {
|
||||
return this._outgoingLine;
|
||||
},
|
||||
|
||||
getIncomingLines : function() {
|
||||
getIncomingLines:function () {
|
||||
var result = [];
|
||||
var children = this.getChildren();
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
@ -794,7 +794,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
getOutgoingConnectedTopic : function() {
|
||||
getOutgoingConnectedTopic:function () {
|
||||
var result = null;
|
||||
var line = this.getOutgoingLine();
|
||||
if ($defined(line)) {
|
||||
@ -803,7 +803,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
_updateConnectionLines : function() {
|
||||
_updateConnectionLines:function () {
|
||||
// Update this to parent line ...
|
||||
var outgoingLine = this.getOutgoingLine();
|
||||
if ($defined(outgoingLine)) {
|
||||
@ -822,7 +822,7 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
setBranchVisibility : function(value) {
|
||||
setBranchVisibility:function (value) {
|
||||
var current = this;
|
||||
var parent = this;
|
||||
while (parent != null && parent.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
@ -833,7 +833,7 @@ mindplot.Topic = new Class({
|
||||
},
|
||||
|
||||
|
||||
setVisibility : function(value) {
|
||||
setVisibility:function (value) {
|
||||
this._setTopicVisibility(value);
|
||||
|
||||
// Hide all children...
|
||||
@ -842,7 +842,7 @@ mindplot.Topic = new Class({
|
||||
this._setRelationshipLinesVisibility(value);
|
||||
},
|
||||
|
||||
moveToBack : function() {
|
||||
moveToBack:function () {
|
||||
|
||||
// Update relationship lines
|
||||
for (var j = 0; j < this._relationships.length; j++) {
|
||||
@ -856,7 +856,7 @@ mindplot.Topic = new Class({
|
||||
this.get2DElement().moveToBack();
|
||||
},
|
||||
|
||||
moveToFront : function() {
|
||||
moveToFront:function () {
|
||||
|
||||
this.get2DElement().moveToFront();
|
||||
var connector = this.getShrinkConnector();
|
||||
@ -869,18 +869,18 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
isVisible : function() {
|
||||
isVisible:function () {
|
||||
var elem = this.get2DElement();
|
||||
return elem.isVisible();
|
||||
},
|
||||
|
||||
_setRelationshipLinesVisibility : function(value) {
|
||||
this._relationships.forEach(function(relationship) {
|
||||
_setRelationshipLinesVisibility:function (value) {
|
||||
this._relationships.forEach(function (relationship) {
|
||||
relationship.setVisibility(value);
|
||||
});
|
||||
},
|
||||
|
||||
_setTopicVisibility : function(value) {
|
||||
_setTopicVisibility:function (value) {
|
||||
var elem = this.get2DElement();
|
||||
elem.setVisibility(value);
|
||||
|
||||
@ -895,7 +895,7 @@ mindplot.Topic = new Class({
|
||||
textShape.setVisibility(this.getShapeType() != mindplot.model.TopicShape.IMAGE ? value : false);
|
||||
},
|
||||
|
||||
setOpacity : function(opacity) {
|
||||
setOpacity:function (opacity) {
|
||||
var elem = this.get2DElement();
|
||||
elem.setOpacity(opacity);
|
||||
|
||||
@ -907,7 +907,7 @@ mindplot.Topic = new Class({
|
||||
textShape.setOpacity(opacity);
|
||||
},
|
||||
|
||||
_setChildrenVisibility : function(isVisible) {
|
||||
_setChildrenVisibility:function (isVisible) {
|
||||
|
||||
// Hide all children.
|
||||
var children = this.getChildren();
|
||||
@ -924,7 +924,7 @@ mindplot.Topic = new Class({
|
||||
|
||||
},
|
||||
|
||||
invariant : function() {
|
||||
invariant:function () {
|
||||
var line = this._outgoingLine;
|
||||
var model = this.getModel();
|
||||
var isConnected = model.isConnected();
|
||||
@ -936,10 +936,10 @@ mindplot.Topic = new Class({
|
||||
},
|
||||
|
||||
|
||||
setSize : function(size, force) {
|
||||
setSize:function (size, force) {
|
||||
$assert(size, "size can not be null");
|
||||
$assert($defined(size.width), "size seem not to be a valid element");
|
||||
size = {width:Math.ceil(size.width),height: Math.ceil(size.height)};
|
||||
size = {width:Math.ceil(size.width), height:Math.ceil(size.height)};
|
||||
|
||||
var oldSize = this.getSize();
|
||||
var hasSizeChanged = oldSize.width != size.width || oldSize.height != size.height;
|
||||
@ -956,16 +956,16 @@ mindplot.Topic = new Class({
|
||||
this._updatePositionOnChangeSize(oldSize, size);
|
||||
|
||||
if (hasSizeChanged) {
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeResizeEvent, {node:this.getModel(),size:size});
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeResizeEvent, {node:this.getModel(), size:size});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_updatePositionOnChangeSize : function() {
|
||||
_updatePositionOnChangeSize:function () {
|
||||
$assert(false, "this method must be overwrited.");
|
||||
},
|
||||
|
||||
disconnect : function(workspace) {
|
||||
disconnect:function (workspace) {
|
||||
var outgoingLine = this.getOutgoingLine();
|
||||
if ($defined(outgoingLine)) {
|
||||
$assert(workspace, 'workspace can not be null');
|
||||
@ -1009,17 +1009,17 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
getOrder : function() {
|
||||
getOrder:function () {
|
||||
var model = this.getModel();
|
||||
return model.getOrder();
|
||||
},
|
||||
|
||||
setOrder : function(value) {
|
||||
setOrder:function (value) {
|
||||
var model = this.getModel();
|
||||
model.setOrder(value);
|
||||
},
|
||||
|
||||
connectTo : function(targetTopic, workspace, isVisible) {
|
||||
connectTo:function (targetTopic, workspace, isVisible) {
|
||||
$assert(!this._outgoingLine, 'Could not connect an already connected node');
|
||||
$assert(targetTopic != this, 'Cilcular connection are not allowed');
|
||||
$assert(targetTopic, 'Parent Graph can not be null');
|
||||
@ -1068,22 +1068,22 @@ mindplot.Topic = new Class({
|
||||
|
||||
// Fire connection event ...
|
||||
if (this.isInWorkspace()) {
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeConnectEvent, {parentNode:targetTopic.getModel(), childNode: this.getModel()});
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeConnectEvent, {parentNode:targetTopic.getModel(), childNode:this.getModel()});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
appendChild : function(child) {
|
||||
appendChild:function (child) {
|
||||
var children = this.getChildren();
|
||||
children.push(child);
|
||||
},
|
||||
|
||||
removeChild : function(child) {
|
||||
removeChild:function (child) {
|
||||
var children = this.getChildren();
|
||||
children.erase(child);
|
||||
},
|
||||
|
||||
getChildren : function() {
|
||||
getChildren:function () {
|
||||
var result = this._children;
|
||||
if (!$defined(result)) {
|
||||
this._children = [];
|
||||
@ -1092,7 +1092,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
removeFromWorkspace : function(workspace) {
|
||||
removeFromWorkspace:function (workspace) {
|
||||
var elem2d = this.get2DElement();
|
||||
workspace.removeChild(elem2d);
|
||||
var line = this.getOutgoingLine();
|
||||
@ -1103,7 +1103,7 @@ mindplot.Topic = new Class({
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeRemoved, this.getModel());
|
||||
},
|
||||
|
||||
addToWorkspace : function(workspace) {
|
||||
addToWorkspace:function (workspace) {
|
||||
var elem = this.get2DElement();
|
||||
workspace.appendChild(elem);
|
||||
if (!this.isInWorkspace()) {
|
||||
@ -1112,18 +1112,18 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
|
||||
if (this.getModel().isConnected())
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeConnectEvent, {parentNode:this.getOutgoingConnectedTopic().getModel(), childNode: this.getModel()});
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeConnectEvent, {parentNode:this.getOutgoingConnectedTopic().getModel(), childNode:this.getModel()});
|
||||
|
||||
}
|
||||
}
|
||||
this._isInWorkspace = true;
|
||||
this._adjustShapes();
|
||||
},
|
||||
|
||||
isInWorkspace : function() {
|
||||
isInWorkspace:function () {
|
||||
return this._isInWorkspace;
|
||||
},
|
||||
|
||||
createDragNode : function(layoutManager) {
|
||||
createDragNode:function (layoutManager) {
|
||||
var result = this.parent(layoutManager);
|
||||
|
||||
// Is the node already connected ?
|
||||
@ -1139,7 +1139,7 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
_adjustShapes : function() {
|
||||
_adjustShapes:function () {
|
||||
if (this._isInWorkspace) {
|
||||
|
||||
var textShape = this.getTextShape();
|
||||
@ -1168,7 +1168,7 @@ mindplot.Topic = new Class({
|
||||
var height = textHeight + (topicPadding * 2);
|
||||
var width = textWidth + iconsWidth + (topicPadding * 2);
|
||||
|
||||
this.setSize({width:width,height:height});
|
||||
this.setSize({width:width, height:height});
|
||||
|
||||
// Position node ...
|
||||
textShape.setPosition(topicPadding + iconsWidth, topicPadding);
|
||||
@ -1180,7 +1180,7 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_flatten2DElements : function(topic) {
|
||||
_flatten2DElements:function (topic) {
|
||||
var result = [];
|
||||
|
||||
var children = topic.getChildren();
|
||||
@ -1203,8 +1203,8 @@ mindplot.Topic = new Class({
|
||||
|
||||
|
||||
mindplot.Topic.CONNECTOR_WIDTH = 6;
|
||||
mindplot.Topic.OUTER_SHAPE_ATTRIBUTES = {fillColor:'rgb(252,235,192)',stroke:'1 dot rgb(241,163,39)',x:0,y:0};
|
||||
mindplot.Topic.OUTER_SHAPE_ATTRIBUTES_FOCUS = {fillColor:'rgb(244,184,45)',x:0,y:0};
|
||||
mindplot.Topic.OUTER_SHAPE_ATTRIBUTES = {fillColor:'rgb(252,235,192)', stroke:'1 dot rgb(241,163,39)', x:0, y:0};
|
||||
mindplot.Topic.OUTER_SHAPE_ATTRIBUTES_FOCUS = {fillColor:'rgb(244,184,45)', x:0, y:0};
|
||||
mindplot.Topic.INNER_RECT_ATTRIBUTES = {stroke:'2 solid'};
|
||||
|
||||
|
||||
|
@ -41,15 +41,14 @@ mindplot.TopicFeature = {
|
||||
});
|
||||
},
|
||||
|
||||
createModel : function(id, topic, attributes) {
|
||||
createModel : function(id, attributes) {
|
||||
$assert(id, 'type can not be null');
|
||||
$assert(topic, 'topic can not be null');
|
||||
$assert(attributes, 'attributes can not be null');
|
||||
|
||||
var model = mindplot.TopicFeature._featuresMetadataById.filter(function(elem) {
|
||||
return elem.id == id;
|
||||
})[0].model;
|
||||
return new model(topic, attributes);
|
||||
return new model(attributes);
|
||||
},
|
||||
|
||||
createIcon : function(topic, model) {
|
||||
|
@ -62,7 +62,7 @@ mindplot.collaboration.framework.brix.model.NodeModel = new Class({
|
||||
var model = new mindplot.model.NodeModel(cmodel.getType(), designer.getMindmap(), this.getId());
|
||||
cmodel.copyTo(model);
|
||||
|
||||
actionDispatcher.addTopic(model, this.getId(), true);
|
||||
actionDispatcher.addTopics([model], [this.getId()]);
|
||||
}
|
||||
} catch(e) {
|
||||
console.trace();
|
||||
|
@ -18,39 +18,49 @@
|
||||
|
||||
mindplot.commands.AddTopicCommand = new Class({
|
||||
Extends:mindplot.Command,
|
||||
initialize: function(model, parentTopicId) {
|
||||
$assert(model, 'Model can not be null');
|
||||
initialize:function (models, parentTopicsId) {
|
||||
$assert(models, 'models can not be null');
|
||||
$assert(parentTopicsId == null || parentTopicsId.length == models.length, 'parents and models must have the same size');
|
||||
|
||||
this.parent();
|
||||
this._model = model;
|
||||
this._parentId = parentTopicId;
|
||||
this._models = models;
|
||||
this._parentsIds = parentTopicsId;
|
||||
},
|
||||
|
||||
execute: function(commandContext) {
|
||||
execute:function (commandContext) {
|
||||
|
||||
// Add a new topic ...
|
||||
var topic = commandContext.createTopic(this._model, false);
|
||||
this._models.forEach(function (model, index) {
|
||||
|
||||
// Connect to topic ...
|
||||
if ($defined(this._parentId)) {
|
||||
var parentTopic = commandContext.findTopics(this._parentId)[0];
|
||||
commandContext.connect(topic, parentTopic);
|
||||
}
|
||||
// Add a new topic ...
|
||||
var topic = commandContext.createTopic(model, false);
|
||||
|
||||
// Finally, focus ...
|
||||
var designer = commandContext._designer;
|
||||
var fade = new mindplot.util.FadeEffect([topic,topic.getOutgoingLine()], true);
|
||||
fade.addEvent('complete', function() {
|
||||
designer.onObjectFocusEvent(topic);
|
||||
topic.setOnFocus(true);
|
||||
});
|
||||
fade.start();
|
||||
// Connect to topic ...
|
||||
if (this._parentsIds) {
|
||||
var parentId = this._parentsIds[index];
|
||||
if ($defined(parentId)) {
|
||||
var parentTopic = commandContext.findTopics(parentId)[0];
|
||||
commandContext.connect(topic, parentTopic);
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, focus ...
|
||||
var designer = commandContext._designer;
|
||||
var fade = new mindplot.util.FadeEffect([topic, topic.getOutgoingLine()], true);
|
||||
fade.addEvent('complete', function () {
|
||||
designer.onObjectFocusEvent(topic);
|
||||
topic.setOnFocus(true);
|
||||
});
|
||||
fade.start();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
undoExecute: function(commandContext) {
|
||||
undoExecute:function (commandContext) {
|
||||
// Finally, delete the topic from the workspace ...
|
||||
var topicId = this._model.getId();
|
||||
var topic = commandContext.findTopics(topicId)[0];
|
||||
commandContext.deleteTopic(topic);
|
||||
this._models.forEach(function (model) {
|
||||
|
||||
var topicId = model.getId();
|
||||
var topic = commandContext.findTopics(topicId)[0];
|
||||
commandContext.deleteTopic(topic);
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
@ -17,13 +17,11 @@
|
||||
*/
|
||||
|
||||
mindplot.model.FeatureModel = new Class({
|
||||
initialize:function(type, topic) {
|
||||
initialize:function(type) {
|
||||
$assert(type, 'type can not be null');
|
||||
$assert(topic, 'topic can not be null');
|
||||
|
||||
this._id = mindplot.model.FeatureModel._nextUUID();
|
||||
this._type = type;
|
||||
this._topic = topic;
|
||||
this._attributes = {};
|
||||
|
||||
// Create type method ...
|
||||
@ -53,10 +51,6 @@ mindplot.model.FeatureModel = new Class({
|
||||
return this._attributes[key];
|
||||
},
|
||||
|
||||
getTopic : function() {
|
||||
return this._topic;
|
||||
},
|
||||
|
||||
getId : function() {
|
||||
return this._id;
|
||||
},
|
||||
|
@ -56,7 +56,7 @@ mindplot.model.INodeModel = new Class({
|
||||
|
||||
setPosition : function(x, y) {
|
||||
$assert(!isNaN(parseInt(x)), "x position is not valid:" + x);
|
||||
$assert(!isNaN(parseInt(y)), "x position is not valid:" + y);
|
||||
$assert(!isNaN(parseInt(y)), "y position is not valid:" + y);
|
||||
this.putProperty('position', '{x:' + parseInt(x) + ',y:' + parseInt(y) + '}');
|
||||
},
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
mindplot.model.IconModel = new Class({
|
||||
Extends: mindplot.model.FeatureModel,
|
||||
initialize:function(topic, attributes) {
|
||||
this.parent(mindplot.model.IconModel.FEATURE_TYPE, topic);
|
||||
initialize:function(attributes) {
|
||||
this.parent(mindplot.model.IconModel.FEATURE_TYPE);
|
||||
this.setIconType(attributes.id);
|
||||
},
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
mindplot.model.LinkModel = new Class({
|
||||
Extends: mindplot.model.FeatureModel,
|
||||
initialize : function(topic, attributes) {
|
||||
this.parent(mindplot.model.LinkModel.FEATURE_TYPE, topic);
|
||||
initialize : function(attributes) {
|
||||
this.parent(mindplot.model.LinkModel.FEATURE_TYPE);
|
||||
this.setUrl(attributes.url);
|
||||
},
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
mindplot.model.NodeModel = new Class({
|
||||
Extends: mindplot.model.INodeModel,
|
||||
initialize:function(type, mindmap, id) {
|
||||
Extends:mindplot.model.INodeModel,
|
||||
initialize:function (type, mindmap, id) {
|
||||
$assert(type, 'Node type can not be null');
|
||||
$assert(mindmap, 'mindmap can not be null');
|
||||
this._properties = {};
|
||||
@ -32,61 +32,61 @@ mindplot.model.NodeModel = new Class({
|
||||
this._feature = [];
|
||||
},
|
||||
|
||||
createFeature: function(type, attributes) {
|
||||
return mindplot.TopicFeature.createModel(type, this, attributes);
|
||||
createFeature:function (type, attributes) {
|
||||
return mindplot.TopicFeature.createModel(type, attributes);
|
||||
},
|
||||
|
||||
addFeature: function(feature) {
|
||||
addFeature:function (feature) {
|
||||
$assert(feature, 'feature can not be null');
|
||||
this._feature.push(feature);
|
||||
},
|
||||
|
||||
getFeatures: function() {
|
||||
getFeatures:function () {
|
||||
return this._feature;
|
||||
},
|
||||
|
||||
removeFeature: function(feature) {
|
||||
removeFeature:function (feature) {
|
||||
$assert(feature, 'feature can not be null');
|
||||
this._feature.erase(feature);
|
||||
},
|
||||
|
||||
findFeatureByType : function(type) {
|
||||
findFeatureByType:function (type) {
|
||||
$assert(type, 'type can not be null');
|
||||
return this._feature.filter(function(feature) {
|
||||
return this._feature.filter(function (feature) {
|
||||
return feature.getType() == type;
|
||||
});
|
||||
},
|
||||
|
||||
findFeatureById : function(id) {
|
||||
findFeatureById:function (id) {
|
||||
$assert($defined(id), 'id can not be null');
|
||||
return this._feature.filter(function(feature) {
|
||||
return this._feature.filter(function (feature) {
|
||||
return feature.getId() == id;
|
||||
})[0];
|
||||
},
|
||||
|
||||
getPropertiesKeys : function() {
|
||||
getPropertiesKeys:function () {
|
||||
return Object.keys(this._properties);
|
||||
},
|
||||
|
||||
putProperty : function(key, value) {
|
||||
putProperty:function (key, value) {
|
||||
$defined(key, 'key can not be null');
|
||||
this._properties[key] = value;
|
||||
},
|
||||
|
||||
|
||||
getProperties: function() {
|
||||
getProperties:function () {
|
||||
return this._properties;
|
||||
},
|
||||
|
||||
getProperty : function(key) {
|
||||
getProperty:function (key) {
|
||||
$defined(key, 'key can not be null');
|
||||
var result = this._properties[key];
|
||||
return !$defined(result) ? null : result;
|
||||
},
|
||||
|
||||
clone : function() {
|
||||
clone:function () {
|
||||
var result = new mindplot.model.NodeModel(this.getType(), this._mindmap);
|
||||
result._children = this._children.map(function(node) {
|
||||
result._children = this._children.map(function (node) {
|
||||
var cnode = node.clone();
|
||||
cnode._parent = result;
|
||||
return cnode;
|
||||
@ -97,32 +97,52 @@ mindplot.model.NodeModel = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
appendChild : function(child) {
|
||||
/**
|
||||
* Similar to clone, assign new id to the elements ...
|
||||
* @return {mindplot.model.NodeModel}
|
||||
*/
|
||||
deepCopy:function () {
|
||||
var result = new mindplot.model.NodeModel(this.getType(), this._mindmap);
|
||||
result._children = this._children.map(function (node) {
|
||||
var cnode = node.deepCopy();
|
||||
cnode._parent = result;
|
||||
return cnode;
|
||||
});
|
||||
|
||||
var id = result.getId();
|
||||
result._properties = Object.clone(this._properties);
|
||||
result.setId(id);
|
||||
|
||||
result._feature = this._feature.clone();
|
||||
return result;
|
||||
},
|
||||
|
||||
appendChild:function (child) {
|
||||
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object');
|
||||
this._children.push(child);
|
||||
child._parent = this;
|
||||
},
|
||||
|
||||
removeChild : function(child) {
|
||||
removeChild:function (child) {
|
||||
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object.');
|
||||
this._children.erase(child);
|
||||
child._parent = null;
|
||||
},
|
||||
|
||||
getChildren : function() {
|
||||
getChildren:function () {
|
||||
return this._children;
|
||||
},
|
||||
|
||||
getParent : function() {
|
||||
getParent:function () {
|
||||
return this._parent;
|
||||
},
|
||||
|
||||
setParent : function(parent) {
|
||||
setParent:function (parent) {
|
||||
$assert(parent != this, 'The same node can not be parent and child if itself.');
|
||||
this._parent = parent;
|
||||
},
|
||||
|
||||
canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight,targetTopicSize) {
|
||||
canBeConnected:function (sourceModel, sourcePosition, targetTopicHeight, targetTopicSize) {
|
||||
$assert(sourceModel != this, 'The same node can not be parent and child if itself.');
|
||||
$assert(sourcePosition, 'childPosition can not be null.');
|
||||
$assert(targetTopicHeight, 'childrenWidth can not be null.');
|
||||
@ -169,7 +189,7 @@ mindplot.model.NodeModel = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
_isChildNode : function(node) {
|
||||
_isChildNode:function (node) {
|
||||
var result = false;
|
||||
if (node == this) {
|
||||
result = true;
|
||||
@ -186,7 +206,7 @@ mindplot.model.NodeModel = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
findNodeById : function(id) {
|
||||
findNodeById:function (id) {
|
||||
var result = null;
|
||||
if (this.getId() == id) {
|
||||
result = this;
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
mindplot.model.NoteModel = new Class({
|
||||
Extends: mindplot.model.FeatureModel,
|
||||
initialize : function(topic, attributes) {
|
||||
this.parent(mindplot.model.NoteModel.FEATURE_TYPE, topic);
|
||||
initialize : function(attributes) {
|
||||
this.parent(mindplot.model.NoteModel.FEATURE_TYPE);
|
||||
this.setText(attributes.text);
|
||||
},
|
||||
|
||||
|
@ -351,7 +351,7 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
|
||||
// Create a new element ....
|
||||
var featureType = child.tagName;
|
||||
var feature = mindplot.TopicFeature.createModel(featureType, topic, attributes);
|
||||
var feature = mindplot.TopicFeature.createModel(featureType, attributes);
|
||||
topic.addFeature(feature);
|
||||
|
||||
} else if (child.tagName == "text") {
|
||||
@ -411,7 +411,7 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
return null;
|
||||
}
|
||||
// Is the connections points valid ?. If it's not, do not load the relationship ...
|
||||
if (mindmap.findNodeById(srcId) == null || mindmap.findNodeById(destId)==null) {
|
||||
if (mindmap.findNodeById(srcId) == null || mindmap.findNodeById(destId) == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -17,20 +17,20 @@
|
||||
*/
|
||||
|
||||
mindplot.widget.IconPanel = new Class({
|
||||
Extends: mindplot.widget.ToolbarPaneItem,
|
||||
initialize : function(buttonId, model) {
|
||||
Extends:mindplot.widget.ToolbarPaneItem,
|
||||
initialize:function (buttonId, model) {
|
||||
this.parent(buttonId, model);
|
||||
},
|
||||
|
||||
_updateSelectedItem : function() {
|
||||
_updateSelectedItem:function () {
|
||||
return this.getPanelElem();
|
||||
|
||||
},
|
||||
|
||||
buildPanel: function() {
|
||||
var content = new Element('div', {'class':'toolbarPanel','id':'IconsPanel'});
|
||||
content.setStyles({width:253,height:210,padding:5});
|
||||
content.addEvent("click", function(event) {
|
||||
buildPanel:function () {
|
||||
var content = new Element('div', {'class':'toolbarPanel', 'id':'IconsPanel'});
|
||||
content.setStyles({width:253, height:210, padding:5});
|
||||
content.addEvent("click", function (event) {
|
||||
event.stopPropagation()
|
||||
});
|
||||
|
||||
@ -52,12 +52,12 @@ mindplot.widget.IconPanel = new Class({
|
||||
img.setStyles({width:16,
|
||||
height:16,
|
||||
padding:"0px 2px",
|
||||
cursor: 'pointer'
|
||||
cursor:'pointer'
|
||||
}).inject(familyContent);
|
||||
|
||||
var panel = this;
|
||||
var model = this.getModel();
|
||||
img.addEvent('click', function(event) {
|
||||
img.addEvent('click', function (event) {
|
||||
model.setValue(this.id);
|
||||
panel.hide();
|
||||
}.bind(img));
|
||||
|
@ -251,10 +251,10 @@ mindplot.widget.Menu = new Class({
|
||||
this._registerTooltip('redoEdition', $msg('REDO'), "meta+shift+Z");
|
||||
|
||||
|
||||
this._addButton('addTopic', true, false, function () {
|
||||
this._addButton('addTopics', true, false, function () {
|
||||
designer.createChildForSelectedNode();
|
||||
});
|
||||
this._registerTooltip('addTopic', $msg('ADD_TOPIC'), "Enter");
|
||||
this._registerTooltip('addTopics', $msg('ADD_TOPIC'), "Enter");
|
||||
|
||||
|
||||
this._addButton('deleteTopic', true, true, function () {
|
||||
|
@ -43,5 +43,10 @@ SUB_TOPIC=Sub Topic
|
||||
ISOLATED_TOPIC=Isolated Topic
|
||||
CENTRAL_TOPIC=Central Topic
|
||||
SHORTCUTS=Keyboard Shortcuts
|
||||
|
||||
ENTITIES_COULD_NOT_BE_DELETED=Could not delete topic or relation. At least one map entity must be selected.
|
||||
AT_LEAST_ONE_TOPIC_MUST_BE_SELECTED=At least one topic must be selected.
|
||||
CLIPBOARD_IS_EMPTY=Nothing to copy. Clipboard is empty.
|
||||
CENTRAL_TOPIC_CAN_NOT_BE_DELETED=Central topic can not be deleted.
|
||||
MULTIPLE_LINES=Add multiple text lines.
|
||||
COPY_AND_PASTE_TOPICS=Copy and Paste Topics
|
@ -44,3 +44,5 @@ ISOLATED_TOPIC=Tópico Aislado
|
||||
CENTRAL_TOPIC=Tópico Central
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE=Tópicos hijos no pueden ser colapsados. Solo un topic debe ser seleccionado.
|
||||
SHORTCUTS=Accesos directos
|
||||
MULTIPLE_LINES=Add multilines text node
|
||||
COPY_AND_PASTE_TOPICS=Copy Topics
|
||||
|
@ -43,3 +43,5 @@ SUB_TOPIC=子节点
|
||||
ISOLATED_TOPIC=独立节点
|
||||
CENTRAL_TOPIC=中心节点
|
||||
SHORTCUTS=快捷键
|
||||
MULTIPLE_LINES=Add multilines text node
|
||||
COPY_AND_PASTE_TOPICS=Copy Topics
|
||||
|
@ -43,3 +43,5 @@ SUB_TOPIC=子節點
|
||||
ISOLATED_TOPIC=獨立節點
|
||||
CENTRAL_TOPIC=中心節點
|
||||
SHORTCUTS=快捷鍵
|
||||
MULTIPLE_LINES=Add multilines text node
|
||||
COPY_AND_PASTE_TOPICS=Copy Topics
|
||||
|
@ -1,46 +1,52 @@
|
||||
<map name="3" version="pela">
|
||||
<map name="welcome" version="tango">
|
||||
<topic central="true" text="Welcome To WiseMapping" id="1" fontStyle=";;#dfcfe6;;;" bgColor="#0a0a08">
|
||||
<topic position="-326,50" order="2" text="Productivity" id="2" fontStyle=";;#104f11;;;" bgColor="#d9b518">
|
||||
<topic position="178,-130" order="0" text="Try it Now!" id="11" fontStyle=";;#ffffff;;;" bgColor="#250be3"
|
||||
brColor="#080559">
|
||||
<topic position="272,-156" order="0" text="Double Click" id="12" fontStyle=";;#001be6;;italic;"/>
|
||||
<topic position="274,-130" order="1" text=" INS to insert" id="13" fontStyle=";;#001be6;;italic;"/>
|
||||
<topic position="285,-104" order="2" text="Drag map to move" id="14" fontStyle=";;#001be6;;italic;"/>
|
||||
</topic>
|
||||
<topic position="-189,-52" order="1" text="Productivity" id="2" fontStyle=";;#104f11;;;" bgColor="#d9b518">
|
||||
<icon id="chart_bar"/>
|
||||
<topic position="-443,17" order="0" text="Share your ideas" id="3">
|
||||
<topic position="-310,-78" order="0" text="Share your ideas" id="3">
|
||||
<icon id="bulb_light_on"/>
|
||||
</topic>
|
||||
<topic position="-429,41" order="1" text="Brainstorming" id="4"/>
|
||||
<topic position="-413,65" order="2" text="Visual " id="5"/>
|
||||
<topic position="-299,-52" order="1" text="Brainstorming" id="4"/>
|
||||
<topic position="-283,-26" order="2" text="Visual " id="5"/>
|
||||
</topic>
|
||||
<topic position="257,150" order="6" text="Features" id="15">
|
||||
<topic position="350,81" order="0" text="Links to Sites" id="16" fontStyle=";6;;;;">
|
||||
<link url="www.digg.com"/>
|
||||
<topic position="185,-39" order="2" text="Mind Mapping" id="6" fontStyle=";;#602378;;;" bgColor="#edabff">
|
||||
<topic position="303,-78" order="0" text="Share with Collegues" id="7"/>
|
||||
<topic position="275,-52" order="1" text="Online" id="8"/>
|
||||
<topic position="299,-26" order="2" text="Anyplace, Anytime" id="9"/>
|
||||
<topic position="277,0" order="3" text="Free!!!" id="10"/>
|
||||
</topic>
|
||||
<topic position="-183,39" order="3" text="Web 2.0 Tool" id="22" fontStyle=";;#0c1d6b;;;" bgColor="#add1f7">
|
||||
<topic position="-281,0" order="0" text="Collaborate" id="23"/>
|
||||
<topic position="-302,26" order="1" text="No plugin required" id="24">
|
||||
<icon id="conn_disconnect"/>
|
||||
</topic>
|
||||
<topic position="328,105" order="1" text="Fonts" id="17"/>
|
||||
<topic position="339,129" order="2" text="Topic Color" id="18"/>
|
||||
<topic position="343,153" order="3" text="Topic Shapes" shape="line" id="19"/>
|
||||
<topic position="334,177" order="4" text="Icons" id="20">
|
||||
<topic position="-271,52" order="2" text="Share" id="25"/>
|
||||
<topic position="-282,78" order="3" text="Easy to use" id="26"/>
|
||||
</topic>
|
||||
<topic position="171,91" order="4" text="Features" id="15">
|
||||
<topic position="266,26" order="0" text="Links to Sites" id="16" fontStyle=";6;;;;">
|
||||
<link url="http://www.digg.com" type="url"/>
|
||||
</topic>
|
||||
<topic position="245,52" order="1" text="Fonts" id="17"/>
|
||||
<topic position="255,78" order="2" text="Topic Color" id="18"/>
|
||||
<topic position="260,104" order="3" text="Topic Shapes" shape="line" id="19"/>
|
||||
<topic position="252,130" order="4" text="Icons" id="20">
|
||||
<icon id="object_rainbow"/>
|
||||
</topic>
|
||||
<topic position="357,201" order="5" text="History Changes" id="21">
|
||||
<topic position="272,156" order="5" text="History Changes" id="21">
|
||||
<icon id="arrowc_turn_left"/>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic position="-336,-100" order="3" text="Web 2.0 Tool" id="22" fontStyle=";;#0c1d6b;;;" bgColor="#add1f7">
|
||||
<topic position="-433,-145" order="0" text="Collaborate" id="23"/>
|
||||
<topic position="-453,-121" order="1" text="No plugin required" id="24">
|
||||
<icon id="conn_disconnect"/>
|
||||
</topic>
|
||||
<topic position="-420,-97" order="2" text="Share" id="25"/>
|
||||
<topic position="-432,-73" order="3" text="Easy to use" id="26"/>
|
||||
</topic>
|
||||
<topic position="266,0" order="0" text="Try it Now!" id="11" fontStyle=";;#ffffff;;;" bgColor="#250be3"
|
||||
brColor="#080559">
|
||||
<topic position="358,-33" order="0" text="Double Click" id="12" fontStyle=";;#001be6;;italic;"/>
|
||||
<topic position="362,-9" order="1" text=" INS to insert" id="13" fontStyle=";;#001be6;;italic;"/>
|
||||
<topic position="371,15" order="2" text="Drag map to move" id="14" fontStyle=";;#001be6;;italic;"/>
|
||||
</topic>
|
||||
<topic position="299,-100" order="3" text="Mind Mapping" id="6" fontStyle=";;#602378;;;" bgColor="#edabff">
|
||||
<topic position="415,-145" order="0" text="Share with Collegues" id="7"/>
|
||||
<topic position="385,-121" order="1" text="Online" id="8"/>
|
||||
<topic position="410,-97" order="2" text="Anyplace, Anytime" id="9"/>
|
||||
<topic position="386,-73" order="3" text="Free!!!" id="10"/>
|
||||
</topic>
|
||||
</topic>
|
||||
<relationship srcTopicId="1" destTopicId="3" lineType="3" endArrow="true" startArrow="false"/>
|
||||
<relationship srcTopicId="3" destTopicId="1" lineType="3" srcCtrlPoint="-10,-37" destCtrlPoint="-212,-107"
|
||||
endArrow="true" startArrow="false"/>
|
||||
<relationship srcTopicId="6" destTopicId="14" lineType="3" endArrow="true" startArrow="false"/>
|
||||
<relationship srcTopicId="12" destTopicId="18" lineType="3" srcCtrlPoint="184,86" destCtrlPoint="166,2"
|
||||
endArrow="true" startArrow="false"/>
|
||||
</map>
|
@ -66,6 +66,17 @@
|
||||
<td><spring:message code="JUST_START_TYPING"/> | F2</td>
|
||||
<td><spring:message code="JUST_START_TYPING"/> | F2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><spring:message code="MULTIPLE_LINES"/></td>
|
||||
<td>Ctrl + Enter</td>
|
||||
<td>⌘ + Enter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><spring:message code="COPY_AND_PASTE_TOPICS"/></td>
|
||||
<td>Ctrl + c/Ctrl + v</td>
|
||||
<td>⌘ + c/⌘ + c</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><spring:message code="COLLAPSE_CHILDREN"/></td>
|
||||
<td>Space bar</td>
|
||||
|
Loading…
Reference in New Issue
Block a user