mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +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>DragPivot.js</include>
|
||||
<include>ConnectionLine.js</include>
|
||||
<include>RelationshipLine.js</include>
|
||||
<include>Relationship.js</include>
|
||||
<include>DragConnector.js</include>
|
||||
<include>TextEditor.js</include>
|
||||
<include>MultilineTextEditor.js</include>
|
||||
|
@ -31,7 +31,7 @@ mindplot.ActionDispatcher = new Class({
|
||||
throw "method must be implemented.";
|
||||
},
|
||||
|
||||
deleteTopics: function(topicsIds, relIds) {
|
||||
deleteEntities: function(topicsIds, relIds) {
|
||||
throw "method must be implemented.";
|
||||
},
|
||||
|
||||
|
@ -63,7 +63,7 @@ mindplot.CentralTopic = new Class({
|
||||
|
||||
},
|
||||
|
||||
_updatePositionOnChangeSize : function(oldSize, newSize, updatePosition) {
|
||||
_updatePositionOnChangeSize:function () {
|
||||
|
||||
// Center main topic ...
|
||||
var zeroPoint = new core.Point(0, 0);
|
||||
@ -94,5 +94,13 @@ mindplot.CentralTopic = new Class({
|
||||
|
||||
getShrinkConnector:function () {
|
||||
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));
|
||||
},
|
||||
|
||||
deleteTopics : function(topicsIds, relIds) {
|
||||
deleteEntities : function(topicsIds, relIds) {
|
||||
$assert(topicsIds, "topicsIds can not be null");
|
||||
var framework = this._getFramework();
|
||||
var mindmap = framework.getModel();
|
||||
|
@ -248,7 +248,7 @@ mindplot.Designer = new Class({
|
||||
|
||||
topic.addEvent('ontblur', function () {
|
||||
var topics = this.getModel().filterSelectedTopics();
|
||||
var rels = this.getModel().filterSelectedRelations();
|
||||
var rels = this.getModel().filterSelectedRelationships();
|
||||
|
||||
if (topics.length == 0 || rels.length == 0) {
|
||||
this.fireEvent('onblur');
|
||||
@ -257,7 +257,7 @@ mindplot.Designer = new Class({
|
||||
|
||||
topic.addEvent('ontfocus', function () {
|
||||
var topics = this.getModel().filterSelectedTopics();
|
||||
var rels = this.getModel().filterSelectedRelations();
|
||||
var rels = this.getModel().filterSelectedRelationships();
|
||||
|
||||
if (topics.length == 1 || rels.length == 1) {
|
||||
this.fireEvent('onfocus');
|
||||
@ -275,7 +275,7 @@ mindplot.Designer = new Class({
|
||||
});
|
||||
|
||||
var model = this.getModel();
|
||||
var objects = model.getObjects();
|
||||
var objects = model.getEntities();
|
||||
objects.forEach(function (object) {
|
||||
// Disable all nodes on focus but not the current if Ctrl key isn't being pressed
|
||||
if (!$defined(event) || (!event.control && !event.meta)) {
|
||||
@ -289,14 +289,14 @@ mindplot.Designer = new Class({
|
||||
|
||||
selectAll:function () {
|
||||
var model = this.getModel();
|
||||
var objects = model.getObjects();
|
||||
var objects = model.getEntities();
|
||||
objects.forEach(function (object) {
|
||||
object.setOnFocus(true);
|
||||
});
|
||||
},
|
||||
|
||||
deselectAll:function () {
|
||||
var objects = this.getModel().getObjects();
|
||||
var objects = this.getModel().getEntities();
|
||||
objects.forEach(function (object) {
|
||||
object.setOnFocus(false);
|
||||
});
|
||||
@ -475,13 +475,20 @@ mindplot.Designer = new Class({
|
||||
},
|
||||
|
||||
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 ....
|
||||
var screen = this._workspace.getScreenManager();
|
||||
var pos = screen.getWorkspaceMousePosition(event);
|
||||
var selectedTopic = this.getModel().selectedTopic();
|
||||
|
||||
// create a connection ...
|
||||
this._relPivot.start(selectedTopic, pos);
|
||||
this._relPivot.start(nodes[0], pos);
|
||||
},
|
||||
|
||||
connectByRelation:function (sourceTopic, targetTopic) {
|
||||
@ -489,10 +496,8 @@ mindplot.Designer = new Class({
|
||||
$assert(targetTopic, "targetTopic can not be null");
|
||||
|
||||
// Create a new topic model ...
|
||||
// @Todo: Model should not be modified from here ...
|
||||
var mindmap = this.getMindmap();
|
||||
var model = mindmap.createRelationship(sourceTopic.getModel().getId(), targetTopic.getModel().getId());
|
||||
|
||||
this._actionDispatcher.connectByRelation(model);
|
||||
},
|
||||
|
||||
@ -614,77 +619,46 @@ mindplot.Designer = new Class({
|
||||
return this._relationshipModelToRelationship(model);
|
||||
},
|
||||
|
||||
removeRelationship:function (model) {
|
||||
this._mindmap.removeRelationship(model);
|
||||
var relationship = this._relationships[model.getId()];
|
||||
_deleteRelationship:function (relationship) {
|
||||
var sourceTopic = relationship.getSourceTopic();
|
||||
sourceTopic.removeRelationship(relationship);
|
||||
sourceTopic.deleteRelationship(relationship);
|
||||
|
||||
var targetTopic = relationship.getTargetTopic();
|
||||
targetTopic.removeRelationship(relationship);
|
||||
targetTopic.deleteRelationship(relationship);
|
||||
|
||||
this._workspace.removeChild(relationship);
|
||||
delete this._relationships[model.getId()];
|
||||
|
||||
this.getModel().removeRelationship(relationship);
|
||||
},
|
||||
|
||||
_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 topics = dmodel.getTopics();
|
||||
|
||||
for (var i = 0; i < topics.length; i++) {
|
||||
var t = topics[i];
|
||||
if (t.getModel().getId() == fromNodeId) {
|
||||
sourceTopic = t;
|
||||
}
|
||||
if (t.getModel().getId() == toNodeId) {
|
||||
targetTopic = t;
|
||||
}
|
||||
if (targetTopic != null && sourceTopic != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
var sourceTopicId = model.getFromNode();
|
||||
var sourceTopic = dmodel.findTopicById(sourceTopicId);
|
||||
|
||||
// Create node graph ...
|
||||
var relationLine = new mindplot.RelationshipLine(sourceTopic, targetTopic, model.getLineType());
|
||||
if ($defined(model.getSrcCtrlPoint())) {
|
||||
var srcPoint = model.getSrcCtrlPoint().clone();
|
||||
relationLine.setSrcControlPoint(srcPoint);
|
||||
}
|
||||
if ($defined(model.getDestCtrlPoint())) {
|
||||
var destPoint = model.getDestCtrlPoint().clone();
|
||||
relationLine.setDestControlPoint(destPoint);
|
||||
}
|
||||
var targetTopicId = model.getToNode();
|
||||
var targetTopic = dmodel.findTopicById(targetTopicId);
|
||||
|
||||
|
||||
relationLine.getLine().setDashed(3, 2);
|
||||
relationLine.setShowEndArrow(model.getEndArrow());
|
||||
relationLine.setShowStartArrow(model.getStartArrow());
|
||||
relationLine.setModel(model);
|
||||
|
||||
//Add Listeners
|
||||
relationLine.addEvent('onfocus', function (event) {
|
||||
elem.onObjectFocusEvent(relationLine, event);
|
||||
});
|
||||
// Build relationship line ....
|
||||
var relationship = new mindplot.Relationship(sourceTopic, targetTopic, model);
|
||||
relationship.addEvent('onfocus', function (event) {
|
||||
this.onObjectFocusEvent(relationship, event);
|
||||
}.bind(this));
|
||||
|
||||
// Append it to the workspace ...
|
||||
dmodel.addRelationship(model.getId(), relationLine);
|
||||
|
||||
return relationLine;
|
||||
dmodel.addRelationship(relationship);
|
||||
return relationship;
|
||||
},
|
||||
|
||||
_removeNode:function (node) {
|
||||
_removeTopic:function (node) {
|
||||
if (node.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
var parent = node._parent;
|
||||
node.disconnect(this._workspace);
|
||||
|
||||
//remove children
|
||||
while (node.getChildren().length > 0) {
|
||||
this._removeNode(node.getChildren()[0]);
|
||||
this._removeTopic(node.getChildren()[0]);
|
||||
}
|
||||
|
||||
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) {
|
||||
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 topicsIds = model.filterTopicsIds(validateFunc, validateError);
|
||||
var relIds = model.filterRelationIds(validateFunc, validateError);
|
||||
var topicIds = model.filterTopicsIds(validateFunc, validateError);
|
||||
var relIds = model.filterSelectedRelationships().map(function (rel) {
|
||||
return rel.getId();
|
||||
});
|
||||
|
||||
if (topicsIds.length > 0 || relIds.length > 0) {
|
||||
this._actionDispatcher.deleteTopics(topicsIds, relIds);
|
||||
// Finally delete the topics ...
|
||||
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 keyboardEvents = {
|
||||
'backspace':function (event) {
|
||||
designer.deleteCurrentNode();
|
||||
designer.deleteSelectedEntities();
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@ -61,7 +61,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
}.bind(this),
|
||||
|
||||
'delete':function () {
|
||||
designer.deleteCurrentNode();
|
||||
designer.deleteSelectedEntities();
|
||||
}.bind(this),
|
||||
|
||||
'enter':function () {
|
||||
|
@ -21,7 +21,7 @@ mindplot.DesignerModel = new Class({
|
||||
initialize:function (options) {
|
||||
this._zoom = options.zoom;
|
||||
this._topics = [];
|
||||
this._relationships = {};
|
||||
this._relationships = [];
|
||||
},
|
||||
|
||||
getZoom:function () {
|
||||
@ -36,6 +36,10 @@ mindplot.DesignerModel = new Class({
|
||||
return this._topics;
|
||||
},
|
||||
|
||||
getRelationships:function () {
|
||||
return this._relationships;
|
||||
},
|
||||
|
||||
getCentralTopic:function () {
|
||||
var topics = this.getTopics();
|
||||
return topics[0];
|
||||
@ -51,22 +55,19 @@ mindplot.DesignerModel = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
filterSelectedRelations : function() {
|
||||
filterSelectedRelationships:function () {
|
||||
var result = [];
|
||||
for (var id in this._relationships) {
|
||||
var relationship = this._relationships[id];
|
||||
if (relationship.isOnFocus()) {
|
||||
result.push(relationship);
|
||||
for (var i = 0; i < this._relationships.length; i++) {
|
||||
if (this._relationships[i].isOnFocus()) {
|
||||
result.push(this._relationships[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
getObjects : function() {
|
||||
getEntities:function () {
|
||||
var result = [].append(this._topics);
|
||||
for (var id in this._relationships) {
|
||||
result.push(this._relationships[id]);
|
||||
}
|
||||
result.append(this._relationships);
|
||||
return result;
|
||||
},
|
||||
|
||||
@ -75,16 +76,19 @@ mindplot.DesignerModel = new Class({
|
||||
this._topics.erase(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");
|
||||
this._topics.push(topic);
|
||||
},
|
||||
|
||||
addRelationship : function(id, rel) {
|
||||
addRelationship:function (rel) {
|
||||
$assert(rel, "rel can not be null");
|
||||
$assert(id, "id can not be null");
|
||||
|
||||
this._relationships[id] = rel;
|
||||
this._relationships.push(rel);
|
||||
},
|
||||
|
||||
filterTopicsIds:function (validate, errorMsg) {
|
||||
@ -109,30 +113,6 @@ mindplot.DesignerModel = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
filterRelationIds : function(validate, errorMsg) {
|
||||
var result = [];
|
||||
var relationships = this.filterSelectedRelations();
|
||||
|
||||
var isValid = true;
|
||||
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();
|
||||
|
@ -85,7 +85,9 @@ mindplot.Messages.BUNDLES = {
|
||||
ISOLATED_TOPIC:'Isolated Topic',
|
||||
CENTRAL_TOPIC:'Central Topic',
|
||||
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.',
|
||||
CENTRAL_TOPIC_CAN_NOT_BE_DELETED: 'Central topic can not be deleted.'
|
||||
},
|
||||
'es':{
|
||||
DISCARD_CHANGES:'Descartar Cambios',
|
||||
|
@ -119,7 +119,7 @@ mindplot.NodeGraph = new Class({
|
||||
this.closeEditors();
|
||||
|
||||
// Fire event ...
|
||||
this.fireEvent(focus ? 'ontfocus' : 'ontblur');
|
||||
this.fireEvent(focus ? 'ontfocus' : 'ontblur',this);
|
||||
|
||||
}
|
||||
},
|
||||
|
@ -15,15 +15,25 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.RelationshipLine = new Class({
|
||||
mindplot.Relationship = new Class({
|
||||
Extends:mindplot.ConnectionLine,
|
||||
initialize:function(sourceNode, targetNode, lineType) {
|
||||
this.parent(sourceNode, targetNode, lineType);
|
||||
initialize:function (sourceNode, targetNode, model) {
|
||||
$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.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.setStroke(2, "solid", "#3f96ff");
|
||||
|
||||
var ctrlPoints = this._line2d.getControlPoints();
|
||||
this._focusShape.setSrcControlPoint(ctrlPoints[0]);
|
||||
this._focusShape.setDestControlPoint(ctrlPoints[1]);
|
||||
@ -32,15 +42,27 @@ mindplot.RelationshipLine = new Class({
|
||||
this._isInWorkspace = false;
|
||||
this._controlPointsController = new mindplot.ControlPoint();
|
||||
|
||||
var strokeColor = mindplot.RelationshipLine.getStrokeColor();
|
||||
this._startArrow = new web2d.Arrow();
|
||||
this._endArrow = new web2d.Arrow();
|
||||
this._startArrow.setStrokeColor(strokeColor);
|
||||
this._startArrow.setStrokeWidth(2);
|
||||
this.setShowStartArrow(true);
|
||||
|
||||
// Share style is disable ...
|
||||
if (this._showEndArrow) {
|
||||
this._endArrow = new web2d.Arrow();
|
||||
this._endArrow.setStrokeColor(strokeColor);
|
||||
this._endArrow.setStrokeWidth(2);
|
||||
this._line2d.setStroke(1, 'solid', strokeColor);
|
||||
}
|
||||
|
||||
// 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) {
|
||||
@ -82,7 +104,7 @@ mindplot.RelationshipLine = new Class({
|
||||
line2d.moveToFront();
|
||||
|
||||
//Positionate Arrows
|
||||
this._positionateArrows();
|
||||
this._positionArrows();
|
||||
|
||||
// Add connector ...
|
||||
this._positionateConnector(targetTopic);
|
||||
@ -94,40 +116,51 @@ mindplot.RelationshipLine = new Class({
|
||||
this._controlPointsController.redraw();
|
||||
},
|
||||
|
||||
_positionateArrows : function() {
|
||||
_positionArrows:function () {
|
||||
var tpos = this._line2d.getTo();
|
||||
this._endArrow.setFrom(tpos.x, tpos.y);
|
||||
|
||||
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();
|
||||
|
||||
if (this._endArrow) {
|
||||
this._endArrow.setFrom(tpos.x, tpos.y);
|
||||
this._endArrow.moveToBack();
|
||||
}
|
||||
|
||||
if (this._line2d.getType() == "CurvedLine") {
|
||||
var controlPoints = this._line2d.getControlPoints();
|
||||
this._startArrow.setControlPoint(controlPoints[0]);
|
||||
if (this._endArrow) {
|
||||
this._endArrow.setControlPoint(controlPoints[1]);
|
||||
}
|
||||
} else {
|
||||
this._startArrow.setControlPoint(this._line2d.getTo());
|
||||
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);
|
||||
},
|
||||
|
||||
addToWorkspace:function (workspace) {
|
||||
workspace.appendChild(this._focusShape);
|
||||
workspace.appendChild(this._controlPointsController);
|
||||
|
||||
this._controlPointControllerListener = this._initializeControlPointController.bind(this);
|
||||
this._line2d.addEvent('click', this._controlPointControllerListener);
|
||||
this._isInWorkspace = true;
|
||||
|
||||
workspace.appendChild(this._startArrow);
|
||||
if (this._endArrow)
|
||||
workspace.appendChild(this._endArrow);
|
||||
|
||||
this.parent(workspace);
|
||||
this._positionArrows();
|
||||
},
|
||||
|
||||
_initializeControlPointController:function () {
|
||||
@ -140,13 +173,14 @@ mindplot.RelationshipLine = new Class({
|
||||
this._line2d.removeEvent('click', this._controlPointControllerListener);
|
||||
this._isInWorkspace = false;
|
||||
workspace.removeChild(this._startArrow);
|
||||
if (this._endArrow)
|
||||
workspace.removeChild(this._endArrow);
|
||||
|
||||
this.parent(workspace);
|
||||
},
|
||||
|
||||
getType:function () {
|
||||
return mindplot.RelationshipLine.type;
|
||||
return mindplot.Relationship.type;
|
||||
},
|
||||
|
||||
setOnFocus:function (focus) {
|
||||
@ -160,7 +194,7 @@ mindplot.RelationshipLine = new Class({
|
||||
|
||||
this._controlPointsController.setVisibility(focus);
|
||||
this._onFocus = focus;
|
||||
this._line2d.setCursor(this.isOnFocus() ? 'default' : 'pointer');
|
||||
console.log("foucus:....");
|
||||
|
||||
}
|
||||
},
|
||||
@ -199,7 +233,8 @@ mindplot.RelationshipLine = new Class({
|
||||
|
||||
setVisibility:function (value) {
|
||||
this.parent(value);
|
||||
this._endArrow.setVisibility(this._showEndArrow && value);
|
||||
if (this._showEndArrow)
|
||||
this._endArrow.setVisibility(this._showEndArrow);
|
||||
this._startArrow.setVisibility(this._showStartArrow && value);
|
||||
},
|
||||
|
||||
@ -223,27 +258,20 @@ mindplot.RelationshipLine = new Class({
|
||||
this.redraw();
|
||||
},
|
||||
|
||||
isShowEndArrow : function() {
|
||||
return this._showEndArrow;
|
||||
},
|
||||
|
||||
isShowStartArrow : function() {
|
||||
return this._showStartArrow;
|
||||
},
|
||||
|
||||
setFrom:function (x, y) {
|
||||
$assert(x, "x must be defined");
|
||||
$assert(y, "y must be defined");
|
||||
$assert($defined(x), "x must be defined");
|
||||
$assert($defined(y), "y must be defined");
|
||||
|
||||
this._line2d.setFrom(x, y);
|
||||
this._startArrow.setFrom(x, y);
|
||||
},
|
||||
|
||||
setTo:function (x, y) {
|
||||
$assert(y, "x must be defined");
|
||||
$assert(y, "y must be defined");
|
||||
$assert($defined(x), "x must be defined");
|
||||
$assert($defined(y), "y must be defined");
|
||||
|
||||
this._line2d.setTo(x, y);
|
||||
if (this._endArrow)
|
||||
this._endArrow.setFrom(x, y);
|
||||
},
|
||||
|
||||
@ -254,6 +282,7 @@ mindplot.RelationshipLine = new Class({
|
||||
|
||||
setDestControlPoint:function (control) {
|
||||
this._line2d.setDestControlPoint(control);
|
||||
if (this._showEndArrow)
|
||||
this._endArrow.setControlPoint(control);
|
||||
},
|
||||
|
||||
@ -275,10 +304,15 @@ mindplot.RelationshipLine = new Class({
|
||||
|
||||
setIsDestControlPointCustom:function (isCustom) {
|
||||
this._line2d.setIsDestControlPointCustom(isCustom);
|
||||
}});
|
||||
},
|
||||
|
||||
getId: function(){
|
||||
return this._model.getId();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mindplot.RelationshipLine.type = "RelationshipLine";
|
||||
mindplot.RelationshipLine.getStrokeColor = function() {
|
||||
mindplot.Relationship.type = "Relationship";
|
||||
mindplot.Relationship.getStrokeColor = function () {
|
||||
return '#9b74e6';
|
||||
};
|
@ -39,7 +39,7 @@ mindplot.StandaloneActionDispatcher = new Class({
|
||||
this.execute(command);
|
||||
},
|
||||
|
||||
deleteTopics: function(topicsIds, relIds) {
|
||||
deleteEntities:function (topicsIds, relIds) {
|
||||
var command = new mindplot.commands.DeleteCommand(topicsIds, relIds);
|
||||
this.execute(command);
|
||||
},
|
||||
@ -255,7 +255,7 @@ mindplot.CommandContext = new Class({
|
||||
},
|
||||
|
||||
deleteTopic:function (topic) {
|
||||
this._designer._removeNode(topic);
|
||||
this._designer._removeTopic(topic);
|
||||
},
|
||||
|
||||
createTopic:function (model, isVisible) {
|
||||
@ -280,19 +280,21 @@ mindplot.CommandContext = new Class({
|
||||
$assert(model, "model cannot be null");
|
||||
return this._designer.createRelationship(model);
|
||||
},
|
||||
removeRelationship:function(model) {
|
||||
this._designer.removeRelationship(model);
|
||||
|
||||
deleteRelationship:function (relationship) {
|
||||
this._designer._deleteRelationship(relationship);
|
||||
},
|
||||
|
||||
findRelationships:function(lineIds) {
|
||||
var result = [];
|
||||
lineIds.forEach(function(lineId) {
|
||||
var line = this._designer.getModel().getRelationshipsById()[lineId];
|
||||
if ($defined(line)) {
|
||||
result.push(line);
|
||||
findRelationships:function (relIds) {
|
||||
$assert($defined(relIds), "relId can not be null");
|
||||
if (!(relIds instanceof Array)) {
|
||||
relIds = [relIds];
|
||||
}
|
||||
}.bind(this));
|
||||
return result;
|
||||
|
||||
var designerRel = this._designer.getModel().getRelationships();
|
||||
return designerRel.filter(function (rel) {
|
||||
return relIds.contains(rel.getId());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -315,7 +315,7 @@ mindplot.Topic = new Class({
|
||||
this._relationships.push(relationship);
|
||||
},
|
||||
|
||||
removeRelationship : function(relationship) {
|
||||
deleteRelationship : function(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++) {
|
||||
var brixNodeModel = brixChildren.get(i);
|
||||
var cmodel = new mindplot.collaboration.framework.brix.model.NodeModel(this._brixFramework, brixNodeModel, this.getMindmap());
|
||||
actionDispatcher.deleteTopics([cmodel.getId()]);
|
||||
actionDispatcher.deleteEntities([cmodel.getId()]);
|
||||
}
|
||||
} catch(e) {
|
||||
console.trace();
|
||||
|
@ -32,7 +32,7 @@ mindplot.commands.AddRelationshipCommand = new Class({
|
||||
relationship.setOnFocus(true);
|
||||
},
|
||||
undoExecute: function(commandContext) {
|
||||
var relationship = commandContext.removeRelationship(this._model);
|
||||
var relationship = commandContext.deleteRelationship(this._model);
|
||||
|
||||
// @Todo: Esto esta mal. Designer toca el mindmap ...
|
||||
// this._mindmap.removeRelationship(this._model);
|
||||
|
@ -41,8 +41,9 @@ mindplot.commands.DeleteCommand = new Class({
|
||||
var relationships = topic.getRelationships();
|
||||
while (relationships.length > 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);
|
||||
@ -61,13 +62,11 @@ mindplot.commands.DeleteCommand = new Class({
|
||||
}.bind(this)
|
||||
);
|
||||
}
|
||||
var lines = commandContext.findRelationships(this._relIds);
|
||||
if (lines.length > 0) {
|
||||
lines.forEach(function(line, index) {
|
||||
if (line.isInWorkspace()) {
|
||||
this._deletedRelationships.push(line.getModel().clone());
|
||||
commandContext.removeRelationship(line.getModel());
|
||||
}
|
||||
var rels = commandContext.findRelationships(this._relIds);
|
||||
if (rels.length > 0) {
|
||||
rels.forEach(function (rel) {
|
||||
this._deletedRelationships.push(rel.getModel().clone());
|
||||
commandContext.deleteRelationship(rel);
|
||||
}.bind(this));
|
||||
}
|
||||
},
|
||||
@ -90,8 +89,8 @@ mindplot.commands.DeleteCommand = new Class({
|
||||
}.bind(this)
|
||||
);
|
||||
this._deletedRelationships.forEach(
|
||||
function(relationship, index) {
|
||||
commandContext.createRelationship(relationship);
|
||||
function (rel) {
|
||||
commandContext.createRelationship(rel);
|
||||
}.bind(this));
|
||||
|
||||
this._deletedTopicModels = [];
|
||||
|
@ -100,7 +100,7 @@ mindplot.model.IMindmap = new Class({
|
||||
throw "Unsupported operation";
|
||||
},
|
||||
|
||||
removeRelationship : function(relationship) {
|
||||
deleteRelationship : function(relationship) {
|
||||
throw "Unsupported operation";
|
||||
},
|
||||
|
||||
|
@ -106,7 +106,7 @@ mindplot.model.Mindmap = new Class({
|
||||
this._relationships.push(relationship);
|
||||
},
|
||||
|
||||
removeRelationship : function(relationship) {
|
||||
deleteRelationship : function(relationship) {
|
||||
this._relationships.erase(relationship);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.model.RelationshipModel = new Class({
|
||||
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(targetTopicId), 'to node type can not be null');
|
||||
@ -39,6 +49,7 @@ mindplot.model.RelationshipModel = new Class({
|
||||
},
|
||||
|
||||
getId:function () {
|
||||
$assert(this._id, "id is null");
|
||||
return this._id;
|
||||
},
|
||||
|
||||
@ -99,15 +110,3 @@ mindplot.model.RelationshipModel = new Class({
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
var relationDom = document.createElement("relationship");
|
||||
relationDom.setAttribute("srcTopicId", relationship.getFromNode());
|
||||
relationDom.setAttribute("destTopicId", relationship.getToNode());
|
||||
var result = document.createElement("relationship");
|
||||
result.setAttribute("srcTopicId", relationship.getFromNode());
|
||||
result.setAttribute("destTopicId", relationship.getToNode());
|
||||
|
||||
var lineType = relationship.getLineType();
|
||||
relationDom.setAttribute("lineType", lineType);
|
||||
result.setAttribute("lineType", lineType);
|
||||
if (lineType == mindplot.ConnectionLine.CURVED || lineType == mindplot.ConnectionLine.SIMPLE_CURVED) {
|
||||
if ($defined(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())) {
|
||||
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());
|
||||
relationDom.setAttribute("startArrow", relationship.getStartArrow());
|
||||
return relationDom;
|
||||
result.setAttribute("endArrow", relationship.getEndArrow());
|
||||
result.setAttribute("startArrow", relationship.getStartArrow());
|
||||
return result;
|
||||
},
|
||||
|
||||
loadFromDom : function(dom, mapId) {
|
||||
|
@ -258,7 +258,7 @@ mindplot.widget.Menu = new Class({
|
||||
|
||||
|
||||
this._addButton('deleteTopic', true, true, function () {
|
||||
designer.deleteCurrentNode();
|
||||
designer.deleteSelectedEntities();
|
||||
});
|
||||
this._registerTooltip('deleteTopic', $msg('TOPIC_DELETE'), "Delete");
|
||||
|
||||
@ -446,7 +446,7 @@ mindplot.widget.Menu = new Class({
|
||||
|
||||
designer.addEvent('onblur', function () {
|
||||
var topics = designer.getModel().filterSelectedTopics();
|
||||
var rels = designer.getModel().filterSelectedRelations();
|
||||
var rels = designer.getModel().filterSelectedRelationships();
|
||||
|
||||
this._toolbarElems.forEach(function (button) {
|
||||
var disable = false;
|
||||
@ -472,7 +472,7 @@ mindplot.widget.Menu = new Class({
|
||||
|
||||
designer.addEvent('onfocus', function () {
|
||||
var topics = designer.getModel().filterSelectedTopics();
|
||||
var rels = designer.getModel().filterSelectedRelations();
|
||||
var rels = designer.getModel().filterSelectedRelationships();
|
||||
|
||||
this._toolbarElems.forEach(function (button) {
|
||||
if (button.isTopicAction() && topics.length > 0) {
|
||||
|
@ -43,3 +43,5 @@ SUB_TOPIC=Sub Topic
|
||||
ISOLATED_TOPIC=Isolated Topic
|
||||
CENTRAL_TOPIC=Central Topic
|
||||
SHORTCUTS=Keyboard Shortcuts
|
||||
ENTITIES_COULD_NOT_BE_DELETED=Could not delete topic or relation. At least one map entity must be selected.
|
||||
CENTRAL_TOPIC_CAN_NOT_BE_DELETED=Central topic can not be deleted.
|
@ -90,6 +90,9 @@ public class UserServiceImpl
|
||||
|
||||
@Override
|
||||
public void auditLogin(@NotNull User user) {
|
||||
if(user==null){
|
||||
throw new IllegalArgumentException("User can not be null");
|
||||
}
|
||||
final AccessAuditory accessAuditory = new AccessAuditory();
|
||||
accessAuditory.setUser(user);
|
||||
accessAuditory.setLoginDate(Calendar.getInstance());
|
||||
|
Loading…
Reference in New Issue
Block a user