diff --git a/core-js/src/main/javascript/Loader.js b/core-js/src/main/javascript/Loader.js
deleted file mode 100644
index 446cc826..00000000
--- a/core-js/src/main/javascript/Loader.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-core.Loader =
-{
- load: function(scriptPath, stylePath,jsFileName)
- {
- var headElement = document.getElementsByTagName('head');
- var htmlDoc = headElement.item(0);
- var baseUrl = this.baseUrl(jsFileName);
- if (scriptPath && scriptPath.length > 0)
- {
- for (var i = 0; i < scriptPath.length; i++)
- {
- this.includeScriptNode(baseUrl + scriptPath[i]);
- }
- }
- if (stylePath && stylePath.length > 0)
- {
- for (var i = 0; i < stylePath.length; i++)
- {
- this.includeStyleNode(baseUrl + stylePath[i]);
- }
- }
- },
- baseUrl: function(jsFileName)
- {
- var headElement = document.getElementsByTagName('head');
- var htmlDoc = headElement.item(0);
- var headChildren = htmlDoc.childNodes;
- var result = null;
- for (var i = 0; i < headChildren.length; i++)
- {
- var node = headChildren.item(i);
- if (node.nodeName && node.nodeName.toLowerCase() == "script")
- {
- var libraryUrl = node.src;
- if (libraryUrl.indexOf(jsFileName) != -1)
- {
- var index = libraryUrl.lastIndexOf("/");
- index = libraryUrl.lastIndexOf("/", index - 1);
- result = libraryUrl.substring(0, index);
- }
- }
- }
-
- if (result == null)
- {
- throw "Could not obtain the base url directory.";
- }
- return result;
- },
- includeScriptNode: function(filename) {
- var html_doc = document.getElementsByTagName('head').item(0);
- var js = document.createElement('script');
- js.setAttribute('language', 'javascript');
- js.setAttribute('type', 'text/javascript');
- js.setAttribute('src', filename);
- html_doc.appendChild(js);
- return false;
- },
- includeStyleNode: function(filename) {
- var html_doc = document.getElementsByTagName('head').item(0);
- var js = document.createElement('link');
- js.setAttribute('rel', 'stylesheet');
- js.setAttribute('type', 'text/css');
- js.setAttribute('href', filename);
- html_doc.appendChild(js);
- return false;
- }
-};
diff --git a/core-js/src/main/javascript/Utils.js b/core-js/src/main/javascript/Utils.js
index c6c369c2..56567599 100644
--- a/core-js/src/main/javascript/Utils.js
+++ b/core-js/src/main/javascript/Utils.js
@@ -78,14 +78,6 @@ Math.sign = function(value) {
};
-// Extensions ....
-function $import(src) {
- var scriptElem = document.createElement('script');
- scriptElem.setAttribute('src', src);
- scriptElem.setAttribute('type', 'text/javascript');
- document.getElementsByTagName('head')[0].appendChild(scriptElem);
-}
-
/**
* Retrieve the mouse position.
*/
@@ -274,6 +266,7 @@ core.Utils.calculateDefaultControlPoints = function(srcPos, tarPos) {
core.Utils.setVisibilityAnimated = function(elems, isVisible, doneFn) {
core.Utils.animateVisibility(elems, isVisible, doneFn);
};
+
core.Utils.setChildrenVisibilityAnimated = function(rootElem, isVisible) {
var children = core.Utils._addInnerChildrens(rootElem);
core.Utils.animateVisibility(children, isVisible);
diff --git a/mindplot/pom.xml b/mindplot/pom.xml
index 9f81212b..e340a744 100644
--- a/mindplot/pom.xml
+++ b/mindplot/pom.xml
@@ -55,6 +55,9 @@
+
+
+
@@ -67,7 +70,6 @@
-
@@ -171,6 +173,18 @@
files="collaboration/frameworks/brix/BrixFramework.js"/>
+
+
+
+
+
+
diff --git a/mindplot/src/main/javascript/ActionDispatcher.js b/mindplot/src/main/javascript/ActionDispatcher.js
new file mode 100644
index 00000000..ecf15e99
--- /dev/null
+++ b/mindplot/src/main/javascript/ActionDispatcher.js
@@ -0,0 +1,116 @@
+/*
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//noinspection JSUnusedLocalSymbols
+mindplot.ActionDispatcher = new Class({
+ Implements:[Events],
+ initialize: function(commandContext) {
+ $assert(commandContext, "commandContext can not be null");
+ },
+
+ addIconToTopic: function(topicId, iconType) {
+ throw "method must be implemented.";
+ },
+
+ addLinkToTopic: function(topicId, url) {
+ throw "method must be implemented.";
+ },
+
+ addNoteToTopic: function(topicId, text) {
+ throw "method must be implemented.";
+ },
+
+ addRelationship: function(model, mindmap) {
+ throw "method must be implemented.";
+ },
+
+ addTopic: function(model, parentTopicId, animated) {
+ throw "method must be implemented.";
+ },
+
+ deleteTopics: function(topicsIds) {
+ throw "method must be implemented.";
+ },
+
+ dragTopic: function(topicId, position, order, parentTopic) {
+ throw "method must be implemented.";
+ },
+
+ moveControlPoint: function(ctrlPoint, point) {
+ throw "method must be implemented.";
+ },
+
+ removeIconFromTopic: function(topicId, iconModel) {
+ throw "method must be implemented.";
+ },
+
+ removeLinkFromTopic: function(topicId) {
+ throw "method must be implemented.";
+ },
+
+ removeNoteFromTopic: function(topicId) {
+ throw "method must be implemented.";
+ },
+
+ changeFontFamilyToTopic: function(topicIds, fontFamily) {
+ throw "method must be implemented.";
+ },
+
+ changeFontStyleToTopic: function(topicsIds) {
+ throw "method must be implemented.";
+ },
+
+ changeFontColorToTopic: function(topicsIds, color) {
+ throw "method must be implemented.";
+ },
+
+ changeBackgroundColorToTopic: function(topicsIds, color) {
+ throw "method must be implemented.";
+ },
+
+ changeBorderColorToTopic: function(topicsIds, color) {
+ throw "method must be implemented.";
+ },
+
+ changeShapeToTopic : function(topicsIds, shapeType) {
+ throw "method must be implemented.";
+ },
+
+ changeFontWeightToTopic : function(topicsIds) {
+ throw "method must be implemented.";
+ },
+
+ changeTextOnTopic : function(topicsIds, text) {
+ throw "method must be implemented.";
+ },
+
+ shrinkBranch : function(topicsIds, collapse)
+ {
+ throw "method must be implemented.";
+ }
+
+});
+
+mindplot.ActionDispatcher.setInstance = function(dispatcher) {
+ mindplot.ActionDispatcher._instance = dispatcher;
+};
+
+mindplot.ActionDispatcher.getInstance = function() {
+ return mindplot.ActionDispatcher._instance;
+};
+
diff --git a/mindplot/src/main/javascript/ActionIcon.js b/mindplot/src/main/javascript/ActionIcon.js
index c262fadc..ff8261ec 100644
--- a/mindplot/src/main/javascript/ActionIcon.js
+++ b/mindplot/src/main/javascript/ActionIcon.js
@@ -19,7 +19,7 @@
mindplot.ActionIcon = new Class({
Extends:mindplot.Icon,
initialize: function(topic, url) {
- mindplot.Icon.call(this, url);
+ this.parent(url);
this._node = topic;
},
getNode:function() {
diff --git a/mindplot/src/main/javascript/BaseCommandDispatcher.js b/mindplot/src/main/javascript/BaseCommandDispatcher.js
deleted file mode 100644
index 95c62904..00000000
--- a/mindplot/src/main/javascript/BaseCommandDispatcher.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright [2011] [wisemapping]
- *
- * Licensed under WiseMapping Public License, Version 1.0 (the "License").
- * It is basically the Apache License, Version 2.0 (the "License") plus the
- * "powered by wisemapping" text requirement on every single page;
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the license at
- *
- * http://www.wisemapping.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-mindplot.BaseCommandDispatcher = new Class({
-
- initialize: function() {
- },
- addIconToTopic: function() {
- throw "method must be implemented.";
- },
- addLinkToTopic: function() {
- throw "method must be implemented.";
- },
- addNoteToTopic: function() {
- throw "method must be implemented.";
- },addRelationship: function() {
- throw "method must be implemented.";
- },addTopic: function() {
- throw "method must be implemented.";
- },changeIcon: function() {
- throw "method must be implemented.";
- },deleteTopic: function() {
- throw "method must be implemented.";
- },dragTopic: function() {
- throw "method must be implemented.";
- },moveControllPoint: function() {
- throw "method must be implemented.";
- } ,removeIconFromTopic: function() {
- throw "method must be implemented.";
- },removeLinkFromTopic: function() {
- throw "method must be implemented.";
- },removeNodeFromTopic: function() {
- throw "method must be implemented.";
- }
-});
-
diff --git a/mindplot/src/main/javascript/BrixActionDispatcher.js b/mindplot/src/main/javascript/BrixActionDispatcher.js
new file mode 100644
index 00000000..13745be0
--- /dev/null
+++ b/mindplot/src/main/javascript/BrixActionDispatcher.js
@@ -0,0 +1,25 @@
+/*
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+mindplot.BrixActionDispatcher = new Class({
+ Extends: mindplot.ActionDispatcher,
+ initialize: function(commandContext, fireOnChange) {
+ this.parent(commandContext, fireOnChange);
+ }
+});
+
diff --git a/mindplot/src/main/javascript/CentralTopic.js b/mindplot/src/main/javascript/CentralTopic.js
index fa75f00e..6534a9e4 100644
--- a/mindplot/src/main/javascript/CentralTopic.js
+++ b/mindplot/src/main/javascript/CentralTopic.js
@@ -33,7 +33,7 @@ mindplot.CentralTopic = new Class({
setCursor : function(type) {
type = (type == 'move') ? 'default' : type;
- mindplot.Topic.prototype.setCursor.call(this, type);
+ this.parent(type);
},
isConnectedToCentralTopic : function() {
diff --git a/mindplot/src/main/javascript/ControlPoint.js b/mindplot/src/main/javascript/ControlPoint.js
index cf8c4c2b..59214bee 100644
--- a/mindplot/src/main/javascript/ControlPoint.js
+++ b/mindplot/src/main/javascript/ControlPoint.js
@@ -113,8 +113,10 @@ mindplot.ControlPoint = new Class({
_mouseUp : function(event, point) {
this._workspace.getScreenManager().removeEventListener('mousemove', this._mouseMoveFunction);
this._workspace.getScreenManager().removeEventListener('mouseup', this._mouseUpFunction);
- var command = new mindplot.commands.MoveControlPointCommand(this, point);
- designer._actionRunner.execute(command); //todo:Uggly!! designer is global!!
+
+ var actionDispatcher = mindplot.ActionDispatcher.getInstance();
+ actionDispatcher.moveControlPoint(this, point);
+
this._isBinded = false;
/*event.preventDefault();
event.stop();
diff --git a/mindplot/src/main/javascript/DesignerActionRunner.js b/mindplot/src/main/javascript/DesignerActionRunner.js
index 4c88498c..18881bb9 100644
--- a/mindplot/src/main/javascript/DesignerActionRunner.js
+++ b/mindplot/src/main/javascript/DesignerActionRunner.js
@@ -17,40 +17,34 @@
*/
mindplot.DesignerActionRunner = new Class({
- initialize: function(designer) {
- this._designer = designer;
+ initialize: function(commandContext, notifier) {
+ $assert(commandContext, "commandContext can not be null");
+
this._undoManager = new mindplot.DesignerUndoManager();
- this._context = new mindplot.CommandContext(this._designer);
+ this._context = commandContext;
+ this._notifier = notifier;
},
execute:function(command) {
$assert(command, "command can not be null");
- // Execute action ...
command.execute(this._context);
-
- // Enqueue it ...
this._undoManager.enqueue(command);
-
- // Fire event
- var event = this._undoManager._buildEvent();
- this._designer._fireEvent("change", event);
+ this.fireChangeEvent();
},
undo: function() {
this._undoManager.execUndo(this._context);
-
- // Fire event
- var event = this._undoManager._buildEvent();
- this._designer._fireEvent("change", event);
+ this.fireChangeEvent();
},
redo: function() {
this._undoManager.execRedo(this._context);
+ this.fireChangeEvent();
+ },
- // Fire event
- var event = this._undoManager._buildEvent();
- this._designer._fireEvent("change", event);
-
+ fireChangeEvent : function () {
+ var event = this._undoManager.buildEvent();
+ this._notifier.fireEvent("modelUpdate", event);
},
markAsChangeBase: function() {
@@ -60,75 +54,3 @@ mindplot.DesignerActionRunner = new Class({
return this._undoManager.hasBeenChanged();
}
});
-
-mindplot.CommandContext = new Class({
- initialize: function(designer) {
- this._designer = designer;
- },
- findTopics:function(topicsIds) {
- var designerTopics = this._designer._topics;
- if (!(topicsIds instanceof Array)) {
- topicsIds = [topicsIds];
- }
-
- var result = designerTopics.filter(function(topic) {
- var found = false;
- if (topic != null) {
- var topicId = topic.getId();
- found = topicsIds.contains(topicId);
- }
- return found;
-
- });
- return result;
- },
- deleteTopic:function(topic) {
- this._designer._removeNode(topic);
- },
- createTopic:function(model, isVisible) {
- $assert(model, "model can not be null");
- var topic = this._designer._nodeModelToNodeGraph(model, isVisible);
-
- return topic;
- },
- createModel:function() {
- var mindmap = this._designer.getMindmap();
- var model = mindmap.createNode(mindplot.model.NodeModel.MAIN_TOPIC_TYPE);
- return model;
- },
- connect:function(childTopic, parentTopic, isVisible) {
- childTopic.connectTo(parentTopic, this._designer._workspace, isVisible);
- } ,
- disconnect:function(topic) {
- topic.disconnect(this._designer._workspace);
- },
- createRelationship:function(model) {
- $assert(model, "model cannot be null");
- var relationship = this._designer.createRelationship(model);
- return relationship;
- },
- removeRelationship:function(model) {
- this._designer.removeRelationship(model);
- },
- findRelationships:function(lineIds) {
- var result = [];
- lineIds.forEach(function(lineId, index) {
- var line = this._designer._relationships[lineId];
- if ($defined(line)) {
- result.push(line);
- }
- }.bind(this));
- return result;
- },
- getSelectedRelationshipLines:function() {
- return this._designer.getSelectedRelationshipLines();
- }
-});
-
-mindplot.DesignerActionRunner.setInstance = function(actionRunner) {
- mindplot.DesignerActionRunner._instance = actionRunner;
-};
-
-mindplot.DesignerActionRunner.getInstance = function() {
- return mindplot.DesignerActionRunner._instance;
-};
diff --git a/mindplot/src/main/javascript/DesignerUndoManager.js b/mindplot/src/main/javascript/DesignerUndoManager.js
index 91205e12..48bf215b 100644
--- a/mindplot/src/main/javascript/DesignerUndoManager.js
+++ b/mindplot/src/main/javascript/DesignerUndoManager.js
@@ -17,10 +17,12 @@
*/
mindplot.DesignerUndoManager = new Class({
- initialize: function() {
+ initialize: function(fireChange) {
this._undoQueue = [];
this._redoQueue = [];
this._baseId = 0;
+ this._fireChange = fireChange;
+
},
enqueue:function(command) {
@@ -55,7 +57,7 @@ mindplot.DesignerUndoManager = new Class({
}
},
- _buildEvent: function() {
+ buildEvent: function() {
return {undoSteps: this._undoQueue.length, redoSteps:this._redoQueue.length};
},
diff --git a/mindplot/src/main/javascript/DragPivot.js b/mindplot/src/main/javascript/DragPivot.js
index 4debdb2d..95867d38 100644
--- a/mindplot/src/main/javascript/DragPivot.js
+++ b/mindplot/src/main/javascript/DragPivot.js
@@ -201,8 +201,11 @@ mindplot.DragPivot = new Class({
// Connected to Rect ...
var connectRect = this._connectRect;
var targetSize = targetTopic.getSize();
- var width = targetSize.width;
- var height = targetSize.height;
+
+ // Add 4 pixel in order to keep create a rect bigger than the topic.
+ var width = targetSize.width + 4;
+ var height = targetSize.height + 4;
+
connectRect.setSize(width, height);
var targetPosition = targetTopic.getPosition();
diff --git a/mindplot/src/main/javascript/DragTopic.js b/mindplot/src/main/javascript/DragTopic.js
index fc38eaf0..dadae382 100644
--- a/mindplot/src/main/javascript/DragTopic.js
+++ b/mindplot/src/main/javascript/DragTopic.js
@@ -1,239 +1,203 @@
/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-mindplot.DragTopic = function(dragShape, draggedNode)
-{
- $assert(dragShape, 'Rect can not be null.');
- $assert(draggedNode, 'draggedNode can not be null.');
+mindplot.DragTopic = new Class({
+ initialize:function(dragShape, draggedNode) {
+ $assert(dragShape, 'Rect can not be null.');
+ $assert(draggedNode, 'draggedNode can not be null.');
- this._elem2d = dragShape;
- this._order = null;
- this._draggedNode = draggedNode;
- this._position = new core.Point();
-};
+ this._elem2d = dragShape;
+ this._order = null;
+ this._draggedNode = draggedNode;
+ this._position = new core.Point();
+ },
-mindplot.DragTopic.initialize = function(workspace)
-{
+ setOrder : function(order) {
+ this._order = order;
+ },
+
+ setPosition : function(x, y) {
+ this._position.setValue(x, y);
+
+ // Elements are positioned in the center.
+ // All topic element must be positioned based on the innerShape.
+ var draggedNode = this._draggedNode;
+ var size = draggedNode.getSize();
+
+ var cx = Math.ceil(x - (size.width / 2));
+ var cy = Math.ceil(y - (size.height / 2));
+
+ // Update visual position.
+ this._elem2d.setPosition(cx, cy);
+ },
+
+ getInnerShape : function() {
+ return this._elem2d;
+ },
+
+ disconnect : function(workspace) {
+ // Clear connection line ...
+ var dragPivot = this._getDragPivot();
+ dragPivot.disconnect(workspace);
+ },
+
+ canBeConnectedTo : function(targetTopic) {
+ $assert(targetTopic, 'parent can not be null');
+
+ var result = true;
+ if (!targetTopic.areChildrenShrinked() && !targetTopic.isCollapsed()) {
+ // Dragged node can not be connected to himself.
+ if (targetTopic == this._draggedNode) {
+ result = false;
+ } else {
+ var draggedNode = this.getDraggedTopic();
+ var topicPosition = this.getPosition();
+
+ var targetTopicModel = targetTopic.getModel();
+ var childTopicModel = draggedNode.getModel();
+
+ result = targetTopicModel.canBeConnected(childTopicModel, topicPosition, 18);
+ }
+ } else {
+ result = false;
+ }
+ return result;
+ },
+
+ connectTo : function(parent) {
+ $assert(parent, 'Parent connection node can not be null.');
+
+ var dragPivot = this._getDragPivot();
+ dragPivot.connectTo(parent);
+ },
+
+ getDraggedTopic : function() {
+ return this._draggedNode;
+ },
+
+
+ removeFromWorkspace : function(workspace) {
+ // Remove drag shadow.
+ workspace.removeChild(this._elem2d);
+
+ // Remove pivot shape. To improve performace it will not be removed. Only the visilility will be changed.
+ var dragPivot = this._getDragPivot();
+ dragPivot.setVisibility(false);
+ },
+
+ addToWorkspace : function(workspace) {
+ workspace.appendChild(this._elem2d);
+ var dragPivot = this._getDragPivot();
+
+ dragPivot.addToWorkspace(workspace);
+ dragPivot.setVisibility(true);
+ },
+
+ _getDragPivot : function() {
+ return mindplot.DragTopic.__getDragPivot();
+ },
+
+ getPosition:function() {
+ return this._position;
+ }
+ ,
+
+ isDragTopic : function() {
+ return true;
+ },
+
+ updateDraggedTopic : function(workspace) {
+ $assert(workspace, 'workspace can not be null');
+
+ var dragPivot = this._getDragPivot();
+ var draggedTopic = this.getDraggedTopic();
+
+ var isDragConnected = this.isConnected();
+ // @Todo: Remove this static ...
+ var actionDispatcher = mindplot.ActionDispatcher.getInstance();
+ var topicId = draggedTopic.getId();
+
+ if (isDragConnected) {
+
+ var targetTopic = this.getConnectedToTopic();
+ if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
+ // Update topic position ...
+ var dragPivotPosition = dragPivot.getPosition();
+
+ // Must position the dragged topic taking into account the current node size.
+ var pivotSize = dragPivot.getSize();
+ var draggedTopicSize = draggedTopic.getSize();
+ var xOffset = draggedTopicSize.width - pivotSize.width;
+ xOffset = Math.round(xOffset / 2);
+
+ if (dragPivotPosition.x > 0) {
+ dragPivotPosition.x = parseInt(dragPivotPosition.x) + xOffset;
+ }
+ else {
+ dragPivotPosition.x = parseInt(dragPivotPosition.x) - xOffset;
+ }
+ // Set new position ...
+ actionDispatcher.dragTopic(topicId, dragPivotPosition, null, targetTopic);
+
+ } else {
+ // Main topic connections can be positioned only with the order ...
+ actionDispatcher.dragTopic(topicId, null, this._order, targetTopic);
+ }
+ } else {
+
+ // If the node is not connected, positionate based on the original drag topic position.
+ var dragPosition = this.getPosition();
+ actionDispatcher.dragTopic(topicId, dragPosition);
+ }
+ },
+
+ setBoardPosition : function(point) {
+ $assert(point, 'point can not be null');
+ var dragPivot = this._getDragPivot();
+ dragPivot.setPosition(point);
+ },
+
+ getConnectedToTopic : function() {
+ var dragPivot = this._getDragPivot();
+ return dragPivot.getTargetTopic();
+ },
+
+ isConnected : function() {
+ return this.getConnectedToTopic() != null;
+ }
+
+});
+
+mindplot.DragTopic.PIVOT_SIZE = {width:50,height:10};
+
+mindplot.DragTopic.init = function(workspace) {
+
+ $assert(workspace, "workspace can not be null");
var pivot = mindplot.DragTopic.__getDragPivot();
workspace.appendChild(pivot);
-};
+}
-mindplot.DragTopic.prototype.setOrder = function(order)
-{
- this._order = order;
-};
-
-mindplot.DragTopic.prototype.setPosition = function(x, y)
-{
- this._position.setValue(x, y);
-
- // Elements are positioned in the center.
- // All topic element must be positioned based on the innerShape.
- var draggedNode = this._draggedNode;
- var size = draggedNode.getSize();
-
- var cx = Math.ceil(x - (size.width / 2));
- var cy = Math.ceil(y - (size.height / 2));
-
- // Update visual position.
- this._elem2d.setPosition(cx, cy);
-};
-
-mindplot.DragTopic.prototype.getInnerShape = function()
-{
- return this._elem2d;
-};
-
-mindplot.DragTopic.prototype.disconnect = function(workspace)
-{
- // Clear connection line ...
- var dragPivot = this._getDragPivot();
- dragPivot.disconnect(workspace);
-};
-
-mindplot.DragTopic.prototype.canBeConnectedTo = function(targetTopic)
-{
- $assert(targetTopic, 'parent can not be null');
-
- var result = true;
- if (!targetTopic.areChildrenShrinked() && !targetTopic.isCollapsed())
- {
- // Dragged node can not be connected to himself.
- if (targetTopic == this._draggedNode)
- {
- result = false;
- } else
- {
- var draggedNode = this.getDraggedTopic();
- var topicPosition = this.getPosition();
-
- var targetTopicModel = targetTopic.getModel();
- var childTopicModel = draggedNode.getModel();
-
- result = targetTopicModel.canBeConnected(childTopicModel, topicPosition, 18);
- }
- } else
- {
- result = false;
- }
- return result;
-};
-
-mindplot.DragTopic.prototype.connectTo = function(parent)
-{
- $assert(parent, 'Parent connection node can not be null.');
-
- var dragPivot = this._getDragPivot();
- dragPivot.connectTo(parent);
-};
-
-mindplot.DragTopic.prototype.getDraggedTopic = function()
-{
- return this._draggedNode;
-};
-
-
-mindplot.DragTopic.prototype.removeFromWorkspace = function(workspace)
-{
- // Remove drag shadow.
- workspace.removeChild(this._elem2d);
-
- // Remove pivot shape. To improve performace it will not be removed. Only the visilility will be changed.
- var dragPivot = this._getDragPivot();
- dragPivot.setVisibility(false);
-};
-
-mindplot.DragTopic.prototype.addToWorkspace = function(workspace)
-{
- workspace.appendChild(this._elem2d);
- var dragPivot = this._getDragPivot();
-
- dragPivot.addToWorkspace(workspace);
- dragPivot.setVisibility(true);
-};
-
-mindplot.DragTopic.prototype._getDragPivot = function()
-{
- return mindplot.DragTopic.__getDragPivot();
-};
-
-mindplot.DragTopic.__getDragPivot = function()
-{
+mindplot.DragTopic.__getDragPivot = function() {
var result = mindplot.DragTopic._dragPivot;
- if (!$defined(result))
- {
+ if (!$defined(result)) {
result = new mindplot.DragPivot();
mindplot.DragTopic._dragPivot = result;
}
return result;
-};
-
-
-mindplot.DragTopic.prototype.getPosition = function()
-{
- return this._position;
-};
-
-mindplot.DragTopic.prototype.isDragTopic = function()
-{
- return true;
-};
-
-mindplot.DragTopic.prototype.updateDraggedTopic = function(workspace)
-{
- $assert(workspace, 'workspace can not be null');
-
- var dragPivot = this._getDragPivot();
- var draggedTopic = this.getDraggedTopic();
-
- var isDragConnected = this.isConnected();
- var actionRunner = mindplot.DesignerActionRunner.getInstance();
- var topicId = draggedTopic.getId();
- var command = new mindplot.commands.DragTopicCommand(topicId);
-
- if (isDragConnected)
- {
-
- var targetTopic = this.getConnectedToTopic();
- if (targetTopic.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE)
- {
- // Update topic position ...
- var dragPivotPosition = dragPivot.getPosition();
-
- // Must position the dragged topic taking into account the current node size.
- var pivotSize = dragPivot.getSize();
- var draggedTopicSize = draggedTopic.getSize();
- var xOffset = draggedTopicSize.width - pivotSize.width;
- xOffset = Math.round(xOffset / 2);
-
- if (dragPivotPosition.x > 0)
- {
- dragPivotPosition.x = parseInt(dragPivotPosition.x) + xOffset;
- }
- else
- {
- dragPivotPosition.x = parseInt(dragPivotPosition.x) - xOffset;
- }
- // Set new position ...
- command.setPosition(dragPivotPosition);
-
- } else
- {
- // Main topic connections can be positioned only with the order ...
- command.setOrder(this._order);
- }
-
- // Set new parent topic ..
- command.setParetTopic(targetTopic);
- } else {
-
- // If the node is not connected, positionate based on the original drag topic position.
- var dragPosition = this.getPosition();
- command = new mindplot.commands.DragTopicCommand(topicId, dragPosition);
- command.setPosition(dragPosition);
- }
- actionRunner.execute(command);
-};
-
-mindplot.DragTopic.prototype.setBoardPosition = function(point)
-{
- $assert(point, 'point can not be null');
- var dragPivot = this._getDragPivot();
- dragPivot.setPosition(point);
-};
-
-
-mindplot.DragTopic.prototype.getBoardPosition = function(point)
-{
- $assert(point, 'point can not be null');
- var dragPivot = this._getDragPivot();
- return dragPivot.getPosition();
-};
-
-mindplot.DragTopic.prototype.getConnectedToTopic = function()
-{
- var dragPivot = this._getDragPivot();
- return dragPivot.getTargetTopic();
-};
-
-mindplot.DragTopic.prototype.isConnected = function()
-{
- return this.getConnectedToTopic() != null;
-};
-
-mindplot.DragTopic.PIVOT_SIZE = {width:50,height:10};
+}
+
diff --git a/mindplot/src/main/javascript/DragTopicPositioner.js b/mindplot/src/main/javascript/DragTopicPositioner.js
index a8478556..1a4deafc 100644
--- a/mindplot/src/main/javascript/DragTopicPositioner.js
+++ b/mindplot/src/main/javascript/DragTopicPositioner.js
@@ -71,7 +71,8 @@ mindplot.DragTopicPositioner = new Class({
// Finally, connect nodes ...
if (!dragTopic.isConnected()) {
var centalTopic = topics[0];
- if ($defined(mainTopicToMainTopicConnection)) {
+ if ($defined(mainTopicToMainTopicConnection))
+ {
dragTopic.connectTo(mainTopicToMainTopicConnection);
} else if (Math.abs(dragTopic.getPosition().x - centalTopic.getPosition().x) <= mindplot.DragTopicPositioner.CENTRAL_TO_MAINTOPIC_MAX_HORIZONTAL_DISTANCE) {
dragTopic.connectTo(centalTopic);
@@ -82,7 +83,6 @@ mindplot.DragTopicPositioner = new Class({
_lookUpForMainTopicToMainTopicConnection : function(dragTopic) {
var topics = this._topics;
var result = null;
- var clouserDistance = -1;
var draggedNode = dragTopic.getDraggedTopic();
var distance = null;
diff --git a/mindplot/src/main/javascript/IconGroup.js b/mindplot/src/main/javascript/IconGroup.js
index d6c265e6..8f4c6065 100644
--- a/mindplot/src/main/javascript/IconGroup.js
+++ b/mindplot/src/main/javascript/IconGroup.js
@@ -55,9 +55,12 @@ mindplot.IconGroup = new Class({
},
addIcon : function(icon) {
+ $defined(icon,"icon is not defined");
icon.setGroup(this);
+
var newIcon = icon.getImage();
var nativeElem = this.options.nativeElem;
+
var iconSize = newIcon.getSize();
var size = nativeElem.getSize();
newIcon.setPosition(size.width, 0);
@@ -186,8 +189,10 @@ mindplot.IconGroup = new Class({
_calculateOffsets : function() {
var offset = this.options.topic.getOffset();
var text = this.options.topic.getTextShape();
+
var sizeHeight = text.getHtmlFontSize();
var yOffset = offset;
+
var shape = this.options.topic.getShapeType();
yOffset = text.getPosition().y + (sizeHeight - 18) / 2 + 1;
return {x:offset, y:yOffset};
diff --git a/mindplot/src/main/javascript/ImageIcon.js b/mindplot/src/main/javascript/ImageIcon.js
index 695f924e..e5ceb605 100644
--- a/mindplot/src/main/javascript/ImageIcon.js
+++ b/mindplot/src/main/javascript/ImageIcon.js
@@ -16,13 +16,13 @@
* limitations under the License.
*/
-mindplot.ImageIcon = new Class(
- {
+mindplot.ImageIcon = new Class({
Extends:mindplot.Icon,
initialize:function(iconModel, topic, designer) {
$assert(iconModel, 'iconModel can not be null');
$assert(topic, 'topic can not be null');
$assert(designer, 'designer can not be null');
+
this._topic = topic;
this._iconModel = iconModel;
this._designer = designer;
@@ -44,16 +44,16 @@ mindplot.ImageIcon = new Class(
if (!$defined(designer._viewMode) || ($defined(designer._viewMode) && !designer._viewMode)) {
- removeImage.addEvent('click', function(event) {
- var actionRunner = designer._actionRunner;
- var command = new mindplot.commands.RemoveIconFromTopicCommand(this._topic.getId(), iconModel);
- actionRunner.execute(command);
+ removeImage.addEvent('click', function() {
+ var actionDispatcher = mindplot.ActionDispatcher.getInstance();
+ actionDispatcher.removeIconFromTopic(this._topic.getId(), iconModel);
tip.forceClose();
- }.bindWithEvent(this));
+ });
//Icon
var image = this.getImage();
- image.addEventListener('click', function(event) {
+ image.addEventListener('click', function() {
+
var iconType = iconModel.getIconType();
var newIconType = this._getNextFamilyIconId(iconType);
iconModel.setIconType(newIconType);
@@ -61,21 +61,16 @@ mindplot.ImageIcon = new Class(
var imgUrl = this._getImageUrl(newIconType);
this._image.setHref(imgUrl);
- // // @Todo: Support revert of change icon ...
- // var actionRunner = designer._actionRunner;
- // var command = new mindplot.commands.ChangeIconFromTopicCommand(this._topic.getId());
- // this._actionRunner.execute(command);
+ }.bind(this));
-
- }.bindWithEvent(this));
-
- var imageIcon = this;
image.addEventListener('mouseover', function(event) {
- tip.open(event, container, imageIcon);
- });
+ tip.open(event, container, this);
+ }.bind(this));
+
image.addEventListener('mouseout', function(event) {
tip.close(event);
});
+
image.addEventListener('mousemove', function(event) {
tip.updatePosition(event);
});
@@ -83,7 +78,7 @@ mindplot.ImageIcon = new Class(
}
},
- _getImageUrl : function(iconId) {
+ _getImageUrl : function(iconId) {
return "../icons/" + iconId + ".png";
},
@@ -99,7 +94,6 @@ mindplot.ImageIcon = new Class(
var result = null;
for (var i = 0; i < familyIcons.length && result == null; i++) {
if (familyIcons[i] == iconId) {
- var nextIconId;
//Is last one?
if (i == (familyIcons.length - 1)) {
result = familyIcons[0];
@@ -164,7 +158,7 @@ mindplot.ImageIcon.prototype.ICON_FAMILIES = [
{"id": "bullet", "icons" : ["bullet_black","bullet_blue","bullet_green","bullet_orange","bullet_red","bullet_pink","bullet_purple"]},
{"id": "tag", "icons" : ["tag_blue","tag_green","tag_orange","tag_red","tag_pink","tag_yellow"]},
{"id": "object", "icons" : ["object_bell","object_clanbomber","object_key","object_pencil","object_phone","object_magnifier","object_clip","object_music","object_star","object_wizard","object_house","object_cake","object_camera","object_palette","object_rainbow"]}
-]
+];
diff --git a/mindplot/src/main/javascript/LinkIcon.js b/mindplot/src/main/javascript/LinkIcon.js
index 3d6c38d2..29b34173 100644
--- a/mindplot/src/main/javascript/LinkIcon.js
+++ b/mindplot/src/main/javascript/LinkIcon.js
@@ -90,8 +90,9 @@ mindplot.LinkIcon = new Class({
removeBtn.setStyle("margin-left", "3px");
removeBtn.addEvent('click', function(event) {
- var command = new mindplot.commands.RemoveLinkFromTopicCommand(this._topic.getId());
- designer._actionRunner.execute(command);
+
+ var actionDispatcher = mindplot.ActionDispatcher.getInstance();
+ actionDispatcher.removeLinkFromTopic(this._topic.getId());
bubbleTip.forceClose();
}.bindWithEvent(this));
@@ -148,7 +149,7 @@ mindplot.LinkIcon = new Class({
});
},
- getUrl : function() {
+ getUrl : function() {
return this._url;
},
diff --git a/mindplot/src/main/javascript/LocalActionDispatcher.js b/mindplot/src/main/javascript/LocalActionDispatcher.js
new file mode 100644
index 00000000..b32b96da
--- /dev/null
+++ b/mindplot/src/main/javascript/LocalActionDispatcher.js
@@ -0,0 +1,310 @@
+/*
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+mindplot.LocalActionDispatcher = new Class({
+ Extends: mindplot.ActionDispatcher,
+ initialize: function(commandContext) {
+ this.parent(commandContext);
+ this._actionRunner = new mindplot.DesignerActionRunner(commandContext, this);
+ },
+
+ hasBeenChanged: function() {
+ // @todo: This don't seems to belong here.
+ this._actionRunner.hasBeenChanged();
+ },
+
+ addIconToTopic: function(topicId, iconType) {
+ var command = new mindplot.commands.AddIconToTopicCommand(topicId, iconType);
+ this.execute(command);
+ },
+
+ addLinkToTopic: function(topicId, url) {
+ var command = new mindplot.commands.AddLinkToTopicCommand(topicId, url);
+ this.execute(command);
+ },
+
+ addTopic:function(model, parentTopicId, animated) {
+ var command = new mindplot.commands.AddTopicCommand(model, parentTopicId, animated);
+ this.execute(command);
+ },
+
+ addNoteToTopic: function(topicId, text) {
+ var command = new mindplot.commands.AddNoteToTopicCommand(topicId, text);
+ this.execute(command);
+ },
+
+ addRelationship: function(model, mindmap) {
+ var command = new mindplot.commands.AddRelationshipCommand(model, mindmap);
+ this.execute(command);
+ },
+
+ deleteTopics: function(topicsIds) {
+ var command = new mindplot.commands.DeleteTopicCommand(topicsIds);
+ this.execute(command);
+ },
+
+ dragTopic: function(topicId, position, order, parentTopic) {
+ var command = new mindplot.commands.DragTopicCommand(topicId, position, order, parentTopic);
+ this.execute(command);
+ },
+
+ moveControlPoint: function(ctrlPoint, point) {
+ var command = new mindplot.commands.MoveControlPointCommand(ctrlPoint, point);
+ this.execute(command);
+ },
+
+ removeIconFromTopic: function(topicId, iconModel) {
+ var command = new mindplot.commands.RemoveIconFromTopicCommand(topicId, iconModel);
+ this.execute(command);
+ },
+ removeLinkFromTopic: function(topicId) {
+ var command = new mindplot.commands.RemoveLinkFromTopicCommand(topicId);
+ this.execute(command);
+ },
+
+ removeNoteFromTopic: function(topicId) {
+ var command = new mindplot.commands.RemoveNoteFromTopicCommand(topicId);
+ this.execute(command);
+ },
+ changeFontStyleToTopic: function(topicsIds) {
+
+ var commandFunc = function(topic) {
+ var result = topic.getFontStyle();
+ var style = (result == "italic") ? "normal" : "italic";
+ topic.setFontStyle(style, true);
+ return result;
+ };
+ var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds);
+ this._actionRunner.execute(command);
+
+ },
+
+ changeTextOnTopic : function(topicsIds, text) {
+ $assert(topicsIds, "topicsIds can not be null");
+
+ var commandFunc = function(topic, value) {
+
+ var result = topic.getText();
+ topic.setText(value);
+ return result;
+ };
+
+ var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, text);
+ this._actionRunner.execute(command);
+ },
+
+ changeFontFamilyToTopic: function(topicIds, fontFamily) {
+ $assert(topicIds, "topicIds can not be null");
+ $assert(fontFamily, "fontFamily can not be null");
+
+
+ var commandFunc = function(topic, fontFamily) {
+ var result = topic.getFontFamily();
+ topic.setFontFamily(fontFamily, true);
+
+ core.Executor.instance.delay(topic.updateNode, 0, topic);
+ return result;
+ };
+
+ var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicIds, fontFamily);
+ this.execute(command);
+ },
+
+ changeFontColorToTopic: function(topicsIds, color) {
+ $assert(topicsIds, "topicIds can not be null");
+ $assert(color, "color can not be null");
+
+ var commandFunc = function(topic, color) {
+ var result = topic.getFontColor();
+ topic.setFontColor(color, true);
+ return result;
+ };
+
+ var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
+ command.discartDuplicated = "fontColorCommandId";
+ this.execute(command);
+ },
+
+ changeBackgroundColorToTopic: function(topicsIds, color) {
+ $assert(topicsIds, "topicIds can not be null");
+ $assert(color, "color can not be null");
+
+ var commandFunc = function(topic, color) {
+ var result = topic.getBackgroundColor();
+ topic.setBackgroundColor(color);
+ return result;
+ };
+
+ var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
+ command.discartDuplicated = "backColor";
+ this.execute(command);
+ },
+
+ changeBorderColorToTopic : function(topicsIds, color) {
+ $assert(topicsIds, "topicIds can not be null");
+ $assert(color, "topicIds can not be null");
+
+ var commandFunc = function(topic, color) {
+ var result = topic.getBorderColor();
+ topic.setBorderColor(color);
+ return result;
+ };
+
+ var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
+ command.discartDuplicated = "borderColorCommandId";
+ this.execute(command);
+ },
+
+ changeFontSizeToTopic : function(topicsIds, size) {
+ $assert(topicsIds, "topicIds can not be null");
+ $assert(size, "size can not be null");
+
+ var commandFunc = function(topic, size) {
+ var result = topic.getFontSize();
+ topic.setFontSize(size, true);
+
+ core.Executor.instance.delay(topic.updateNode, 0, topic);
+ return result;
+ };
+
+ var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, size);
+ this.execute(command);
+ },
+
+ changeShapeToTopic : function(topicsIds, shapeType) {
+ $assert(topicsIds, "topicsIds can not be null");
+ $assert(shapeType, "shapeType can not be null");
+
+ var commandFunc = function(topic, shapeType) {
+ var result = topic.getShapeType();
+ topic.setShapeType(shapeType, true);
+ return result;
+ };
+
+ var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, shapeType);
+ this.execute(command);
+ },
+
+ changeFontWeightToTopic : function(topicsIds) {
+ $assert(topicsIds, "topicsIds can not be null");
+
+ var commandFunc = function(topic) {
+ var result = topic.getFontWeight();
+ var weight = (result == "bold") ? "normal" : "bold";
+ topic.setFontWeight(weight, true);
+
+ core.Executor.instance.delay(topic.updateNode, 0, topic);
+ /*var updated = function() {
+ topic.updateNode();
+ };
+ updated.delay(0);*/
+ return result;
+ };
+
+ var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds);
+ this.execute(command);
+ },
+
+ shrinkBranch : function(topicsIds, collapse) {
+ $assert(topicsIds, "topicsIds can not be null");
+
+ var commandFunc = function(topic, isShrink) {
+ topic.setChildrenShrinked(isShrink);
+ return !isShrink;
+ };
+
+ var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, collapse);
+ this.execute(command);
+ },
+
+ execute:function(command) {
+ this._actionRunner.execute(command);
+ }
+
+});
+
+mindplot.CommandContext = new Class({
+ initialize: function(designer) {
+ $assert(designer, "designer can not be null");
+ this._designer = designer;
+ },
+ findTopics:function(topicsIds) {
+ var designerTopics = this._designer._topics;
+ if (!(topicsIds instanceof Array)) {
+ topicsIds = [topicsIds];
+ }
+
+ var result = designerTopics.filter(function(topic) {
+ var found = false;
+ if (topic != null) {
+ var topicId = topic.getId();
+ found = topicsIds.contains(topicId);
+ }
+ return found;
+
+ });
+ return result;
+ },
+
+ deleteTopic:function(topic) {
+ this._designer._removeNode(topic);
+ },
+
+ createTopic:function(model, isVisible) {
+ $assert(model, "model can not be null");
+ return this._designer._nodeModelToNodeGraph(model, isVisible);
+ },
+
+ createModel:function() {
+ var mindmap = this._designer.getMindmap();
+ return mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE);
+ },
+
+ connect:function(childTopic, parentTopic, isVisible) {
+ childTopic.connectTo(parentTopic, this._designer._workspace, isVisible);
+ } ,
+
+ disconnect:function(topic) {
+ topic.disconnect(this._designer._workspace);
+ },
+
+ createRelationship:function(model) {
+ $assert(model, "model cannot be null");
+ return this._designer.createRelationship(model);
+ },
+ removeRelationship:function(model) {
+ this._designer.removeRelationship(model);
+ },
+
+ findRelationships:function(lineIds) {
+ var result = [];
+ lineIds.forEach(function(lineId, index) {
+ var line = this._designer._relationships[lineId];
+ if ($defined(line)) {
+ result.push(line);
+ }
+ }.bind(this));
+ return result;
+ },
+
+ getSelectedRelationshipLines:function() {
+ return this._designer.getSelectedRelationshipLines();
+ }
+});
+
+
diff --git a/mindplot/src/main/javascript/MainTopic.js b/mindplot/src/main/javascript/MainTopic.js
index 56cc6ee6..7e22e2de 100644
--- a/mindplot/src/main/javascript/MainTopic.js
+++ b/mindplot/src/main/javascript/MainTopic.js
@@ -119,7 +119,7 @@ mindplot.MainTopic = new Class({
},
disconnect : function(workspace) {
- mindplot.Topic.prototype.disconnect.call(this, workspace);
+ this.parent(workspace);
var size = this.getSize();
var model = this.getModel();
diff --git a/mindplot/src/main/javascript/MindmapDesigner.js b/mindplot/src/main/javascript/MindmapDesigner.js
index 50a8230e..ecfe74d3 100644
--- a/mindplot/src/main/javascript/MindmapDesigner.js
+++ b/mindplot/src/main/javascript/MindmapDesigner.js
@@ -22,9 +22,14 @@ mindplot.MindmapDesigner = new Class({
$assert(profile.zoom, "zoom must be defined");
$assert(divElement, "divElement must be defined");
- // Undo manager ...
- this._actionRunner = new mindplot.DesignerActionRunner(this);
- mindplot.DesignerActionRunner.setInstance(this._actionRunner);
+ // Dispatcher manager ...
+ var commandContext = new mindplot.CommandContext(this);
+ this._actionDispatcher = new mindplot.LocalActionDispatcher(commandContext);
+ this._actionDispatcher.addEvent("modelUpdate", function(event) {
+ this._fireEvent("modelUpdate", event);
+ }.bind(this));
+
+ mindplot.ActionDispatcher.setInstance(this._actionDispatcher);
// Initial Zoom
this._zoom = profile.zoom;
@@ -39,18 +44,13 @@ mindplot.MindmapDesigner = new Class({
var editorClass = mindplot.TextEditorFactory.getTextEditorFromName(mindplot.EditorOptions.textEditor);
this._editor = new editorClass(this, this._actionRunner);
-
// Init layout managers ...
this._topics = [];
-// var layoutManagerClass = mindplot.layout.LayoutManagerFactory.getManagerByName(mindplot.EditorOptions.LayoutManager);
-// this._layoutManager = new layoutManagerClass(this);
this._layoutManager = new mindplot.layout.OriginalLayoutManager(this);
// Register handlers..
this._registerEvents();
-
this._relationships = {};
-
this._events = {};
},
@@ -63,11 +63,8 @@ mindplot.MindmapDesigner = new Class({
return topics[0];
},
-
addEventListener : function(eventType, listener) {
-
this._events[eventType] = listener;
-
},
_fireEvent : function(eventType, event) {
@@ -87,7 +84,7 @@ mindplot.MindmapDesigner = new Class({
// Create nodes on double click...
screenManager.addEventListener('click', function(event) {
if (workspace.isWorkspaceEventsEnabled()) {
- var t = mindmapDesigner.getEditor().isVisible();
+ mindmapDesigner.getEditor().isVisible();
mindmapDesigner.getEditor().lostFocus();
// @todo: Puaj hack...
mindmapDesigner._cleanScreen();
@@ -110,8 +107,7 @@ mindplot.MindmapDesigner = new Class({
var centralTopicId = centralTopic.getId();
// Execute action ...
- var command = new mindplot.commands.AddTopicCommand(model, centralTopicId, true);
- this._actionRunner.execute(command);
+ this._actionDispatcher.addTopic(model, centralTopicId, true);
}
}.bind(this));
}
@@ -159,14 +155,14 @@ mindplot.MindmapDesigner = new Class({
onObjectFocusEvent : function(currentObject, event) {
this.getEditor().lostFocus();
var selectableObjects = this.getSelectedObjects();
+
// Disable all nodes on focus but not the current if Ctrl key isn't being pressed
if (!$defined(event) || event.ctrlKey == false) {
- for (var i = 0; i < selectableObjects.length; i++) {
- var selectableObject = selectableObjects[i];
+ selectableObjects.forEach(function(selectableObject) {
if (selectableObject.isOnFocus() && selectableObject != currentObject) {
selectableObject.setOnFocus(false);
}
- }
+ });
}
},
@@ -214,8 +210,9 @@ mindplot.MindmapDesigner = new Class({
var parentTopicId = centalTopic.getId();
var childModel = centalTopic.createChildModel(this._layoutManager.needsPrepositioning());
- var command = new mindplot.commands.AddTopicCommand(childModel, parentTopicId, true);
- this._actionRunner.execute(command);
+ // Execute event ...
+ this._actionDispatcher.addTopic(childModel, parentTopicId, true);
+
},
createSiblingForSelectedNode : function() {
@@ -241,9 +238,8 @@ mindplot.MindmapDesigner = new Class({
var parentTopic = topic.getOutgoingConnectedTopic();
var siblingModel = topic.createSiblingModel(this._layoutManager.needsPrepositioning());
var parentTopicId = parentTopic.getId();
- var command = new mindplot.commands.AddTopicCommand(siblingModel, parentTopicId, true);
- this._actionRunner.execute(command);
+ this._actionDispatcher.addTopic(siblingModel, parentTopicId, true);
}
},
@@ -303,8 +299,8 @@ mindplot.MindmapDesigner = new Class({
var mindmap = this.getMindmap();
var model = mindmap.createRelationship(fromNode.getModel().getId(), toNode.getModel().getId());
- var command = new mindplot.commands.AddRelationshipCommand(model, mindmap);
- this._actionRunner.execute(command);
+ this._actionDispatcher.addRelationship(model, mindmap);
+
},
needsSave : function() {
@@ -364,7 +360,8 @@ mindplot.MindmapDesigner = new Class({
this._fireEvent("loadsuccess");
- },
+ }
+ ,
load : function(mapId) {
$assert(mapId, 'mapName can not be null');
@@ -383,7 +380,8 @@ mindplot.MindmapDesigner = new Class({
this._goToNode.attempt(centralTopic, this);
this._fireEvent("loadsuccess");
- },
+ }
+ ,
_loadMap : function(mapId, mindmapModel) {
var designer = this;
@@ -396,7 +394,7 @@ mindplot.MindmapDesigner = new Class({
for (var i = 0; i < branches.length; i++) {
// NodeModel -> NodeGraph ...
var nodeModel = branches[i];
- var nodeGraph = this._nodeModelToNodeGraph(nodeModel);
+ var nodeGraph = this._nodeModelToNodeGraph(nodeModel, false);
// Update shrink render state...
nodeGraph.setBranchVisibility(true);
@@ -412,42 +410,46 @@ mindplot.MindmapDesigner = new Class({
});
this._fireEvent("loadsuccess");
- },
+ }
+ ,
getMindmap : function() {
return this._mindmap;
- },
+ }
+ ,
undo : function() {
this._actionRunner.undo();
- },
+ }
+ ,
redo : function() {
this._actionRunner.redo();
- },
+ }
+ ,
_nodeModelToNodeGraph : function(nodeModel, isVisible) {
$assert(nodeModel, "Node model can not be null");
var nodeGraph = this._buildNodeGraph(nodeModel);
- if ($defined(isVisible))
+ if (isVisible)
nodeGraph.setVisibility(isVisible);
var children = nodeModel.getChildren().slice();
-
children = this._layoutManager.prepareNode(nodeGraph, children);
for (var i = 0; i < children.length; i++) {
var child = children[i];
if ($defined(child))
- this._nodeModelToNodeGraph(child);
+ this._nodeModelToNodeGraph(child, false);
}
var workspace = this._workspace;
workspace.appendChild(nodeGraph);
return nodeGraph;
- },
+ }
+ ,
_relationshipModelToRelationship : function(model) {
$assert(model, "Node model can not be null");
@@ -480,7 +482,6 @@ mindplot.MindmapDesigner = new Class({
},
_buildRelationship : function (model) {
- var workspace = this._workspace;
var elem = this;
var fromNodeId = model.getFromNode();
@@ -521,7 +522,6 @@ mindplot.MindmapDesigner = new Class({
relationLine.setModel(model);
//Add Listeners
- var elem = this;
relationLine.addEventListener('onfocus', function(event) {
elem.onObjectFocusEvent.attempt([relationLine, event], elem);
});
@@ -567,8 +567,7 @@ mindplot.MindmapDesigner = new Class({
var validateError = 'Central topic can not be deleted.';
var selectedObjects = this._getValidSelectedObjectsIds(validateFunc, validateError);
if (selectedObjects.nodes.length > 0 || selectedObjects.relationshipLines.length > 0) {
- var command = new mindplot.commands.DeleteTopicCommand(selectedObjects);
- this._actionRunner.execute(command);
+ this._actionDispatcher.deleteTopics(selectedObjects);
}
},
@@ -577,19 +576,8 @@ mindplot.MindmapDesigner = new Class({
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
- var commandFunc = function(topic, font) {
- var result = topic.getFontFamily();
- topic.setFontFamily(font, true);
+ this._actionDispatcher.changeFontFamilyToTopic(topicsIds, font);
- core.Executor.instance.delay(topic.updateNode, 0, topic);
- /*var updated = function() {
- topic.updateNode();
- };
- updated.delay(0);*/
- return result;
- }
- var command = new mindplot.commands.GenericFunctionCommand(commandFunc, font, topicsIds);
- this._actionRunner.execute(command);
}
},
@@ -597,14 +585,7 @@ mindplot.MindmapDesigner = new Class({
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
- var commandFunc = function(topic) {
- var result = topic.getFontStyle();
- var style = (result == "italic") ? "normal" : "italic";
- topic.setFontStyle(style, true);
- return result;
- }
- var command = new mindplot.commands.GenericFunctionCommand(commandFunc, "", topicsIds);
- this._actionRunner.execute(command);
+ this._actionDispatcher.changeFontStyleToTopic(topicsIds);
}
},
@@ -612,14 +593,7 @@ mindplot.MindmapDesigner = new Class({
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
- var commandFunc = function(topic, color) {
- var result = topic.getFontColor();
- topic.setFontColor(color, true);
- return result;
- }
- var command = new mindplot.commands.GenericFunctionCommand(commandFunc, color, topicsIds);
- command.discartDuplicated = "fontColorCommandId";
- this._actionRunner.execute(command);
+ this._actionDispatcher.changeFontColorToTopic(topicsIds, color);
}
},
@@ -628,20 +602,11 @@ mindplot.MindmapDesigner = new Class({
var validateFunc = function(topic) {
return topic.getShapeType() != mindplot.model.NodeModel.SHAPE_TYPE_LINE
};
- var validateError = 'Color can not be setted to line topics.';
+ var validateError = 'Color can not be set to line topics.';
var validSelectedObjects = this._getValidSelectedObjectsIds(validateFunc, validateError);
- ;
var topicsIds = validSelectedObjects.nodes;
-
if (topicsIds.length > 0) {
- var commandFunc = function(topic, color) {
- var result = topic.getBackgroundColor();
- topic.setBackgroundColor(color);
- return result;
- }
- var command = new mindplot.commands.GenericFunctionCommand(commandFunc, color, topicsIds);
- command.discartDuplicated = "backColor";
- this._actionRunner.execute(command);
+ this._actionDispatcher.changeBackgroundColorToTopic(topicsIds, color);
}
},
@@ -688,20 +653,12 @@ mindplot.MindmapDesigner = new Class({
var validateFunc = function(topic) {
return topic.getShapeType() != mindplot.model.NodeModel.SHAPE_TYPE_LINE
};
- var validateError = 'Color can not be setted to line topics.';
+ var validateError = 'Color can not be set to line topics.';
var validSelectedObjects = this._getValidSelectedObjectsIds(validateFunc, validateError);
- ;
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
- var commandFunc = function(topic, color) {
- var result = topic.getBorderColor();
- topic.setBorderColor(color);
- return result;
- }
- var command = new mindplot.commands.GenericFunctionCommand(commandFunc, color, topicsIds);
- command.discartDuplicated = "borderColorCommandId";
- this._actionRunner.execute(command);
+ this._actionDispatcher.changeBorderColorToTopic(topicsIds, color);
}
},
@@ -709,19 +666,7 @@ mindplot.MindmapDesigner = new Class({
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
- var commandFunc = function(topic, size) {
- var result = topic.getFontSize();
- topic.setFontSize(size, true);
-
- core.Executor.instance.delay(topic.updateNode, 0, topic);
- /*var updated = function() {
- topic.updateNode();
- };
- updated.delay(0);*/
- return result;
- }
- var command = new mindplot.commands.GenericFunctionCommand(commandFunc, size, topicsIds);
- this._actionRunner.execute(command);
+ this._actionDispatcher.changeFontSizeToTopic(topicsIds, size);
}
},
@@ -734,13 +679,7 @@ mindplot.MindmapDesigner = new Class({
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
- var commandFunc = function(topic, size) {
- var result = topic.getShapeType();
- topic.setShapeType(size, true);
- return result;
- }
- var command = new mindplot.commands.GenericFunctionCommand(commandFunc, shape, topicsIds);
- this._actionRunner.execute(command);
+ this._actionDispatcher.changeShapeToTopic(topicsIds, shape);
}
},
@@ -749,30 +688,15 @@ mindplot.MindmapDesigner = new Class({
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
- var commandFunc = function(topic) {
- var result = topic.getFontWeight();
- var weight = (result == "bold") ? "normal" : "bold";
- topic.setFontWeight(weight, true);
-
- core.Executor.instance.delay(topic.updateNode, 0, topic);
- /*var updated = function() {
- topic.updateNode();
- };
- updated.delay(0);*/
- return result;
- }
- var command = new mindplot.commands.GenericFunctionCommand(commandFunc, "", topicsIds);
- this._actionRunner.execute(command);
+ this._actionDispatcher.changeFontWeightToTopic(topicsIds);
}
},
- addImage2SelectedNode : function(iconType) {
+ addIconType2SelectedNode : function(iconType) {
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
-
- var command = new mindplot.commands.AddIconToTopicCommand(topicsIds[0], iconType);
- this._actionRunner.execute(command);
+ this._actionDispatcher.addIconToTopic(topicsIds[0], iconType);
}
},
@@ -780,8 +704,7 @@ mindplot.MindmapDesigner = new Class({
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
- var command = new mindplot.commands.AddLinkToTopicCommand(topicsIds[0], url);
- this._actionRunner.execute(command);
+ this._actionDispatcher.addLinkToTopic(topicsIds[0], url);
}
},
@@ -793,11 +716,11 @@ mindplot.MindmapDesigner = new Class({
if (!$defined(topic._hasLink)) {
var msg = new Element('div');
var urlText = new Element('div').inject(msg);
- urlText.innerHTML = "URL:"
+ urlText.innerHTML = "URL:";
var formElem = new Element('form', {'action': 'none', 'id':'linkFormId'});
var urlInput = new Element('input', {'type': 'text', 'size':30});
urlInput.inject(formElem);
- formElem.inject(msg)
+ formElem.inject(msg);
var okButtonId = "linkOkButtonId";
formElem.addEvent('submit', function(e) {
@@ -833,8 +756,7 @@ mindplot.MindmapDesigner = new Class({
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
- var command = new mindplot.commands.AddNoteToTopicCommand(topicsIds[0], text);
- this._actionRunner.execute(command);
+ this._actionDispatcher.addNoteToTopic(topicsIds[0], text);
}
},
@@ -881,27 +803,6 @@ mindplot.MindmapDesigner = new Class({
}
},
- removeLastImageFromSelectedNode : function() {
- var nodes = this._getSelectedNodes();
- if (nodes.length == 0) {
- core.Monitor.getInstance().logMessage('A topic must be selected in order to execute this operation.');
- } else {
- var elem = nodes[0];
- elem.removeLastIcon(this);
- core.Executor.instance.delay(elem.updateNode, 0, elem);
- /*var executor = function(editor)
- {
- return function()
- {
- elem.updateNode();
- };
- };
-
- setTimeout(executor(this), 0);*/
- }
- },
-
-
_getSelectedNodes : function() {
var result = new Array();
for (var i = 0; i < this._topics.length; i++) {
@@ -951,6 +852,7 @@ mindplot.MindmapDesigner = new Class({
evt.returnValue = false;
}
else {
+ // @ToDo: I think that some of the keys has been removed ... Check this...
evt = new Event(event);
var key = evt.key;
if (!this._editor.isVisible()) {
@@ -961,6 +863,8 @@ mindplot.MindmapDesigner = new Class({
this._showEditor(key);
}
else {
+ var nodes;
+ var node;
switch (key) {
case 'delete':
this.deleteCurrentNode();
@@ -974,9 +878,9 @@ mindplot.MindmapDesigner = new Class({
this.createChildForSelectedNode();
break;
case 'right':
- var nodes = this._getSelectedNodes();
+ nodes = this._getSelectedNodes();
if (nodes.length > 0) {
- var node = nodes[0];
+ node = nodes[0];
if (node.getTopicType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this._goToSideChild(node, 'RIGHT');
}
@@ -991,9 +895,9 @@ mindplot.MindmapDesigner = new Class({
}
break;
case 'left':
- var nodes = this._getSelectedNodes();
+ nodes = this._getSelectedNodes();
if (nodes.length > 0) {
- var node = nodes[0];
+ node = nodes[0];
if (node.getTopicType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this._goToSideChild(node, 'LEFT');
}
@@ -1008,18 +912,18 @@ mindplot.MindmapDesigner = new Class({
}
break;
case'up':
- var nodes = this._getSelectedNodes();
+ nodes = this._getSelectedNodes();
if (nodes.length > 0) {
- var node = nodes[0];
+ node = nodes[0];
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this._goToBrother(node, 'UP');
}
}
break;
case 'down':
- var nodes = this._getSelectedNodes();
+ nodes = this._getSelectedNodes();
if (nodes.length > 0) {
- var node = nodes[0];
+ node = nodes[0];
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this._goToBrother(node, 'DOWN');
}
@@ -1029,8 +933,7 @@ mindplot.MindmapDesigner = new Class({
this._showEditor();
break;
case 'space':
-
- var nodes = this._getSelectedNodes();
+ nodes = this._getSelectedNodes();
if (nodes.length > 0) {
var topic = nodes[0];
@@ -1043,9 +946,9 @@ mindplot.MindmapDesigner = new Class({
evt.preventDefault();
break;
case 'esc':
- var nodes = this._getSelectedNodes();
+ nodes = this._getSelectedNodes();
for (var i = 0; i < nodes.length; i++) {
- var node = nodes[i];
+ node = nodes[i];
node.setOnFocus(false);
}
break;
@@ -1170,17 +1073,6 @@ mindplot.MindmapDesigner = new Class({
getWorkSpace : function() {
return this._workspace;
- },
-
- findRelationShipsByTopicId : function(topicId) {
- var result = [];
- for (var relationshipId in this._relationships) {
- var relationship = this._relationships[relationshipId];
- if (relationship.getModel().getFromNode() == topicId || relationship.getModel().getToNode() == topicId) {
- result.push(relationship);
- }
- }
- return result;
}
}
);
diff --git a/mindplot/src/main/javascript/NodeGraph.js b/mindplot/src/main/javascript/NodeGraph.js
index 1f7c55f3..e46c64eb 100644
--- a/mindplot/src/main/javascript/NodeGraph.js
+++ b/mindplot/src/main/javascript/NodeGraph.js
@@ -18,7 +18,7 @@
mindplot.NodeGraph = new Class({
initialize:function(nodeModel) {
- $assert(nodeModel,"model can not be null");
+ $assert(nodeModel, "model can not be null");
this._mouseEvents = true;
this.setModel(nodeModel);
this._onFocus = false;
@@ -74,13 +74,10 @@ mindplot.NodeGraph = new Class({
this._model.setSize(size.width, size.height);
},
- getModel
- :
- function() {
- $assert(this._model, 'Model has not been initialized yet');
- return this._model;
- }
- ,
+ getModel:function() {
+ $assert(this._model, 'Model has not been initialized yet');
+ return this._model;
+ },
setModel : function(model) {
$assert(model, 'Model can not be null');
diff --git a/mindplot/src/main/javascript/Note.js b/mindplot/src/main/javascript/Note.js
index 52979339..b0fc6712 100644
--- a/mindplot/src/main/javascript/Note.js
+++ b/mindplot/src/main/javascript/Note.js
@@ -21,7 +21,7 @@ mindplot.Note = new Class({
initialize : function(textModel, topic, designer) {
var divContainer = designer.getWorkSpace().getScreenManager().getContainer();
var bubbleTip = mindplot.BubbleTip.getInstance(divContainer);
- mindplot.Icon.call(this, mindplot.Note.IMAGE_URL);
+ this.parent(mindplot.Note.IMAGE_URL);
this._noteModel = textModel;
this._topic = topic;
this._designer = designer;
@@ -50,8 +50,9 @@ mindplot.Note = new Class({
removeBtn.setStyle("margin-left", "3px");
removeBtn.addEvent('click', function(event) {
- var command = new mindplot.commands.RemoveNoteFromTopicCommand(this._topic.getId());
- designer._actionRunner.execute(command);
+ var actionDispatcher = mindplot.ActionDispatcher.getInstance();
+ actionDispatcher.removeNoteFromTopic(this._topic.getId());
+
bubbleTip.forceClose();
}.bindWithEvent(this));
diff --git a/mindplot/src/main/javascript/RelationshipLine.js b/mindplot/src/main/javascript/RelationshipLine.js
index 44f70861..5c50c08a 100644
--- a/mindplot/src/main/javascript/RelationshipLine.js
+++ b/mindplot/src/main/javascript/RelationshipLine.js
@@ -45,8 +45,7 @@ mindplot.RelationshipLine = new Class({
},
setStroke : function(color, style, opacity) {
- // @Todo: How this is supported in mootools ?
- mindplot.ConnectionLine.prototype.setStroke.call(this, color, style, opacity);
+ this.parent(color, style, opacity);
this._startArrow.setStrokeColor(color);
},
@@ -126,7 +125,7 @@ mindplot.RelationshipLine = new Class({
workspace.appendChild(this._startArrow);
workspace.appendChild(this._endArrow);
- mindplot.ConnectionLine.prototype.addToWorkspace.call(this, workspace);
+ this.parent(workspace);
},
_initializeControlPointController : function(event, workspace) {
@@ -141,7 +140,7 @@ mindplot.RelationshipLine = new Class({
workspace.removeChild(this._startArrow);
workspace.removeChild(this._endArrow);
- mindplot.ConnectionLine.prototype.removeFromWorkspace.call(this, workspace);
+ this.parent(workspace);
},
getType : function() {
@@ -195,13 +194,13 @@ mindplot.RelationshipLine = new Class({
},
setVisibility : function(value) {
- mindplot.ConnectionLine.prototype.setVisibility.call(this, value);
+ this.parent(value);
this._endArrow.setVisibility(this._showEndArrow && value);
this._startArrow.setVisibility(this._showStartArrow && value);
},
setOpacity : function(opacity) {
- mindplot.ConnectionLine.prototype.setOpacity.call(this, opacity);
+ this.parent(opacity);
if (this._showEndArrow)
this._endArrow.setOpacity(opacity);
if (this._showStartArrow)
diff --git a/mindplot/src/main/javascript/ShrinkConnector.js b/mindplot/src/main/javascript/ShrinkConnector.js
index 5a661d9b..ed8356d0 100644
--- a/mindplot/src/main/javascript/ShrinkConnector.js
+++ b/mindplot/src/main/javascript/ShrinkConnector.js
@@ -26,18 +26,11 @@ mindplot.ShirinkConnector = new Class({
elipse.setSize(mindplot.Topic.CONNECTOR_WIDTH, mindplot.Topic.CONNECTOR_WIDTH);
elipse.addEventListener('click', function(event) {
var model = topic.getModel();
- var isShrink = !model.areChildrenShrinked();
+ var collapse = !model.areChildrenShrinked();
- var actionRunner = mindplot.DesignerActionRunner.getInstance();
var topicId = topic.getId();
-
- var commandFunc = function(topic, isShrink) {
- topic.setChildrenShrinked(isShrink);
- return !isShrink;
- };
-
- var command = new mindplot.commands.GenericFunctionCommand(commandFunc, isShrink, [topicId]);
- actionRunner.execute(command);
+ var actionDispatcher = mindplot.ActionDispatcher.getInstance();
+ actionDispatcher.shrinkBranch([topicId],collapse);
var e = new Event(event).stop();
e.preventDefault();
diff --git a/mindplot/src/main/javascript/SingleCommandDispatcher.js b/mindplot/src/main/javascript/SingleCommandDispatcher.js
deleted file mode 100644
index 7093aa51..00000000
--- a/mindplot/src/main/javascript/SingleCommandDispatcher.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright [2011] [wisemapping]
- *
- * Licensed under WiseMapping Public License, Version 1.0 (the "License").
- * It is basically the Apache License, Version 2.0 (the "License") plus the
- * "powered by wisemapping" text requirement on every single page;
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the license at
- *
- * http://www.wisemapping.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-mindplot.SingleCommandDispatcher = new Class(
-{
- Extends:mindplot.BaseCommandDispatcher,
- initialize: function() {
-
- },
- addIconToTopic: function() {
- throw "method must be implemented.";
- },
- addLinkToTopic: function() {
- throw "method must be implemented.";
- },
- addNoteToTopic: function() {
- throw "method must be implemented.";
- },addRelationship: function() {
- throw "method must be implemented.";
- },addTopic: function() {
- throw "method must be implemented.";
- },changeIcon: function() {
- throw "method must be implemented.";
- },deleteTopic: function() {
- throw "method must be implemented.";
- },dragTopic: function() {
- throw "method must be implemented.";
- },moveControllPoint: function() {
- throw "method must be implemented.";
- } ,removeIconFromTopic: function() {
- throw "method must be implemented.";
- },removeLinkFromTopic: function() {
- throw "method must be implemented.";
- },removeNodeFromTopic: function() {
- throw "method must be implemented.";
- }
-});
-
diff --git a/mindplot/src/main/javascript/TextEditor.js b/mindplot/src/main/javascript/TextEditor.js
index 7a4b538f..7b71f511 100644
--- a/mindplot/src/main/javascript/TextEditor.js
+++ b/mindplot/src/main/javascript/TextEditor.js
@@ -17,11 +17,10 @@
*/
mindplot.TextEditor = new Class({
- initialize:function(designer, actionRunner) {
+ initialize:function(designer) {
this._designer = designer;
this._screenManager = designer.getWorkSpace().getScreenManager();
this._container = this._screenManager.getContainer();
- this._actionRunner = actionRunner;
this._isVisible = false;
//Create editor ui
@@ -132,13 +131,8 @@ mindplot.TextEditor = new Class({
var text = this.getText();
var topicId = this._currentNode.getId();
- var commandFunc = function(topic, value) {
- var result = topic.getText();
- topic.setText(value);
- return result;
- };
- var command = new mindplot.commands.GenericFunctionCommand(commandFunc, text, [topicId]);
- this._actionRunner.execute(command);
+ var actionDispatcher = mindplot.ActionDispatcher.getInstance();
+ actionDispatcher.changeTextOnTopic([topicId], text);
}
},
@@ -221,7 +215,6 @@ mindplot.TextEditor = new Class({
};
setTimeout(executor(this), 10);
- //console.log('init done');
},
setStyle : function (fontStyle) {
diff --git a/mindplot/src/main/javascript/Topic.js b/mindplot/src/main/javascript/Topic.js
index 93ba30e8..e7b8ade7 100644
--- a/mindplot/src/main/javascript/Topic.js
+++ b/mindplot/src/main/javascript/Topic.js
@@ -30,8 +30,7 @@ mindplot.Topic = new Class({
this._buildShape();
this.setMouseEventsEnabled(true);
- // Positionate topic ....
- var model = this.getModel();
+ // Position a topic ....
var pos = model.getPosition();
if (pos != null && model.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
this.setPosition(pos);
@@ -65,8 +64,8 @@ mindplot.Topic = new Class({
//Let's register all the events. The first one is the default one. The others will be copied.
//this._registerDefaultListenersToElement(innerShape, this);
-
var dispatcher = dispatcherByEventType['mousedown'];
+
if ($defined(dispatcher)) {
for (var i = 1; i < dispatcher._listeners.length; i++) {
innerShape.addEventListener('mousedown', dispatcher._listeners[i]);
@@ -245,7 +244,7 @@ mindplot.Topic = new Class({
return this._icon;
},
- _buildIconGroup : function(disableEventsListeners) {
+ _buildIconGroup : function() {
var result = new mindplot.IconGroup(this);
var model = this.getModel();
@@ -455,16 +454,6 @@ mindplot.Topic = new Class({
var model = this.getModel();
model.setFontFamily(value);
}
- /*var elem = this;
- var executor = function(editor)
- {
- return function()
- {
- elem.updateNode(updateModel);
- };
- };
-
- setTimeout(executor(this), 0);*/
core.Executor.instance.delay(this.updateNode, 0, this, [updateModel]);
},
@@ -475,16 +464,6 @@ mindplot.Topic = new Class({
var model = this.getModel();
model.setFontSize(value);
}
- /*var elem = this;
- var executor = function(editor)
- {
- return function()
- {
- elem.updateNode(updateModel);
- };
- };
-
- setTimeout(executor(this), 0);*/
core.Executor.instance.delay(this.updateNode, 0, this, [updateModel]);
},
@@ -496,16 +475,6 @@ mindplot.Topic = new Class({
var model = this.getModel();
model.setFontStyle(value);
}
- /*var elem = this;
- var executor = function(editor)
- {
- return function()
- {
- elem.updateNode(updateModel);
- };
- };
-
- setTimeout(executor(this), 0);*/
core.Executor.instance.delay(this.updateNode, 0, this, [updateModel]);
},
@@ -870,9 +839,7 @@ mindplot.Topic = new Class({
},
moveToBack : function() {
-// this._helpers.forEach(function(helper, index){
-// helper.moveToBack();
-// });
+
// Update relationship lines
for (var j = 0; j < this._relationships.length; j++) {
this._relationships[j].moveToBack();
@@ -883,8 +850,6 @@ mindplot.Topic = new Class({
}
this.get2DElement().moveToBack();
-
-
},
moveToFront : function() {
@@ -906,7 +871,6 @@ mindplot.Topic = new Class({
},
_setRelationshipLinesVisibility : function(value) {
- //var relationships = designer.findRelationShipsByTopicId(this.getId());
this._relationships.forEach(function(relationship, index) {
relationship.setVisibility(value);
});
@@ -974,14 +938,6 @@ mindplot.Topic = new Class({
type = 'mousedown';
}
- /* var textShape = this.getTextShape();
- textShape.addEventListener(type, listener);
-
- var outerShape = this.getOuterShape();
- outerShape.addEventListener(type, listener);
-
- var innerShape = this.getInnerShape();
- innerShape.addEventListener(type, listener);*/
var shape = this.get2DElement();
shape.addEventListener(type, listener);
},
@@ -991,15 +947,6 @@ mindplot.Topic = new Class({
if (type == 'onfocus') {
type = 'mousedown';
}
- /*var textShape = this.getTextShape();
- textShape.removeEventListener(type, listener);
-
- var outerShape = this.getOuterShape();
- outerShape.removeEventListener(type, listener);
-
- var innerShape = this.getInnerShape();
- innerShape.removeEventListener(type, listener);*/
-
var shape = this.get2DElement();
shape.removeEventListener(type, listener);
},
@@ -1013,7 +960,6 @@ mindplot.Topic = new Class({
var outerShape = this.getOuterShape();
var innerShape = this.getInnerShape();
- var connector = this.getShrinkConnector();
outerShape.setSize(size.width + 4, size.height + 6);
innerShape.setSize(size.width, size.height);
@@ -1177,14 +1123,14 @@ mindplot.Topic = new Class({
},
createDragNode : function() {
- var dragNode = mindplot.NodeGraph.prototype.createDragNode.call(this);
+ var result = this.parent();
// Is the node already connected ?
var targetTopic = this.getOutgoingConnectedTopic();
if ($defined(targetTopic)) {
- dragNode.connectTo(targetTopic);
+ result.connectTo(targetTopic);
}
- return dragNode;
+ return result;
},
updateNode : function(updatePosition) {
diff --git a/mindplot/src/main/javascript/TopicBoard.js b/mindplot/src/main/javascript/TopicBoard.js
deleted file mode 100644
index b7790479..00000000
--- a/mindplot/src/main/javascript/TopicBoard.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright [2011] [wisemapping]
- *
- * Licensed under WiseMapping Public License, Version 1.0 (the "License").
- * It is basically the Apache License, Version 2.0 (the "License") plus the
- * "powered by wisemapping" text requirement on every single page;
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the license at
- *
- * http://www.wisemapping.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//@Todo: Por que lo cambiaste a Board ?
-mindplot.TopicBoard = new Class({
-
- initialize: function() {
- this._height = null;
- },
-
- _removeEntryByOrder : function(order, position) {
- var board = this._getBoard(position);
- var entry = board.lookupEntryByOrder(order);
-
- $assert(!entry.isAvailable(), 'Entry must not be available in order to be removed.Entry Order:' + order);
- entry.removeTopic();
- board.update(entry);
- },
-
- removeTopicFromBoard : function(topic) {
- var position = topic.getPosition();
- var order = topic.getOrder();
-
- this._removeEntryByOrder(order, position);
- topic.setOrder(null);
- },
-
- positionateDragTopic :function(dragTopic) {
- throw "this method must be overrided";
- },
-
- getHeight: function() {
- var board = this._getBoard();
- return board.getHeight();
- }
- }
-);
-
diff --git a/mindplot/src/main/javascript/collaboration/frameworks/brix/BrixFramework.js b/mindplot/src/main/javascript/collaboration/frameworks/brix/BrixFramework.js
index 977eee92..aeeb0199 100644
--- a/mindplot/src/main/javascript/collaboration/frameworks/brix/BrixFramework.js
+++ b/mindplot/src/main/javascript/collaboration/frameworks/brix/BrixFramework.js
@@ -29,6 +29,7 @@ mindplot.collaboration.frameworks.brix.BrixFramework.instanciate=function(){
if($defined(isGoogleBrix) && !instanciated){
instanciated=true;
var app = new goog.collab.CollaborativeApp();
+ mindplot.collaboration.frameworks.brix.BrixFramework.buildMenu(app);
app.start();
app.addListener('modelLoad', function(model){
var framework = new mindplot.collaboration.frameworks.brix.BrixFramework(model, app);
@@ -37,6 +38,32 @@ mindplot.collaboration.frameworks.brix.BrixFramework.instanciate=function(){
}
};
+mindplot.collaboration.frameworks.brix.BrixFramework.buildMenu=function(app){
+ var menuBar = new goog.collab.ui.MenuBar();
+
+ // Configure toolbar menu ...
+ var fileMenu = menuBar.addSubMenu("File");
+ fileMenu.addItem("Save", function() {
+ });
+ fileMenu.addItem("Export", function() {
+ });
+
+ var editMenu = menuBar.addSubMenu("Edit");
+ editMenu.addItem("Undo", function() {
+ });
+ editMenu.addItem("Redo", function() {
+ });
+
+ var formatMenu = menuBar.addSubMenu("Format");
+ formatMenu.addItem("Bold", function() {
+ });
+
+ var helpMenu = menuBar.addSubMenu("Help");
+ helpMenu.addItem("Shortcuts", function() {
+ });
+
+ app.setMenuBar(menuBar);
+};
mindplot.collaboration.frameworks.brix.BrixFramework.instanciate();
diff --git a/mindplot/src/main/javascript/commands/AddIconToTopicCommand.js b/mindplot/src/main/javascript/commands/AddIconToTopicCommand.js
index a6eb2dff..b079fd7d 100644
--- a/mindplot/src/main/javascript/commands/AddIconToTopicCommand.js
+++ b/mindplot/src/main/javascript/commands/AddIconToTopicCommand.js
@@ -1,33 +1,30 @@
/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-mindplot.commands.AddIconToTopicCommand = new Class(
-{
+mindplot.commands.AddIconToTopicCommand = new Class({
Extends:mindplot.Command,
- initialize: function(topicId, iconType)
- {
+ initialize: function(topicId, iconType) {
$assert(topicId, 'topicId can not be null');
$assert(iconType, 'iconType can not be null');
this._selectedObjectsIds = topicId;
this._iconType = iconType;
},
- execute: function(commandContext)
- {
+ execute: function(commandContext) {
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
var updated = function() {
var iconImg = topic.addIcon(this._iconType, commandContext._designer);
@@ -36,8 +33,7 @@ mindplot.commands.AddIconToTopicCommand = new Class(
}.bind(this);
updated.delay(0);
},
- undoExecute: function(commandContext)
- {
+ undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
var updated = function() {
topic.removeIcon(this._iconModel);
diff --git a/mindplot/src/main/javascript/commands/AddLinkToTopicCommand.js b/mindplot/src/main/javascript/commands/AddLinkToTopicCommand.js
index 408cd233..5d2f881f 100644
--- a/mindplot/src/main/javascript/commands/AddLinkToTopicCommand.js
+++ b/mindplot/src/main/javascript/commands/AddLinkToTopicCommand.js
@@ -1,42 +1,38 @@
/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-mindplot.commands.AddLinkToTopicCommand =new Class(
-{
+mindplot.commands.AddLinkToTopicCommand = new Class({
Extends:mindplot.Command,
- initialize: function(topicId,url)
- {
+ initialize: function(topicId, url) {
$assert(topicId, 'topicId can not be null');
this._selectedObjectsIds = topicId;
this._url = url;
this._id = mindplot.Command._nextUUID();
},
- execute: function(commandContext)
- {
+ execute: function(commandContext) {
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
var updated = function() {
- topic.addLink(this._url,commandContext._designer);
+ topic.addLink(this._url, commandContext._designer);
topic.updateNode();
}.bind(this);
updated.delay(0);
},
- undoExecute: function(commandContext)
- {
+ undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
var updated = function() {
topic.removeLink();
diff --git a/mindplot/src/main/javascript/commands/AddNoteToTopicCommand.js b/mindplot/src/main/javascript/commands/AddNoteToTopicCommand.js
index 05bfe16b..b685ccac 100644
--- a/mindplot/src/main/javascript/commands/AddNoteToTopicCommand.js
+++ b/mindplot/src/main/javascript/commands/AddNoteToTopicCommand.js
@@ -1,42 +1,38 @@
/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-mindplot.commands.AddNoteToTopicCommand = new Class(
-{
+mindplot.commands.AddNoteToTopicCommand = new Class({
Extends:mindplot.Command,
- initialize: function(topicId,text)
- {
+ initialize: function(topicId, text) {
$assert(topicId, 'topicId can not be null');
this._selectedObjectsIds = topicId;
this._text = text;
this._id = mindplot.Command._nextUUID();
},
- execute: function(commandContext)
- {
+ execute: function(commandContext) {
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
var updated = function() {
- topic.addNote(this._text,commandContext._designer);
+ topic.addNote(this._text, commandContext._designer);
topic.updateNode();
}.bind(this);
updated.delay(0);
},
- undoExecute: function(commandContext)
- {
+ undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
var updated = function() {
topic.removeNote();
diff --git a/mindplot/src/main/javascript/commands/AddRelationshipCommand.js b/mindplot/src/main/javascript/commands/AddRelationshipCommand.js
index 6b37b6c7..b5c637ba 100644
--- a/mindplot/src/main/javascript/commands/AddRelationshipCommand.js
+++ b/mindplot/src/main/javascript/commands/AddRelationshipCommand.js
@@ -1,40 +1,36 @@
/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-mindplot.commands.AddRelationshipCommand = new Class(
-{
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+mindplot.commands.AddRelationshipCommand = new Class({
Extends:mindplot.Command,
- initialize: function(model, mindmap)
- {
+ initialize: function(model, mindmap) {
$assert(model, 'Relationship model can not be null');
this._model = model;
this._mindmap = mindmap;
this._id = mindplot.Command._nextUUID();
},
- execute: function(commandContext)
- {
+ execute: function(commandContext) {
var relationship = commandContext.createRelationship(this._model);
// Finally, focus ...
var designer = commandContext._designer;
designer.onObjectFocusEvent.attempt(relationship, designer);
relationship.setOnFocus(true);
},
- undoExecute: function(commandContext)
- {
+ undoExecute: function(commandContext) {
var relationship = commandContext.removeRelationship(this._model);
this._mindmap.removeRelationship(this._model);
}
diff --git a/mindplot/src/main/javascript/commands/AddTopicCommand.js b/mindplot/src/main/javascript/commands/AddTopicCommand.js
index 8c6877cc..b2b34e70 100644
--- a/mindplot/src/main/javascript/commands/AddTopicCommand.js
+++ b/mindplot/src/main/javascript/commands/AddTopicCommand.js
@@ -1,69 +1,67 @@
/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
mindplot.commands.AddTopicCommand = new Class(
-{
- Extends:mindplot.Command,
- initialize: function(model, parentTopicId, animated)
{
- $assert(model, 'Model can not be null');
- this._model = model;
- this._parentId = parentTopicId;
- this._id = mindplot.Command._nextUUID();
- this._animated = $defined(animated)?animated:false;
- },
- execute: function(commandContext)
- {
- // Add a new topic ...
+ Extends:mindplot.Command,
+ initialize: function(model, parentTopicId, animated) {
+ $assert(model, 'Model can not be null');
+ this._model = model;
+ this._parentId = parentTopicId;
+ this._id = mindplot.Command._nextUUID();
+ this._animated = $defined(animated) ? animated : false;
+ },
- var topic = commandContext.createTopic(this._model, !this._animated);
+ execute: function(commandContext) {
- // Connect to topic ...
- if ($defined(this._parentId))
- {
- var parentTopic = commandContext.findTopics(this._parentId)[0];
- commandContext.connect(topic, parentTopic, !this._animated);
+ // Add a new topic ...
+ var topic = commandContext.createTopic(this._model, !this._animated);
+
+ // Connect to topic ...
+ if ($defined(this._parentId)) {
+ var parentTopic = commandContext.findTopics(this._parentId)[0];
+ commandContext.connect(topic, parentTopic, !this._animated);
+ }
+
+ var doneFn = function() {
+ // Finally, focus ...
+ var designer = commandContext._designer;
+ designer.onObjectFocusEvent(topic);
+ topic.setOnFocus(true);
+ };
+
+ if (this._animated) {
+ core.Utils.setVisibilityAnimated([topic,topic.getOutgoingLine()], true, doneFn);
+ } else
+ doneFn.attempt();
+ },
+
+ undoExecute: function(commandContext) {
+ // Finally, delete the topic from the workspace ...
+ var topicId = this._model.getId();
+ var topic = commandContext.findTopics(topicId)[0];
+ var doneFn = function() {
+ commandContext.deleteTopic(topic);
+ };
+ if (this._animated) {
+ core.Utils.setVisibilityAnimated([topic,topic.getOutgoingLine()], false, doneFn);
+ }
+ else
+ doneFn.attempt();
}
-
- var doneFn = function(){
- // Finally, focus ...
- var designer = commandContext._designer;
- designer.onObjectFocusEvent.attempt(topic, designer);
- topic.setOnFocus(true);
- };
-
- if(this._animated){
- core.Utils.setVisibilityAnimated([topic,topic.getOutgoingLine()],true,doneFn);
- } else
- doneFn.attempt();
- },
- undoExecute: function(commandContext)
- {
- // Finally, delete the topic from the workspace ...
- var topicId = this._model.getId();
- var topic = commandContext.findTopics(topicId)[0];
- var doneFn = function(){
- commandContext.deleteTopic(topic);
- };
- if(this._animated){
- core.Utils.setVisibilityAnimated([topic,topic.getOutgoingLine()],false, doneFn);
- }
- else
- doneFn.attempt();
- }
-});
\ No newline at end of file
+ });
\ No newline at end of file
diff --git a/mindplot/src/main/javascript/commands/ChangeIconFromTopicCommand.js b/mindplot/src/main/javascript/commands/ChangeIconFromTopicCommand.js
deleted file mode 100644
index 4b7ae24f..00000000
--- a/mindplot/src/main/javascript/commands/ChangeIconFromTopicCommand.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-mindplot.commands.ChangeIconFromTopicCommand = new Class(
-{
- Extends:mindplot.Command,
- initialize: function(topicId, iconId, iconType)
- {
- $assert(topicId, 'topicId can not be null');
- $assert(iconId, 'iconId can not be null');
- $assert(iconType, 'iconType can not be null');
- this._selectedObjectsIds = topicId;
- this._iconModel = iconId;
- this._iconType = iconType;
- },
- execute: function(commandContext)
- {
- var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
- var updated = function() {
- topic.removeIcon(this._iconModel);
- topic.updateNode();
- }.bind(this);
- updated.delay(0);
- },
- undoExecute: function(commandContext)
- {
- var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
- var updated = function() {
- topic.addIcon(this._iconModel, commandContext._designer);
- topic.updateNode();
- }.bind(this);
- updated.delay(0);
- }
-});
\ No newline at end of file
diff --git a/mindplot/src/main/javascript/commands/DeleteTopicCommand.js b/mindplot/src/main/javascript/commands/DeleteTopicCommand.js
index 6a7a3f33..9db432e4 100644
--- a/mindplot/src/main/javascript/commands/DeleteTopicCommand.js
+++ b/mindplot/src/main/javascript/commands/DeleteTopicCommand.js
@@ -1,26 +1,24 @@
/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-mindplot.commands.DeleteTopicCommand = new Class(
-{
+mindplot.commands.DeleteTopicCommand = new Class({
Extends:mindplot.Command,
- initialize: function(topicsIds)
- {
+ initialize: function(topicsIds) {
$assert(topicsIds, "topicsIds must be defined");
this._selectedObjectsIds = topicsIds;
this._deletedTopicModels = [];
@@ -28,18 +26,16 @@ mindplot.commands.DeleteTopicCommand = new Class(
this._deletedRelationships = [];
this._id = mindplot.Command._nextUUID();
},
- execute: function(commandContext)
- {
+ execute: function(commandContext) {
var topics = commandContext.findTopics(this._selectedObjectsIds.nodes);
- if(topics.length>0){
- topics.forEach(
- function(topic, index)
- {
+ if (topics.length > 0) {
+ topics.forEach(
+ function(topic, index) {
var model = topic.getModel().clone();
- //delete relationships
+ //delete relationships
var relationships = topic.getRelationships();
- while(relationships.length>0){
+ while (relationships.length > 0) {
var relationship = relationships[0];
this._deletedRelationships.push(relationship.getModel().clone());
commandContext.removeRelationship(relationship.getModel());
@@ -50,8 +46,7 @@ mindplot.commands.DeleteTopicCommand = new Class(
// Is connected?.
var outTopic = topic.getOutgoingConnectedTopic();
var outTopicId = null;
- if (outTopic != null)
- {
+ if (outTopic != null) {
outTopicId = outTopic.getId();
}
this._parentTopicIds.push(outTopicId);
@@ -60,41 +55,39 @@ mindplot.commands.DeleteTopicCommand = new Class(
commandContext.deleteTopic(topic);
}.bind(this)
- ); }
+ );
+ }
var lines = commandContext.findRelationships(this._selectedObjectsIds.relationshipLines);
- if(lines.length>0){
- lines.forEach(function(line,index){
- if(line.isInWorkspace()){
+ if (lines.length > 0) {
+ lines.forEach(function(line, index) {
+ if (line.isInWorkspace()) {
this._deletedRelationships.push(line.getModel().clone());
- commandContext.removeRelationship(line.getModel());
+ commandContext.removeRelationship(line.getModel());
}
}.bind(this));
}
},
- undoExecute: function(commandContext)
- {
+ undoExecute: function(commandContext) {
var topics = commandContext.findTopics(this._selectedObjectsIds);
var parent = commandContext.findTopics(this._parentTopicIds);
this._deletedTopicModels.forEach(
- function(model, index)
- {
- var topic = commandContext.createTopic(model);
+ function(model, index) {
+ var topic = commandContext.createTopic(model);
- // Was the topic connected?
- var parentTopic = parent[index];
- if (parentTopic != null)
- {
- commandContext.connect(topic, parentTopic);
- }
+ // Was the topic connected?
+ var parentTopic = parent[index];
+ if (parentTopic != null) {
+ commandContext.connect(topic, parentTopic);
+ }
- }.bind(this)
- );
+ }.bind(this)
+ );
this._deletedRelationships.forEach(
- function(relationship, index){
- commandContext.createRelationship(relationship);
- }.bind(this));
+ function(relationship, index) {
+ commandContext.createRelationship(relationship);
+ }.bind(this));
this._deletedTopicModels = [];
this._parentTopicIds = [];
diff --git a/mindplot/src/main/javascript/commands/DragTopicCommand.js b/mindplot/src/main/javascript/commands/DragTopicCommand.js
index 984614dc..fcaf6093 100644
--- a/mindplot/src/main/javascript/commands/DragTopicCommand.js
+++ b/mindplot/src/main/javascript/commands/DragTopicCommand.js
@@ -1,35 +1,35 @@
/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-mindplot.commands.DragTopicCommand = new Class(
-{
+mindplot.commands.DragTopicCommand = new Class({
Extends:mindplot.Command,
- initialize: function(topicId)
- {
- $assert(topicId, "topicId must be defined");
- this._selectedObjectsIds = topicId;
- this._parentTopic = null;
- this._position = null;
- this._order = null;
+ initialize: function(topicIds, position, order, parentTopic) {
+ $assert(topicIds, "topicIds must be defined");
+
+ this._selectedObjectsIds = topicIds;
+ if ($defined(parentTopic))
+ this._parentId = parentTopic.getId();
+
+ this._position = position;
+ this._order = order;
this._id = mindplot.Command._nextUUID();
},
- execute: function(commandContext)
- {
+ execute: function(commandContext) {
var topic = commandContext.findTopics([this._selectedObjectsIds])[0];
@@ -39,70 +39,51 @@ mindplot.commands.DragTopicCommand = new Class(
var origPosition = null;
// if (topic.getType() == mindplot.model.NodeModel.MAIN_TOPIC_TYPE && origParentTopic != null && origParentTopic.getType() == mindplot.model.NodeModel.MAIN_TOPIC_TYPE)
// {
- // In this case, topics are positioned using order ...
- origOrder = topic.getOrder();
+ // In this case, topics are positioned using order ...
+ origOrder = topic.getOrder();
// } else
// {
- origPosition = topic.getPosition().clone();
+ origPosition = topic.getPosition().clone();
// }
// Disconnect topic ..
- if ($defined(origParentTopic))
- {
+ if ($defined(origParentTopic)) {
commandContext.disconnect(topic);
}
// Set topic order ...
- if (this._order != null)
- {
+ if (this._order != null) {
topic.setOrder(this._order);
- } else if (this._position != null)
- {
+ } else if (this._position != null) {
// Set position ...
topic.setPosition(this._position);
- } else
- {
+ } else {
$assert("Illegal commnad state exception.");
}
this._order = origOrder;
this._position = origPosition;
// Finally, connect topic ...
- if ($defined(this._parentId))
- {
+ if ($defined(this._parentId)) {
var parentTopic = commandContext.findTopics([this._parentId])[0];
commandContext.connect(topic, parentTopic);
}
// Backup old parent id ...
this._parentId = null;
- if ($defined(origParentTopic))
- {
+ if ($defined(origParentTopic)) {
this._parentId = origParentTopic.getId();
}
},
- undoExecute: function(commandContext)
- {
+ undoExecute: function(commandContext) {
this.execute(commandContext);
var selectedRelationships = commandContext.getSelectedRelationshipLines();
- selectedRelationships.forEach(function(relationshipLine,index){
+ selectedRelationships.forEach(function(relationshipLine) {
relationshipLine.redraw();
});
- },
- setPosition: function(point)
- {
- this._position = point;
- },
- setParetTopic: function(topic) {
- this._parentId = topic.getId();
-
- },
- setOrder: function(order)
- {
- this._order = order
}
});
\ No newline at end of file
diff --git a/mindplot/src/main/javascript/commands/GenericFunctionCommand.js b/mindplot/src/main/javascript/commands/GenericFunctionCommand.js
index 6b01287b..f9cba3dc 100644
--- a/mindplot/src/main/javascript/commands/GenericFunctionCommand.js
+++ b/mindplot/src/main/javascript/commands/GenericFunctionCommand.js
@@ -1,66 +1,57 @@
/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-mindplot.commands.GenericFunctionCommand =new Class(
-{
+mindplot.commands.GenericFunctionCommand = new Class({
Extends:mindplot.Command,
- initialize: function(commandFunc,value,topicsIds)
- {
+ initialize: function(commandFunc, topicsIds,value) {
$assert(commandFunc, "commandFunc must be defined");
$assert(topicsIds, "topicsIds must be defined");
+
this._value = value;
this._selectedObjectsIds = topicsIds;
this._commandFunc = commandFunc;
this._oldValues = [];
this._id = mindplot.Command._nextUUID();
},
- execute: function(commandContext)
- {
- if (!this.applied)
- {
+ execute: function(commandContext) {
+ if (!this.applied) {
var topics = commandContext.findTopics(this._selectedObjectsIds);
- topics.forEach(function(topic)
- {
+ topics.forEach(function(topic) {
var oldValue = this._commandFunc(topic, this._value);
this._oldValues.push(oldValue);
}.bind(this));
this.applied = true;
- } else
- {
+ } else {
throw "Command can not be applied two times in a row.";
}
},
- undoExecute: function(commandContext)
- {
- if (this.applied)
- {
+ undoExecute: function(commandContext) {
+ if (this.applied) {
var topics = commandContext.findTopics(this._selectedObjectsIds);
- topics.forEach(function(topic,index)
- {
+ topics.forEach(function(topic, index) {
this._commandFunc(topic, this._oldValues[index]);
}.bind(this));
this.applied = false;
this._oldValues = [];
- } else
- {
+ } else {
throw "undo can not be applied.";
}
}
diff --git a/mindplot/src/main/javascript/commands/MoveControlPointCommand.js b/mindplot/src/main/javascript/commands/MoveControlPointCommand.js
index a5be49c8..ee11efc5 100644
--- a/mindplot/src/main/javascript/commands/MoveControlPointCommand.js
+++ b/mindplot/src/main/javascript/commands/MoveControlPointCommand.js
@@ -1,33 +1,32 @@
/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-mindplot.commands.MoveControlPointCommand = new Class(
-{
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+mindplot.commands.MoveControlPointCommand = new Class({
Extends:mindplot.Command,
- initialize: function(ctrlPointController, point)
- {
+ initialize: function(ctrlPointController, point) {
$assert(ctrlPointController, 'line can not be null');
+ $assert(point, 'point can not be null');
+
this._ctrlPointControler = ctrlPointController;
this._line = ctrlPointController._line;
- var model = this._line.getModel();
this._controlPoint = this._ctrlPointControler.getControlPoint(point).clone();
- this._oldControlPoint= this._ctrlPointControler.getOriginalCtrlPoint(point).clone();
+ this._oldControlPoint = this._ctrlPointControler.getOriginalCtrlPoint(point).clone();
this._originalEndPoint = this._ctrlPointControler.getOriginalEndPoint(point).clone();
- switch (point){
+ switch (point) {
case 0:
this._wasCustom = this._line.getLine().isSrcControlPointCustom();
this._endPoint = this._line.getLine().getFrom().clone();
@@ -40,10 +39,9 @@ mindplot.commands.MoveControlPointCommand = new Class(
this._id = mindplot.Command._nextUUID();
this._point = point;
},
- execute: function(commandContext)
- {
+ execute: function(commandContext) {
var model = this._line.getModel();
- switch (this._point){
+ switch (this._point) {
case 0:
model.setSrcCtrlPoint(this._controlPoint.clone());
this._line.setFrom(this._endPoint.x, this._endPoint.y);
@@ -58,36 +56,35 @@ mindplot.commands.MoveControlPointCommand = new Class(
this._line.setDestControlPoint(this._controlPoint.clone());
break;
}
- if(this._line.isOnFocus()){
+ if (this._line.isOnFocus()) {
this._line._refreshSelectedShape();
this._ctrlPointControler.setLine(this._line);
}
this._line.getLine().updateLine(this._point);
},
- undoExecute: function(commandContext)
- {
+ undoExecute: function(commandContext) {
var line = this._line;
var model = line.getModel();
- switch (this._point){
+ switch (this._point) {
case 0:
- if($defined(this._oldControlPoint)){
+ if ($defined(this._oldControlPoint)) {
line.setFrom(this._originalEndPoint.x, this._originalEndPoint.y);
model.setSrcCtrlPoint(this._oldControlPoint.clone());
line.setSrcControlPoint(this._oldControlPoint.clone());
line.setIsSrcControlPointCustom(this._wasCustom);
}
- break;
+ break;
case 1:
- if($defined(this._oldControlPoint)){
+ if ($defined(this._oldControlPoint)) {
line.setTo(this._originalEndPoint.x, this._originalEndPoint.y);
model.setDestCtrlPoint(this._oldControlPoint.clone());
line.setDestControlPoint(this._oldControlPoint.clone());
line.setIsDestControlPointCustom(this._wasCustom);
}
- break;
+ break;
}
this._line.getLine().updateLine(this._point);
- if(this._line.isOnFocus()){
+ if (this._line.isOnFocus()) {
this._ctrlPointControler.setLine(line);
line._refreshSelectedShape();
}
diff --git a/mindplot/src/main/javascript/commands/RemoveIconFromTopicCommand.js b/mindplot/src/main/javascript/commands/RemoveIconFromTopicCommand.js
index 344c7fa7..a265c8ce 100644
--- a/mindplot/src/main/javascript/commands/RemoveIconFromTopicCommand.js
+++ b/mindplot/src/main/javascript/commands/RemoveIconFromTopicCommand.js
@@ -16,8 +16,7 @@
* limitations under the License.
*/
-mindplot.commands.RemoveIconFromTopicCommand = new Class(
-{
+mindplot.commands.RemoveIconFromTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId, iconModel)
{
diff --git a/mindplot/src/main/javascript/commands/RemoveLinkFromTopicCommand.js b/mindplot/src/main/javascript/commands/RemoveLinkFromTopicCommand.js
index 71e9cad0..2289ac30 100644
--- a/mindplot/src/main/javascript/commands/RemoveLinkFromTopicCommand.js
+++ b/mindplot/src/main/javascript/commands/RemoveLinkFromTopicCommand.js
@@ -1,31 +1,28 @@
/*
-* Copyright [2011] [wisemapping]
-*
-* Licensed under WiseMapping Public License, Version 1.0 (the "License").
-* It is basically the Apache License, Version 2.0 (the "License") plus the
-* "powered by wisemapping" text requirement on every single page;
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the license at
-*
-* http://www.wisemapping.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-mindplot.commands.RemoveLinkFromTopicCommand =new Class(
-{
+mindplot.commands.RemoveLinkFromTopicCommand = new Class({
Extends:mindplot.Command,
- initialize: function(topicId)
- {
+ initialize: function(topicId) {
$assert(topicId, 'topicId can not be null');
this._selectedObjectsIds = topicId;
},
- execute: function(commandContext)
- {
+ execute: function(commandContext) {
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
this._url = topic._link.getUrl();
var updated = function() {
@@ -33,11 +30,10 @@ mindplot.commands.RemoveLinkFromTopicCommand =new Class(
}.bind(this);
updated.delay(0);
},
- undoExecute: function(commandContext)
- {
+ undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
var updated = function() {
- topic.addLink(this._url,commandContext._designer);
+ topic.addLink(this._url, commandContext._designer);
topic.updateNode();
}.bind(this);
updated.delay(0);
diff --git a/mindplot/src/main/javascript/commands/RemoveNoteFromTopicCommand.js b/mindplot/src/main/javascript/commands/RemoveNoteFromTopicCommand.js
index 8594719d..0840d903 100644
--- a/mindplot/src/main/javascript/commands/RemoveNoteFromTopicCommand.js
+++ b/mindplot/src/main/javascript/commands/RemoveNoteFromTopicCommand.js
@@ -16,8 +16,7 @@
* limitations under the License.
*/
-mindplot.commands.RemoveNoteFromTopicCommand = new Class(
-{
+mindplot.commands.RemoveNoteFromTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId)
{
diff --git a/mindplot/src/main/javascript/footer.js b/mindplot/src/main/javascript/footer.js
index 300c8aa3..b6de234d 100644
--- a/mindplot/src/main/javascript/footer.js
+++ b/mindplot/src/main/javascript/footer.js
@@ -15,8 +15,3 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-if($defined(afterMindpotLibraryLoading))
-{
- afterMindpotLibraryLoading();
-}
diff --git a/mindplot/src/main/javascript/header.js b/mindplot/src/main/javascript/header.js
index 81710eeb..28cb8e70 100644
--- a/mindplot/src/main/javascript/header.js
+++ b/mindplot/src/main/javascript/header.js
@@ -25,4 +25,5 @@
var mindplot = {};
mindplot.util = {};
mindplot.commands = {};
-mindplot.layout = {};
\ No newline at end of file
+mindplot.layout = {};
+mindplot.widget = {};
\ No newline at end of file
diff --git a/mindplot/src/main/javascript/layout/OriginalLayoutManager.js b/mindplot/src/main/javascript/layout/OriginalLayoutManager.js
index 55dceef0..fb08b1bd 100644
--- a/mindplot/src/main/javascript/layout/OriginalLayoutManager.js
+++ b/mindplot/src/main/javascript/layout/OriginalLayoutManager.js
@@ -24,12 +24,13 @@ mindplot.layout.OriginalLayoutManager = new Class({
initialize:function(designer, options) {
this.parent(designer, options);
this._dragTopicPositioner = new mindplot.DragTopicPositioner(this);
- // Init dragger manager.
+
+ // Init drag manager.
var workSpace = this.getDesigner().getWorkSpace();
this._dragger = this._buildDragManager(workSpace);
// Add shapes to speed up the loading process ...
- mindplot.DragTopic.initialize(workSpace);
+ mindplot.DragTopic.init(workSpace);
},
prepareNode:function(node, children) {
// Sort children by order to solve adding order in for OriginalLayoutManager...
@@ -62,15 +63,19 @@ mindplot.layout.OriginalLayoutManager = new Class({
nodesByOrder = null;
return node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE ? result : children;
},
+
_nodeResizeEvent:function(node) {
},
+
_nodeRepositionateEvent:function(node) {
this.getTopicBoardForTopic(node).repositionate();
},
+
getDragTopicPositioner : function() {
return this._dragTopicPositioner;
},
+
_buildDragManager: function(workspace) {
// Init dragger manager.
var dragger = new mindplot.DragManager(workspace);
@@ -115,11 +120,12 @@ mindplot.layout.OriginalLayoutManager = new Class({
return dragger;
},
+
registerListenersOnNode : function(topic) {
// Register node listeners ...
var designer = this.getDesigner();
topic.addEventListener('onfocus', function(event) {
- designer.onObjectFocusEvent.attempt([topic, event], designer);
+ designer.onObjectFocusEvent(topic, event);
});
// Add drag behaviour ...
@@ -136,12 +142,15 @@ mindplot.layout.OriginalLayoutManager = new Class({
}
},
+
_createMainTopicBoard:function(node) {
return new mindplot.MainTopicBoard(node, this);
},
+
_createCentralTopicBoard:function(node) {
return new mindplot.CentralTopicBoard(node, this);
},
+
getClassName:function() {
return mindplot.layout.OriginalLayoutManager.NAME;
}
diff --git a/mindplot/src/main/javascript/layout/boards/Board.js b/mindplot/src/main/javascript/layout/boards/Board.js
index 0848db7f..86ccdb9f 100644
--- a/mindplot/src/main/javascript/layout/boards/Board.js
+++ b/mindplot/src/main/javascript/layout/boards/Board.js
@@ -1,7 +1,7 @@
mindplot.layout.boards = {};
mindplot.layout.boards.Board = new Class({
-
+ Implements: [Events,Options],
options: {
},
@@ -31,6 +31,3 @@ mindplot.layout.boards.Board = new Class({
});
mindplot.layout.boards.Board.NAME = "Board";
-
-mindplot.layout.boards.Board.implement(new Events);
-mindplot.layout.boards.Board.implement(new Options);
\ No newline at end of file
diff --git a/mindplot/src/main/javascript/widget/FontFamilyPanel.js b/mindplot/src/main/javascript/widget/FontFamilyPanel.js
new file mode 100644
index 00000000..9d5f5421
--- /dev/null
+++ b/mindplot/src/main/javascript/widget/FontFamilyPanel.js
@@ -0,0 +1,37 @@
+/*
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+mindplot.widget.FontFamilyPanel = new Class({
+ Extends : mindplot.widget.ToolbarPanel,
+ initialize : function(buttonId, model) {
+ this.parent(buttonId, model);
+ },
+
+ buildPanel: function() {
+
+ var content = new Element("div", {'class':'toolbarPanel','id':'fontFamilyPanel'});
+ content.innerHTML = '' +
+ '
Times
' +
+ '
Arial
' +
+ '
Tahoma
' +
+ '
Verdana
';
+
+ return content;
+
+ }
+});
\ No newline at end of file
diff --git a/mindplot/src/main/javascript/widget/FontSizePanel.js b/mindplot/src/main/javascript/widget/FontSizePanel.js
new file mode 100644
index 00000000..34b30120
--- /dev/null
+++ b/mindplot/src/main/javascript/widget/FontSizePanel.js
@@ -0,0 +1,37 @@
+/*
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+mindplot.widget.FontSizePanel = new Class({
+ Extends : mindplot.widget.ToolbarPanel,
+ initialize : function(buttonId, model) {
+ this.parent(buttonId, model);
+ },
+
+ buildPanel: function() {
+
+ var content = new Element("div", {'class':'toolbarPanel','id':'fontSizePanel'});
+ content.innerHTML = '' +
+ '
Small
' +
+ '
Normal
' +
+ '
Large
' +
+ '
Huge
';
+
+ return content;
+
+ }
+});
\ No newline at end of file
diff --git a/mindplot/src/main/javascript/widget/IconPanel.js b/mindplot/src/main/javascript/widget/IconPanel.js
new file mode 100644
index 00000000..24195717
--- /dev/null
+++ b/mindplot/src/main/javascript/widget/IconPanel.js
@@ -0,0 +1,141 @@
+/*
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+mindplot.widget.IconPanel = new Class({
+ Implements:[Options,Events],
+ options:{
+ width:253,
+ initialWidth:0,
+ height:200,
+ panel:null,
+ onStart:Class.empty,
+ state:'close'
+ },
+
+ initialize:function(buttonId, model) {
+ this._buttonId = buttonId;
+ this._model = model;
+
+ this.options.content = this._build();
+ this.init();
+
+ },
+
+ init:function() {
+ var panel = new Element('div');
+ var buttonElem = $(this._buttonId);
+
+ var coord = buttonElem.getCoordinates();
+ var top = buttonElem.getTop() + coord.height + 2;
+ var left = buttonElem.getLeft();
+
+ panel.setStyles({
+ width:this.options.initialWidth,
+ height:0,position:'absolute',
+ top:top,
+ left:left,
+ background:'#e5e5e5',
+ border:'1px solid #BBB4D6',
+ zIndex:20,
+ overflow:'hidden'}
+ );
+
+ this.options.panel = panel;
+ this.options.content.inject(panel);
+
+ this.options.content.addEvent('click', function() {
+ this.hide();
+ }.bind(this));
+
+ panel.setStyle('opacity', 0);
+ panel.inject($(document.body));
+ this.registerOpenPanel();
+ },
+
+ show:function() {
+ this.fireEvent("show");
+ if (this.options.state == 'close') {
+ if (!$defined(this.options.panel)) {
+ this.init();
+ }
+
+ var panel = this.options.panel;
+ panel.setStyles({
+ border: '1px solid #636163',
+ opacity:100,
+ height:this.options.height,
+ width:this.options.width
+ });
+ this.fireEvent('onStart');
+ this.registerClosePanel();
+ this.options.state = 'open';
+
+ }
+ },
+
+ hide:function() {
+ if (this.options.state == 'open') {
+ // Magic, disappear effect ;)
+ this.options.panel.setStyles({border: '1px solid transparent', opacity:0});
+ this.registerOpenPanel();
+ this.options.state = 'close';
+ }
+ },
+
+ registerOpenPanel:function() {
+ $(this._buttonId).removeEvents('click');
+ $(this._buttonId).addEvent('click', function() {
+ this.show();
+ }.bind(this));
+ },
+
+ registerClosePanel:function() {
+ $(this._buttonId).removeEvents('click');
+ $(this._buttonId).addEvent('click', function() {
+ this.hide();
+ }.bind(this));
+ } ,
+
+ _build : function() {
+ var content = new Element('div').setStyles({width:253,height:200,padding:5});
+ var count = 0;
+ for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i = i + 1) {
+ var familyIcons = mindplot.ImageIcon.prototype.ICON_FAMILIES[i].icons;
+ for (var j = 0; j < familyIcons.length; j = j + 1) {
+ // Separate icons by line ...
+ var familyContent;
+ if ((count % 12) == 0) {
+ familyContent = new Element('div').inject(content);
+ }
+
+ var iconId = familyIcons[j];
+ var img = new Element('img').setStyles({width:16,height:16,padding:"0px 2px"}).inject(familyContent);
+ img.id = iconId;
+ img.src = mindplot.ImageIcon.prototype._getImageUrl(iconId);
+
+ img.addEvent('click', function() {
+ this._model.setValue(img.id);
+ }.bind(this));
+
+ count = count + 1;
+ }
+ }
+ return content;
+ }
+
+});
\ No newline at end of file
diff --git a/mindplot/src/main/javascript/widget/Menu.js b/mindplot/src/main/javascript/widget/Menu.js
new file mode 100644
index 00000000..8205d1a6
--- /dev/null
+++ b/mindplot/src/main/javascript/widget/Menu.js
@@ -0,0 +1,150 @@
+/*
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+mindplot.widget.Menu = new Class({
+ initialize : function(designer) {
+ this._designer = designer;
+ this._toolbarElems = [];
+ this._colorPickers = [];
+
+ var fontFamilyModel = {
+ getValue: function() {
+ var nodes = designer.getSelectedNodes();
+ var length = nodes.length;
+ if (length == 1) {
+ return nodes[0].getFontFamily();
+ }
+ },
+
+ setValue: function(value) {
+ designer.setFont2SelectedNode(value);
+
+ }
+ };
+ var fontFamilyPanel = new mindplot.widget.FontFamilyPanel("fontFamily", fontFamilyModel);
+ fontFamilyPanel.addEvent('show',function(){this.clear()}.bind(this));
+ this._toolbarElems.push(fontFamilyPanel);
+
+ var fontSizeModel = {
+ getValue: function() {
+ var nodes = designer.getSelectedNodes();
+ var length = nodes.length;
+ if (length == 1) {
+ return nodes[0].getFontSize();
+ }
+ },
+ setValue: function(value) {
+ designer.setFontSize2SelectedNode(value);
+ }
+ };
+ var fontSizePanel = new mindplot.widget.FontSizePanel("fontSize", fontSizeModel);
+ fontSizePanel.addEvent('show',function(){this.clear()}.bind(this));
+ this._toolbarElems.push(fontSizePanel);
+
+ var topicShapeModel = {
+ getValue: function() {
+ var nodes = designer.getSelectedNodes();
+ var length = nodes.length;
+ if (length == 1) {
+ return nodes[0].getShapeType();
+ }
+ },
+ setValue: function(value) {
+ designer.setShape2SelectedNode(value);
+ }
+ };
+ var topicShapePanel = new mindplot.widget.TopicShapePanel("topicShape", topicShapeModel);
+ topicShapePanel.addEvent('show',function(){this.clear()}.bind(this));
+ this._toolbarElems.push(topicShapePanel);
+
+ // Create icon panel dialog ...
+ var topicIconModel = {
+ getValue: function() {
+ return null;
+ },
+ setValue: function(value) {
+ designer.addIconType2SelectedNode(value);
+ }
+ };
+ var iconPanel = new mindplot.widget.IconPanel('topicIcon', topicIconModel);
+ iconPanel.addEvent('show',function(){this.clear()}.bind(this));
+ this._toolbarElems.push(iconPanel);
+
+
+ var topicColorPicker = new MooRainbow('topicColor', {
+ id: 'topicColor',
+ imgPath: '../images/',
+ startColor: [255, 255, 255],
+ onInit: function() {
+ this.clear();
+ }.bind(this),
+
+ onChange: function(color) {
+ designer.setBackColor2SelectedNode(color.hex);
+ },
+ onComplete: function() {
+ this.clear();
+ }.bind(this)
+ });
+ this._colorPickers.push(topicColorPicker);
+
+ var borderColorPicker = new MooRainbow('topicBorder', {
+ id: 'topicBorder',
+ imgPath: '../images/',
+ startColor: [255, 255, 255],
+ onInit: function() {
+ this.clear();
+ }.bind(this),
+ onChange: function(color) {
+ designer.setBorderColor2SelectedNode(color.hex);
+ },
+ onComplete: function() {
+ this.clear();
+ }.bind(this)
+
+ });
+ this._colorPickers.push(borderColorPicker);
+
+ var fontColorPicker = new MooRainbow('fontColor', {
+ id: 'fontColor',
+ imgPath: '../images/',
+ startColor: [255, 255, 255],
+ onInit: function() {
+ this.clear();
+ }.bind(this),
+ onChange: function(color) {
+ designer.setFontColor2SelectedNode(color.hex);
+ },
+ onComplete: function() {
+ this.clear();
+ }.bind(this)
+ });
+ this._colorPickers.push(fontColorPicker);
+ },
+
+ clear : function() {
+ this._toolbarElems.forEach(function(elem) {
+ elem.hide();
+ });
+
+ this._colorPickers.forEach(function(elem) {
+ $clear(elem);
+ elem.hide();
+ });
+ }
+});
\ No newline at end of file
diff --git a/mindplot/src/main/javascript/widget/ToolbarPanel.js b/mindplot/src/main/javascript/widget/ToolbarPanel.js
new file mode 100644
index 00000000..17df4b6d
--- /dev/null
+++ b/mindplot/src/main/javascript/widget/ToolbarPanel.js
@@ -0,0 +1,89 @@
+/*
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+mindplot.widget.ToolbarPanel = new Class({
+ Implements:[Events],
+ initialize : function(buttonId, model) {
+ $assert(buttonId, "buttonId can not be null");
+ $assert(model, "model can not be null");
+ this._model = model;
+ this._panelId = this.initPanel(buttonId);
+ },
+
+ buildPanel : function() {
+ throw "Method must be implemented";
+ }.protect(),
+
+ initPanel: function (buttonId) {
+ $assert(buttonId, "buttonId can not be null");
+
+ var panelElem = this.buildPanel();
+ var buttonElem = $(buttonId);
+
+ // Add panel content ..
+ panelElem.setStyle('display', 'none');
+ panelElem.inject(buttonElem);
+
+ // Register on toolbar elements ...
+ var menuElems = panelElem.getElements('div');
+ menuElems.forEach(function(elem) {
+ elem.addEvent('click', function() {
+ var value = $defined(elem.getAttribute('model')) ? elem.getAttribute('model') : elem.id;
+ this._model.setValue(value);
+ this.hide();
+ }.bind(this));
+ }.bind(this));
+
+ // Font family event handling ....
+ buttonElem.addEvent('click', function() {
+
+ // Is the panel being displayed ?
+ if (this.isVisible()) {
+ this.hide();
+ } else {
+ this.show();
+ }
+
+ }.bind(this));
+ return panelElem.id;
+ },
+
+ show : function() {
+ this.fireEvent('show');
+
+ var menuElems = $(this._panelId).getElements('div');
+ var value = this._model.getValue();
+ menuElems.forEach(function(elem) {
+ var elemValue = $defined(elem.getAttribute('model')) ? elem.getAttribute('model') : elem.id;
+ if (elemValue == value)
+ elem.className = "toolbarPanelLinkSelectedLink";
+ else
+ elem.className = "toolbarPanelLink";
+ });
+ $(this._panelId).setStyle('display', 'block');
+
+ },
+
+ hide : function() {
+ $(this._panelId).setStyle('display', 'none');
+ },
+
+ isVisible : function() {
+ return $(this._panelId).getStyle('display') == 'block';
+ }
+});
\ No newline at end of file
diff --git a/mindplot/src/main/javascript/widget/TopicShapePanel.js b/mindplot/src/main/javascript/widget/TopicShapePanel.js
new file mode 100644
index 00000000..c693d6e4
--- /dev/null
+++ b/mindplot/src/main/javascript/widget/TopicShapePanel.js
@@ -0,0 +1,37 @@
+/*
+ * Copyright [2011] [wisemapping]
+ *
+ * Licensed under WiseMapping Public License, Version 1.0 (the "License").
+ * It is basically the Apache License, Version 2.0 (the "License") plus the
+ * "powered by wisemapping" text requirement on every single page;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the license at
+ *
+ * http://www.wisemapping.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+mindplot.widget.TopicShapePanel = new Class({
+ Extends : mindplot.widget.ToolbarPanel,
+ initialize : function(buttonId, model) {
+ this.parent(buttonId, model);
+ },
+
+ buildPanel: function() {
+
+ var content = new Element("div", {'class':'toolbarPanel','id':'topicShapePanel'});
+ content.innerHTML = '' +
+ '' +
+ '' +
+ '' +
+ '';
+
+ return content;
+
+ }
+});
\ No newline at end of file
diff --git a/wise-doc/src/main/webapp/css/editor.css b/wise-doc/src/main/webapp/css/editor.css
index d0d55023..28ae4ea8 100644
--- a/wise-doc/src/main/webapp/css/editor.css
+++ b/wise-doc/src/main/webapp/css/editor.css
@@ -24,7 +24,7 @@ html {
top: 30px;
}
-#waitingContainer,#errorContainer {
+#waitingContainer, #errorContainer {
position: relative;
top: 80px;
height: 120px; /*background: whitesmoke;*/
@@ -33,7 +33,7 @@ html {
padding: 15px;
width: 100%;
border: 1px solid;
- border-color:#a9a9a9;
+ border-color: #a9a9a9;
}
@@ -62,7 +62,7 @@ html {
vertical-align: text-bottom;
height: 30px;
float: right;
- padding-left:120px;
+ padding-left: 120px;
}
#waitingContainer .loadingIcon {
@@ -123,7 +123,7 @@ html {
color: #ffffff;
border-bottom: 2px solid black;
position: absolute;
- top: 35px;
+ top: 0;
}
div#toolbar .buttonContainer {
@@ -134,9 +134,8 @@ div#toolbar .buttonContainer {
.buttonContainer fieldset {
border: 1px solid #BBB4D6;
- padding: 2px;
- margin: 1px;
- padding-bottom: 4px;
+ padding: 2px 2px 4px;
+ margin: 8px 1px 1px;
}
.buttonContainer legend {
@@ -158,6 +157,11 @@ div#toolbar .button {
margin: 0 2px 2px 2px;
cursor: pointer;
text-align: center;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -o-user-select: none;
+ user-select: none;
}
div#toolbar .comboButton {
@@ -190,7 +194,7 @@ div#toolbar .toolbarLabel {
top: 55%;
text-align: center;
width: 34px;
- height: 36px;
+ height: 10px;
font-size: 10px;
}
@@ -209,15 +213,15 @@ div#file, div#zoom, div#node, div#font, div#share {
}
div#zoom {
- left: 229px;
+ left: 84px;
}
div#node {
- left: 311px;
+ left: 165px;
}
div#font {
- left: 679px; /*left:581px;*/
+ left: 532px; /*left:581px;*/
}
div#share {
@@ -250,15 +254,15 @@ div#redoEdition {
#export {
background: url(../images/file_export.png) no-repeat center top;
- position:relative;
+ position: relative;
}
#exportAnchor {
- position:absolute;
- width:100%;
- height:100%;
- top:0;
- left:0;
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ top: 0;
+ left: 0;
}
div#zoomIn {
@@ -380,7 +384,13 @@ div#fontColor {
display: none;
position: absolute;
z-index: 4;
- top: 71px;
+ top: 53px;
+ text-align: left;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -o-user-select: none;
+ user-select: none;
}
div.toolbarPanelLink {
@@ -547,7 +557,7 @@ div#tabs {
div.tabContent {
clear: left;
width: 100%;
- height: 63px;
+ height: 50px;
border-bottom: 1px solid #bbb4d6;
border-top: 1px solid #bbb4d6;
background: #E5E5E5;
@@ -608,7 +618,7 @@ ol#toc span {
#mindplot {
position: relative;
- top: 103px;
+ top: 53px;
left: 0;
width: 100%;
border: 0;
@@ -722,21 +732,21 @@ div#small_error_icon {
}
div#toolbar .topicRelation {
- width:56px;
+ width: 56px;
background: url(../images/topic_relationship.png) no-repeat center top;
z-index: 4;
}
div#toolbar .topicRelation:hover {
- width:56px;
+ width: 56px;
background: url(../images/topic_relationship.png) no-repeat center top;
z-index: 4;
}
-div#toolbar .relationshiplabel{
- width:56px;
+div#toolbar .relationshiplabel {
+ width: 56px;
}
.nicEdit-main {
- outline:none;
+ outline: none;
}
\ No newline at end of file
diff --git a/wise-doc/src/main/webapp/html/collab.html b/wise-doc/src/main/webapp/html/collab.html
new file mode 100644
index 00000000..b4e47abb
--- /dev/null
+++ b/wise-doc/src/main/webapp/html/collab.html
@@ -0,0 +1,47 @@
+
+
+
+
+
+Este es este no ?
+
+
+
\ No newline at end of file
diff --git a/wise-doc/src/main/webapp/html/editor.html b/wise-doc/src/main/webapp/html/editor.html
index 872eb0bb..47c80791 100644
--- a/wise-doc/src/main/webapp/html/editor.html
+++ b/wise-doc/src/main/webapp/html/editor.html
@@ -13,6 +13,8 @@
+
+
@@ -24,6 +26,7 @@
+