mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
Fix error connecting to the central node.
This commit is contained in:
parent
d921cecb19
commit
8da65a9102
@ -106,7 +106,7 @@
|
|||||||
<include>DragManager.js</include>
|
<include>DragManager.js</include>
|
||||||
<include>DragPivot.js</include>
|
<include>DragPivot.js</include>
|
||||||
<include>ConnectionLine.js</include>
|
<include>ConnectionLine.js</include>
|
||||||
<include>RelationshipLine.js</include>
|
<include>Relationship.js</include>
|
||||||
<include>DragConnector.js</include>
|
<include>DragConnector.js</include>
|
||||||
<include>TextEditor.js</include>
|
<include>TextEditor.js</include>
|
||||||
<include>MultilineTextEditor.js</include>
|
<include>MultilineTextEditor.js</include>
|
||||||
|
@ -31,7 +31,7 @@ mindplot.ActionDispatcher = new Class({
|
|||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteTopics: function(topicsIds, relIds) {
|
deleteEntities: function(topicsIds, relIds) {
|
||||||
throw "method must be implemented.";
|
throw "method must be implemented.";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,98 +1,106 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.CentralTopic = new Class({
|
mindplot.CentralTopic = new Class({
|
||||||
|
|
||||||
Extends:mindplot.Topic,
|
Extends:mindplot.Topic,
|
||||||
initialize: function(model, options) {
|
initialize:function (model, options) {
|
||||||
this.parent(model, options);
|
this.parent(model, options);
|
||||||
},
|
},
|
||||||
|
|
||||||
_registerEvents : function() {
|
_registerEvents:function () {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
// This disable the drag of the central topic. But solves the problem of deselecting the nodes when the screen is clicked.
|
// This disable the drag of the central topic. But solves the problem of deselecting the nodes when the screen is clicked.
|
||||||
this.addEvent('mousedown', function(event) {
|
this.addEvent('mousedown', function (event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
workoutIncomingConnectionPoint : function() {
|
workoutIncomingConnectionPoint:function () {
|
||||||
return this.getPosition();
|
return this.getPosition();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getInnerPadding : function() {
|
_getInnerPadding:function () {
|
||||||
return 11;
|
return 11;
|
||||||
},
|
},
|
||||||
|
|
||||||
getTopicType : function() {
|
getTopicType:function () {
|
||||||
return mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE;
|
return mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE;
|
||||||
},
|
},
|
||||||
|
|
||||||
setCursor : function(type) {
|
setCursor:function (type) {
|
||||||
type = (type == 'move') ? 'default' : type;
|
type = (type == 'move') ? 'default' : type;
|
||||||
this.parent(type);
|
this.parent(type);
|
||||||
},
|
},
|
||||||
|
|
||||||
isConnectedToCentralTopic : function() {
|
isConnectedToCentralTopic:function () {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_defaultShapeType : function() {
|
_defaultShapeType:function () {
|
||||||
return mindplot.model.TopicShape.ROUNDED_RECT;
|
return mindplot.model.TopicShape.ROUNDED_RECT;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
updateTopicShape : function() {
|
updateTopicShape:function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePositionOnChangeSize : function(oldSize, newSize, updatePosition) {
|
_updatePositionOnChangeSize:function () {
|
||||||
|
|
||||||
// Center main topic ...
|
// Center main topic ...
|
||||||
var zeroPoint = new core.Point(0, 0);
|
var zeroPoint = new core.Point(0, 0);
|
||||||
this.setPosition(zeroPoint);
|
this.setPosition(zeroPoint);
|
||||||
},
|
},
|
||||||
|
|
||||||
_defaultText : function() {
|
_defaultText:function () {
|
||||||
return $msg('CENTRAL_TOPIC');
|
return $msg('CENTRAL_TOPIC');
|
||||||
},
|
},
|
||||||
|
|
||||||
_defaultBackgroundColor : function() {
|
_defaultBackgroundColor:function () {
|
||||||
return "rgb(80,157,192)";
|
return "rgb(80,157,192)";
|
||||||
},
|
},
|
||||||
|
|
||||||
_defaultBorderColor : function() {
|
_defaultBorderColor:function () {
|
||||||
return "rgb(57,113,177)";
|
return "rgb(57,113,177)";
|
||||||
},
|
},
|
||||||
|
|
||||||
_defaultFontStyle : function() {
|
_defaultFontStyle:function () {
|
||||||
return {
|
return {
|
||||||
font:"Verdana",
|
font:"Verdana",
|
||||||
size: 10,
|
size:10,
|
||||||
style:"normal",
|
style:"normal",
|
||||||
weight:"bold",
|
weight:"bold",
|
||||||
color:"#ffffff"
|
color:"#ffffff"
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
getShrinkConnector : function() {
|
getShrinkConnector:function () {
|
||||||
return null;
|
return null;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
workoutOutgoingConnectionPoint:function (targetPosition) {
|
||||||
|
$assert(targetPosition, 'targetPoint can not be null');
|
||||||
|
var pos = this.getPosition();
|
||||||
|
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos);
|
||||||
|
var size = this.getSize();
|
||||||
|
return mindplot.util.Shape.calculateRectConnectionPoint(pos, size, !isAtRight);
|
||||||
|
}
|
||||||
});
|
});
|
@ -139,7 +139,7 @@ mindplot.BrixActionDispatcher = new Class({
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteTopics : function(topicsIds, relIds) {
|
deleteEntities : function(topicsIds, relIds) {
|
||||||
$assert(topicsIds, "topicsIds can not be null");
|
$assert(topicsIds, "topicsIds can not be null");
|
||||||
var framework = this._getFramework();
|
var framework = this._getFramework();
|
||||||
var mindmap = framework.getModel();
|
var mindmap = framework.getModel();
|
||||||
|
@ -248,7 +248,7 @@ mindplot.Designer = new Class({
|
|||||||
|
|
||||||
topic.addEvent('ontblur', function () {
|
topic.addEvent('ontblur', function () {
|
||||||
var topics = this.getModel().filterSelectedTopics();
|
var topics = this.getModel().filterSelectedTopics();
|
||||||
var rels = this.getModel().filterSelectedRelations();
|
var rels = this.getModel().filterSelectedRelationships();
|
||||||
|
|
||||||
if (topics.length == 0 || rels.length == 0) {
|
if (topics.length == 0 || rels.length == 0) {
|
||||||
this.fireEvent('onblur');
|
this.fireEvent('onblur');
|
||||||
@ -257,7 +257,7 @@ mindplot.Designer = new Class({
|
|||||||
|
|
||||||
topic.addEvent('ontfocus', function () {
|
topic.addEvent('ontfocus', function () {
|
||||||
var topics = this.getModel().filterSelectedTopics();
|
var topics = this.getModel().filterSelectedTopics();
|
||||||
var rels = this.getModel().filterSelectedRelations();
|
var rels = this.getModel().filterSelectedRelationships();
|
||||||
|
|
||||||
if (topics.length == 1 || rels.length == 1) {
|
if (topics.length == 1 || rels.length == 1) {
|
||||||
this.fireEvent('onfocus');
|
this.fireEvent('onfocus');
|
||||||
@ -275,7 +275,7 @@ mindplot.Designer = new Class({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
var objects = model.getObjects();
|
var objects = model.getEntities();
|
||||||
objects.forEach(function (object) {
|
objects.forEach(function (object) {
|
||||||
// Disable all nodes on focus but not the current if Ctrl key isn't being pressed
|
// Disable all nodes on focus but not the current if Ctrl key isn't being pressed
|
||||||
if (!$defined(event) || (!event.control && !event.meta)) {
|
if (!$defined(event) || (!event.control && !event.meta)) {
|
||||||
@ -289,14 +289,14 @@ mindplot.Designer = new Class({
|
|||||||
|
|
||||||
selectAll:function () {
|
selectAll:function () {
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
var objects = model.getObjects();
|
var objects = model.getEntities();
|
||||||
objects.forEach(function (object) {
|
objects.forEach(function (object) {
|
||||||
object.setOnFocus(true);
|
object.setOnFocus(true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deselectAll:function () {
|
deselectAll:function () {
|
||||||
var objects = this.getModel().getObjects();
|
var objects = this.getModel().getEntities();
|
||||||
objects.forEach(function (object) {
|
objects.forEach(function (object) {
|
||||||
object.setOnFocus(false);
|
object.setOnFocus(false);
|
||||||
});
|
});
|
||||||
@ -475,13 +475,20 @@ mindplot.Designer = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
showRelPivot:function (event) {
|
showRelPivot:function (event) {
|
||||||
|
|
||||||
|
var nodes = this.getModel().filterSelectedTopics();
|
||||||
|
if (nodes.length <= 0) {
|
||||||
|
// This could not happen ...
|
||||||
|
$notify("Could not create relationship. Parent relationship topic must be selected first.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Current mouse position ....
|
// Current mouse position ....
|
||||||
var screen = this._workspace.getScreenManager();
|
var screen = this._workspace.getScreenManager();
|
||||||
var pos = screen.getWorkspaceMousePosition(event);
|
var pos = screen.getWorkspaceMousePosition(event);
|
||||||
var selectedTopic = this.getModel().selectedTopic();
|
|
||||||
|
|
||||||
// create a connection ...
|
// create a connection ...
|
||||||
this._relPivot.start(selectedTopic, pos);
|
this._relPivot.start(nodes[0], pos);
|
||||||
},
|
},
|
||||||
|
|
||||||
connectByRelation:function (sourceTopic, targetTopic) {
|
connectByRelation:function (sourceTopic, targetTopic) {
|
||||||
@ -489,10 +496,8 @@ mindplot.Designer = new Class({
|
|||||||
$assert(targetTopic, "targetTopic can not be null");
|
$assert(targetTopic, "targetTopic can not be null");
|
||||||
|
|
||||||
// Create a new topic model ...
|
// Create a new topic model ...
|
||||||
// @Todo: Model should not be modified from here ...
|
|
||||||
var mindmap = this.getMindmap();
|
var mindmap = this.getMindmap();
|
||||||
var model = mindmap.createRelationship(sourceTopic.getModel().getId(), targetTopic.getModel().getId());
|
var model = mindmap.createRelationship(sourceTopic.getModel().getId(), targetTopic.getModel().getId());
|
||||||
|
|
||||||
this._actionDispatcher.connectByRelation(model);
|
this._actionDispatcher.connectByRelation(model);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -614,77 +619,46 @@ mindplot.Designer = new Class({
|
|||||||
return this._relationshipModelToRelationship(model);
|
return this._relationshipModelToRelationship(model);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeRelationship:function (model) {
|
_deleteRelationship:function (relationship) {
|
||||||
this._mindmap.removeRelationship(model);
|
|
||||||
var relationship = this._relationships[model.getId()];
|
|
||||||
var sourceTopic = relationship.getSourceTopic();
|
var sourceTopic = relationship.getSourceTopic();
|
||||||
sourceTopic.removeRelationship(relationship);
|
sourceTopic.deleteRelationship(relationship);
|
||||||
|
|
||||||
var targetTopic = relationship.getTargetTopic();
|
var targetTopic = relationship.getTargetTopic();
|
||||||
targetTopic.removeRelationship(relationship);
|
targetTopic.deleteRelationship(relationship);
|
||||||
|
|
||||||
this._workspace.removeChild(relationship);
|
this._workspace.removeChild(relationship);
|
||||||
delete this._relationships[model.getId()];
|
|
||||||
|
this.getModel().removeRelationship(relationship);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildRelationship:function (model) {
|
_buildRelationship:function (model) {
|
||||||
var elem = this;
|
|
||||||
|
|
||||||
var fromNodeId = model.getFromNode();
|
|
||||||
var toNodeId = model.getToNode();
|
|
||||||
|
|
||||||
var sourceTopic = null;
|
|
||||||
var targetTopic = null;
|
|
||||||
var dmodel = this.getModel();
|
var dmodel = this.getModel();
|
||||||
var topics = dmodel.getTopics();
|
|
||||||
|
|
||||||
for (var i = 0; i < topics.length; i++) {
|
var sourceTopicId = model.getFromNode();
|
||||||
var t = topics[i];
|
var sourceTopic = dmodel.findTopicById(sourceTopicId);
|
||||||
if (t.getModel().getId() == fromNodeId) {
|
|
||||||
sourceTopic = t;
|
|
||||||
}
|
|
||||||
if (t.getModel().getId() == toNodeId) {
|
|
||||||
targetTopic = t;
|
|
||||||
}
|
|
||||||
if (targetTopic != null && sourceTopic != null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create node graph ...
|
var targetTopicId = model.getToNode();
|
||||||
var relationLine = new mindplot.RelationshipLine(sourceTopic, targetTopic, model.getLineType());
|
var targetTopic = dmodel.findTopicById(targetTopicId);
|
||||||
if ($defined(model.getSrcCtrlPoint())) {
|
|
||||||
var srcPoint = model.getSrcCtrlPoint().clone();
|
|
||||||
relationLine.setSrcControlPoint(srcPoint);
|
|
||||||
}
|
|
||||||
if ($defined(model.getDestCtrlPoint())) {
|
|
||||||
var destPoint = model.getDestCtrlPoint().clone();
|
|
||||||
relationLine.setDestControlPoint(destPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Build relationship line ....
|
||||||
relationLine.getLine().setDashed(3, 2);
|
var relationship = new mindplot.Relationship(sourceTopic, targetTopic, model);
|
||||||
relationLine.setShowEndArrow(model.getEndArrow());
|
relationship.addEvent('onfocus', function (event) {
|
||||||
relationLine.setShowStartArrow(model.getStartArrow());
|
this.onObjectFocusEvent(relationship, event);
|
||||||
relationLine.setModel(model);
|
}.bind(this));
|
||||||
|
|
||||||
//Add Listeners
|
|
||||||
relationLine.addEvent('onfocus', function (event) {
|
|
||||||
elem.onObjectFocusEvent(relationLine, event);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Append it to the workspace ...
|
// Append it to the workspace ...
|
||||||
dmodel.addRelationship(model.getId(), relationLine);
|
dmodel.addRelationship(relationship);
|
||||||
|
return relationship;
|
||||||
return relationLine;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeNode:function (node) {
|
_removeTopic:function (node) {
|
||||||
if (node.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
if (node.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
var parent = node._parent;
|
var parent = node._parent;
|
||||||
node.disconnect(this._workspace);
|
node.disconnect(this._workspace);
|
||||||
|
|
||||||
//remove children
|
//remove children
|
||||||
while (node.getChildren().length > 0) {
|
while (node.getChildren().length > 0) {
|
||||||
this._removeNode(node.getChildren()[0]);
|
this._removeTopic(node.getChildren()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._workspace.removeChild(node);
|
this._workspace.removeChild(node);
|
||||||
@ -700,19 +674,30 @@ mindplot.Designer = new Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteCurrentNode:function () {
|
deleteSelectedEntities:function () {
|
||||||
|
|
||||||
|
var topics = this.getModel().filterSelectedTopics();
|
||||||
|
var relation = this.getModel().filterSelectedRelationships();
|
||||||
|
if (topics.length <= 0 && relation.length <= 0) {
|
||||||
|
// If there are more than one node selected,
|
||||||
|
$notify($msg('ENTITIES_COULD_NOT_BE_DELETED'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter the lists ...
|
||||||
var validateFunc = function (object) {
|
var validateFunc = function (object) {
|
||||||
return object.getType() == mindplot.RelationshipLine.type || object.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE
|
return object.getType() == mindplot.Relationship.type || object.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE
|
||||||
};
|
};
|
||||||
var validateError = 'Central topic can not be deleted.';
|
var validateError = $msg('CENTRAL_TOPIC_CAN_NOT_BE_DELETED');
|
||||||
|
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
var topicsIds = model.filterTopicsIds(validateFunc, validateError);
|
var topicIds = model.filterTopicsIds(validateFunc, validateError);
|
||||||
var relIds = model.filterRelationIds(validateFunc, validateError);
|
var relIds = model.filterSelectedRelationships().map(function (rel) {
|
||||||
|
return rel.getId();
|
||||||
|
});
|
||||||
|
|
||||||
if (topicsIds.length > 0 || relIds.length > 0) {
|
// Finally delete the topics ...
|
||||||
this._actionDispatcher.deleteTopics(topicsIds, relIds);
|
if (topicIds.length > 0 || relIds.length > 0) {
|
||||||
|
this._actionDispatcher.deleteEntities(topicIds, relIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -42,7 +42,7 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
var model = designer.getModel();
|
var model = designer.getModel();
|
||||||
var keyboardEvents = {
|
var keyboardEvents = {
|
||||||
'backspace':function (event) {
|
'backspace':function (event) {
|
||||||
designer.deleteCurrentNode();
|
designer.deleteSelectedEntities();
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@ -61,7 +61,7 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
}.bind(this),
|
}.bind(this),
|
||||||
|
|
||||||
'delete':function () {
|
'delete':function () {
|
||||||
designer.deleteCurrentNode();
|
designer.deleteSelectedEntities();
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
|
|
||||||
'enter':function () {
|
'enter':function () {
|
||||||
|
@ -17,31 +17,35 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.DesignerModel = new Class({
|
mindplot.DesignerModel = new Class({
|
||||||
Implements: [Events],
|
Implements:[Events],
|
||||||
initialize : function(options) {
|
initialize:function (options) {
|
||||||
this._zoom = options.zoom;
|
this._zoom = options.zoom;
|
||||||
this._topics = [];
|
this._topics = [];
|
||||||
this._relationships = {};
|
this._relationships = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
getZoom : function() {
|
getZoom:function () {
|
||||||
return this._zoom;
|
return this._zoom;
|
||||||
},
|
},
|
||||||
|
|
||||||
setZoom : function(zoom) {
|
setZoom:function (zoom) {
|
||||||
this._zoom = zoom;
|
this._zoom = zoom;
|
||||||
},
|
},
|
||||||
|
|
||||||
getTopics : function() {
|
getTopics:function () {
|
||||||
return this._topics;
|
return this._topics;
|
||||||
},
|
},
|
||||||
|
|
||||||
getCentralTopic : function() {
|
getRelationships:function () {
|
||||||
|
return this._relationships;
|
||||||
|
},
|
||||||
|
|
||||||
|
getCentralTopic:function () {
|
||||||
var topics = this.getTopics();
|
var topics = this.getTopics();
|
||||||
return topics[0];
|
return topics[0];
|
||||||
},
|
},
|
||||||
|
|
||||||
filterSelectedTopics : function() {
|
filterSelectedTopics:function () {
|
||||||
var result = [];
|
var result = [];
|
||||||
for (var i = 0; i < this._topics.length; i++) {
|
for (var i = 0; i < this._topics.length; i++) {
|
||||||
if (this._topics[i].isOnFocus()) {
|
if (this._topics[i].isOnFocus()) {
|
||||||
@ -51,43 +55,43 @@ mindplot.DesignerModel = new Class({
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
filterSelectedRelations : function() {
|
filterSelectedRelationships:function () {
|
||||||
var result = [];
|
var result = [];
|
||||||
for (var id in this._relationships) {
|
for (var i = 0; i < this._relationships.length; i++) {
|
||||||
var relationship = this._relationships[id];
|
if (this._relationships[i].isOnFocus()) {
|
||||||
if (relationship.isOnFocus()) {
|
result.push(this._relationships[i]);
|
||||||
result.push(relationship);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
getObjects : function() {
|
getEntities:function () {
|
||||||
var result = [].append(this._topics);
|
var result = [].append(this._topics);
|
||||||
for (var id in this._relationships) {
|
result.append(this._relationships);
|
||||||
result.push(this._relationships[id]);
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeTopic : function(topic) {
|
removeTopic:function (topic) {
|
||||||
$assert(topic, "topic can not be null");
|
$assert(topic, "topic can not be null");
|
||||||
this._topics.erase(topic);
|
this._topics.erase(topic);
|
||||||
},
|
},
|
||||||
|
|
||||||
addTopic : function(topic) {
|
removeRelationship:function (rel) {
|
||||||
|
$assert(rel, "rel can not be null");
|
||||||
|
this._relationships.erase(rel);
|
||||||
|
},
|
||||||
|
|
||||||
|
addTopic:function (topic) {
|
||||||
$assert(topic, "topic can not be null");
|
$assert(topic, "topic can not be null");
|
||||||
this._topics.push(topic);
|
this._topics.push(topic);
|
||||||
},
|
},
|
||||||
|
|
||||||
addRelationship : function(id, rel) {
|
addRelationship:function (rel) {
|
||||||
$assert(rel, "rel can not be null");
|
$assert(rel, "rel can not be null");
|
||||||
$assert(id, "id can not be null");
|
this._relationships.push(rel);
|
||||||
|
|
||||||
this._relationships[id] = rel;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
filterTopicsIds : function(validate, errorMsg) {
|
filterTopicsIds:function (validate, errorMsg) {
|
||||||
var result = [];
|
var result = [];
|
||||||
var topics = this.filterSelectedTopics();
|
var topics = this.filterSelectedTopics();
|
||||||
|
|
||||||
@ -109,41 +113,17 @@ mindplot.DesignerModel = new Class({
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
filterRelationIds : function(validate, errorMsg) {
|
|
||||||
var result = [];
|
|
||||||
var relationships = this.filterSelectedRelations();
|
|
||||||
|
|
||||||
var isValid = true;
|
selectedTopic:function () {
|
||||||
for (var j = 0; j < relationships.length; j++) {
|
|
||||||
var selectedLine = relationships[j];
|
|
||||||
isValid = true;
|
|
||||||
if ($defined(validate)) {
|
|
||||||
isValid = validate(selectedLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isValid) {
|
|
||||||
result.push(selectedLine.getId());
|
|
||||||
} else {
|
|
||||||
$notify(errorMsg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
|
|
||||||
getRelationshipsById : function() {
|
|
||||||
return this._relationships;
|
|
||||||
},
|
|
||||||
|
|
||||||
selectedTopic : function() {
|
|
||||||
var topics = this.filterSelectedTopics();
|
var topics = this.filterSelectedTopics();
|
||||||
return (topics.length > 0) ? topics[0] : null;
|
return (topics.length > 0) ? topics[0] : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
findTopicById: function(id) {
|
findTopicById:function (id) {
|
||||||
var result = null;
|
var result = null;
|
||||||
for (var i = 0; i < this._topics.length; i++) {
|
for (var i = 0; i < this._topics.length; i++) {
|
||||||
var topic = this._topics[i];
|
var topic = this._topics[i];
|
||||||
if(topic.getId()==id){
|
if (topic.getId() == id) {
|
||||||
result = topic;
|
result = topic;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,229 +1,231 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.Messages = new Class({
|
mindplot.Messages = new Class({
|
||||||
Static:{
|
Static:{
|
||||||
init:function (locale) {
|
init:function (locale) {
|
||||||
locale = $defined(locale) ? locale : 'en';
|
locale = $defined(locale) ? locale : 'en';
|
||||||
var bundle = mindplot.Messages.BUNDLES[locale];
|
var bundle = mindplot.Messages.BUNDLES[locale];
|
||||||
if (bundle == null && locale.indexOf("_") != -1) {
|
if (bundle == null && locale.indexOf("_") != -1) {
|
||||||
// Try to locate without the specialization ...
|
// Try to locate without the specialization ...
|
||||||
locale = locale.substring(0, locale.indexOf("_"));
|
locale = locale.substring(0, locale.indexOf("_"));
|
||||||
bundle = mindplot.Messages.BUNDLES[locale];
|
bundle = mindplot.Messages.BUNDLES[locale];
|
||||||
}
|
}
|
||||||
mindplot.Messages.__bundle = bundle;
|
mindplot.Messages.__bundle = bundle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$msg = function (key) {
|
$msg = function (key) {
|
||||||
if (!mindplot.Messages.__bundle) {
|
if (!mindplot.Messages.__bundle) {
|
||||||
mindplot.Messages.init('en');
|
mindplot.Messages.init('en');
|
||||||
}
|
}
|
||||||
return mindplot.Messages.__bundle[key];
|
return mindplot.Messages.__bundle[key];
|
||||||
};
|
};
|
||||||
|
|
||||||
mindplot.Messages.BUNDLES = {
|
mindplot.Messages.BUNDLES = {
|
||||||
'en':{
|
'en':{
|
||||||
|
|
||||||
ZOOM_IN:'Zoom In',
|
ZOOM_IN:'Zoom In',
|
||||||
ZOOM_OUT:'Zoom Out',
|
ZOOM_OUT:'Zoom Out',
|
||||||
TOPIC_SHAPE:'Topic Shape',
|
TOPIC_SHAPE:'Topic Shape',
|
||||||
TOPIC_ADD:'Add Topic',
|
TOPIC_ADD:'Add Topic',
|
||||||
TOPIC_DELETE:'Delete Topic',
|
TOPIC_DELETE:'Delete Topic',
|
||||||
TOPIC_ICON:'Add Icon',
|
TOPIC_ICON:'Add Icon',
|
||||||
TOPIC_LINK:'Add Link',
|
TOPIC_LINK:'Add Link',
|
||||||
TOPIC_RELATIONSHIP:'Relationship',
|
TOPIC_RELATIONSHIP:'Relationship',
|
||||||
TOPIC_COLOR:'Topic Color',
|
TOPIC_COLOR:'Topic Color',
|
||||||
TOPIC_BORDER_COLOR:'Topic Border Color',
|
TOPIC_BORDER_COLOR:'Topic Border Color',
|
||||||
TOPIC_NOTE:'Add Note',
|
TOPIC_NOTE:'Add Note',
|
||||||
FONT_FAMILY:'Font Type',
|
FONT_FAMILY:'Font Type',
|
||||||
FONT_SIZE:'Text Size',
|
FONT_SIZE:'Text Size',
|
||||||
FONT_BOLD:'Text Bold',
|
FONT_BOLD:'Text Bold',
|
||||||
FONT_ITALIC:'Text Italic',
|
FONT_ITALIC:'Text Italic',
|
||||||
UNDO_EDITION:'Undo Edition',
|
UNDO_EDITION:'Undo Edition',
|
||||||
REDO_EDITION:'Redo Edition',
|
REDO_EDITION:'Redo Edition',
|
||||||
UNDO:'Undo',
|
UNDO:'Undo',
|
||||||
REDO:'Redo',
|
REDO:'Redo',
|
||||||
INSERT:'Insert',
|
INSERT:'Insert',
|
||||||
SAVE:'Save',
|
SAVE:'Save',
|
||||||
NOTE:'Note',
|
NOTE:'Note',
|
||||||
ADD_TOPIC:'Add Topic',
|
ADD_TOPIC:'Add Topic',
|
||||||
LOADING:'Loading ...',
|
LOADING:'Loading ...',
|
||||||
EXPORT:'Export',
|
EXPORT:'Export',
|
||||||
PRINT:'Print',
|
PRINT:'Print',
|
||||||
PUBLISH:'Publish',
|
PUBLISH:'Publish',
|
||||||
COLLABORATE:'Share',
|
COLLABORATE:'Share',
|
||||||
HISTORY:'History',
|
HISTORY:'History',
|
||||||
DISCARD_CHANGES:'Discard Changes',
|
DISCARD_CHANGES:'Discard Changes',
|
||||||
FONT_COLOR:'Text Color',
|
FONT_COLOR:'Text Color',
|
||||||
SAVING:'Saving ...',
|
SAVING:'Saving ...',
|
||||||
SAVE_COMPLETE:'Save Complete',
|
SAVE_COMPLETE:'Save Complete',
|
||||||
ZOOM_IN_ERROR:'Zoom too high.',
|
ZOOM_IN_ERROR:'Zoom too high.',
|
||||||
ZOOM_ERROR:'No more zoom can be applied.',
|
ZOOM_ERROR:'No more zoom can be applied.',
|
||||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'Could not create a topic. Only one topic must be selected.',
|
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'Could not create a topic. Only one topic must be selected.',
|
||||||
ONE_TOPIC_MUST_BE_SELECTED:'Could not create a topic. One topic must be selected.',
|
ONE_TOPIC_MUST_BE_SELECTED:'Could not create a topic. One topic must be selected.',
|
||||||
SAVE_COULD_NOT_BE_COMPLETED:'Save could not be completed. Try latter.',
|
SAVE_COULD_NOT_BE_COMPLETED:'Save could not be completed. Try latter.',
|
||||||
UNEXPECTED_ERROR_LOADING:"We're sorry, an unexpected error has occurred. Try again reloading the editor.\nIf the problem persists, contact us to support@wisemapping.com.",
|
UNEXPECTED_ERROR_LOADING:"We're sorry, an unexpected error has occurred. Try again reloading the editor.\nIf the problem persists, contact us to support@wisemapping.com.",
|
||||||
MAIN_TOPIC:'Main Topic',
|
MAIN_TOPIC:'Main Topic',
|
||||||
SUB_TOPIC:'Sub Topic',
|
SUB_TOPIC:'Sub Topic',
|
||||||
ISOLATED_TOPIC:'Isolated Topic',
|
ISOLATED_TOPIC:'Isolated Topic',
|
||||||
CENTRAL_TOPIC:'Central Topic',
|
CENTRAL_TOPIC:'Central Topic',
|
||||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'Children can not be collapsed. One topic must be selected.',
|
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'Children can not be collapsed. One topic must be selected.',
|
||||||
SHORTCUTS:'Keyboard Shortcuts'
|
SHORTCUTS:'Keyboard Shortcuts',
|
||||||
},
|
ENTITIES_COULD_NOT_BE_DELETED: 'Could not delete topic or relation. At least one map entity must be selected.',
|
||||||
'es':{
|
CENTRAL_TOPIC_CAN_NOT_BE_DELETED: 'Central topic can not be deleted.'
|
||||||
DISCARD_CHANGES:'Descartar Cambios',
|
},
|
||||||
SAVE:'Guardar',
|
'es':{
|
||||||
INSERT:'Insertar',
|
DISCARD_CHANGES:'Descartar Cambios',
|
||||||
ZOOM_IN:'Acercar',
|
SAVE:'Guardar',
|
||||||
ZOOM_OUT:'Alejar',
|
INSERT:'Insertar',
|
||||||
TOPIC_BORDER_COLOR:'Color del Borde',
|
ZOOM_IN:'Acercar',
|
||||||
TOPIC_SHAPE:'Forma del Tópico',
|
ZOOM_OUT:'Alejar',
|
||||||
TOPIC_ADD:'Agregar Tópico',
|
TOPIC_BORDER_COLOR:'Color del Borde',
|
||||||
TOPIC_DELETE:'Borrar Tópico',
|
TOPIC_SHAPE:'Forma del Tópico',
|
||||||
TOPIC_ICON:'Agregar Icono',
|
TOPIC_ADD:'Agregar Tópico',
|
||||||
TOPIC_LINK:'Agregar Enlace',
|
TOPIC_DELETE:'Borrar Tópico',
|
||||||
TOPIC_NOTE:'Agregar Nota',
|
TOPIC_ICON:'Agregar Icono',
|
||||||
TOPIC_COLOR:'Color Tópico',
|
TOPIC_LINK:'Agregar Enlace',
|
||||||
TOPIC_RELATIONSHIP:'Relación',
|
TOPIC_NOTE:'Agregar Nota',
|
||||||
FONT_FAMILY:'Tipo de Fuente',
|
TOPIC_COLOR:'Color Tópico',
|
||||||
FONT_SIZE:'Tamaño de Texto',
|
TOPIC_RELATIONSHIP:'Relación',
|
||||||
FONT_BOLD:'Negrita',
|
FONT_FAMILY:'Tipo de Fuente',
|
||||||
FONT_ITALIC:'Italica',
|
FONT_SIZE:'Tamaño de Texto',
|
||||||
FONT_COLOR:'Color de Texto',
|
FONT_BOLD:'Negrita',
|
||||||
UNDO_EDITION:'Undo Edition',
|
FONT_ITALIC:'Italica',
|
||||||
REDO_EDITION:'Redo Edition',
|
FONT_COLOR:'Color de Texto',
|
||||||
UNDO:'Rehacer',
|
UNDO_EDITION:'Undo Edition',
|
||||||
NOTE:'Nota',
|
REDO_EDITION:'Redo Edition',
|
||||||
LOADING:'Cargando ...',
|
UNDO:'Rehacer',
|
||||||
PRINT:'Imprimir',
|
NOTE:'Nota',
|
||||||
PUBLISH:'Publicar',
|
LOADING:'Cargando ...',
|
||||||
REDO:'Deshacer',
|
PRINT:'Imprimir',
|
||||||
ADD_TOPIC:'Agregar Tópico',
|
PUBLISH:'Publicar',
|
||||||
COLLABORATE:'Compartir',
|
REDO:'Deshacer',
|
||||||
EXPORT:'Exportar',
|
ADD_TOPIC:'Agregar Tópico',
|
||||||
HISTORY:'History',
|
COLLABORATE:'Compartir',
|
||||||
SAVE_COMPLETE:'Grabado Completo',
|
EXPORT:'Exportar',
|
||||||
SAVING:'Grabando ...',
|
HISTORY:'History',
|
||||||
ONE_TOPIC_MUST_BE_SELECTED:'No ha sido posible crear un nuevo tópico. Al menos un tópico debe ser seleccionado.',
|
SAVE_COMPLETE:'Grabado Completo',
|
||||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'No ha sido posible crear un nuevo tópico. Solo un tópico debe ser seleccionado.',
|
SAVING:'Grabando ...',
|
||||||
SAVE_COULD_NOT_BE_COMPLETED:'Grabación no pudo ser completada. Intentelo mas tarde.',
|
ONE_TOPIC_MUST_BE_SELECTED:'No ha sido posible crear un nuevo tópico. Al menos un tópico debe ser seleccionado.',
|
||||||
UNEXPECTED_ERROR_LOADING:"Lo sentimos, un error inesperado ha ocurrido. Intentelo nuevamente recargando el editor.\n Si el problema persiste, contactenos a support@wisemapping.com.",
|
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'No ha sido posible crear un nuevo tópico. Solo un tópico debe ser seleccionado.',
|
||||||
ZOOM_ERROR:'No es posible aplicar mas zoom.',
|
SAVE_COULD_NOT_BE_COMPLETED:'Grabación no pudo ser completada. Intentelo mas tarde.',
|
||||||
ZOOM_IN_ERROR:'El zoom es muy alto.',
|
UNEXPECTED_ERROR_LOADING:"Lo sentimos, un error inesperado ha ocurrido. Intentelo nuevamente recargando el editor.\n Si el problema persiste, contactenos a support@wisemapping.com.",
|
||||||
MAIN_TOPIC:'Tópico Principal',
|
ZOOM_ERROR:'No es posible aplicar mas zoom.',
|
||||||
SUB_TOPIC:'Tópico Secundario',
|
ZOOM_IN_ERROR:'El zoom es muy alto.',
|
||||||
ISOLATED_TOPIC:'Tópico Aislado',
|
MAIN_TOPIC:'Tópico Principal',
|
||||||
CENTRAL_TOPIC:'Tópico Central',
|
SUB_TOPIC:'Tópico Secundario',
|
||||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'Tópicos hijos no pueden ser colapsados. Solo un topic debe ser seleccionado.',
|
ISOLATED_TOPIC:'Tópico Aislado',
|
||||||
SHORTCUTS:'Accesos directos'
|
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.',
|
||||||
zh_cn:{
|
SHORTCUTS:'Accesos directos'
|
||||||
ZOOM_IN:'放大',
|
},
|
||||||
ZOOM_OUT:'缩小',
|
zh_cn:{
|
||||||
TOPIC_SHAPE:'节点外形',
|
ZOOM_IN:'放大',
|
||||||
TOPIC_ADD:'添加节点',
|
ZOOM_OUT:'缩小',
|
||||||
TOPIC_DELETE:'删除节点',
|
TOPIC_SHAPE:'节点外形',
|
||||||
TOPIC_ICON:'加入图标',
|
TOPIC_ADD:'添加节点',
|
||||||
TOPIC_LINK:'添加链接',
|
TOPIC_DELETE:'删除节点',
|
||||||
TOPIC_RELATIONSHIP:'关系',
|
TOPIC_ICON:'加入图标',
|
||||||
TOPIC_COLOR:'节点颜色',
|
TOPIC_LINK:'添加链接',
|
||||||
TOPIC_BORDER_COLOR:'边框颜色',
|
TOPIC_RELATIONSHIP:'关系',
|
||||||
TOPIC_NOTE:'添加注释',
|
TOPIC_COLOR:'节点颜色',
|
||||||
FONT_FAMILY:'字体',
|
TOPIC_BORDER_COLOR:'边框颜色',
|
||||||
FONT_SIZE:'文字大小',
|
TOPIC_NOTE:'添加注释',
|
||||||
FONT_BOLD:'粗体',
|
FONT_FAMILY:'字体',
|
||||||
FONT_ITALIC:'斜体',
|
FONT_SIZE:'文字大小',
|
||||||
UNDO:'撤销',
|
FONT_BOLD:'粗体',
|
||||||
REDO:'重做',
|
FONT_ITALIC:'斜体',
|
||||||
INSERT:'插入',
|
UNDO:'撤销',
|
||||||
SAVE:'保存',
|
REDO:'重做',
|
||||||
NOTE:'注释',
|
INSERT:'插入',
|
||||||
ADD_TOPIC:'添加节点',
|
SAVE:'保存',
|
||||||
LOADING:'载入中……',
|
NOTE:'注释',
|
||||||
EXPORT:'导出',
|
ADD_TOPIC:'添加节点',
|
||||||
PRINT:'打印',
|
LOADING:'载入中……',
|
||||||
PUBLISH:'公开',
|
EXPORT:'导出',
|
||||||
COLLABORATE:'共享',
|
PRINT:'打印',
|
||||||
HISTORY:'历史',
|
PUBLISH:'公开',
|
||||||
DISCARD_CHANGES:'清除改变',
|
COLLABORATE:'共享',
|
||||||
FONT_COLOR:'文本颜色',
|
HISTORY:'历史',
|
||||||
SAVING:'保存中……',
|
DISCARD_CHANGES:'清除改变',
|
||||||
SAVE_COMPLETE:'完成保存',
|
FONT_COLOR:'文本颜色',
|
||||||
ZOOM_IN_ERROR:'缩放过多。',
|
SAVING:'保存中……',
|
||||||
ZOOM_ERROR:'不能再缩放。',
|
SAVE_COMPLETE:'完成保存',
|
||||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'不能创建节点。仅能选择一个节点。',
|
ZOOM_IN_ERROR:'缩放过多。',
|
||||||
ONE_TOPIC_MUST_BE_SELECTED:'不能创建节点。必须选择一个节点。',
|
ZOOM_ERROR:'不能再缩放。',
|
||||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'子节点不能折叠。必须选择一个节点。',
|
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'不能创建节点。仅能选择一个节点。',
|
||||||
SAVE_COULD_NOT_BE_COMPLETED:'保存未完成。稍后再试。',
|
ONE_TOPIC_MUST_BE_SELECTED:'不能创建节点。必须选择一个节点。',
|
||||||
UNEXPECTED_ERROR_LOADING:'抱歉,突遭错误,我们无法处理你的请求。\n尝试重新装载编辑器。如果问题依然存在请联系support@wisemapping.com。',
|
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'子节点不能折叠。必须选择一个节点。',
|
||||||
MAIN_TOPIC:'主节点',
|
SAVE_COULD_NOT_BE_COMPLETED:'保存未完成。稍后再试。',
|
||||||
SUB_TOPIC:'子节点',
|
UNEXPECTED_ERROR_LOADING:'抱歉,突遭错误,我们无法处理你的请求。\n尝试重新装载编辑器。如果问题依然存在请联系support@wisemapping.com。',
|
||||||
ISOLATED_TOPIC:'独立节点',
|
MAIN_TOPIC:'主节点',
|
||||||
CENTRAL_TOPIC:'中心节点',
|
SUB_TOPIC:'子节点',
|
||||||
SHORTCUTS:'快捷键'
|
ISOLATED_TOPIC:'独立节点',
|
||||||
},
|
CENTRAL_TOPIC:'中心节点',
|
||||||
zh_tw:{
|
SHORTCUTS:'快捷键'
|
||||||
ZOOM_IN:'放大',
|
},
|
||||||
ZOOM_OUT:'縮小',
|
zh_tw:{
|
||||||
TOPIC_SHAPE:'節點外形',
|
ZOOM_IN:'放大',
|
||||||
TOPIC_ADD:'添加節點',
|
ZOOM_OUT:'縮小',
|
||||||
TOPIC_DELETE:'刪除節點',
|
TOPIC_SHAPE:'節點外形',
|
||||||
TOPIC_ICON:'加入圖示',
|
TOPIC_ADD:'添加節點',
|
||||||
TOPIC_LINK:'添加鏈接',
|
TOPIC_DELETE:'刪除節點',
|
||||||
TOPIC_RELATIONSHIP:'關係',
|
TOPIC_ICON:'加入圖示',
|
||||||
TOPIC_COLOR:'節點顏色',
|
TOPIC_LINK:'添加鏈接',
|
||||||
TOPIC_BORDER_COLOR:'邊框顏色',
|
TOPIC_RELATIONSHIP:'關係',
|
||||||
TOPIC_NOTE:'添加注釋',
|
TOPIC_COLOR:'節點顏色',
|
||||||
FONT_FAMILY:'字體',
|
TOPIC_BORDER_COLOR:'邊框顏色',
|
||||||
FONT_SIZE:'文字大小',
|
TOPIC_NOTE:'添加注釋',
|
||||||
FONT_BOLD:'粗體',
|
FONT_FAMILY:'字體',
|
||||||
FONT_ITALIC:'斜體',
|
FONT_SIZE:'文字大小',
|
||||||
UNDO:'撤銷',
|
FONT_BOLD:'粗體',
|
||||||
REDO:'重做',
|
FONT_ITALIC:'斜體',
|
||||||
INSERT:'插入',
|
UNDO:'撤銷',
|
||||||
SAVE:'保存',
|
REDO:'重做',
|
||||||
NOTE:'注釋',
|
INSERT:'插入',
|
||||||
ADD_TOPIC:'添加節點',
|
SAVE:'保存',
|
||||||
LOADING:'載入中……',
|
NOTE:'注釋',
|
||||||
EXPORT:'導出',
|
ADD_TOPIC:'添加節點',
|
||||||
PRINT:'列印',
|
LOADING:'載入中……',
|
||||||
PUBLISH:'公開',
|
EXPORT:'導出',
|
||||||
COLLABORATE:'共用',
|
PRINT:'列印',
|
||||||
HISTORY:'歷史',
|
PUBLISH:'公開',
|
||||||
DISCARD_CHANGES:'清除改變',
|
COLLABORATE:'共用',
|
||||||
FONT_COLOR:'文本顏色',
|
HISTORY:'歷史',
|
||||||
SAVING:'保存中……',
|
DISCARD_CHANGES:'清除改變',
|
||||||
SAVE_COMPLETE:'完成保存',
|
FONT_COLOR:'文本顏色',
|
||||||
ZOOM_IN_ERROR:'縮放過多。',
|
SAVING:'保存中……',
|
||||||
ZOOM_ERROR:'不能再縮放。',
|
SAVE_COMPLETE:'完成保存',
|
||||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'不能創建節點。僅能選擇一個節點。',
|
ZOOM_IN_ERROR:'縮放過多。',
|
||||||
ONE_TOPIC_MUST_BE_SELECTED:'不能創建節點。必須選擇一個節點。',
|
ZOOM_ERROR:'不能再縮放。',
|
||||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'子節點不能折疊。必須選擇一個節點。',
|
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'不能創建節點。僅能選擇一個節點。',
|
||||||
SAVE_COULD_NOT_BE_COMPLETED:'保存未完成。稍後再試。',
|
ONE_TOPIC_MUST_BE_SELECTED:'不能創建節點。必須選擇一個節點。',
|
||||||
UNEXPECTED_ERROR_LOADING:'抱歉,突遭錯誤,我們無法處理你的請求。\n嘗試重新裝載編輯器。如果問題依然存在請聯繫support@wisemapping.com。',
|
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'子節點不能折疊。必須選擇一個節點。',
|
||||||
MAIN_TOPIC:'主節點',
|
SAVE_COULD_NOT_BE_COMPLETED:'保存未完成。稍後再試。',
|
||||||
SUB_TOPIC:'子節點',
|
UNEXPECTED_ERROR_LOADING:'抱歉,突遭錯誤,我們無法處理你的請求。\n嘗試重新裝載編輯器。如果問題依然存在請聯繫support@wisemapping.com。',
|
||||||
ISOLATED_TOPIC:'獨立節點',
|
MAIN_TOPIC:'主節點',
|
||||||
CENTRAL_TOPIC:'中心節點',
|
SUB_TOPIC:'子節點',
|
||||||
SHORTCUTS:'快捷鍵'
|
ISOLATED_TOPIC:'獨立節點',
|
||||||
}
|
CENTRAL_TOPIC:'中心節點',
|
||||||
};
|
SHORTCUTS:'快捷鍵'
|
||||||
mindplot.Messages.BUNDLES['zh'] = mindplot.Messages.zh_tw;
|
}
|
||||||
|
};
|
||||||
|
mindplot.Messages.BUNDLES['zh'] = mindplot.Messages.zh_tw;
|
||||||
|
|
||||||
|
@ -1,168 +1,168 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.NodeGraph = new Class({
|
mindplot.NodeGraph = new Class({
|
||||||
initialize:function(nodeModel, options) {
|
initialize:function(nodeModel, options) {
|
||||||
$assert(nodeModel, "model can not be null");
|
$assert(nodeModel, "model can not be null");
|
||||||
|
|
||||||
this._options = options;
|
this._options = options;
|
||||||
this._mouseEvents = true;
|
this._mouseEvents = true;
|
||||||
this.setModel(nodeModel);
|
this.setModel(nodeModel);
|
||||||
this._onFocus = false;
|
this._onFocus = false;
|
||||||
this._event = new Events();
|
this._event = new Events();
|
||||||
this._size = {width:50,height:20};
|
this._size = {width:50,height:20};
|
||||||
},
|
},
|
||||||
|
|
||||||
isReadOnly : function(){
|
isReadOnly : function(){
|
||||||
return this._options.readOnly;
|
return this._options.readOnly;
|
||||||
},
|
},
|
||||||
|
|
||||||
getType : function() {
|
getType : function() {
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
return model.getType();
|
return model.getType();
|
||||||
},
|
},
|
||||||
|
|
||||||
setId : function(id) {
|
setId : function(id) {
|
||||||
this.getModel().setId(id);
|
this.getModel().setId(id);
|
||||||
},
|
},
|
||||||
|
|
||||||
_set2DElement : function(elem2d) {
|
_set2DElement : function(elem2d) {
|
||||||
this._elem2d = elem2d;
|
this._elem2d = elem2d;
|
||||||
},
|
},
|
||||||
|
|
||||||
get2DElement : function() {
|
get2DElement : function() {
|
||||||
$assert(this._elem2d, 'NodeGraph has not been initialized properly');
|
$assert(this._elem2d, 'NodeGraph has not been initialized properly');
|
||||||
return this._elem2d;
|
return this._elem2d;
|
||||||
},
|
},
|
||||||
|
|
||||||
setPosition : function(point, fireEvent) {
|
setPosition : function(point, fireEvent) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
addEvent : function(type, listener) {
|
addEvent : function(type, listener) {
|
||||||
var elem = this.get2DElement();
|
var elem = this.get2DElement();
|
||||||
elem.addEvent(type, listener);
|
elem.addEvent(type, listener);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeEvent : function(type, listener) {
|
removeEvent : function(type, listener) {
|
||||||
var elem = this.get2DElement();
|
var elem = this.get2DElement();
|
||||||
elem.removeEvent(type, listener);
|
elem.removeEvent(type, listener);
|
||||||
},
|
},
|
||||||
|
|
||||||
fireEvent: function(type, event) {
|
fireEvent: function(type, event) {
|
||||||
var elem = this.get2DElement();
|
var elem = this.get2DElement();
|
||||||
elem.fireEvent(type, event);
|
elem.fireEvent(type, event);
|
||||||
},
|
},
|
||||||
|
|
||||||
setMouseEventsEnabled : function(isEnabled) {
|
setMouseEventsEnabled : function(isEnabled) {
|
||||||
this._mouseEvents = isEnabled;
|
this._mouseEvents = isEnabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
isMouseEventsEnabled : function() {
|
isMouseEventsEnabled : function() {
|
||||||
return this._mouseEvents;
|
return this._mouseEvents;
|
||||||
},
|
},
|
||||||
|
|
||||||
getSize : function() {
|
getSize : function() {
|
||||||
return this._size;
|
return this._size;
|
||||||
},
|
},
|
||||||
|
|
||||||
setSize : function(size) {
|
setSize : function(size) {
|
||||||
this._size.width = parseInt(size.width);
|
this._size.width = parseInt(size.width);
|
||||||
this._size.height = parseInt(size.height);
|
this._size.height = parseInt(size.height);
|
||||||
},
|
},
|
||||||
|
|
||||||
getModel:function() {
|
getModel:function() {
|
||||||
$assert(this._model, 'Model has not been initialized yet');
|
$assert(this._model, 'Model has not been initialized yet');
|
||||||
return this._model;
|
return this._model;
|
||||||
},
|
},
|
||||||
|
|
||||||
setModel : function(model) {
|
setModel : function(model) {
|
||||||
$assert(model, 'Model can not be null');
|
$assert(model, 'Model can not be null');
|
||||||
this._model = model;
|
this._model = model;
|
||||||
},
|
},
|
||||||
|
|
||||||
getId : function() {
|
getId : function() {
|
||||||
return this._model.getId();
|
return this._model.getId();
|
||||||
},
|
},
|
||||||
|
|
||||||
setOnFocus : function(focus) {
|
setOnFocus : function(focus) {
|
||||||
if (this._onFocus != focus) {
|
if (this._onFocus != focus) {
|
||||||
|
|
||||||
this._onFocus = focus;
|
this._onFocus = focus;
|
||||||
var outerShape = this.getOuterShape();
|
var outerShape = this.getOuterShape();
|
||||||
if (focus) {
|
if (focus) {
|
||||||
outerShape.setFill(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES_FOCUS.fillColor);
|
outerShape.setFill(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES_FOCUS.fillColor);
|
||||||
outerShape.setOpacity(1);
|
outerShape.setOpacity(1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
outerShape.setFill(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES.fillColor);
|
outerShape.setFill(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES.fillColor);
|
||||||
outerShape.setOpacity(0);
|
outerShape.setOpacity(0);
|
||||||
}
|
}
|
||||||
this.setCursor('move');
|
this.setCursor('move');
|
||||||
|
|
||||||
// In any case, always try to hide the editor ...
|
// In any case, always try to hide the editor ...
|
||||||
this.closeEditors();
|
this.closeEditors();
|
||||||
|
|
||||||
// Fire event ...
|
// Fire event ...
|
||||||
this.fireEvent(focus ? 'ontfocus' : 'ontblur');
|
this.fireEvent(focus ? 'ontfocus' : 'ontblur',this);
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
isOnFocus : function() {
|
isOnFocus : function() {
|
||||||
return this._onFocus;
|
return this._onFocus;
|
||||||
},
|
},
|
||||||
|
|
||||||
dispose : function(workspace) {
|
dispose : function(workspace) {
|
||||||
this.setOnFocus(false);
|
this.setOnFocus(false);
|
||||||
workspace.removeChild(this);
|
workspace.removeChild(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
createDragNode : function(layoutManager) {
|
createDragNode : function(layoutManager) {
|
||||||
var dragShape = this._buildDragShape();
|
var dragShape = this._buildDragShape();
|
||||||
return new mindplot.DragTopic(dragShape, this, layoutManager);
|
return new mindplot.DragTopic(dragShape, this, layoutManager);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildDragShape : function() {
|
_buildDragShape : function() {
|
||||||
$assert(false, '_buildDragShape must be implemented by all nodes.');
|
$assert(false, '_buildDragShape must be implemented by all nodes.');
|
||||||
},
|
},
|
||||||
|
|
||||||
getPosition : function() {
|
getPosition : function() {
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
return model.getPosition();
|
return model.getPosition();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mindplot.NodeGraph.create = function(nodeModel, options) {
|
mindplot.NodeGraph.create = function(nodeModel, options) {
|
||||||
$assert(nodeModel, 'Model can not be null');
|
$assert(nodeModel, 'Model can not be null');
|
||||||
|
|
||||||
var type = nodeModel.getType();
|
var type = nodeModel.getType();
|
||||||
$assert(type, 'Node model type can not be null');
|
$assert(type, 'Node model type can not be null');
|
||||||
|
|
||||||
var result;
|
var result;
|
||||||
if (type == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
if (type == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
result = new mindplot.CentralTopic(nodeModel, options);
|
result = new mindplot.CentralTopic(nodeModel, options);
|
||||||
} else
|
} else
|
||||||
if (type == mindplot.model.INodeModel.MAIN_TOPIC_TYPE) {
|
if (type == mindplot.model.INodeModel.MAIN_TOPIC_TYPE) {
|
||||||
result = new mindplot.MainTopic(nodeModel, options);
|
result = new mindplot.MainTopic(nodeModel, options);
|
||||||
} else {
|
} else {
|
||||||
$assert(false, "unsupported node type:" + type);
|
$assert(false, "unsupported node type:" + type);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
@ -15,15 +15,25 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.RelationshipLine = new Class({
|
mindplot.Relationship = new Class({
|
||||||
Extends: mindplot.ConnectionLine,
|
Extends:mindplot.ConnectionLine,
|
||||||
initialize:function(sourceNode, targetNode, lineType) {
|
initialize:function (sourceNode, targetNode, model) {
|
||||||
this.parent(sourceNode, targetNode, lineType);
|
$assert(sourceNode,"sourceNode can not be null");
|
||||||
|
$assert(targetNode,"targetNode can not be null");
|
||||||
|
|
||||||
|
this.parent(sourceNode, targetNode, model.getLineType());
|
||||||
|
this.setModel(model);
|
||||||
|
|
||||||
|
var strokeColor = mindplot.Relationship.getStrokeColor();
|
||||||
|
|
||||||
this._line2d.setIsSrcControlPointCustom(false);
|
this._line2d.setIsSrcControlPointCustom(false);
|
||||||
this._line2d.setIsDestControlPointCustom(false);
|
this._line2d.setIsDestControlPointCustom(false);
|
||||||
|
this._line2d.setCursor('pointer');
|
||||||
|
this._line2d.setStroke(1, 'solid', strokeColor);
|
||||||
|
this._line2d.setDashed(4, 2);
|
||||||
this._focusShape = this._createLine(this.getLineType(), mindplot.ConnectionLine.SIMPLE_CURVED);
|
this._focusShape = this._createLine(this.getLineType(), mindplot.ConnectionLine.SIMPLE_CURVED);
|
||||||
this._focusShape.setStroke(2, "solid", "#3f96ff");
|
this._focusShape.setStroke(2, "solid", "#3f96ff");
|
||||||
|
|
||||||
var ctrlPoints = this._line2d.getControlPoints();
|
var ctrlPoints = this._line2d.getControlPoints();
|
||||||
this._focusShape.setSrcControlPoint(ctrlPoints[0]);
|
this._focusShape.setSrcControlPoint(ctrlPoints[0]);
|
||||||
this._focusShape.setDestControlPoint(ctrlPoints[1]);
|
this._focusShape.setDestControlPoint(ctrlPoints[1]);
|
||||||
@ -32,23 +42,35 @@ mindplot.RelationshipLine = new Class({
|
|||||||
this._isInWorkspace = false;
|
this._isInWorkspace = false;
|
||||||
this._controlPointsController = new mindplot.ControlPoint();
|
this._controlPointsController = new mindplot.ControlPoint();
|
||||||
|
|
||||||
var strokeColor = mindplot.RelationshipLine.getStrokeColor();
|
|
||||||
this._startArrow = new web2d.Arrow();
|
this._startArrow = new web2d.Arrow();
|
||||||
this._endArrow = new web2d.Arrow();
|
|
||||||
this._startArrow.setStrokeColor(strokeColor);
|
this._startArrow.setStrokeColor(strokeColor);
|
||||||
this._startArrow.setStrokeWidth(2);
|
this._startArrow.setStrokeWidth(2);
|
||||||
this._endArrow.setStrokeColor(strokeColor);
|
this.setShowStartArrow(true);
|
||||||
this._endArrow.setStrokeWidth(2);
|
|
||||||
this._line2d.setStroke(1, 'solid', strokeColor);
|
|
||||||
|
|
||||||
|
// Share style is disable ...
|
||||||
|
if (this._showEndArrow) {
|
||||||
|
this._endArrow = new web2d.Arrow();
|
||||||
|
this._endArrow.setStrokeColor(strokeColor);
|
||||||
|
this._endArrow.setStrokeWidth(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Position the line ...
|
||||||
|
if ($defined(model.getSrcCtrlPoint())) {
|
||||||
|
var srcPoint = model.getSrcCtrlPoint().clone();
|
||||||
|
this.setSrcControlPoint(srcPoint);
|
||||||
|
}
|
||||||
|
if ($defined(model.getDestCtrlPoint())) {
|
||||||
|
var destPoint = model.getDestCtrlPoint().clone();
|
||||||
|
this.setDestControlPoint(destPoint);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setStroke : function(color, style, opacity) {
|
setStroke:function (color, style, opacity) {
|
||||||
this.parent(color, style, opacity);
|
this.parent(color, style, opacity);
|
||||||
this._startArrow.setStrokeColor(color);
|
this._startArrow.setStrokeColor(color);
|
||||||
},
|
},
|
||||||
|
|
||||||
redraw : function() {
|
redraw:function () {
|
||||||
var line2d = this._line2d;
|
var line2d = this._line2d;
|
||||||
var sourceTopic = this._sourceTopic;
|
var sourceTopic = this._sourceTopic;
|
||||||
var sourcePosition = sourceTopic.getPosition();
|
var sourcePosition = sourceTopic.getPosition();
|
||||||
@ -56,7 +78,7 @@ mindplot.RelationshipLine = new Class({
|
|||||||
var targetTopic = this._targetTopic;
|
var targetTopic = this._targetTopic;
|
||||||
var targetPosition = targetTopic.getPosition();
|
var targetPosition = targetTopic.getPosition();
|
||||||
|
|
||||||
var sPos,tPos;
|
var sPos, tPos;
|
||||||
this._line2d.setStroke(2);
|
this._line2d.setStroke(2);
|
||||||
var ctrlPoints = this._line2d.getControlPoints();
|
var ctrlPoints = this._line2d.getControlPoints();
|
||||||
if (!this._line2d.isDestControlPointCustom() && !this._line2d.isSrcControlPointCustom()) {
|
if (!this._line2d.isDestControlPointCustom() && !this._line2d.isSrcControlPointCustom()) {
|
||||||
@ -82,7 +104,7 @@ mindplot.RelationshipLine = new Class({
|
|||||||
line2d.moveToFront();
|
line2d.moveToFront();
|
||||||
|
|
||||||
//Positionate Arrows
|
//Positionate Arrows
|
||||||
this._positionateArrows();
|
this._positionArrows();
|
||||||
|
|
||||||
// Add connector ...
|
// Add connector ...
|
||||||
this._positionateConnector(targetTopic);
|
this._positionateConnector(targetTopic);
|
||||||
@ -94,62 +116,74 @@ mindplot.RelationshipLine = new Class({
|
|||||||
this._controlPointsController.redraw();
|
this._controlPointsController.redraw();
|
||||||
},
|
},
|
||||||
|
|
||||||
_positionateArrows : function() {
|
_positionArrows:function () {
|
||||||
var tpos = this._line2d.getTo();
|
var tpos = this._line2d.getTo();
|
||||||
this._endArrow.setFrom(tpos.x, tpos.y);
|
|
||||||
|
|
||||||
var spos = this._line2d.getFrom();
|
var spos = this._line2d.getFrom();
|
||||||
this._startArrow.setFrom(spos.x, spos.y);
|
|
||||||
|
|
||||||
this._endArrow.moveToBack();
|
this._startArrow.setFrom(spos.x, spos.y);
|
||||||
this._startArrow.moveToBack();
|
this._startArrow.moveToBack();
|
||||||
|
|
||||||
|
if (this._endArrow) {
|
||||||
|
this._endArrow.setFrom(tpos.x, tpos.y);
|
||||||
|
this._endArrow.moveToBack();
|
||||||
|
}
|
||||||
|
|
||||||
if (this._line2d.getType() == "CurvedLine") {
|
if (this._line2d.getType() == "CurvedLine") {
|
||||||
var controlPoints = this._line2d.getControlPoints();
|
var controlPoints = this._line2d.getControlPoints();
|
||||||
this._startArrow.setControlPoint(controlPoints[0]);
|
this._startArrow.setControlPoint(controlPoints[0]);
|
||||||
this._endArrow.setControlPoint(controlPoints[1]);
|
if (this._endArrow) {
|
||||||
|
this._endArrow.setControlPoint(controlPoints[1]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this._startArrow.setControlPoint(this._line2d.getTo());
|
this._startArrow.setControlPoint(this._line2d.getTo());
|
||||||
this._endArrow.setControlPoint(this._line2d.getFrom());
|
if (this._endArrow) {
|
||||||
|
this._endArrow.setControlPoint(this._line2d.getFrom());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._endArrow.setVisibility(this.isVisible() && this._showEndArrow);
|
if (this._showEndArrow) {
|
||||||
|
this._endArrow.setVisibility(this.isVisible());
|
||||||
|
}
|
||||||
this._startArrow.setVisibility(this.isVisible() && this._showStartArrow);
|
this._startArrow.setVisibility(this.isVisible() && this._showStartArrow);
|
||||||
},
|
},
|
||||||
|
|
||||||
addToWorkspace : function(workspace) {
|
addToWorkspace:function (workspace) {
|
||||||
workspace.appendChild(this._focusShape);
|
workspace.appendChild(this._focusShape);
|
||||||
workspace.appendChild(this._controlPointsController);
|
workspace.appendChild(this._controlPointsController);
|
||||||
|
|
||||||
this._controlPointControllerListener = this._initializeControlPointController.bind(this);
|
this._controlPointControllerListener = this._initializeControlPointController.bind(this);
|
||||||
this._line2d.addEvent('click', this._controlPointControllerListener);
|
this._line2d.addEvent('click', this._controlPointControllerListener);
|
||||||
this._isInWorkspace = true;
|
this._isInWorkspace = true;
|
||||||
|
|
||||||
workspace.appendChild(this._startArrow);
|
workspace.appendChild(this._startArrow);
|
||||||
workspace.appendChild(this._endArrow);
|
if (this._endArrow)
|
||||||
|
workspace.appendChild(this._endArrow);
|
||||||
|
|
||||||
this.parent(workspace);
|
this.parent(workspace);
|
||||||
|
this._positionArrows();
|
||||||
},
|
},
|
||||||
|
|
||||||
_initializeControlPointController : function() {
|
_initializeControlPointController:function () {
|
||||||
this.setOnFocus(true);
|
this.setOnFocus(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeFromWorkspace : function(workspace) {
|
removeFromWorkspace:function (workspace) {
|
||||||
workspace.removeChild(this._focusShape);
|
workspace.removeChild(this._focusShape);
|
||||||
workspace.removeChild(this._controlPointsController);
|
workspace.removeChild(this._controlPointsController);
|
||||||
this._line2d.removeEvent('click', this._controlPointControllerListener);
|
this._line2d.removeEvent('click', this._controlPointControllerListener);
|
||||||
this._isInWorkspace = false;
|
this._isInWorkspace = false;
|
||||||
workspace.removeChild(this._startArrow);
|
workspace.removeChild(this._startArrow);
|
||||||
workspace.removeChild(this._endArrow);
|
if (this._endArrow)
|
||||||
|
workspace.removeChild(this._endArrow);
|
||||||
|
|
||||||
this.parent(workspace);
|
this.parent(workspace);
|
||||||
},
|
},
|
||||||
|
|
||||||
getType : function() {
|
getType:function () {
|
||||||
return mindplot.RelationshipLine.type;
|
return mindplot.Relationship.type;
|
||||||
},
|
},
|
||||||
|
|
||||||
setOnFocus : function(focus) {
|
setOnFocus:function (focus) {
|
||||||
// Change focus shape
|
// Change focus shape
|
||||||
if (this.isOnFocus() != focus) {
|
if (this.isOnFocus() != focus) {
|
||||||
if (focus) {
|
if (focus) {
|
||||||
@ -160,12 +194,12 @@ mindplot.RelationshipLine = new Class({
|
|||||||
|
|
||||||
this._controlPointsController.setVisibility(focus);
|
this._controlPointsController.setVisibility(focus);
|
||||||
this._onFocus = focus;
|
this._onFocus = focus;
|
||||||
this._line2d.setCursor(this.isOnFocus() ? 'default' : 'pointer');
|
console.log("foucus:....");
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_refreshShape : function () {
|
_refreshShape:function () {
|
||||||
var sPos = this._line2d.getFrom();
|
var sPos = this._line2d.getFrom();
|
||||||
var tPos = this._line2d.getTo();
|
var tPos = this._line2d.getTo();
|
||||||
var ctrlPoints = this._line2d.getControlPoints();
|
var ctrlPoints = this._line2d.getControlPoints();
|
||||||
@ -179,7 +213,7 @@ mindplot.RelationshipLine = new Class({
|
|||||||
this._focusShape.updateLine();
|
this._focusShape.updateLine();
|
||||||
},
|
},
|
||||||
|
|
||||||
addEvent : function(type, listener) {
|
addEvent:function (type, listener) {
|
||||||
// Translate to web 2d events ...
|
// Translate to web 2d events ...
|
||||||
if (type == 'onfocus') {
|
if (type == 'onfocus') {
|
||||||
type = 'mousedown';
|
type = 'mousedown';
|
||||||
@ -189,21 +223,22 @@ mindplot.RelationshipLine = new Class({
|
|||||||
line.addEvent(type, listener);
|
line.addEvent(type, listener);
|
||||||
},
|
},
|
||||||
|
|
||||||
isOnFocus : function() {
|
isOnFocus:function () {
|
||||||
return this._onFocus;
|
return this._onFocus;
|
||||||
},
|
},
|
||||||
|
|
||||||
isInWorkspace : function() {
|
isInWorkspace:function () {
|
||||||
return this._isInWorkspace;
|
return this._isInWorkspace;
|
||||||
},
|
},
|
||||||
|
|
||||||
setVisibility : function(value) {
|
setVisibility:function (value) {
|
||||||
this.parent(value);
|
this.parent(value);
|
||||||
this._endArrow.setVisibility(this._showEndArrow && value);
|
if (this._showEndArrow)
|
||||||
|
this._endArrow.setVisibility(this._showEndArrow);
|
||||||
this._startArrow.setVisibility(this._showStartArrow && value);
|
this._startArrow.setVisibility(this._showStartArrow && value);
|
||||||
},
|
},
|
||||||
|
|
||||||
setOpacity : function(opacity) {
|
setOpacity:function (opacity) {
|
||||||
this.parent(opacity);
|
this.parent(opacity);
|
||||||
if (this._showEndArrow)
|
if (this._showEndArrow)
|
||||||
this._endArrow.setOpacity(opacity);
|
this._endArrow.setOpacity(opacity);
|
||||||
@ -211,74 +246,73 @@ mindplot.RelationshipLine = new Class({
|
|||||||
this._startArrow.setOpacity(opacity);
|
this._startArrow.setOpacity(opacity);
|
||||||
},
|
},
|
||||||
|
|
||||||
setShowEndArrow : function(visible) {
|
setShowEndArrow:function (visible) {
|
||||||
this._showEndArrow = visible;
|
this._showEndArrow = visible;
|
||||||
if (this._isInWorkspace)
|
if (this._isInWorkspace)
|
||||||
this.redraw();
|
this.redraw();
|
||||||
},
|
},
|
||||||
|
|
||||||
setShowStartArrow : function(visible) {
|
setShowStartArrow:function (visible) {
|
||||||
this._showStartArrow = visible;
|
this._showStartArrow = visible;
|
||||||
if (this._isInWorkspace)
|
if (this._isInWorkspace)
|
||||||
this.redraw();
|
this.redraw();
|
||||||
},
|
},
|
||||||
|
|
||||||
isShowEndArrow : function() {
|
setFrom:function (x, y) {
|
||||||
return this._showEndArrow;
|
$assert($defined(x), "x must be defined");
|
||||||
},
|
$assert($defined(y), "y must be defined");
|
||||||
|
|
||||||
isShowStartArrow : function() {
|
|
||||||
return this._showStartArrow;
|
|
||||||
},
|
|
||||||
|
|
||||||
setFrom : function(x, y) {
|
|
||||||
$assert(x, "x must be defined");
|
|
||||||
$assert(y, "y must be defined");
|
|
||||||
|
|
||||||
this._line2d.setFrom(x, y);
|
this._line2d.setFrom(x, y);
|
||||||
this._startArrow.setFrom(x, y);
|
this._startArrow.setFrom(x, y);
|
||||||
},
|
},
|
||||||
|
|
||||||
setTo : function(x, y) {
|
setTo:function (x, y) {
|
||||||
$assert(y, "x must be defined");
|
$assert($defined(x), "x must be defined");
|
||||||
$assert(y, "y must be defined");
|
$assert($defined(y), "y must be defined");
|
||||||
|
|
||||||
this._line2d.setTo(x, y);
|
this._line2d.setTo(x, y);
|
||||||
this._endArrow.setFrom(x, y);
|
if (this._endArrow)
|
||||||
|
this._endArrow.setFrom(x, y);
|
||||||
},
|
},
|
||||||
|
|
||||||
setSrcControlPoint : function(control) {
|
setSrcControlPoint:function (control) {
|
||||||
this._line2d.setSrcControlPoint(control);
|
this._line2d.setSrcControlPoint(control);
|
||||||
this._startArrow.setControlPoint(control);
|
this._startArrow.setControlPoint(control);
|
||||||
},
|
},
|
||||||
|
|
||||||
setDestControlPoint : function(control) {
|
setDestControlPoint:function (control) {
|
||||||
this._line2d.setDestControlPoint(control);
|
this._line2d.setDestControlPoint(control);
|
||||||
this._endArrow.setControlPoint(control);
|
if (this._showEndArrow)
|
||||||
|
this._endArrow.setControlPoint(control);
|
||||||
},
|
},
|
||||||
|
|
||||||
getControlPoints : function() {
|
getControlPoints:function () {
|
||||||
return this._line2d.getControlPoints();
|
return this._line2d.getControlPoints();
|
||||||
},
|
},
|
||||||
|
|
||||||
isSrcControlPointCustom : function() {
|
isSrcControlPointCustom:function () {
|
||||||
return this._line2d.isSrcControlPointCustom();
|
return this._line2d.isSrcControlPointCustom();
|
||||||
},
|
},
|
||||||
|
|
||||||
isDestControlPointCustom : function() {
|
isDestControlPointCustom:function () {
|
||||||
return this._line2d.isDestControlPointCustom();
|
return this._line2d.isDestControlPointCustom();
|
||||||
},
|
},
|
||||||
|
|
||||||
setIsSrcControlPointCustom : function(isCustom) {
|
setIsSrcControlPointCustom:function (isCustom) {
|
||||||
this._line2d.setIsSrcControlPointCustom(isCustom);
|
this._line2d.setIsSrcControlPointCustom(isCustom);
|
||||||
},
|
},
|
||||||
|
|
||||||
setIsDestControlPointCustom : function(isCustom) {
|
setIsDestControlPointCustom:function (isCustom) {
|
||||||
this._line2d.setIsDestControlPointCustom(isCustom);
|
this._line2d.setIsDestControlPointCustom(isCustom);
|
||||||
}});
|
},
|
||||||
|
|
||||||
|
getId: function(){
|
||||||
|
return this._model.getId();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
mindplot.RelationshipLine.type = "RelationshipLine";
|
mindplot.Relationship.type = "Relationship";
|
||||||
mindplot.RelationshipLine.getStrokeColor = function() {
|
mindplot.Relationship.getStrokeColor = function () {
|
||||||
return '#9b74e6';
|
return '#9b74e6';
|
||||||
};
|
};
|
@ -17,45 +17,45 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mindplot.StandaloneActionDispatcher = new Class({
|
mindplot.StandaloneActionDispatcher = new Class({
|
||||||
Extends: mindplot.ActionDispatcher,
|
Extends:mindplot.ActionDispatcher,
|
||||||
initialize: function(commandContext) {
|
initialize:function (commandContext) {
|
||||||
this.parent(commandContext);
|
this.parent(commandContext);
|
||||||
this._actionRunner = new mindplot.DesignerActionRunner(commandContext, this);
|
this._actionRunner = new mindplot.DesignerActionRunner(commandContext, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
hasBeenChanged: function() {
|
hasBeenChanged:function () {
|
||||||
// @todo: This don't seems to belong here.
|
// @todo: This don't seems to belong here.
|
||||||
this._actionRunner.hasBeenChanged();
|
this._actionRunner.hasBeenChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
addTopic:function(nodeModel, parentTopicId, animated) {
|
addTopic:function (nodeModel, parentTopicId, animated) {
|
||||||
var command = new mindplot.commands.AddTopicCommand(nodeModel, parentTopicId, animated);
|
var command = new mindplot.commands.AddTopicCommand(nodeModel, parentTopicId, animated);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
connectByRelation: function(model) {
|
connectByRelation:function (model) {
|
||||||
var command = new mindplot.commands.AddRelationshipCommand(model);
|
var command = new mindplot.commands.AddRelationshipCommand(model);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteTopics: function(topicsIds, relIds) {
|
deleteEntities:function (topicsIds, relIds) {
|
||||||
var command = new mindplot.commands.DeleteCommand(topicsIds, relIds);
|
var command = new mindplot.commands.DeleteCommand(topicsIds, relIds);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
dragTopic: function(topicId, position, order, parentTopic) {
|
dragTopic:function (topicId, position, order, parentTopic) {
|
||||||
var command = new mindplot.commands.DragTopicCommand(topicId, position, order, parentTopic);
|
var command = new mindplot.commands.DragTopicCommand(topicId, position, order, parentTopic);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
moveTopic: function(topicId, position) {
|
moveTopic:function (topicId, position) {
|
||||||
$assert($defined(topicId), "topicsId can not be null");
|
$assert($defined(topicId), "topicsId can not be null");
|
||||||
$assert($defined(position), "position can not be null");
|
$assert($defined(position), "position can not be null");
|
||||||
|
|
||||||
var commandFunc = function(topic, value) {
|
var commandFunc = function (topic, value) {
|
||||||
var result = topic.getPosition();
|
var result = topic.getPosition();
|
||||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeMoveEvent, {node:topic.getModel(),position:value});
|
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeMoveEvent, {node:topic.getModel(), position:value});
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -63,14 +63,14 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
moveControlPoint: function(ctrlPoint, point) {
|
moveControlPoint:function (ctrlPoint, point) {
|
||||||
var command = new mindplot.commands.MoveControlPointCommand(ctrlPoint, point);
|
var command = new mindplot.commands.MoveControlPointCommand(ctrlPoint, point);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
changeFontStyleToTopic: function(topicsIds) {
|
changeFontStyleToTopic:function (topicsIds) {
|
||||||
|
|
||||||
var commandFunc = function(topic) {
|
var commandFunc = function (topic) {
|
||||||
var result = topic.getFontStyle();
|
var result = topic.getFontStyle();
|
||||||
var style = (result == "italic") ? "normal" : "italic";
|
var style = (result == "italic") ? "normal" : "italic";
|
||||||
topic.setFontStyle(style, true);
|
topic.setFontStyle(style, true);
|
||||||
@ -81,10 +81,10 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
changeTextToTopic : function(topicsIds, text) {
|
changeTextToTopic:function (topicsIds, text) {
|
||||||
$assert($defined(topicsIds), "topicsIds can not be null");
|
$assert($defined(topicsIds), "topicsIds can not be null");
|
||||||
|
|
||||||
var commandFunc = function(topic, value) {
|
var commandFunc = function (topic, value) {
|
||||||
var result = topic.getText();
|
var result = topic.getText();
|
||||||
topic.setText(value);
|
topic.setText(value);
|
||||||
return result;
|
return result;
|
||||||
@ -94,12 +94,12 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
changeFontFamilyToTopic: function(topicIds, fontFamily) {
|
changeFontFamilyToTopic:function (topicIds, fontFamily) {
|
||||||
$assert(topicIds, "topicIds can not be null");
|
$assert(topicIds, "topicIds can not be null");
|
||||||
$assert(fontFamily, "fontFamily can not be null");
|
$assert(fontFamily, "fontFamily can not be null");
|
||||||
|
|
||||||
|
|
||||||
var commandFunc = function(topic, fontFamily) {
|
var commandFunc = function (topic, fontFamily) {
|
||||||
var result = topic.getFontFamily();
|
var result = topic.getFontFamily();
|
||||||
topic.setFontFamily(fontFamily, true);
|
topic.setFontFamily(fontFamily, true);
|
||||||
|
|
||||||
@ -111,11 +111,11 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
changeFontColorToTopic: function(topicsIds, color) {
|
changeFontColorToTopic:function (topicsIds, color) {
|
||||||
$assert(topicsIds, "topicIds can not be null");
|
$assert(topicsIds, "topicIds can not be null");
|
||||||
$assert(color, "color can not be null");
|
$assert(color, "color can not be null");
|
||||||
|
|
||||||
var commandFunc = function(topic, color) {
|
var commandFunc = function (topic, color) {
|
||||||
var result = topic.getFontColor();
|
var result = topic.getFontColor();
|
||||||
topic.setFontColor(color, true);
|
topic.setFontColor(color, true);
|
||||||
return result;
|
return result;
|
||||||
@ -126,11 +126,11 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
changeBackgroundColorToTopic: function(topicsIds, color) {
|
changeBackgroundColorToTopic:function (topicsIds, color) {
|
||||||
$assert(topicsIds, "topicIds can not be null");
|
$assert(topicsIds, "topicIds can not be null");
|
||||||
$assert(color, "color can not be null");
|
$assert(color, "color can not be null");
|
||||||
|
|
||||||
var commandFunc = function(topic, color) {
|
var commandFunc = function (topic, color) {
|
||||||
var result = topic.getBackgroundColor();
|
var result = topic.getBackgroundColor();
|
||||||
topic.setBackgroundColor(color);
|
topic.setBackgroundColor(color);
|
||||||
return result;
|
return result;
|
||||||
@ -141,11 +141,11 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
changeBorderColorToTopic : function(topicsIds, color) {
|
changeBorderColorToTopic:function (topicsIds, color) {
|
||||||
$assert(topicsIds, "topicIds can not be null");
|
$assert(topicsIds, "topicIds can not be null");
|
||||||
$assert(color, "topicIds can not be null");
|
$assert(color, "topicIds can not be null");
|
||||||
|
|
||||||
var commandFunc = function(topic, color) {
|
var commandFunc = function (topic, color) {
|
||||||
var result = topic.getBorderColor();
|
var result = topic.getBorderColor();
|
||||||
topic.setBorderColor(color);
|
topic.setBorderColor(color);
|
||||||
return result;
|
return result;
|
||||||
@ -156,11 +156,11 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
changeFontSizeToTopic : function(topicsIds, size) {
|
changeFontSizeToTopic:function (topicsIds, size) {
|
||||||
$assert(topicsIds, "topicIds can not be null");
|
$assert(topicsIds, "topicIds can not be null");
|
||||||
$assert(size, "size can not be null");
|
$assert(size, "size can not be null");
|
||||||
|
|
||||||
var commandFunc = function(topic, size) {
|
var commandFunc = function (topic, size) {
|
||||||
var result = topic.getFontSize();
|
var result = topic.getFontSize();
|
||||||
topic.setFontSize(size, true);
|
topic.setFontSize(size, true);
|
||||||
|
|
||||||
@ -172,11 +172,11 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
changeShapeTypeToTopic : function(topicsIds, shapeType) {
|
changeShapeTypeToTopic:function (topicsIds, shapeType) {
|
||||||
$assert(topicsIds, "topicsIds can not be null");
|
$assert(topicsIds, "topicsIds can not be null");
|
||||||
$assert(shapeType, "shapeType can not be null");
|
$assert(shapeType, "shapeType can not be null");
|
||||||
|
|
||||||
var commandFunc = function(topic, shapeType) {
|
var commandFunc = function (topic, shapeType) {
|
||||||
var result = topic.getShapeType();
|
var result = topic.getShapeType();
|
||||||
topic.setShapeType(shapeType, true);
|
topic.setShapeType(shapeType, true);
|
||||||
return result;
|
return result;
|
||||||
@ -186,10 +186,10 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
changeFontWeightToTopic : function(topicsIds) {
|
changeFontWeightToTopic:function (topicsIds) {
|
||||||
$assert(topicsIds, "topicsIds can not be null");
|
$assert(topicsIds, "topicsIds can not be null");
|
||||||
|
|
||||||
var commandFunc = function(topic) {
|
var commandFunc = function (topic) {
|
||||||
var result = topic.getFontWeight();
|
var result = topic.getFontWeight();
|
||||||
var weight = (result == "bold") ? "normal" : "bold";
|
var weight = (result == "bold") ? "normal" : "bold";
|
||||||
topic.setFontWeight(weight, true);
|
topic.setFontWeight(weight, true);
|
||||||
@ -202,10 +202,10 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
shrinkBranch : function(topicsIds, collapse) {
|
shrinkBranch:function (topicsIds, collapse) {
|
||||||
$assert(topicsIds, "topicsIds can not be null");
|
$assert(topicsIds, "topicsIds can not be null");
|
||||||
|
|
||||||
var commandFunc = function(topic, isShrink) {
|
var commandFunc = function (topic, isShrink) {
|
||||||
topic.setChildrenShrunken(isShrink);
|
topic.setChildrenShrunken(isShrink);
|
||||||
return !isShrink;
|
return !isShrink;
|
||||||
};
|
};
|
||||||
@ -214,22 +214,22 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
this.execute(command, false);
|
this.execute(command, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
addFeatureToTopic : function(topicId, featureType, attributes) {
|
addFeatureToTopic:function (topicId, featureType, attributes) {
|
||||||
var command = new mindplot.commands.AddFeatureToTopicCommand(topicId, featureType, attributes);
|
var command = new mindplot.commands.AddFeatureToTopicCommand(topicId, featureType, attributes);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
changeFeatureToTopic : function(topicId, featureId, attributes) {
|
changeFeatureToTopic:function (topicId, featureId, attributes) {
|
||||||
var command = new mindplot.commands.ChangeFeatureToTopicCommand(topicId, featureId, attributes);
|
var command = new mindplot.commands.ChangeFeatureToTopicCommand(topicId, featureId, attributes);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeFeatureFromTopic : function(topicId, featureId) {
|
removeFeatureFromTopic:function (topicId, featureId) {
|
||||||
var command = new mindplot.commands.RemoveFeatureFromTopicCommand(topicId, featureId);
|
var command = new mindplot.commands.RemoveFeatureFromTopicCommand(topicId, featureId);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
execute:function(command) {
|
execute:function (command) {
|
||||||
this._actionRunner.execute(command);
|
this._actionRunner.execute(command);
|
||||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout);
|
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout);
|
||||||
}
|
}
|
||||||
@ -237,62 +237,64 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
});
|
});
|
||||||
|
|
||||||
mindplot.CommandContext = new Class({
|
mindplot.CommandContext = new Class({
|
||||||
initialize: function(designer) {
|
initialize:function (designer) {
|
||||||
$assert(designer, "designer can not be null");
|
$assert(designer, "designer can not be null");
|
||||||
this._designer = designer;
|
this._designer = designer;
|
||||||
},
|
},
|
||||||
|
|
||||||
findTopics:function(topicsIds) {
|
findTopics:function (topicsIds) {
|
||||||
$assert($defined(topicsIds), "topicsIds can not be null");
|
$assert($defined(topicsIds), "topicsIds can not be null");
|
||||||
if (!(topicsIds instanceof Array)) {
|
if (!(topicsIds instanceof Array)) {
|
||||||
topicsIds = [topicsIds];
|
topicsIds = [topicsIds];
|
||||||
}
|
}
|
||||||
|
|
||||||
var designerTopics = this._designer.getModel().getTopics();
|
var designerTopics = this._designer.getModel().getTopics();
|
||||||
return designerTopics.filter(function(topic) {
|
return designerTopics.filter(function (topic) {
|
||||||
return topicsIds.contains(topic.getId());
|
return topicsIds.contains(topic.getId());
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteTopic:function(topic) {
|
deleteTopic:function (topic) {
|
||||||
this._designer._removeNode(topic);
|
this._designer._removeTopic(topic);
|
||||||
},
|
},
|
||||||
|
|
||||||
createTopic:function(model, isVisible) {
|
createTopic:function (model, isVisible) {
|
||||||
$assert(model, "model can not be null");
|
$assert(model, "model can not be null");
|
||||||
return this._designer._nodeModelToNodeGraph(model, isVisible);
|
return this._designer._nodeModelToNodeGraph(model, isVisible);
|
||||||
},
|
},
|
||||||
|
|
||||||
createModel:function() {
|
createModel:function () {
|
||||||
var mindmap = this._designer.getMindmap();
|
var mindmap = this._designer.getMindmap();
|
||||||
return mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE);
|
return mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE);
|
||||||
},
|
},
|
||||||
|
|
||||||
connect:function(childTopic, parentTopic, isVisible) {
|
connect:function (childTopic, parentTopic, isVisible) {
|
||||||
childTopic.connectTo(parentTopic, this._designer._workspace, isVisible);
|
childTopic.connectTo(parentTopic, this._designer._workspace, isVisible);
|
||||||
} ,
|
},
|
||||||
|
|
||||||
disconnect:function(topic) {
|
disconnect:function (topic) {
|
||||||
topic.disconnect(this._designer._workspace);
|
topic.disconnect(this._designer._workspace);
|
||||||
},
|
},
|
||||||
|
|
||||||
createRelationship:function(model) {
|
createRelationship:function (model) {
|
||||||
$assert(model, "model cannot be null");
|
$assert(model, "model cannot be null");
|
||||||
return this._designer.createRelationship(model);
|
return this._designer.createRelationship(model);
|
||||||
},
|
},
|
||||||
removeRelationship:function(model) {
|
|
||||||
this._designer.removeRelationship(model);
|
deleteRelationship:function (relationship) {
|
||||||
|
this._designer._deleteRelationship(relationship);
|
||||||
},
|
},
|
||||||
|
|
||||||
findRelationships:function(lineIds) {
|
findRelationships:function (relIds) {
|
||||||
var result = [];
|
$assert($defined(relIds), "relId can not be null");
|
||||||
lineIds.forEach(function(lineId) {
|
if (!(relIds instanceof Array)) {
|
||||||
var line = this._designer.getModel().getRelationshipsById()[lineId];
|
relIds = [relIds];
|
||||||
if ($defined(line)) {
|
}
|
||||||
result.push(line);
|
|
||||||
}
|
var designerRel = this._designer.getModel().getRelationships();
|
||||||
}.bind(this));
|
return designerRel.filter(function (rel) {
|
||||||
return result;
|
return relIds.contains(rel.getId());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ mindplot.Topic = new Class({
|
|||||||
this._relationships.push(relationship);
|
this._relationships.push(relationship);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeRelationship : function(relationship) {
|
deleteRelationship : function(relationship) {
|
||||||
this._relationships.erase(relationship);
|
this._relationships.erase(relationship);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ mindplot.collaboration.framework.brix.model.NodeModel = new Class({
|
|||||||
for (var i = 0; i < brixChildren.size(); i++) {
|
for (var i = 0; i < brixChildren.size(); i++) {
|
||||||
var brixNodeModel = brixChildren.get(i);
|
var brixNodeModel = brixChildren.get(i);
|
||||||
var cmodel = new mindplot.collaboration.framework.brix.model.NodeModel(this._brixFramework, brixNodeModel, this.getMindmap());
|
var cmodel = new mindplot.collaboration.framework.brix.model.NodeModel(this._brixFramework, brixNodeModel, this.getMindmap());
|
||||||
actionDispatcher.deleteTopics([cmodel.getId()]);
|
actionDispatcher.deleteEntities([cmodel.getId()]);
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.trace();
|
console.trace();
|
||||||
|
@ -32,7 +32,7 @@ mindplot.commands.AddRelationshipCommand = new Class({
|
|||||||
relationship.setOnFocus(true);
|
relationship.setOnFocus(true);
|
||||||
},
|
},
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var relationship = commandContext.removeRelationship(this._model);
|
var relationship = commandContext.deleteRelationship(this._model);
|
||||||
|
|
||||||
// @Todo: Esto esta mal. Designer toca el mindmap ...
|
// @Todo: Esto esta mal. Designer toca el mindmap ...
|
||||||
// this._mindmap.removeRelationship(this._model);
|
// this._mindmap.removeRelationship(this._model);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
mindplot.commands.DeleteCommand = new Class({
|
mindplot.commands.DeleteCommand = new Class({
|
||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicIds, relIds) {
|
initialize:function (topicIds, relIds) {
|
||||||
$assert($defined(topicIds), 'topicIds can not be null');
|
$assert($defined(topicIds), 'topicIds can not be null');
|
||||||
|
|
||||||
this.parent();
|
this.parent();
|
||||||
@ -30,19 +30,20 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
this._id = mindplot.Command._nextUUID();
|
this._id = mindplot.Command._nextUUID();
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute:function (commandContext) {
|
||||||
var topics = commandContext.findTopics(this._topicIds);
|
var topics = commandContext.findTopics(this._topicIds);
|
||||||
if (topics.length > 0) {
|
if (topics.length > 0) {
|
||||||
topics.forEach(
|
topics.forEach(
|
||||||
function(topic, index) {
|
function (topic, index) {
|
||||||
var model = topic.getModel();
|
var model = topic.getModel();
|
||||||
|
|
||||||
// Delete relationships
|
// Delete relationships
|
||||||
var relationships = topic.getRelationships();
|
var relationships = topic.getRelationships();
|
||||||
while (relationships.length > 0) {
|
while (relationships.length > 0) {
|
||||||
var relationship = relationships[0];
|
var relationship = relationships[0];
|
||||||
this._deletedRelationships.push(relationship.getModel().clone());
|
|
||||||
commandContext.removeRelationship(relationship.getModel());
|
this._deletedRelationships.push(relationship);
|
||||||
|
commandContext.deleteRelationship(relationship);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._deletedTopicModels.push(model);
|
this._deletedTopicModels.push(model);
|
||||||
@ -61,24 +62,22 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
var lines = commandContext.findRelationships(this._relIds);
|
var rels = commandContext.findRelationships(this._relIds);
|
||||||
if (lines.length > 0) {
|
if (rels.length > 0) {
|
||||||
lines.forEach(function(line, index) {
|
rels.forEach(function (rel) {
|
||||||
if (line.isInWorkspace()) {
|
this._deletedRelationships.push(rel.getModel().clone());
|
||||||
this._deletedRelationships.push(line.getModel().clone());
|
commandContext.deleteRelationship(rel);
|
||||||
commandContext.removeRelationship(line.getModel());
|
|
||||||
}
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
undoExecute:function (commandContext) {
|
||||||
|
|
||||||
var topics = commandContext.findTopics(this._topicIds);
|
var topics = commandContext.findTopics(this._topicIds);
|
||||||
var parent = commandContext.findTopics(this._parentTopicIds);
|
var parent = commandContext.findTopics(this._parentTopicIds);
|
||||||
|
|
||||||
this._deletedTopicModels.forEach(
|
this._deletedTopicModels.forEach(
|
||||||
function(model, index) {
|
function (model, index) {
|
||||||
var topic = commandContext.createTopic(model);
|
var topic = commandContext.createTopic(model);
|
||||||
|
|
||||||
// Was the topic connected?
|
// Was the topic connected?
|
||||||
@ -90,8 +89,8 @@ mindplot.commands.DeleteCommand = new Class({
|
|||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
this._deletedRelationships.forEach(
|
this._deletedRelationships.forEach(
|
||||||
function(relationship, index) {
|
function (rel) {
|
||||||
commandContext.createRelationship(relationship);
|
commandContext.createRelationship(rel);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
this._deletedTopicModels = [];
|
this._deletedTopicModels = [];
|
||||||
|
@ -1,144 +1,144 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.model.IMindmap = new Class({
|
mindplot.model.IMindmap = new Class({
|
||||||
initialize : function() {
|
initialize : function() {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
getCentralTopic : function() {
|
getCentralTopic : function() {
|
||||||
return this.getBranches()[0];
|
return this.getBranches()[0];
|
||||||
},
|
},
|
||||||
|
|
||||||
getDescription : function() {
|
getDescription : function() {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
setDescription : function(value) {
|
setDescription : function(value) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
getId : function() {
|
getId : function() {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
setId : function(id) {
|
setId : function(id) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
getVersion : function() {
|
getVersion : function() {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
setVersion : function(version) {
|
setVersion : function(version) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
addBranch : function(nodeModel) {
|
addBranch : function(nodeModel) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
getBranches : function() {
|
getBranches : function() {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
removeBranch : function(node) {
|
removeBranch : function(node) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
getRelationships : function() {
|
getRelationships : function() {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
connect : function(parent, child) {
|
connect : function(parent, child) {
|
||||||
// Child already has a parent ?
|
// Child already has a parent ?
|
||||||
$assert(!child.getParent(), 'Child model seems to be already connected');
|
$assert(!child.getParent(), 'Child model seems to be already connected');
|
||||||
|
|
||||||
// Connect node...
|
// Connect node...
|
||||||
parent.appendChild(child);
|
parent.appendChild(child);
|
||||||
|
|
||||||
// Remove from the branch ...
|
// Remove from the branch ...
|
||||||
this.removeBranch(child);
|
this.removeBranch(child);
|
||||||
},
|
},
|
||||||
|
|
||||||
disconnect : function(child) {
|
disconnect : function(child) {
|
||||||
var parent = child.getParent();
|
var parent = child.getParent();
|
||||||
$assert(child, 'Child can not be null.');
|
$assert(child, 'Child can not be null.');
|
||||||
$assert(parent, 'Child model seems to be already connected');
|
$assert(parent, 'Child model seems to be already connected');
|
||||||
|
|
||||||
parent.removeChild(child);
|
parent.removeChild(child);
|
||||||
this.addBranch(child);
|
this.addBranch(child);
|
||||||
},
|
},
|
||||||
|
|
||||||
hasAlreadyAdded : function(node) {
|
hasAlreadyAdded : function(node) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
createNode : function(type, id) {
|
createNode : function(type, id) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
createRelationship : function(fromNode, toNode) {
|
createRelationship : function(fromNode, toNode) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
addRelationship : function(rel) {
|
addRelationship : function(rel) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
removeRelationship : function(relationship) {
|
deleteRelationship : function(relationship) {
|
||||||
throw "Unsupported operation";
|
throw "Unsupported operation";
|
||||||
},
|
},
|
||||||
|
|
||||||
inspect : function() {
|
inspect : function() {
|
||||||
var result = '';
|
var result = '';
|
||||||
result = '{ ';
|
result = '{ ';
|
||||||
|
|
||||||
var branches = this.getBranches();
|
var branches = this.getBranches();
|
||||||
result = result + "version:" + this.getVersion();
|
result = result + "version:" + this.getVersion();
|
||||||
result = result + " , [";
|
result = result + " , [";
|
||||||
|
|
||||||
for (var i = 0; i < branches.length; i++) {
|
for (var i = 0; i < branches.length; i++) {
|
||||||
var node = branches[i];
|
var node = branches[i];
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
result = result + ',\n ';
|
result = result + ',\n ';
|
||||||
}
|
}
|
||||||
result = result + "(" + i + ") =>" + node.inspect();
|
result = result + "(" + i + ") =>" + node.inspect();
|
||||||
}
|
}
|
||||||
result = result + "]";
|
result = result + "]";
|
||||||
|
|
||||||
result = result + ' } ';
|
result = result + ' } ';
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
copyTo : function(target) {
|
copyTo : function(target) {
|
||||||
var source = this;
|
var source = this;
|
||||||
var version = source.getVersion();
|
var version = source.getVersion();
|
||||||
target.setVersion(version);
|
target.setVersion(version);
|
||||||
|
|
||||||
var desc = this.getDescription();
|
var desc = this.getDescription();
|
||||||
target.setDescription(desc);
|
target.setDescription(desc);
|
||||||
|
|
||||||
// Then the rest of the branches ...
|
// Then the rest of the branches ...
|
||||||
var sbranchs = source.getBranches();
|
var sbranchs = source.getBranches();
|
||||||
sbranchs.forEach(function(snode) {
|
sbranchs.forEach(function(snode) {
|
||||||
var tnode = target.createNode(snode.getType(), snode.getId());
|
var tnode = target.createNode(snode.getType(), snode.getId());
|
||||||
snode.copyTo(tnode);
|
snode.copyTo(tnode);
|
||||||
target.addBranch(tnode);
|
target.addBranch(tnode);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -106,7 +106,7 @@ mindplot.model.Mindmap = new Class({
|
|||||||
this._relationships.push(relationship);
|
this._relationships.push(relationship);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeRelationship : function(relationship) {
|
deleteRelationship : function(relationship) {
|
||||||
this._relationships.erase(relationship);
|
this._relationships.erase(relationship);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,17 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
mindplot.model.RelationshipModel = new Class({
|
mindplot.model.RelationshipModel = new Class({
|
||||||
initialize:function(sourceTopicId, targetTopicId) {
|
Static:{
|
||||||
|
_nextUUID:function () {
|
||||||
|
if (!$defined(mindplot.model.RelationshipModel._uuid)) {
|
||||||
|
mindplot.model.RelationshipModel._uuid = 0;
|
||||||
|
}
|
||||||
|
mindplot.model.RelationshipModel._uuid = mindplot.model.RelationshipModel._uuid + 1;
|
||||||
|
return mindplot.model.RelationshipModel._uuid;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
initialize:function (sourceTopicId, targetTopicId) {
|
||||||
$assert($defined(sourceTopicId), 'from node type can not be null');
|
$assert($defined(sourceTopicId), 'from node type can not be null');
|
||||||
$assert($defined(targetTopicId), 'to node type can not be null');
|
$assert($defined(targetTopicId), 'to node type can not be null');
|
||||||
|
|
||||||
@ -30,59 +40,60 @@ mindplot.model.RelationshipModel = new Class({
|
|||||||
this._startArrow = false;
|
this._startArrow = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
getFromNode : function() {
|
getFromNode:function () {
|
||||||
return this._sourceTargetId;
|
return this._sourceTargetId;
|
||||||
},
|
},
|
||||||
|
|
||||||
getToNode : function() {
|
getToNode:function () {
|
||||||
return this._targetTopicId;
|
return this._targetTopicId;
|
||||||
},
|
},
|
||||||
|
|
||||||
getId : function() {
|
getId:function () {
|
||||||
|
$assert(this._id, "id is null");
|
||||||
return this._id;
|
return this._id;
|
||||||
},
|
},
|
||||||
|
|
||||||
getLineType : function() {
|
getLineType:function () {
|
||||||
return this._lineType;
|
return this._lineType;
|
||||||
},
|
},
|
||||||
|
|
||||||
setLineType : function(lineType) {
|
setLineType:function (lineType) {
|
||||||
this._lineType = lineType;
|
this._lineType = lineType;
|
||||||
},
|
},
|
||||||
|
|
||||||
getSrcCtrlPoint : function() {
|
getSrcCtrlPoint:function () {
|
||||||
return this._srcCtrlPoint;
|
return this._srcCtrlPoint;
|
||||||
},
|
},
|
||||||
|
|
||||||
setSrcCtrlPoint : function(srcCtrlPoint) {
|
setSrcCtrlPoint:function (srcCtrlPoint) {
|
||||||
this._srcCtrlPoint = srcCtrlPoint;
|
this._srcCtrlPoint = srcCtrlPoint;
|
||||||
},
|
},
|
||||||
|
|
||||||
getDestCtrlPoint : function() {
|
getDestCtrlPoint:function () {
|
||||||
return this._destCtrlPoint;
|
return this._destCtrlPoint;
|
||||||
},
|
},
|
||||||
|
|
||||||
setDestCtrlPoint : function(destCtrlPoint) {
|
setDestCtrlPoint:function (destCtrlPoint) {
|
||||||
this._destCtrlPoint = destCtrlPoint;
|
this._destCtrlPoint = destCtrlPoint;
|
||||||
},
|
},
|
||||||
|
|
||||||
getEndArrow : function() {
|
getEndArrow:function () {
|
||||||
return this._endArrow;
|
return this._endArrow;
|
||||||
},
|
},
|
||||||
|
|
||||||
setEndArrow : function(endArrow) {
|
setEndArrow:function (endArrow) {
|
||||||
this._endArrow = endArrow;
|
this._endArrow = endArrow;
|
||||||
},
|
},
|
||||||
|
|
||||||
getStartArrow : function() {
|
getStartArrow:function () {
|
||||||
return this._startArrow;
|
return this._startArrow;
|
||||||
},
|
},
|
||||||
|
|
||||||
setStartArrow : function(startArrow) {
|
setStartArrow:function (startArrow) {
|
||||||
this._startArrow = startArrow;
|
this._startArrow = startArrow;
|
||||||
},
|
},
|
||||||
|
|
||||||
clone : function(model) {
|
clone:function (model) {
|
||||||
var result = new mindplot.model.RelationshipModel(this._sourceTargetId, this._targetTopicId);
|
var result = new mindplot.model.RelationshipModel(this._sourceTargetId, this._targetTopicId);
|
||||||
result._id = this._id;
|
result._id = this._id;
|
||||||
result._lineType = this._lineType;
|
result._lineType = this._lineType;
|
||||||
@ -93,21 +104,9 @@ mindplot.model.RelationshipModel = new Class({
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
inspect : function() {
|
inspect:function () {
|
||||||
return '(fromNode:' + this.getFromNode().getId() + ' , toNode: ' + this.getToNode().getId() + ')';
|
return '(fromNode:' + this.getFromNode().getId() + ' , toNode: ' + this.getToNode().getId() + ')';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo: This method must be implemented.
|
|
||||||
*/
|
|
||||||
mindplot.model.RelationshipModel._nextUUID = function() {
|
|
||||||
if (!$defined(this._uuid)) {
|
|
||||||
this._uuid = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._uuid = this._uuid + 1;
|
|
||||||
return this._uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -176,24 +176,25 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_relationshipToXML : function(document, relationship) {
|
_relationshipToXML : function(document, relationship) {
|
||||||
var relationDom = document.createElement("relationship");
|
var result = document.createElement("relationship");
|
||||||
relationDom.setAttribute("srcTopicId", relationship.getFromNode());
|
result.setAttribute("srcTopicId", relationship.getFromNode());
|
||||||
relationDom.setAttribute("destTopicId", relationship.getToNode());
|
result.setAttribute("destTopicId", relationship.getToNode());
|
||||||
|
|
||||||
var lineType = relationship.getLineType();
|
var lineType = relationship.getLineType();
|
||||||
relationDom.setAttribute("lineType", lineType);
|
result.setAttribute("lineType", lineType);
|
||||||
if (lineType == mindplot.ConnectionLine.CURVED || lineType == mindplot.ConnectionLine.SIMPLE_CURVED) {
|
if (lineType == mindplot.ConnectionLine.CURVED || lineType == mindplot.ConnectionLine.SIMPLE_CURVED) {
|
||||||
if ($defined(relationship.getSrcCtrlPoint())) {
|
if ($defined(relationship.getSrcCtrlPoint())) {
|
||||||
var srcPoint = relationship.getSrcCtrlPoint();
|
var srcPoint = relationship.getSrcCtrlPoint();
|
||||||
relationDom.setAttribute("srcCtrlPoint", Math.round(srcPoint.x) + "," + Math.round(srcPoint.y));
|
result.setAttribute("srcCtrlPoint", Math.round(srcPoint.x) + "," + Math.round(srcPoint.y));
|
||||||
}
|
}
|
||||||
if ($defined(relationship.getDestCtrlPoint())) {
|
if ($defined(relationship.getDestCtrlPoint())) {
|
||||||
var destPoint = relationship.getDestCtrlPoint();
|
var destPoint = relationship.getDestCtrlPoint();
|
||||||
relationDom.setAttribute("destCtrlPoint", Math.round(destPoint.x) + "," + Math.round(destPoint.y));
|
result.setAttribute("destCtrlPoint", Math.round(destPoint.x) + "," + Math.round(destPoint.y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
relationDom.setAttribute("endArrow", relationship.getEndArrow());
|
result.setAttribute("endArrow", relationship.getEndArrow());
|
||||||
relationDom.setAttribute("startArrow", relationship.getStartArrow());
|
result.setAttribute("startArrow", relationship.getStartArrow());
|
||||||
return relationDom;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
loadFromDom : function(dom, mapId) {
|
loadFromDom : function(dom, mapId) {
|
||||||
|
@ -258,7 +258,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
|
|
||||||
|
|
||||||
this._addButton('deleteTopic', true, true, function () {
|
this._addButton('deleteTopic', true, true, function () {
|
||||||
designer.deleteCurrentNode();
|
designer.deleteSelectedEntities();
|
||||||
});
|
});
|
||||||
this._registerTooltip('deleteTopic', $msg('TOPIC_DELETE'), "Delete");
|
this._registerTooltip('deleteTopic', $msg('TOPIC_DELETE'), "Delete");
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
|
|
||||||
designer.addEvent('onblur', function () {
|
designer.addEvent('onblur', function () {
|
||||||
var topics = designer.getModel().filterSelectedTopics();
|
var topics = designer.getModel().filterSelectedTopics();
|
||||||
var rels = designer.getModel().filterSelectedRelations();
|
var rels = designer.getModel().filterSelectedRelationships();
|
||||||
|
|
||||||
this._toolbarElems.forEach(function (button) {
|
this._toolbarElems.forEach(function (button) {
|
||||||
var disable = false;
|
var disable = false;
|
||||||
@ -472,7 +472,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
|
|
||||||
designer.addEvent('onfocus', function () {
|
designer.addEvent('onfocus', function () {
|
||||||
var topics = designer.getModel().filterSelectedTopics();
|
var topics = designer.getModel().filterSelectedTopics();
|
||||||
var rels = designer.getModel().filterSelectedRelations();
|
var rels = designer.getModel().filterSelectedRelationships();
|
||||||
|
|
||||||
this._toolbarElems.forEach(function (button) {
|
this._toolbarElems.forEach(function (button) {
|
||||||
if (button.isTopicAction() && topics.length > 0) {
|
if (button.isTopicAction() && topics.length > 0) {
|
||||||
|
@ -43,3 +43,5 @@ SUB_TOPIC=Sub Topic
|
|||||||
ISOLATED_TOPIC=Isolated Topic
|
ISOLATED_TOPIC=Isolated Topic
|
||||||
CENTRAL_TOPIC=Central Topic
|
CENTRAL_TOPIC=Central Topic
|
||||||
SHORTCUTS=Keyboard Shortcuts
|
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.
|
@ -90,6 +90,9 @@ public class UserServiceImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void auditLogin(@NotNull User user) {
|
public void auditLogin(@NotNull User user) {
|
||||||
|
if(user==null){
|
||||||
|
throw new IllegalArgumentException("User can not be null");
|
||||||
|
}
|
||||||
final AccessAuditory accessAuditory = new AccessAuditory();
|
final AccessAuditory accessAuditory = new AccessAuditory();
|
||||||
accessAuditory.setUser(user);
|
accessAuditory.setUser(user);
|
||||||
accessAuditory.setLoginDate(Calendar.getInstance());
|
accessAuditory.setLoginDate(Calendar.getInstance());
|
||||||
|
Loading…
Reference in New Issue
Block a user