still removing .bind(this) usages

This commit is contained in:
Ezequiel Bergamaschi 2014-12-26 18:07:31 -03:00
parent ff6ff266c5
commit 0d20938506
12 changed files with 60 additions and 215 deletions

View File

@ -40,23 +40,6 @@
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
<version>2.5</version> <version>2.5</version>
</plugin> </plugin>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.3.1.5</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceIncludes>
<include>Functions.js</include>
</sourceIncludes>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>net.alchim31.maven</groupId> <groupId>net.alchim31.maven</groupId>

View File

@ -254,153 +254,6 @@
<skipTests>true</skipTests> <skipTests>true</skipTests>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.3.1.5</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.15</version>
</dependency>
</dependencies>
<configuration>
<preloadSources>
<source>libraries/mootools/mootools-core-1.4.5-full-nocompat-yc.js</source>
<source>lib/jquery-1.8.2.js</source>
<source>lib/core.js/</source>
<source>lib/web2d.svg-min.js</source>
<source>libraries/hotkeys/jquery.hotkeys.js</source>
<source>libraries/underscorejs/underscore-min.js</source>
<source>libraries/bootstrap/js/bootstrap.js</source>
</preloadSources>
<sourceIncludes>
<include>header.js</include>
<include>Events.js</include>
<include>Messages.js</include>
<include>TopicEventDispatcher.js</include>
<include>model/IMindmap.js</include>
<include>model/Mindmap.js</include>
<include>model/INodeModel.js</include>
<include>model/NodeModel.js</include>
<include>model/RelationshipModel.js</include>
<include>ActionDispatcher.js</include>
<include>StandaloneActionDispatcher.js</include>
<include>DesignerModel.js</include>
<include>Designer.js</include>
<include>ScreenManager.js</include>
<include>Workspace.js</include>
<include>ShrinkConnector.js</include>
<include>Keyboard.js</include>
<include>DesignerKeyboard.js</include>
<include>Keyboard.js</include>
<include>TopicStyle.js</include>
<include>NodeGraph.js</include>
<include>Topic.js</include>
<include>CentralTopic.js</include>
<include>MainTopic.js</include>
<include>DragTopic.js</include>
<include>DragManager.js</include>
<include>DragPivot.js</include>
<include>ConnectionLine.js</include>
<include>Relationship.js</include>
<include>DragConnector.js</include>
<include>TextEditor.js</include>
<include>MultilineTextEditor.js</include>
<include>TextEditorFactory.js</include>
<include>util/Shape.js</include>
<include>util/FadeEffect.js</include>
<include>persistence/ModelCodeName.js</include>
<include>persistence/XMLSerializer_Pela.js</include>
<include>persistence/XMLSerializer_Tango.js</include>
<include>persistence/Pela2TangoMigrator.js</include>
<include>persistence/XMLSerializer_Beta.js</include>
<include>persistence/Beta2PelaMigrator.js</include>
<include>persistence/XMLSerializerFactory.js</include>
<include>PersistenceManager.js</include>
<include>RestPersistenceManager.js</include>
<include>LocalStorageManager.js</include>
<include>EditorProperties.js</include>
<include>IconGroup.js</include>
<include>Icon.js</include>
<include>LinkIcon.js</include>
<include>NoteIcon.js</include>
<include>ActionIcon.js</include>
<include>ImageIcon.js</include>
<include>model/FeatureModel.js</include>
<include>model/IconModel.js</include>
<include>model/LinkModel.js</include>
<include>model/NoteModel.js</include>
<include>Command.js</include>
<include>DesignerActionRunner.js</include>
<include>DesignerUndoManager.js</include>
<include>ControlPoint.js</include>
<include>EditorOptions.js</include>
<include>RelationshipPivot.js</include>
<include>TopicFeature.js</include>
<include>commands/GenericFunctionCommand.js</include>
<include>commands/DeleteCommand.js</include>
<include>commands/DragTopicCommand.js</include>
<include>commands/AddTopicCommand.js</include>
<include>commands/ChangeFeatureToTopicCommand.js</include>
<include>commands/RemoveFeatureFromTopicCommand.js</include>
<include>commands/AddFeatureToTopicCommand.js</include>
<include>commands/AddRelationshipCommand.js</include>
<include>commands/MoveControlPointCommand.js</include>
<include>widget/ModalDialogNotifier.js</include>
<include>widget/ToolbarNotifier.js</include>
<include>widget/ToolbarItem.js</include>
<include>widget/ToolbarPaneItem.js</include>
<include>widget/NoteEditor.js</include>
<include>widget/LinkEditor.js</include>
<include>widget/FloatingTip.js</include>
<include>widget/LinkIconTooltip.js</include>
<include>widget/KeyboardShortcutTooltip.js</include>
<include>widget/ColorPalettePanel.js</include>
<include>widget/ListToolbarPanel.js</include>
<include>widget/FontFamilyPanel.js</include>
<include>widget/FontSizePanel.js</include>
<include>widget/TopicShapePanel.js</include>
<include>widget/IconPanel.js</include>
<include>widget/IMenu.js</include>
<include>widget/Menu.js</include>
<include>TopicFeature.js</include>
<include>layout/EventBusDispatcher.js</include>
<include>layout/ChangeEvent.js</include>
<include>layout/LayoutManager.js</include>
<include>layout/Node.js</include>
<include>layout/RootedTreeSet.js</include>
<include>layout/ChildrenSorterStrategy.js</include>
<include>layout/AbstractBasicSorter.js</include>
<include>layout/BalancedSorter.js</include>
<include>layout/SymmetricSorter.js</include>
<include>layout/GridSorter.js</include>
<include>layout/OriginalLayout.js</include>
<include>layout/EventBus.js</include>
<include>MessageBundle_en.js</include>
<include>MessageBundle_es.js</include>
<include>MessageBundle_de.js</include>
<include>MessageBundle_fr.js</include>
<include>MessageBundle_pt_BR.js</include>
<include>MessageBundle_zh_CN.js</include>
<include>MessageBundle_zh_TW.js</include>
<include>MessageBundle_ca.js</include>
<include>footer.js</include>
</sourceIncludes>
<specExcludes>
<exclude>static/test/*.js</exclude>
<exclude>simpleTest.js</exclude>
</specExcludes>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -82,9 +82,10 @@ mindplot.RelationshipPivot = new Class({
var model = this._designer.getModel(); var model = this._designer.getModel();
var topics = model.getTopics(); var topics = model.getTopics();
var me = this;
_.each(topics, function (topic) { _.each(topics, function (topic) {
topic.removeEvent('ontfocus', this._onTopicClick); topic.removeEvent('ontfocus', me._onTopicClick);
}.bind(this)); });
workspace.removeChild(this._pivot); workspace.removeChild(this._pivot);
workspace.removeChild(this._startArrow); workspace.removeChild(this._startArrow);

View File

@ -26,7 +26,7 @@ mindplot.ScreenManager = new Class({
this._clickEvents = []; this._clickEvents = [];
this._divContainer.bind('click', function(event) { this._divContainer.bind('click', function(event) {
event.stopPropagation() event.stopPropagation()
}.bind(this)); });
this._divContainer.bind('dblclick', function(event) { this._divContainer.bind('dblclick', function(event) {
event.stopPropagation(); event.stopPropagation();

View File

@ -50,11 +50,11 @@ mindplot.ShirinkConnector = new Class({
ellipse.setFill('rgb(153, 0, 255)'); ellipse.setFill('rgb(153, 0, 255)');
}); });
var me = this;
ellipse.addEvent('mouseout', function(event) { ellipse.addEvent('mouseout', function(event) {
var color = topic.getBackgroundColor(); var color = topic.getBackgroundColor();
this.setFill(color); me.setFill(color);
}.bind(this)); });
ellipse.setCursor('default'); ellipse.setCursor('default');
this._fillColor = '#f7f7f7'; this._fillColor = '#f7f7f7';

View File

@ -68,14 +68,15 @@ mindplot.TextEditor = new Class({
_registerEvents : function(divElem) { _registerEvents : function(divElem) {
var inputElem = this._getTextareaElem(); var inputElem = this._getTextareaElem();
var spanElem = this._getSpanElem(); var spanElem = this._getSpanElem();
var me = this;
divElem.addEvent('keydown', function (event) { divElem.addEvent('keydown', function (event) {
switch (event.key) { switch (event.key) {
case 'esc': case 'esc':
this.close(false); me.close(false);
break; break;
case 'enter': case 'enter':
this.close(true); me.close(true);
break; break;
default: default:
spanElem.innerHTML = inputElem.value; spanElem.innerHTML = inputElem.value;
@ -87,7 +88,7 @@ mindplot.TextEditor = new Class({
break; break;
} }
event.stopPropagation(); event.stopPropagation();
}.bind(this)); });
// If the user clicks on the input, all event must be ignored ... // If the user clicks on the input, all event must be ignored ...
divElem.addEvent('click', function(event) { divElem.addEvent('click', function(event) {

View File

@ -47,11 +47,11 @@ mindplot.Topic = new Class({
this.addEvent('click', function (event) { this.addEvent('click', function (event) {
event.stopPropagation(); event.stopPropagation();
}); });
var me = this;
this.addEvent('dblclick', function (event) { this.addEvent('dblclick', function (event) {
this._getTopicEventDispatcher().show(this); me._getTopicEventDispatcher().show(me);
event.stopPropagation(); event.stopPropagation();
}.bind(this)); });
}, },
setShapeType:function (type) { setShapeType:function (type) {
@ -576,24 +576,25 @@ mindplot.Topic = new Class({
}; };
elem.addEvent('mouseout', outout); elem.addEvent('mouseout', outout);
var me = this;
// Focus events ... // Focus events ...
elem.addEvent('mousedown', function (event) { elem.addEvent('mousedown', function (event) {
if (!this.isReadOnly()) { if (!me.isReadOnly()) {
// Disable topic selection of readOnly mode ... // Disable topic selection of readOnly mode ...
var value = true; var value = true;
if ((event.metaKey && Browser.Platform.mac) || (event.ctrlKey && !Browser.Platform.mac)) { if ((event.metaKey && Browser.Platform.mac) || (event.ctrlKey && !Browser.Platform.mac)) {
value = !this.isOnFocus(); value = !me.isOnFocus();
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
} }
topic.setOnFocus(value); topic.setOnFocus(value);
} }
var eventDispatcher = this._getTopicEventDispatcher(); var eventDispatcher = me._getTopicEventDispatcher();
eventDispatcher.process(mindplot.TopicEvent.CLICK, this); eventDispatcher.process(mindplot.TopicEvent.CLICK, me);
event.stopPropagation(); event.stopPropagation();
}.bind(this)); });
}, },
areChildrenShrunken:function () { areChildrenShrunken:function () {
@ -626,10 +627,11 @@ mindplot.Topic = new Class({
// Do some fancy animation .... // Do some fancy animation ....
var elements = this._flatten2DElements(this); var elements = this._flatten2DElements(this);
var fade = new mindplot.util.FadeEffect(elements, !value); var fade = new mindplot.util.FadeEffect(elements, !value);
var me = this;
fade.addEvent('complete', function () { fade.addEvent('complete', function () {
// Set focus on the parent node ... // Set focus on the parent node ...
if (value) { if (value) {
this.setOnFocus(true); me.setOnFocus(true);
} }
// Set focus in false for all the children ... // Set focus in false for all the children ...
@ -638,7 +640,7 @@ mindplot.Topic = new Class({
elem.setOnFocus(false); elem.setOnFocus(false);
} }
}); });
}.bind(this)); });
fade.start(); fade.start();
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, model); mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, model);

View File

@ -189,7 +189,7 @@ mindplot.Workspace = new Class({
wasDragged = true; wasDragged = true;
}.bind(this); };
screenManager.addEvent('mousemove', workspace._mouseMoveListener); screenManager.addEvent('mousemove', workspace._mouseMoveListener);
// Register mouse up listeners ... // Register mouse up listeners ...

View File

@ -3,13 +3,13 @@
################################################################################## ##################################################################################
# MySQL 5.X configuration properties # MySQL 5.X configuration properties
#database.url=jdbc:mysql://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8 database.url=jdbc:mysql://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8
#database.driver=com.mysql.jdbc.Driver database.driver=com.mysql.jdbc.Driver
#database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
#database.username=wisemapping database.username=wisemapping
#database.password=password database.password=password
#database.validation.enabled=true database.validation.enabled=true
#database.validation.query=SELECT 1 database.validation.query=SELECT 1
## PostgreSQL configuration properties ## PostgreSQL configuration properties
#database.url=jdbc:postgresql://<hostname:port>/wisemapping #database.url=jdbc:postgresql://<hostname:port>/wisemapping
@ -23,11 +23,11 @@
# HSQL Configuration properties # HSQL Configuration properties
database.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping #database.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping
database.driver=org.hsqldb.jdbc.JDBCDriver #database.driver=org.hsqldb.jdbc.JDBCDriver
database.hibernate.dialect=org.hibernate.dialect.HSQLDialect #database.hibernate.dialect=org.hibernate.dialect.HSQLDialect
database.username=sa #database.username=sa
database.password= #database.password=
database.validation.enabled=false database.validation.enabled=false
database.validation.query= database.validation.query=

View File

@ -85,7 +85,8 @@ jQuery.fn.dialogForm = function (options) {
var acceptBtn = $('#' + containerId + ' .btn-accept'); var acceptBtn = $('#' + containerId + ' .btn-accept');
acceptBtn.button('reset'); acceptBtn.button('reset');
acceptBtn.unbind('click').click( function (event) { var dialogElem = this;
acceptBtn.unbind('click').one('click', function (event) {
var formData = {}; var formData = {};
$('#' + containerId + ' input').each(function (index, elem) { $('#' + containerId + ' input').each(function (index, elem) {
formData[elem.name] = elem.value; formData[elem.name] = elem.value;
@ -138,7 +139,6 @@ jQuery.fn.dialogForm = function (options) {
}; };
$(acceptBtn).button('loading'); $(acceptBtn).button('loading');
var dialogElem = this;
jQuery.ajax(url, { jQuery.ajax(url, {
async: false, async: false,
dataType: 'json', dataType: 'json',
@ -155,11 +155,11 @@ jQuery.fn.dialogForm = function (options) {
501: onError 501: onError
} }
}); });
}.bind(this)); });
$('#' + containerId + ' .btn-cancel').click(function () { $('#' + containerId + ' .btn-cancel').click(function () {
this.modal('hide'); this.modal('hide');
}.bind(this)); });
// Register enter input to submit... // Register enter input to submit...
$("input").keypress(function(event) { $("input").keypress(function(event) {
@ -174,6 +174,7 @@ jQuery.fn.dialogForm = function (options) {
$(this).find('input:first').focus(); $(this).find('input:first').focus();
}); });
this.modal(); this.modal();
this.first('input').focus();
}; };
@ -357,7 +358,7 @@ $(function () {
} }
}); });
$("#renameBtn").click(function () { $("#renameBtn").click(function (event) {
// Map to be cloned ... // Map to be cloned ...
var tableElem = $('#mindmapListTable'); var tableElem = $('#mindmapListTable');
var rows = tableElem.dataTableExt.getSelectedRows(); var rows = tableElem.dataTableExt.getSelectedRows();
@ -446,12 +447,14 @@ $(function () {
var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds(); var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
if (mapIds.length > 0 || ignore) { if (mapIds.length > 0 || ignore) {
var mapId = mapIds[0]; 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 () { function () {
$('#' + dialogElemId + ' .btn-accept').unbind('click').click(function () { modalElement.find('.btn-accept').unbind('click').click(function () {
submitDialogForm(); 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 //add the defaultValue
if (labels.length > 0) {
labelList.append('<li><div class="listSeparator"></div></li>') labelList.append('<li><div class="listSeparator"></div></li>')
}
labelList.append(defaultValue); labelList.append(defaultValue);
} }

View File

@ -17,7 +17,7 @@
<div class="form-group"> <div class="form-group">
<label for="title" class="control-label col-md-2 "><spring:message code="NAME"/>: </label> <label for="title" class="control-label col-md-2 "><spring:message code="NAME"/>: </label>
<div class="col-md-10"> <div class="col-md-10">
<input type="text" id="title" name="title" required="required" <input type="text" id="title" name="title" required="required" autofocus="autofocus"
placeholder="<spring:message code="MAP_NAME_HINT"/>" placeholder="<spring:message code="MAP_NAME_HINT"/>"
class="form-control" maxlength="255"/> class="form-control" maxlength="255"/>
</div> </div>

View File

@ -460,7 +460,7 @@
</div> </div>
<!-- Delete map dialog --> <!-- Delete map dialog -->
<div id="delete-dialog-modal" class="modal fade"> <div id="delete-dialog-modal" class="modal fade" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -503,7 +503,7 @@
</div> </div>
<!-- Info map dialog --> <!-- Info map dialog -->
<div id="info-dialog-modal" class="modal fade"> <div id="info-dialog-modal" class="modal fade" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -521,7 +521,7 @@
</div> </div>
<!-- Publish Dialog Config --> <!-- Publish Dialog Config -->
<div id="publish-dialog-modal" class="modal fade"> <div id="publish-dialog-modal" class="modal fade" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -541,7 +541,7 @@
</div> </div>
<!-- Export Dialog Config --> <!-- Export Dialog Config -->
<div id="export-dialog-modal" class="modal fade"> <div id="export-dialog-modal" class="modal fade" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -561,7 +561,7 @@
</div> </div>
<!-- Import Dialog Config --> <!-- Import Dialog Config -->
<div id="import-dialog-modal" class="modal fade"> <div id="import-dialog-modal" class="modal fade" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -582,7 +582,7 @@
</div> </div>
<!-- Share Dialog Config --> <!-- Share Dialog Config -->
<div id="share-dialog-modal" class="modal fade"> <div id="share-dialog-modal" class="modal fade" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -602,7 +602,7 @@
</div> </div>
<!-- History Dialog Config --> <!-- History Dialog Config -->
<div id="history-dialog-modal" class="modal fade"> <div id="history-dialog-modal" class="modal fade" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">