From 0d20938506321193fa6525c3fe8ad5e06b2c861d Mon Sep 17 00:00:00 2001 From: Ezequiel Bergamaschi Date: Fri, 26 Dec 2014 18:07:31 -0300 Subject: [PATCH] still removing .bind(this) usages --- core-js/pom.xml | 17 -- mindplot/pom.xml | 147 ------------------ .../src/main/javascript/RelationshipPivot.js | 5 +- mindplot/src/main/javascript/ScreenManager.js | 2 +- .../src/main/javascript/ShrinkConnector.js | 8 +- mindplot/src/main/javascript/TextEditor.js | 7 +- mindplot/src/main/javascript/Topic.js | 22 +-- mindplot/src/main/javascript/Workspace.js | 2 +- .../src/main/webapp/WEB-INF/app.properties | 24 +-- wise-webapp/src/main/webapp/js/mindmapList.js | 23 +-- .../src/main/webapp/jsp/mindmapImport.jsp | 4 +- .../src/main/webapp/jsp/mindmapList.jsp | 14 +- 12 files changed, 60 insertions(+), 215 deletions(-) diff --git a/core-js/pom.xml b/core-js/pom.xml index cd2e6c06..7ecbdab4 100644 --- a/core-js/pom.xml +++ b/core-js/pom.xml @@ -40,23 +40,6 @@ maven-release-plugin 2.5 - - com.github.searls - jasmine-maven-plugin - 1.3.1.5 - - - - test - - - - - - Functions.js - - - net.alchim31.maven diff --git a/mindplot/pom.xml b/mindplot/pom.xml index e35b75f6..16570a26 100644 --- a/mindplot/pom.xml +++ b/mindplot/pom.xml @@ -254,153 +254,6 @@ true - - com.github.searls - jasmine-maven-plugin - 1.3.1.5 - - - - test - - - - - - net.sourceforge.htmlunit - htmlunit - 2.15 - - - - - libraries/mootools/mootools-core-1.4.5-full-nocompat-yc.js - lib/jquery-1.8.2.js - lib/core.js/ - lib/web2d.svg-min.js - libraries/hotkeys/jquery.hotkeys.js - libraries/underscorejs/underscore-min.js - libraries/bootstrap/js/bootstrap.js - - - header.js - Events.js - Messages.js - TopicEventDispatcher.js - model/IMindmap.js - model/Mindmap.js - model/INodeModel.js - model/NodeModel.js - model/RelationshipModel.js - ActionDispatcher.js - StandaloneActionDispatcher.js - DesignerModel.js - Designer.js - ScreenManager.js - Workspace.js - ShrinkConnector.js - Keyboard.js - DesignerKeyboard.js - Keyboard.js - TopicStyle.js - NodeGraph.js - Topic.js - CentralTopic.js - MainTopic.js - DragTopic.js - DragManager.js - DragPivot.js - ConnectionLine.js - Relationship.js - DragConnector.js - TextEditor.js - MultilineTextEditor.js - TextEditorFactory.js - util/Shape.js - util/FadeEffect.js - persistence/ModelCodeName.js - persistence/XMLSerializer_Pela.js - persistence/XMLSerializer_Tango.js - persistence/Pela2TangoMigrator.js - persistence/XMLSerializer_Beta.js - persistence/Beta2PelaMigrator.js - persistence/XMLSerializerFactory.js - PersistenceManager.js - RestPersistenceManager.js - LocalStorageManager.js - EditorProperties.js - IconGroup.js - Icon.js - LinkIcon.js - NoteIcon.js - ActionIcon.js - ImageIcon.js - model/FeatureModel.js - model/IconModel.js - model/LinkModel.js - model/NoteModel.js - Command.js - DesignerActionRunner.js - DesignerUndoManager.js - ControlPoint.js - EditorOptions.js - RelationshipPivot.js - TopicFeature.js - commands/GenericFunctionCommand.js - commands/DeleteCommand.js - commands/DragTopicCommand.js - commands/AddTopicCommand.js - commands/ChangeFeatureToTopicCommand.js - commands/RemoveFeatureFromTopicCommand.js - commands/AddFeatureToTopicCommand.js - commands/AddRelationshipCommand.js - commands/MoveControlPointCommand.js - widget/ModalDialogNotifier.js - widget/ToolbarNotifier.js - widget/ToolbarItem.js - widget/ToolbarPaneItem.js - widget/NoteEditor.js - widget/LinkEditor.js - widget/FloatingTip.js - widget/LinkIconTooltip.js - widget/KeyboardShortcutTooltip.js - widget/ColorPalettePanel.js - widget/ListToolbarPanel.js - widget/FontFamilyPanel.js - widget/FontSizePanel.js - widget/TopicShapePanel.js - widget/IconPanel.js - widget/IMenu.js - widget/Menu.js - TopicFeature.js - layout/EventBusDispatcher.js - layout/ChangeEvent.js - layout/LayoutManager.js - layout/Node.js - layout/RootedTreeSet.js - layout/ChildrenSorterStrategy.js - layout/AbstractBasicSorter.js - layout/BalancedSorter.js - layout/SymmetricSorter.js - layout/GridSorter.js - layout/OriginalLayout.js - layout/EventBus.js - MessageBundle_en.js - MessageBundle_es.js - MessageBundle_de.js - MessageBundle_fr.js - MessageBundle_pt_BR.js - MessageBundle_zh_CN.js - MessageBundle_zh_TW.js - MessageBundle_ca.js - footer.js - - - static/test/*.js - simpleTest.js - - - diff --git a/mindplot/src/main/javascript/RelationshipPivot.js b/mindplot/src/main/javascript/RelationshipPivot.js index d869f2c2..5c68f3e8 100644 --- a/mindplot/src/main/javascript/RelationshipPivot.js +++ b/mindplot/src/main/javascript/RelationshipPivot.js @@ -82,9 +82,10 @@ mindplot.RelationshipPivot = new Class({ var model = this._designer.getModel(); var topics = model.getTopics(); + var me = this; _.each(topics, function (topic) { - topic.removeEvent('ontfocus', this._onTopicClick); - }.bind(this)); + topic.removeEvent('ontfocus', me._onTopicClick); + }); workspace.removeChild(this._pivot); workspace.removeChild(this._startArrow); diff --git a/mindplot/src/main/javascript/ScreenManager.js b/mindplot/src/main/javascript/ScreenManager.js index a69c1363..a468c318 100644 --- a/mindplot/src/main/javascript/ScreenManager.js +++ b/mindplot/src/main/javascript/ScreenManager.js @@ -26,7 +26,7 @@ mindplot.ScreenManager = new Class({ this._clickEvents = []; this._divContainer.bind('click', function(event) { event.stopPropagation() - }.bind(this)); + }); this._divContainer.bind('dblclick', function(event) { event.stopPropagation(); diff --git a/mindplot/src/main/javascript/ShrinkConnector.js b/mindplot/src/main/javascript/ShrinkConnector.js index 80f5f7d8..02727a42 100644 --- a/mindplot/src/main/javascript/ShrinkConnector.js +++ b/mindplot/src/main/javascript/ShrinkConnector.js @@ -50,11 +50,11 @@ mindplot.ShirinkConnector = new Class({ ellipse.setFill('rgb(153, 0, 255)'); }); - + var me = this; ellipse.addEvent('mouseout', function(event) { var color = topic.getBackgroundColor(); - this.setFill(color); - }.bind(this)); + me.setFill(color); + }); ellipse.setCursor('default'); this._fillColor = '#f7f7f7'; @@ -104,4 +104,4 @@ mindplot.ShirinkConnector = new Class({ moveToFront: function() { this._ellipse.moveToFront(); } -}); \ No newline at end of file +}); diff --git a/mindplot/src/main/javascript/TextEditor.js b/mindplot/src/main/javascript/TextEditor.js index d41a3504..651d9143 100644 --- a/mindplot/src/main/javascript/TextEditor.js +++ b/mindplot/src/main/javascript/TextEditor.js @@ -68,14 +68,15 @@ mindplot.TextEditor = new Class({ _registerEvents : function(divElem) { var inputElem = this._getTextareaElem(); var spanElem = this._getSpanElem(); + var me = this; divElem.addEvent('keydown', function (event) { switch (event.key) { case 'esc': - this.close(false); + me.close(false); break; case 'enter': - this.close(true); + me.close(true); break; default: spanElem.innerHTML = inputElem.value; @@ -87,7 +88,7 @@ mindplot.TextEditor = new Class({ break; } event.stopPropagation(); - }.bind(this)); + }); // If the user clicks on the input, all event must be ignored ... divElem.addEvent('click', function(event) { diff --git a/mindplot/src/main/javascript/Topic.js b/mindplot/src/main/javascript/Topic.js index 5d75bb47..20ad8c07 100644 --- a/mindplot/src/main/javascript/Topic.js +++ b/mindplot/src/main/javascript/Topic.js @@ -47,11 +47,11 @@ mindplot.Topic = new Class({ this.addEvent('click', function (event) { event.stopPropagation(); }); - + var me = this; this.addEvent('dblclick', function (event) { - this._getTopicEventDispatcher().show(this); + me._getTopicEventDispatcher().show(me); event.stopPropagation(); - }.bind(this)); + }); }, setShapeType:function (type) { @@ -576,24 +576,25 @@ mindplot.Topic = new Class({ }; elem.addEvent('mouseout', outout); + var me = this; // Focus events ... elem.addEvent('mousedown', function (event) { - if (!this.isReadOnly()) { + if (!me.isReadOnly()) { // Disable topic selection of readOnly mode ... var value = true; if ((event.metaKey && Browser.Platform.mac) || (event.ctrlKey && !Browser.Platform.mac)) { - value = !this.isOnFocus(); + value = !me.isOnFocus(); event.stopPropagation(); event.preventDefault(); } topic.setOnFocus(value); } - var eventDispatcher = this._getTopicEventDispatcher(); - eventDispatcher.process(mindplot.TopicEvent.CLICK, this); + var eventDispatcher = me._getTopicEventDispatcher(); + eventDispatcher.process(mindplot.TopicEvent.CLICK, me); event.stopPropagation(); - }.bind(this)); + }); }, areChildrenShrunken:function () { @@ -626,10 +627,11 @@ mindplot.Topic = new Class({ // Do some fancy animation .... var elements = this._flatten2DElements(this); var fade = new mindplot.util.FadeEffect(elements, !value); + var me = this; fade.addEvent('complete', function () { // Set focus on the parent node ... if (value) { - this.setOnFocus(true); + me.setOnFocus(true); } // Set focus in false for all the children ... @@ -638,7 +640,7 @@ mindplot.Topic = new Class({ elem.setOnFocus(false); } }); - }.bind(this)); + }); fade.start(); mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, model); diff --git a/mindplot/src/main/javascript/Workspace.js b/mindplot/src/main/javascript/Workspace.js index af209daa..81894848 100644 --- a/mindplot/src/main/javascript/Workspace.js +++ b/mindplot/src/main/javascript/Workspace.js @@ -189,7 +189,7 @@ mindplot.Workspace = new Class({ wasDragged = true; - }.bind(this); + }; screenManager.addEvent('mousemove', workspace._mouseMoveListener); // Register mouse up listeners ... diff --git a/wise-webapp/src/main/webapp/WEB-INF/app.properties b/wise-webapp/src/main/webapp/WEB-INF/app.properties index ce732333..65e7e288 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/app.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/app.properties @@ -3,13 +3,13 @@ ################################################################################## # MySQL 5.X configuration properties -#database.url=jdbc:mysql://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8 -#database.driver=com.mysql.jdbc.Driver -#database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect -#database.username=wisemapping -#database.password=password -#database.validation.enabled=true -#database.validation.query=SELECT 1 +database.url=jdbc:mysql://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8 +database.driver=com.mysql.jdbc.Driver +database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect +database.username=wisemapping +database.password=password +database.validation.enabled=true +database.validation.query=SELECT 1 ## PostgreSQL configuration properties #database.url=jdbc:postgresql:///wisemapping @@ -23,11 +23,11 @@ # HSQL Configuration properties -database.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping -database.driver=org.hsqldb.jdbc.JDBCDriver -database.hibernate.dialect=org.hibernate.dialect.HSQLDialect -database.username=sa -database.password= +#database.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping +#database.driver=org.hsqldb.jdbc.JDBCDriver +#database.hibernate.dialect=org.hibernate.dialect.HSQLDialect +#database.username=sa +#database.password= database.validation.enabled=false database.validation.query= diff --git a/wise-webapp/src/main/webapp/js/mindmapList.js b/wise-webapp/src/main/webapp/js/mindmapList.js index fc2fa0f3..0dbe9196 100644 --- a/wise-webapp/src/main/webapp/js/mindmapList.js +++ b/wise-webapp/src/main/webapp/js/mindmapList.js @@ -85,7 +85,8 @@ jQuery.fn.dialogForm = function (options) { var acceptBtn = $('#' + containerId + ' .btn-accept'); acceptBtn.button('reset'); - acceptBtn.unbind('click').click( function (event) { + var dialogElem = this; + acceptBtn.unbind('click').one('click', function (event) { var formData = {}; $('#' + containerId + ' input').each(function (index, elem) { formData[elem.name] = elem.value; @@ -138,7 +139,6 @@ jQuery.fn.dialogForm = function (options) { }; $(acceptBtn).button('loading'); - var dialogElem = this; jQuery.ajax(url, { async: false, dataType: 'json', @@ -155,11 +155,11 @@ jQuery.fn.dialogForm = function (options) { 501: onError } }); - }.bind(this)); + }); $('#' + containerId + ' .btn-cancel').click(function () { this.modal('hide'); - }.bind(this)); + }); // Register enter input to submit... $("input").keypress(function(event) { @@ -174,6 +174,7 @@ jQuery.fn.dialogForm = function (options) { $(this).find('input:first').focus(); }); this.modal(); + this.first('input').focus(); }; @@ -357,7 +358,7 @@ $(function () { } }); - $("#renameBtn").click(function () { + $("#renameBtn").click(function (event) { // Map to be cloned ... var tableElem = $('#mindmapListTable'); var rows = tableElem.dataTableExt.getSelectedRows(); @@ -446,12 +447,14 @@ $(function () { var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds(); if (mapIds.length > 0 || ignore) { var mapId = mapIds[0]; - $('#' + dialogElemId + ' .modal-body').load(urlTemplate.replace("{mapId}", mapId), + var modalElement = $('#' + dialogElemId); + modalElement.find('.modal-body').load(urlTemplate.replace("{mapId}", mapId), function () { - $('#' + dialogElemId + ' .btn-accept').unbind('click').click(function () { + modalElement.find('.btn-accept').unbind('click').click(function () { submitDialogForm(); }); - $('#' + dialogElemId).modal(); + modalElement.modal(); + //TODO here we need to make focus on a input tag }); } }; @@ -647,7 +650,9 @@ function prepareLabelList(labels) { }); //add the defaultValue - labelList.append('
  • ') + if (labels.length > 0) { + labelList.append('
  • ') + } labelList.append(defaultValue); } diff --git a/wise-webapp/src/main/webapp/jsp/mindmapImport.jsp b/wise-webapp/src/main/webapp/jsp/mindmapImport.jsp index ff0d6846..21c11f82 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapImport.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapImport.jsp @@ -17,7 +17,7 @@
    - " class="form-control" maxlength="255"/>
    @@ -126,4 +126,4 @@ $('#dialogMainForm').submit(); } - \ No newline at end of file + diff --git a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp index 3c9ca6af..a47ebe90 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapList.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapList.jsp @@ -460,7 +460,7 @@
    -