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 48d72fcb..e5ceb605 100644 --- a/mindplot/src/main/javascript/ImageIcon.js +++ b/mindplot/src/main/javascript/ImageIcon.js @@ -22,6 +22,7 @@ mindplot.ImageIcon = new Class({ $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; @@ -47,11 +48,12 @@ mindplot.ImageIcon = new Class({ var actionDispatcher = mindplot.ActionDispatcher.getInstance(); actionDispatcher.removeIconFromTopic(this._topic.getId(), iconModel); tip.forceClose(); - }.bindWithEvent(this)); + }); //Icon var image = this.getImage(); image.addEventListener('click', function() { + var iconType = iconModel.getIconType(); var newIconType = this._getNextFamilyIconId(iconType); iconModel.setIconType(newIconType); @@ -59,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); }); diff --git a/mindplot/src/main/javascript/LocalActionDispatcher.js b/mindplot/src/main/javascript/LocalActionDispatcher.js index 5cbff2a9..fcb84471 100644 --- a/mindplot/src/main/javascript/LocalActionDispatcher.js +++ b/mindplot/src/main/javascript/LocalActionDispatcher.js @@ -20,7 +20,12 @@ mindplot.LocalActionDispatcher = new Class({ Extends: mindplot.ActionDispatcher, initialize: function(commandContext) { this.parent(commandContext); - this._actionRunner = new mindplot.DesignerActionRunner(commandContext,this); + this._actionRunner = new mindplot.DesignerActionRunner(commandContext, this); + }, + + hasBeenChanged: function() { + // @todo: This don't seems to belong here. + this._actionRunner.hasBeenChanged(); }, addIconToTopic: function(topicId, iconType) { diff --git a/mindplot/src/main/javascript/MindmapDesigner.js b/mindplot/src/main/javascript/MindmapDesigner.js index fbbac9de..9e52b993 100644 --- a/mindplot/src/main/javascript/MindmapDesigner.js +++ b/mindplot/src/main/javascript/MindmapDesigner.js @@ -64,9 +64,7 @@ mindplot.MindmapDesigner = new Class({ }, addEventListener : function(eventType, listener) { - this._events[eventType] = listener; - }, _fireEvent : function(eventType, event) { @@ -86,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(); @@ -157,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) { - for (var i = 0; i < selectableObjects.length; i++) { - var selectableObject = selectableObjects[i]; + if (!$defined(event) || event.ctrlKey == false) { + selectableObjects.forEach(function(selectableObject) { if (selectableObject.isOnFocus() && selectableObject != currentObject) { selectableObject.setOnFocus(false); } - } + }); } }, @@ -351,7 +349,8 @@ mindplot.MindmapDesigner = new Class({ this._fireEvent("loadsuccess"); - }, + } + , load : function(mapId) { $assert(mapId, 'mapName can not be null'); @@ -370,7 +369,8 @@ mindplot.MindmapDesigner = new Class({ this._goToNode.attempt(centralTopic, this); this._fireEvent("loadsuccess"); - }, + } + , _loadMap : function(mapId, mindmapModel) { var designer = this; @@ -383,7 +383,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); @@ -399,42 +399,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"); @@ -467,7 +471,6 @@ mindplot.MindmapDesigner = new Class({ }, _buildRelationship : function (model) { - var workspace = this._workspace; var elem = this; var fromNodeId = model.getFromNode(); @@ -508,7 +511,6 @@ mindplot.MindmapDesigner = new Class({ relationLine.setModel(model); //Add Listeners - var elem = this; relationLine.addEventListener('onfocus', function(event) { elem.onObjectFocusEvent.attempt([relationLine, event], elem); }); @@ -850,6 +852,8 @@ mindplot.MindmapDesigner = new Class({ this._showEditor(key); } else { + var nodes; + var node; switch (key) { case 'delete': this.deleteCurrentNode(); @@ -863,9 +867,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.NodeModel.CENTRAL_TOPIC_TYPE) { this._goToSideChild(node, 'RIGHT'); } @@ -880,9 +884,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.NodeModel.CENTRAL_TOPIC_TYPE) { this._goToSideChild(node, 'LEFT'); } @@ -897,18 +901,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.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.NodeModel.CENTRAL_TOPIC_TYPE) { this._goToBrother(node, 'DOWN'); } @@ -918,8 +922,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]; @@ -932,9 +935,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; diff --git a/mindplot/src/main/javascript/NodeGraph.js b/mindplot/src/main/javascript/NodeGraph.js index 28140313..3446f719 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/Topic.js b/mindplot/src/main/javascript/Topic.js index dc2e04db..2c3e2745 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.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() { @@ -973,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); }, @@ -990,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); }, diff --git a/mindplot/src/main/javascript/commands/AddTopicCommand.js b/mindplot/src/main/javascript/commands/AddTopicCommand.js index e55bccf0..b2b34e70 100644 --- a/mindplot/src/main/javascript/commands/AddTopicCommand.js +++ b/mindplot/src/main/javascript/commands/AddTopicCommand.js @@ -41,7 +41,7 @@ mindplot.commands.AddTopicCommand = new Class( var doneFn = function() { // Finally, focus ... var designer = commandContext._designer; - designer.onObjectFocusEvent.attempt(topic, designer); + designer.onObjectFocusEvent(topic); topic.setOnFocus(true); }; diff --git a/mindplot/src/main/javascript/layout/OriginalLayoutManager.js b/mindplot/src/main/javascript/layout/OriginalLayoutManager.js index 06248ae4..be2217e4 100644 --- a/mindplot/src/main/javascript/layout/OriginalLayoutManager.js +++ b/mindplot/src/main/javascript/layout/OriginalLayoutManager.js @@ -63,15 +63,19 @@ mindplot.layout.OriginalLayoutManager = new Class({ nodesByOrder = null; return node.getTopicType() != mindplot.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); @@ -116,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 ... @@ -137,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/wise-doc/src/main/webapp/css/editor.css b/wise-doc/src/main/webapp/css/editor.css index d0d55023..f7c25515 100644 --- a/wise-doc/src/main/webapp/css/editor.css +++ b/wise-doc/src/main/webapp/css/editor.css @@ -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 { @@ -209,15 +208,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 { @@ -547,7 +546,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 +607,7 @@ ol#toc span { #mindplot { position: relative; - top: 103px; + top: 53px; left: 0; width: 100%; border: 0; diff --git a/wise-doc/src/main/webapp/html/editor.html b/wise-doc/src/main/webapp/html/editor.html index d78a44fe..374cf42b 100644 --- a/wise-doc/src/main/webapp/html/editor.html +++ b/wise-doc/src/main/webapp/html/editor.html @@ -41,7 +41,7 @@
- SYMB_EDITOR.LOADING + Loading ...
@@ -50,7 +50,7 @@
- SYMB_EDITOR.ERROR_LOADING + Unexpected error loading your map :(
@@ -98,7 +98,6 @@
-
diff --git a/wise-doc/src/main/webapp/js/editor.js b/wise-doc/src/main/webapp/js/editor.js index 31e04386..32a320e1 100644 --- a/wise-doc/src/main/webapp/js/editor.js +++ b/wise-doc/src/main/webapp/js/editor.js @@ -179,10 +179,12 @@ function afterMindpotLibraryLoading() { var iconChooser = buildIconChooser(); iconPanel = new IconPanel({button:$('topicIcon'), onStart:cleanScreenEvent, content:iconChooser}); + // Register Events ... $(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer)); $("ffoxWorkarroundInput").addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer)); - // + + $('zoomIn').addEvent('click', function(event) { designer.zoomIn(); }); @@ -219,7 +221,6 @@ function afterMindpotLibraryLoading() { }); $('deleteTopic').addEvent('click', function(event) { - var topics = designer.getSelectedNodes(); designer.deleteCurrentNode(); }); @@ -254,7 +255,8 @@ function afterMindpotLibraryLoading() { removeCurrentColorPicker.attempt(colorPicker2, context); } }); - $('topicLink').addEvent('click', function(event) { + + $('topicLink').addEvent('click', function() { designer.addLink2SelectedNode(); }); @@ -263,17 +265,16 @@ function afterMindpotLibraryLoading() { designer.addRelationShip2SelectedNode(event); }); - $('topicNote').addEvent('click', function(event) { + $('topicNote').addEvent('click', function() { designer.addNote2SelectedNode(); }); - - $('fontBold').addEvent('click', function(event) { + $('fontBold').addEvent('click', function() { designer.setWeight2SelectedNode(); }); - $('fontItalic').addEvent('click', function(event) { + $('fontItalic').addEvent('click', function() { designer.setStyle2SelectedNode(); }); @@ -293,43 +294,19 @@ function afterMindpotLibraryLoading() { } }); - // Save event handler .... - var saveButton = $('saveButton'); - saveButton.addEvent('click', function(event) { - - - saveButton.setStyle('cursor', 'wait'); - var saveFunc = function() { - designer.save(function() { - var monitor = core.Monitor.getInstance(); - monitor.logMessage('Save completed successfully'); - saveButton.setStyle('cursor', 'pointer'); - }, true); - } - saveFunc.delay(1); - - }); - - var discardButton = $('discardButton'); - discardButton.addEvent('click', function(event) { - - displayLoading(); - window.document.location = "mymaps.htm"; - }); - // To prevent the user from leaving the page with changes ... - window.onbeforeunload = function confirmExit() { + window.onbeforeunload = function () { if (designer.needsSave()) { designer.save(null, false) } - } + }; // Build panels ... fontFamilyPanel(); shapeTypePanel(); fontSizePanel(); - // If not problem has occured, I close the dialog ... + // If not problem has arisen, close the dialog ... var closeDialog = function() { if (!window.hasUnexpectedErrors) { @@ -388,7 +365,7 @@ function buildMindmapDesigner() { var screenHeight = window.getHeight(); // header - footer - screenHeight = screenHeight - 90 - 61; + screenHeight = screenHeight-115; // body margin ... editorProperties.width = screenWidth; @@ -561,7 +538,7 @@ function JSPomLoader(pomUrl, callback) { callback(); } else { var url = urls.pop(); - console.log("load url:" + url); +// console.log("load url:" + url); Asset.javascript(url, { onLoad: function() { jsRecLoad(urls) diff --git a/wise-webapp/src/main/webapp/js/editor.js b/wise-webapp/src/main/webapp/js/editor.js index 95496aa4..2a957ac9 100644 --- a/wise-webapp/src/main/webapp/js/editor.js +++ b/wise-webapp/src/main/webapp/js/editor.js @@ -226,9 +226,9 @@ function afterMindpotLibraryLoading() { }); $('deleteTopic').addEvent('click', function(event) { - var topics = designer.getSelectedNodes(); designer.deleteCurrentNode(); }); + var context = this; var colorPicker1 = new MooRainbow('topicColor', { id: 'topicColor', @@ -245,6 +245,7 @@ function afterMindpotLibraryLoading() { removeCurrentColorPicker.attempt(colorPicker1, context); } }); + var colorPicker2 = new MooRainbow('topicBorder', { id: 'topicBorder', imgPath: '../images/', @@ -260,6 +261,7 @@ function afterMindpotLibraryLoading() { removeCurrentColorPicker.attempt(colorPicker2, context); } }); + $('topicLink').addEvent('click', function(event) { designer.addLink2SelectedNode(); @@ -274,7 +276,6 @@ function afterMindpotLibraryLoading() { }); - $('fontBold').addEvent('click', function(event) { designer.setWeight2SelectedNode(); }); @@ -391,7 +392,7 @@ function afterMindpotLibraryLoading() { autosave.periodical(30000); // To prevent the user from leaving the page with changes ... - window.onbeforeunload = function confirmExit() { + window.onbeforeunload = function() { if (designer.needsSave()) { designer.save(null, false) }