Bug WA-57 fixed. #resolve

This commit is contained in:
Paulo Gustavo Veiga 2015-04-11 19:41:45 -03:00
parent 2914f5b256
commit 2f26b19250

View File

@ -24,7 +24,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @param {HTMLElement} divElement * @param {HTMLElement} divElement
* @extends mindplot.Events * @extends mindplot.Events
*/ */
initialize:function (options, divElement) { initialize: function (options, divElement) {
$assert(options, "options must be defined"); $assert(options, "options must be defined");
$assert(options.zoom, "zoom must be defined"); $assert(options.zoom, "zoom must be defined");
$assert(options.size, "size must be defined"); $assert(options.size, "size must be defined");
@ -81,7 +81,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
/** /**
* @private * @private
*/ */
_registerWheelEvents:function () { _registerWheelEvents: function () {
var workspace = this._workspace; var workspace = this._workspace;
var me = this; var me = this;
// Zoom In and Zoom Out must active event // Zoom In and Zoom Out must active event
@ -89,20 +89,20 @@ mindplot.Designer = new Class(/** @lends Designer */{
// Change mousewheel handling so we let the default // Change mousewheel handling so we let the default
// event happen if we are outside the container. -> FIXME: it still happening? // event happen if we are outside the container. -> FIXME: it still happening?
/*var coords = screenManager.getContainer().getCoordinates(); /*var coords = screenManager.getContainer().getCoordinates();
var isOutsideContainer = event.client.y < coords.top || var isOutsideContainer = event.client.y < coords.top ||
event.client.y > coords.bottom || event.client.y > coords.bottom ||
event.client.x < coords.left || event.client.x < coords.left ||
event.client.x > coords.right; event.client.x > coords.right;
if (!isOutsideContainer) { if (!isOutsideContainer) {
if (event.wheel > 0) { if (event.wheel > 0) {
this.zoomIn(1.05); this.zoomIn(1.05);
} }
else { else {
this.zoomOut(1.05); this.zoomOut(1.05);
} }
event.preventDefault(); event.preventDefault();
}*/ }*/
if (event.deltaY > 0) { if (event.deltaY > 0) {
me.zoomIn(1.05); me.zoomIn(1.05);
} }
@ -118,7 +118,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @param {Function} listener * @param {Function} listener
* forwards to the TopicEventDispatcher or the parent Events class, depending on the type * forwards to the TopicEventDispatcher or the parent Events class, depending on the type
*/ */
addEvent:function (type, listener) { addEvent: function (type, listener) {
if (type == mindplot.TopicEvent.EDIT || type == mindplot.TopicEvent.CLICK) { if (type == mindplot.TopicEvent.EDIT || type == mindplot.TopicEvent.CLICK) {
var editor = mindplot.TopicEventDispatcher.getInstance(); var editor = mindplot.TopicEventDispatcher.getInstance();
editor.addEvent(type, listener); editor.addEvent(type, listener);
@ -130,7 +130,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
/** /**
* @private * @private
*/ */
_registerMouseEvents:function () { _registerMouseEvents: function () {
var workspace = this._workspace; var workspace = this._workspace;
var screenManager = workspace.getScreenManager(); var screenManager = workspace.getScreenManager();
var me = this; var me = this;
@ -138,7 +138,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
screenManager.addEvent('update', function () { screenManager.addEvent('update', function () {
// Topic must be set to his original state. All editors must be closed. // Topic must be set to his original state. All editors must be closed.
var topics = me.getModel().getTopics(); var topics = me.getModel().getTopics();
_.each(topics, function(object){ _.each(topics, function (object) {
object.closeEditors(); object.closeEditors();
}); });
@ -160,13 +160,13 @@ mindplot.Designer = new Class(/** @lends Designer */{
var model = me._createChildModel(centralTopic, mousePos); var model = me._createChildModel(centralTopic, mousePos);
this._actionDispatcher.addTopics([model], [centralTopic.getId()]); this._actionDispatcher.addTopics([model], [centralTopic.getId()]);
} }
}); }.bind(this));
// Register mouse drag and drop event ... // Register mouse drag and drop event ...
function noopHandler(evt) { function noopHandler(evt) {
evt.stopPropagation(); evt.stopPropagation();
evt.preventDefault(); evt.preventDefault();
}; }
}, },
/** /**
@ -175,7 +175,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @return {mindplot.DragManager} the new dragManager for the workspace with events * @return {mindplot.DragManager} the new dragManager for the workspace with events
* registered * registered
*/ */
_buildDragManager:function (workspace) { _buildDragManager: function (workspace) {
var designerModel = this.getModel(); var designerModel = this.getModel();
var dragConnector = new mindplot.DragConnector(designerModel, this._workspace); var dragConnector = new mindplot.DragConnector(designerModel, this._workspace);
@ -215,7 +215,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @param {width:Number, height:Number} size * @param {width:Number, height:Number} size
* sets width and height of the workspace * sets width and height of the workspace
*/ */
setViewPort:function (size) { setViewPort: function (size) {
this._workspace.setViewPort(size); this._workspace.setViewPort(size);
var model = this.getModel(); var model = this.getModel();
this._workspace.setZoom(model.getZoom(), true); this._workspace.setZoom(model.getZoom(), true);
@ -228,9 +228,9 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @return {mindplot.CentralTopic|mindplot.MainTopic} the topic to the given model, * @return {mindplot.CentralTopic|mindplot.MainTopic} the topic to the given model,
* connected, added to the drag manager, with events registered - complying type & read mode * connected, added to the drag manager, with events registered - complying type & read mode
*/ */
_buildNodeGraph:function (model, readOnly) { _buildNodeGraph: function (model, readOnly) {
// Create node graph ... // Create node graph ...
var topic = mindplot.NodeGraph.create(model, {readOnly:readOnly}); var topic = mindplot.NodeGraph.create(model, {readOnly: readOnly});
this.getModel().addTopic(topic); this.getModel().addTopic(topic);
var me = this; var me = this;
// Add Topic events ... // Add Topic events ...
@ -296,16 +296,16 @@ mindplot.Designer = new Class(/** @lends Designer */{
* sets focus to the given currentObject and removes it from any other objects if not * sets focus to the given currentObject and removes it from any other objects if not
* triggered with Ctrl pressed * triggered with Ctrl pressed
*/ */
onObjectFocusEvent:function (currentObject, event) { onObjectFocusEvent: function (currentObject, event) {
// Close node editors .. // Close node editors ..
var topics = this.getModel().getTopics(); var topics = this.getModel().getTopics();
_.each(topics, function(topic) { _.each(topics, function (topic) {
topic.closeEditors(); topic.closeEditors();
}); });
var model = this.getModel(); var model = this.getModel();
var objects = model.getEntities(); var objects = model.getEntities();
_.each(objects, function(object) { _.each(objects, 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.ctrlKey && !event.metaKey)) { if (!$defined(event) || (!event.ctrlKey && !event.metaKey)) {
if (object.isOnFocus() && object != currentObject) { if (object.isOnFocus() && object != currentObject) {
@ -317,16 +317,16 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** sets focus to all model entities, i.e. relationships and topics */ /** sets focus to all model entities, i.e. relationships and topics */
selectAll:function () { selectAll: function () {
var model = this.getModel(); var model = this.getModel();
var objects = model.getEntities(); var objects = model.getEntities();
_.each(objects, function(object) { _.each(objects, function (object) {
object.setOnFocus(true); object.setOnFocus(true);
}); });
}, },
/** removes focus from all model entities, i.e. relationships and topics */ /** removes focus from all model entities, i.e. relationships and topics */
deselectAll:function () { deselectAll: function () {
var objects = this.getModel().getEntities(); var objects = this.getModel().getEntities();
_.each(objects, function (object) { _.each(objects, function (object) {
object.setOnFocus(false); object.setOnFocus(false);
@ -337,7 +337,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* Set the zoom of the map * Set the zoom of the map
* @param {Number} zoom number between 0.3 and 1.9 * @param {Number} zoom number between 0.3 and 1.9
*/ */
setZoom:function (zoom) { setZoom: function (zoom) {
if (zoom > 1.9 || zoom < 0.3) { if (zoom > 1.9 || zoom < 0.3) {
$notify($msg('ZOOM_IN_ERROR')); $notify($msg('ZOOM_IN_ERROR'));
return; return;
@ -350,7 +350,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @param {Number=} factor * @param {Number=} factor
* zoom out by the given factor, or 1.2, if undefined * zoom out by the given factor, or 1.2, if undefined
*/ */
zoomOut:function (factor) { zoomOut: function (factor) {
if (!factor) if (!factor)
factor = 1.2; factor = 1.2;
@ -370,7 +370,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @param {Number=} factor * @param {Number=} factor
* zoom in by the given factor, or 1.2, if undefined * zoom in by the given factor, or 1.2, if undefined
*/ */
zoomIn:function (factor) { zoomIn: function (factor) {
if (!factor) if (!factor)
factor = 1.2; factor = 1.2;
@ -387,7 +387,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** copy selected topics to a private clipboard */ /** copy selected topics to a private clipboard */
copyToClipboard:function () { copyToClipboard: function () {
var topics = this.getModel().filterSelectedTopics(); var topics = this.getModel().filterSelectedTopics();
if (topics.length <= 0) { if (topics.length <= 0) {
// If there are more than one node selected, // If there are more than one node selected,
@ -414,7 +414,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** paste clipboard contents to the mindmap */ /** paste clipboard contents to the mindmap */
pasteClipboard:function () { pasteClipboard: function () {
if (this._clipboard.length == 0) { if (this._clipboard.length == 0) {
$notify($msg('CLIPBOARD_IS_EMPTY')); $notify($msg('CLIPBOARD_IS_EMPTY'));
return; return;
@ -424,12 +424,12 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** @return {mindplot.DesignerModel} model */ /** @return {mindplot.DesignerModel} model */
getModel:function () { getModel: function () {
return this._model; return this._model;
}, },
/** collapse the subtree of the selected topic */ /** collapse the subtree of the selected topic */
shrinkSelectedBranch:function () { shrinkSelectedBranch: function () {
var nodes = this.getModel().filterSelectedTopics(); var nodes = this.getModel().filterSelectedTopics();
if (nodes.length <= 0 || nodes.length != 1) { if (nodes.length <= 0 || nodes.length != 1) {
// If there are more than one node selected, // If there are more than one node selected,
@ -445,7 +445,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** create a NodeModel for the selected node's child and add it via the ActionDispatcher */ /** create a NodeModel for the selected node's child and add it via the ActionDispatcher */
createChildForSelectedNode:function () { createChildForSelectedNode: function () {
var nodes = this.getModel().filterSelectedTopics(); var nodes = this.getModel().filterSelectedTopics();
if (nodes.length <= 0) { if (nodes.length <= 0) {
// If there are more than one node selected, // If there are more than one node selected,
@ -473,49 +473,48 @@ mindplot.Designer = new Class(/** @lends Designer */{
/** /**
* @private * @private
*/ */
_copyNodeProps: function(sourceModel,targetModel){ _copyNodeProps: function (sourceModel, targetModel) {
// I don't copy the font size if the target is the source is the central topic. // I don't copy the font size if the target is the source is the central topic.
if(sourceModel.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) if (sourceModel.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
{
var fontSize = sourceModel.getFontSize(); var fontSize = sourceModel.getFontSize();
if(fontSize){ if (fontSize) {
targetModel.setFontSize(fontSize) targetModel.setFontSize(fontSize)
} }
} }
var fontFamily = sourceModel.getFontFamily(); var fontFamily = sourceModel.getFontFamily();
if(fontFamily){ if (fontFamily) {
targetModel.setFontFamily(fontFamily) targetModel.setFontFamily(fontFamily)
} }
var fontColor = sourceModel.getFontColor(); var fontColor = sourceModel.getFontColor();
if(fontColor){ if (fontColor) {
targetModel.setFontColor(fontColor) targetModel.setFontColor(fontColor)
} }
var fontWeight = sourceModel.getFontWeight(); var fontWeight = sourceModel.getFontWeight();
if(fontWeight){ if (fontWeight) {
targetModel.setFontWeight(fontWeight) targetModel.setFontWeight(fontWeight)
} }
var fontStyle = sourceModel.getFontStyle(); var fontStyle = sourceModel.getFontStyle();
if(fontStyle){ if (fontStyle) {
targetModel.setFontStyle(fontStyle) targetModel.setFontStyle(fontStyle)
} }
var shape = sourceModel.getShapeType(); var shape = sourceModel.getShapeType();
if(shape){ if (shape) {
targetModel.setShapeType(shape) targetModel.setShapeType(shape)
} }
var borderColor = sourceModel.getBorderColor(); var borderColor = sourceModel.getBorderColor();
if(borderColor){ if (borderColor) {
targetModel.setBorderColor(borderColor) targetModel.setBorderColor(borderColor)
} }
var backgroundColor = sourceModel.getBackgroundColor(); var backgroundColor = sourceModel.getBackgroundColor();
if(backgroundColor){ if (backgroundColor) {
targetModel.setBackgroundColor(backgroundColor) targetModel.setBackgroundColor(backgroundColor)
} }
}, },
@ -526,7 +525,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @param {core.Point} mousePos the mouse position * @param {core.Point} mousePos the mouse position
* @return {mindplot.NodeModel} the node model for the new child * @return {mindplot.NodeModel} the node model for the new child
*/ */
_createChildModel:function (topic, mousePos) { _createChildModel: function (topic, mousePos) {
// Create a new node ... // Create a new node ...
var parentModel = topic.getModel(); var parentModel = topic.getModel();
var mindmap = parentModel.getMindmap(); var mindmap = parentModel.getMindmap();
@ -540,7 +539,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
var position = result.position; var position = result.position;
childModel.setPosition(position.x, position.y); childModel.setPosition(position.x, position.y);
this._copyNodeProps(parentModel,childModel); this._copyNodeProps(parentModel, childModel);
return childModel; return childModel;
}, },
@ -550,7 +549,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @param {mindplot.model.NodeModel} model * @param {mindplot.model.NodeModel} model
* @todo not used * @todo not used
*/ */
addDraggedNode:function (event, model) { addDraggedNode: function (event, model) {
$assert(event, "event can not be null"); $assert(event, "event can not be null");
$assert(model, "model can not be null"); $assert(model, "model can not be null");
@ -568,7 +567,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* creates a sibling or child node of the selected node, if the selected node is the * creates a sibling or child node of the selected node, if the selected node is the
* central topic * central topic
*/ */
createSiblingForSelectedNode:function () { createSiblingForSelectedNode: function () {
var nodes = this.getModel().filterSelectedTopics(); var nodes = this.getModel().filterSelectedTopics();
if (nodes.length <= 0) { if (nodes.length <= 0) {
// If there are no nodes selected, // If there are no nodes selected,
@ -607,7 +606,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @param {mindplot.Topic} topic the topic to create the sibling to * @param {mindplot.Topic} topic the topic to create the sibling to
* @return {mindplot.NodeModel} the node model of the sibling * @return {mindplot.NodeModel} the node model of the sibling
*/ */
_createSiblingModel:function (topic) { _createSiblingModel: function (topic) {
var result = null; var result = null;
var parentTopic = topic.getOutgoingConnectedTopic(); var parentTopic = topic.getOutgoingConnectedTopic();
if (parentTopic != null) { if (parentTopic != null) {
@ -623,7 +622,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
result.setPosition(10, 10); // Set a dummy position ... result.setPosition(10, 10); // Set a dummy position ...
} }
this._copyNodeProps(model,result); this._copyNodeProps(model, result);
return result; return result;
}, },
@ -631,7 +630,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
/** /**
* @param {Event} event * @param {Event} event
*/ */
showRelPivot:function (event) { showRelPivot: function (event) {
var nodes = this.getModel().filterSelectedTopics(); var nodes = this.getModel().filterSelectedTopics();
if (nodes.length <= 0) { if (nodes.length <= 0) {
@ -649,20 +648,20 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** @return the zoom */ /** @return the zoom */
getMindmapProperties:function () { getMindmapProperties: function () {
return {zoom:this.getModel().getZoom()}; return {zoom: this.getModel().getZoom()};
}, },
/** /**
* @param {mindplot.Mindmap} mindmapModel * @param {mindplot.Mindmap} mindmapModel
* @throws will throw an error if mindmapModel is null or undefined * @throws will throw an error if mindmapModel is null or undefined
*/ */
loadMap:function (mindmapModel) { loadMap: function (mindmapModel) {
$assert(mindmapModel, "mindmapModel can not be null"); $assert(mindmapModel, "mindmapModel can not be null");
this._mindmap = mindmapModel; this._mindmap = mindmapModel;
// Init layout manager ... // Init layout manager ...
var size = {width:25, height:25}; var size = {width: 25, height: 25};
var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size); var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size);
var me = this; var me = this;
layoutManager.addEvent('change', function (event) { layoutManager.addEvent('change', function (event) {
@ -701,23 +700,23 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
getMindmap:function () { getMindmap: function () {
return this._mindmap; return this._mindmap;
}, },
/** */ /** */
undo:function () { undo: function () {
// @Todo: This is a hack... // @Todo: This is a hack...
this._actionDispatcher._actionRunner.undo(); this._actionDispatcher._actionRunner.undo();
}, },
/** */ /** */
redo:function () { redo: function () {
this._actionDispatcher._actionRunner.redo(); this._actionDispatcher._actionRunner.redo();
}, },
/** */ /** */
isReadOnly:function () { isReadOnly: function () {
return this._options.readOnly; return this._options.readOnly;
}, },
@ -725,7 +724,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @param {mindplot.model.NodeModel} nodeModel * @param {mindplot.model.NodeModel} nodeModel
* @return {mindplot.Topic} the topic (extends mindplot.NodeGraph) created to the model * @return {mindplot.Topic} the topic (extends mindplot.NodeGraph) created to the model
*/ */
nodeModelToNodeGraph:function (nodeModel) { nodeModelToNodeGraph: function (nodeModel) {
$assert(nodeModel, "Node model can not be null"); $assert(nodeModel, "Node model can not be null");
var children = nodeModel.getChildren().slice(); var children = nodeModel.getChildren().slice();
children = children.sort(function (a, b) { children = children.sort(function (a, b) {
@ -751,7 +750,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @return {mindplot.Relationship} the relationship created to the model * @return {mindplot.Relationship} the relationship created to the model
* @throws will throw an error if model is null or undefined * @throws will throw an error if model is null or undefined
*/ */
_relationshipModelToRelationship:function (model) { _relationshipModelToRelationship: function (model) {
$assert(model, "Node model can not be null"); $assert(model, "Node model can not be null");
var result = this._buildRelationshipShape(model); var result = this._buildRelationshipShape(model);
@ -772,7 +771,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @param {mindplot.model.RelationshipModel} model * @param {mindplot.model.RelationshipModel} model
* @return {mindplot.Relationship} the relationship added to the mindmap * @return {mindplot.Relationship} the relationship added to the mindmap
*/ */
addRelationship:function (model) { addRelationship: function (model) {
var mindmap = this.getMindmap(); var mindmap = this.getMindmap();
mindmap.addRelationship(model); mindmap.addRelationship(model);
return this._relationshipModelToRelationship(model); return this._relationshipModelToRelationship(model);
@ -782,7 +781,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* deletes the relationship from the linked topics, DesignerModel, Workspace and Mindmap * deletes the relationship from the linked topics, DesignerModel, Workspace and Mindmap
* @param {mindplot.Relationship} rel the relationship to delete * @param {mindplot.Relationship} rel the relationship to delete
*/ */
deleteRelationship:function (rel) { deleteRelationship: function (rel) {
var sourceTopic = rel.getSourceTopic(); var sourceTopic = rel.getSourceTopic();
sourceTopic.deleteRelationship(rel); sourceTopic.deleteRelationship(rel);
@ -802,7 +801,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @return {mindplot.Relationship} the new relationship with events registered * @return {mindplot.Relationship} the new relationship with events registered
* @throws will throw an error if the target topic cannot be found * @throws will throw an error if the target topic cannot be found
*/ */
_buildRelationshipShape:function (model) { _buildRelationshipShape: function (model) {
var dmodel = this.getModel(); var dmodel = this.getModel();
var sourceTopicId = model.getFromNode(); var sourceTopicId = model.getFromNode();
@ -839,14 +838,14 @@ mindplot.Designer = new Class(/** @lends Designer */{
// Append it to the workspace ... // Append it to the workspace ...
dmodel.addRelationship(result); dmodel.addRelationship(result);
return result; return result;
}, },
/** /**
* @param {mindplot.model.Topic} node the topic to remove * @param {mindplot.model.Topic} node the topic to remove
* removes the given topic and its children from Workspace, DesignerModel and NodeModel * removes the given topic and its children from Workspace, DesignerModel and NodeModel
*/ */
removeTopic:function (node) { removeTopic: function (node) {
if (!node.isCentralTopic()) { if (!node.isCentralTopic()) {
var parent = node._parent; var parent = node._parent;
node.disconnect(this._workspace); node.disconnect(this._workspace);
@ -872,7 +871,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
/** /**
* @private * @private
*/ */
_resetEdition:function () { _resetEdition: function () {
var screenManager = this._workspace.getScreenManager(); var screenManager = this._workspace.getScreenManager();
screenManager.fireEvent("update"); screenManager.fireEvent("update");
screenManager.fireEvent("mouseup"); screenManager.fireEvent("mouseup");
@ -880,7 +879,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
deleteSelectedEntities:function () { deleteSelectedEntities: function () {
// Is there some action in progress ?. // Is there some action in progress ?.
this._resetEdition(); this._resetEdition();
@ -899,8 +898,8 @@ mindplot.Designer = new Class(/** @lends Designer */{
var topicIds = topics.filter(function (topic) { var topicIds = topics.filter(function (topic) {
return !topic.isCentralTopic(); return !topic.isCentralTopic();
}).map(function (topic) { }).map(function (topic) {
return topic.getId() return topic.getId()
}); });
var relIds = relation.map(function (rel) { var relIds = relation.map(function (rel) {
@ -915,7 +914,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
changeFontFamily:function (font) { changeFontFamily: function (font) {
var topicsIds = this.getModel().filterTopicsIds(); var topicsIds = this.getModel().filterTopicsIds();
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontFamilyToTopic(topicsIds, font); this._actionDispatcher.changeFontFamilyToTopic(topicsIds, font);
@ -924,7 +923,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
changeFontStyle:function () { changeFontStyle: function () {
var topicsIds = this.getModel().filterTopicsIds(); var topicsIds = this.getModel().filterTopicsIds();
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontStyleToTopic(topicsIds); this._actionDispatcher.changeFontStyleToTopic(topicsIds);
@ -932,7 +931,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
changeFontColor:function (color) { changeFontColor: function (color) {
$assert(color, "color can not be null"); $assert(color, "color can not be null");
var topicsIds = this.getModel().filterTopicsIds(); var topicsIds = this.getModel().filterTopicsIds();
@ -942,7 +941,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
changeBackgroundColor:function (color) { changeBackgroundColor: function (color) {
var validateFunc = function (topic) { var validateFunc = function (topic) {
return topic.getShapeType() != mindplot.model.TopicShape.LINE; return topic.getShapeType() != mindplot.model.TopicShape.LINE;
@ -956,7 +955,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
changeBorderColor:function (color) { changeBorderColor: function (color) {
var validateFunc = function (topic) { var validateFunc = function (topic) {
return topic.getShapeType() != mindplot.model.TopicShape.LINE; return topic.getShapeType() != mindplot.model.TopicShape.LINE;
}; };
@ -968,7 +967,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
changeFontSize:function (size) { changeFontSize: function (size) {
var topicsIds = this.getModel().filterTopicsIds(); var topicsIds = this.getModel().filterTopicsIds();
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontSizeToTopic(topicsIds, size); this._actionDispatcher.changeFontSizeToTopic(topicsIds, size);
@ -976,7 +975,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
changeTopicShape:function (shape) { changeTopicShape: function (shape) {
var validateFunc = function (topic) { var validateFunc = function (topic) {
return !(topic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE && shape == mindplot.model.TopicShape.LINE) return !(topic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE && shape == mindplot.model.TopicShape.LINE)
}; };
@ -989,7 +988,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
changeFontWeight:function () { changeFontWeight: function () {
var topicsIds = this.getModel().filterTopicsIds(); var topicsIds = this.getModel().filterTopicsIds();
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontWeightToTopic(topicsIds); this._actionDispatcher.changeFontWeightToTopic(topicsIds);
@ -997,10 +996,10 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
addIconType:function (iconType) { addIconType: function (iconType) {
var topicsIds = this.getModel().filterTopicsIds(); var topicsIds = this.getModel().filterTopicsIds();
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.addFeatureToTopic(topicsIds[0], mindplot.TopicFeature.Icon.id, {id:iconType}); this._actionDispatcher.addFeatureToTopic(topicsIds[0], mindplot.TopicFeature.Icon.id, {id: iconType});
} }
}, },
@ -1008,7 +1007,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
* lets the selected topic open the link editor where the user can define or modify an * lets the selected topic open the link editor where the user can define or modify an
* existing link * existing link
*/ */
addLink:function () { addLink: function () {
var model = this.getModel(); var model = this.getModel();
var topic = model.selectedTopic(); var topic = model.selectedTopic();
if (topic) { if (topic) {
@ -1018,7 +1017,7 @@ mindplot.Designer = new Class(/** @lends Designer */{
}, },
/** */ /** */
addNote:function () { addNote: function () {
var model = this.getModel(); var model = this.getModel();
var topic = model.selectedTopic(); var topic = model.selectedTopic();
if (topic) { if (topic) {
@ -1031,13 +1030,13 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @param {mindplot.Topic} node * @param {mindplot.Topic} node
* sets the focus to the given node * sets the focus to the given node
*/ */
goToNode:function (node) { goToNode: function (node) {
node.setOnFocus(true); node.setOnFocus(true);
this.onObjectFocusEvent(node); this.onObjectFocusEvent(node);
}, },
/** @return {mindplot.Workspace} */ /** @return {mindplot.Workspace} */
getWorkSpace:function () { getWorkSpace: function () {
return this._workspace; return this._workspace;
} }
} }