Rename Event listener

Remove hacks
This commit is contained in:
Paulo Veiga 2011-08-21 12:42:00 -03:00
parent 0e854c8942
commit ad13c296ad
42 changed files with 276 additions and 2944 deletions

View File

@ -50,13 +50,11 @@
<includes>
<include>${basedir}/target/tmp/header-min.js</include>
<include>${basedir}/target/tmp/Functions-min.js</include>
<include>${basedir}/target/tmp/log4js-min.js</include>
<include>${basedir}/target/tmp/Monitor-min.js</include>
<include>${basedir}/target/tmp/Point-min.js</include>
<include>${basedir}/target/tmp/Utils-min.js</include>
<include>${basedir}/target/tmp/WaitDialog-min.js</include>
<include>${basedir}/target/tmp/footer-min.js</include>
<include>${basedir}/target/tmp/Executor-min.js</include>
</includes>
</aggregation>
</aggregations>

View File

@ -1,55 +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.
*/
/**
* I need this class to clean up things after loading has finished. Without this, async functions at startup are a
* nightmare.
*/
core.Executor = new Class({
options:{
isLoading:true
},
initialize:function(options){
this._pendingFunctions=[];
},
setLoading:function(isLoading){
this.options.isLoading = isLoading;
if(!isLoading){
this._pendingFunctions.forEach(function(item){
var result = item.fn.attempt(item.args, item.bind);
$assert(result!=false, "execution failed");
});
this._pendingFunctions=[];
}
},
isLoading:function(){
return this.options.isLoading;
},
delay:function(fn, delay, bind, args){
if(this.options.isLoading){
this._pendingFunctions.push({fn:fn, bind:bind, args:args});
}
else{
fn.delay(delay, bind, args);
}
}
});
core.Executor.instance = new core.Executor();

View File

@ -1,44 +1,43 @@
/*
* 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.
*/
core.Point = function(x, y)
{
this.x = x;
this.y = y;
};
core.Point = new Class({
initialize : function(x, y) {
this.x = x;
this.y = y;
},
core.Point.prototype.setValue = function(x, y)
{
this.x = x;
this.y = y;
};
setValue : function(x, y) {
this.x = x;
this.y = y;
},
core.Point.prototype.inspect = function()
{
return "{x:" + this.x + ",y:" + this.y + "}";
};
inspect : function() {
return "{x:" + this.x + ",y:" + this.y + "}";
},
core.Point.prototype.clone = function()
{
return new core.Point(this.x, this.y);
};
clone : function() {
return new core.Point(this.x, this.y);
},
core.Point.fromString = function(point) {
var values = point.split(',');
return new core.Point(values[0], values[1]);
};
fromString :
function(point) {
var values = point.split(',');
return new core.Point(values[0], values[1]);
}
});

File diff suppressed because it is too large Load Diff

View File

@ -318,7 +318,7 @@
<include>collaboration/frameworks/brix/BrixFramework-min.js</include>
<include>widget/IconPanel-min.js</include>
<include>widget/ToolbarPanel-min.js</include>
<include>widget/ListToolbarPanel-min.js</include>
<include>widget/FontFamilyPanel-min.js</include>
<include>widget/FontSizePanel-min.js</include>
<include>widget/TopicShapePanel-min.js</include>

View File

@ -31,8 +31,8 @@ mindplot.ActionIcon = new Class({
this.getImage().setPosition(x - size.width / 2, y - size.height / 2);
},
addEventListener:function(event, fn) {
this.getImage().addEventListener(event, fn);
addEvent:function(event, fn) {
this.getImage().addEvent(event, fn);
},
addToGroup:function(group) {

View File

@ -27,7 +27,7 @@ mindplot.CentralTopic = new Class({
this.parent();
// This disable the drag of the central topic. But solves the problem of deselecting the nodes when the screen is clicked.
this.addEventListener('mousedown', function(event) {
this.addEvent('mousedown', function(event) {
event.stopPropagation();
});
},

View File

@ -24,12 +24,12 @@ mindplot.ControlPoint = new Class({
new web2d.Line({strokeColor:"#6589de", strokeWidth:1, opacity:0.3})];
this._isBinded = false;
this._controlPointsController[0].addEventListener('mousedown', this._mouseDown.bindWithEvent(this, mindplot.ControlPoint.FROM));
this._controlPointsController[0].addEventListener('click', this._mouseClick.bindWithEvent(this));
this._controlPointsController[0].addEventListener('dblclick', this._mouseClick.bindWithEvent(this));
this._controlPointsController[1].addEventListener('mousedown', this._mouseDown.bindWithEvent(this, mindplot.ControlPoint.TO));
this._controlPointsController[1].addEventListener('click', this._mouseClick.bindWithEvent(this));
this._controlPointsController[1].addEventListener('dblclick', this._mouseClick.bindWithEvent(this));
this._controlPointsController[0].addEvent('mousedown', this._mouseDown.bindWithEvent(this, mindplot.ControlPoint.FROM));
this._controlPointsController[0].addEvent('click', this._mouseClick.bindWithEvent(this));
this._controlPointsController[0].addEvent('dblclick', this._mouseClick.bindWithEvent(this));
this._controlPointsController[1].addEvent('mousedown', this._mouseDown.bindWithEvent(this, mindplot.ControlPoint.TO));
this._controlPointsController[1].addEvent('click', this._mouseClick.bindWithEvent(this));
this._controlPointsController[1].addEvent('dblclick', this._mouseClick.bindWithEvent(this));
},
@ -77,9 +77,9 @@ mindplot.ControlPoint = new Class({
if (!this._isBinded) {
this._isBinded = true;
this._mouseMoveFunction = this._mouseMove.bindWithEvent(this, point);
this._workspace.getScreenManager().addEventListener('mousemove', this._mouseMoveFunction);
this._workspace.getScreenManager().addEvent('mousemove', this._mouseMoveFunction);
this._mouseUpFunction = this._mouseUp.bindWithEvent(this, point);
this._workspace.getScreenManager().addEventListener('mouseup', this._mouseUpFunction);
this._workspace.getScreenManager().addEvent('mouseup', this._mouseUpFunction);
}
event.preventDefault();
event.stop();
@ -111,8 +111,8 @@ mindplot.ControlPoint = new Class({
},
_mouseUp : function(event, point) {
this._workspace.getScreenManager().removeEventListener('mousemove', this._mouseMoveFunction);
this._workspace.getScreenManager().removeEventListener('mouseup', this._mouseUpFunction);
this._workspace.getScreenManager().removeEvent('mousemove', this._mouseMoveFunction);
this._workspace.getScreenManager().removeEvent('mouseup', this._mouseUpFunction);
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
actionDispatcher.moveControlPoint(this, point);

View File

@ -186,7 +186,7 @@ mindplot.DesignerKeyboard = new Class({
var regex = /^(?:shift|control|ctrl|alt|meta)$/;
var modifiers = ['shift', 'control', 'alt', 'meta'];
var excludes = ['esc','capslock','tab'];
var excludes = ['esc','capslock','tab','f3','f4','f5','f6','f7','f8','f9','10','11','12'];
$(document).addEvent('keydown', function(event) {

View File

@ -58,7 +58,7 @@ mindplot.DragManager.prototype.add = function(node)
window.document.body.style.cursor = 'move';
}
};
node.addEventListener('mousedown', mouseDownListener);
node.addEvent('mousedown', mouseDownListener);
};
mindplot.DragManager.prototype.remove = function(node)
@ -154,7 +154,7 @@ mindplot.DragManager.prototype._buildMouseUpListener = function(workspace, node,
* - dragging
* - enddragging
*/
mindplot.DragManager.prototype. addEventListener = function(type, listener)
mindplot.DragManager.prototype. addEvent = function(type, listener)
{
this._listeners[type] = listener;
};

View File

@ -55,7 +55,7 @@ mindplot.IconGroup = new Class({
},
addIcon : function(icon) {
$defined(icon,"icon is not defined");
$defined(icon, "icon is not defined");
icon.setGroup(this);
var newIcon = icon.getImage();
@ -136,7 +136,6 @@ mindplot.IconGroup = new Class({
var iconSize = nativeImage.getSize();
var size = this.options.nativeElem.getSize();
var position = nativeImage.getPosition();
var childs = this.options.nativeElem.removeChild(nativeImage);
this.options.icons.each(function(icon, index) {
var img = icon.getImage();
var pos = img.getPosition();
@ -148,7 +147,7 @@ mindplot.IconGroup = new Class({
this.setSize(size.width, size.height);
},
getNativeElement : function() {
getNativeElement : function() {
return this.options.nativeElem;
},
@ -157,22 +156,13 @@ mindplot.IconGroup = new Class({
},
registerListeners : function() {
this.options.nativeElem.addEventListener('click', function(event) {
this.options.nativeElem.addEvent('click', function(event) {
// Avoid node creation ...
if ($defined(event.stopPropagation)) {
event.stopPropagation(true);
} else {
event.cancelBubble = true;
}
event.stopPropagation();
});
this.options.nativeElem.addEventListener('dblclick', function(event) {
// Avoid node creation ...
if ($defined(event.stopPropagation)) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
this.options.nativeElem.addEvent('dblclick', function(event) {
event.stopPropagation();
});
},

View File

@ -52,7 +52,7 @@ mindplot.ImageIcon = new Class({
//Icon
var image = this.getImage();
image.addEventListener('click', function() {
image.addEvent('click', function() {
var iconType = iconModel.getIconType();
var newIconType = this._getNextFamilyIconId(iconType);
@ -63,15 +63,15 @@ mindplot.ImageIcon = new Class({
}.bind(this));
image.addEventListener('mouseover', function(event) {
image.addEvent('mouseover', function(event) {
tip.open(event, container, this);
}.bind(this));
image.addEventListener('mouseout', function(event) {
image.addEvent('mouseout', function(event) {
tip.close(event);
});
image.addEventListener('mousemove', function(event) {
image.addEvent('mousemove', function(event) {
tip.updatePosition(event);
});

View File

@ -138,13 +138,13 @@ mindplot.LinkIcon = new Class({
}
var linkIcon = this;
image.addEventListener('mouseover', function(event) {
image.addEvent('mouseover', function(event) {
bubbleTip.open(event, container, linkIcon);
});
image.addEventListener('mousemove', function(event) {
image.addEvent('mousemove', function(event) {
bubbleTip.updatePosition(event);
});
image.addEventListener('mouseout', function(event) {
image.addEvent('mouseout', function(event) {
bubbleTip.close(event);
});
},

View File

@ -118,7 +118,7 @@ mindplot.LocalActionDispatcher = new Class({
var result = topic.getFontFamily();
topic.setFontFamily(fontFamily, true);
core.Executor.instance.delay(topic.updateNode, 0, topic);
topic.updateNode.delay(0, topic);
return result;
};
@ -179,7 +179,7 @@ mindplot.LocalActionDispatcher = new Class({
var result = topic.getFontSize();
topic.setFontSize(size, true);
core.Executor.instance.delay(topic.updateNode, 0, topic);
topic.updateNode.delay(0, topic);
return result;
};
@ -209,11 +209,7 @@ mindplot.LocalActionDispatcher = new Class({
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);*/
topic.updateNode.delay(0, topic);
return result;
};

View File

@ -64,7 +64,7 @@ mindplot.MindmapDesigner = new Class({
mindplot.DesignerKeyboard.register(this);
// To prevent the user from leaving the page with changes ...
window.addEvent('beforeunload', function () {
$(window).addEvent('beforeunload', function () {
if (this.needsSave()) {
this.save(null, false)
}
@ -123,7 +123,7 @@ mindplot.MindmapDesigner = new Class({
return topics[0];
},
addEventListener : function(eventType, listener) {
addEvent : function(eventType, listener) {
this._events[eventType] = listener;
},
@ -154,7 +154,7 @@ mindplot.MindmapDesigner = new Class({
this._layoutManager.registerListenersOnNode(topic);
// If a node had gained focus, clean the rest of the nodes ...
topic.addEventListener('mousedown', function(event) {
topic.addEvent('mousedown', function(event) {
this.onObjectFocusEvent(topic, event);
}.bind(this));
}
@ -164,7 +164,6 @@ mindplot.MindmapDesigner = new Class({
if (isConnected) {
// Improve this ...
var targetTopicModel = model.getParent();
var targetTopicId = targetTopicModel.getId();
var targetTopic = null;
for (var i = 0; i < topics.length; i++) {
@ -295,7 +294,7 @@ mindplot.MindmapDesigner = new Class({
}
,
addRelationShip2SelectedNode : function(event) {
addRelationShip : function(event) {
var screen = this._workspace.getScreenManager();
var pos = screen.getWorkspaceMousePosition(event);
var selectedTopics = this.getSelectedNodes();
@ -456,10 +455,9 @@ mindplot.MindmapDesigner = new Class({
}
var relationships = mindmapModel.getRelationships();
for (var j = 0; j < relationships.length; j++) {
var relationship = this._relationshipModelToRelationship(relationships[j]);
this._relationshipModelToRelationship(relationships[j]);
}
}
core.Executor.instance.setLoading(false);
this._getTopics().forEach(function(topic) {
delete topic.getModel()._finalPosition;
});
@ -578,7 +576,7 @@ mindplot.MindmapDesigner = new Class({
relationLine.setModel(model);
//Add Listeners
relationLine.addEventListener('onfocus', function(event) {
relationLine.addEvent('onfocus', function(event) {
elem.onObjectFocusEvent.attempt([relationLine, event], elem);
});
@ -624,7 +622,7 @@ mindplot.MindmapDesigner = new Class({
},
setFont2SelectedNode : function(font) {
changeFontFamily : function(font) {
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
@ -641,7 +639,8 @@ mindplot.MindmapDesigner = new Class({
}
},
setFontColor2SelectedNode : function(color) {
changeFontColor : function(color) {
$assert(color,"color can not be null");
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
@ -649,7 +648,7 @@ mindplot.MindmapDesigner = new Class({
}
},
setBackColor2SelectedNode : function(color) {
changeBackgroundColor : function(color) {
var validateFunc = function(topic) {
return topic.getShapeType() != mindplot.model.NodeModel.SHAPE_TYPE_LINE
@ -700,7 +699,7 @@ mindplot.MindmapDesigner = new Class({
return result;
},
setBorderColor2SelectedNode : function(color) {
changeBorderColor : function(color) {
var validateFunc = function(topic) {
return topic.getShapeType() != mindplot.model.NodeModel.SHAPE_TYPE_LINE
};
@ -713,7 +712,7 @@ mindplot.MindmapDesigner = new Class({
}
},
setFontSize2SelectedNode : function(size) {
changeFontSize : function(size) {
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
@ -722,7 +721,7 @@ mindplot.MindmapDesigner = new Class({
}
,
setShape2SelectedNode : function(shape) {
changeTopicShape : function(shape) {
var validateFunc = function(topic) {
return !(topic.getType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE && shape == mindplot.model.NodeModel.SHAPE_TYPE_LINE)
};
@ -743,7 +742,7 @@ mindplot.MindmapDesigner = new Class({
}
},
addIconType2SelectedNode : function(iconType) {
addIconType : function(iconType) {
var validSelectedObjects = this._getValidSelectedObjectsIds();
var topicsIds = validSelectedObjects.nodes;
if (topicsIds.length > 0) {
@ -759,7 +758,7 @@ mindplot.MindmapDesigner = new Class({
}
},
addLink2SelectedNode : function() {
addLink : function() {
var selectedTopics = this.getSelectedNodes();
var topic = null;
if (selectedTopics.length > 0) {
@ -811,7 +810,7 @@ mindplot.MindmapDesigner = new Class({
}
},
addNote2SelectedNode : function() {
addNote : function() {
var selectedTopics = this.getSelectedNodes();
var topic = null;
if (selectedTopics.length > 0) {

View File

@ -52,9 +52,9 @@ mindplot.NodeGraph = new Class({
this._model.setPosition(point.x, point.y);
},
addEventListener : function(type, listener) {
addEvent : function(type, listener) {
var elem = this.get2DElement();
elem.addEventListener(type, listener);
elem.addEvent(type, listener);
},
setMouseEventsEnabled : function(isEnabled) {

View File

@ -96,7 +96,7 @@ mindplot.Note = new Class({
}
var note = this;
image.addEventListener('mouseover', function(event) {
image.addEvent('mouseover', function(event) {
var text = textModel.getText();
text = unescape(text);
text = text.replace(/\n/ig, "<br/>");
@ -106,10 +106,10 @@ mindplot.Note = new Class({
bubbleTip.open(event, container, note);
}.bind(this));
image.addEventListener('mousemove', function(event) {
image.addEvent('mousemove', function(event) {
bubbleTip.updatePosition(event);
});
image.addEventListener('mouseout', function(event) {
image.addEvent('mouseout', function(event) {
bubbleTip.close(event);
});
},

View File

@ -119,7 +119,7 @@ mindplot.RelationshipLine = new Class({
workspace.appendChild(this._focusShape);
workspace.appendChild(this._controlPointsController);
this._controlPointControllerListener = this._initializeControlPointController.bindWithEvent(this, workspace);
this._line2d.addEventListener('click', this._controlPointControllerListener);
this._line2d.addEvent('click', this._controlPointControllerListener);
this._isInWorkspace = true;
workspace.appendChild(this._startArrow);
@ -135,7 +135,7 @@ mindplot.RelationshipLine = new Class({
removeFromWorkspace : function(workspace) {
workspace.removeChild(this._focusShape);
workspace.removeChild(this._controlPointsController);
this._line2d.removeEventListener('click', this._controlPointControllerListener);
this._line2d.removeEvent('click', this._controlPointControllerListener);
this._isInWorkspace = false;
workspace.removeChild(this._startArrow);
workspace.removeChild(this._endArrow);
@ -175,14 +175,14 @@ mindplot.RelationshipLine = new Class({
//this._focusShape.setDestControlPoint(ctrlPoints[1]);
},
addEventListener : function(type, listener) {
addEvent : function(type, listener) {
// Translate to web 2d events ...
if (type == 'onfocus') {
type = 'mousedown';
}
var line = this._line2d;
line.addEventListener(type, listener);
line.addEvent(type, listener);
},
isOnFocus : function() {

View File

@ -24,7 +24,7 @@ mindplot.ShirinkConnector = new Class({
elipse.setFill('#f7f7f7');
elipse.setSize(mindplot.Topic.CONNECTOR_WIDTH, mindplot.Topic.CONNECTOR_WIDTH);
elipse.addEventListener('click', function(event) {
elipse.addEvent('click', function(event) {
var model = topic.getModel();
var collapse = !model.areChildrenShrinked();
@ -37,24 +37,25 @@ mindplot.ShirinkConnector = new Class({
});
elipse.addEventListener('mousedown', function(event) {
elipse.addEvent('mousedown', function(event) {
// Avoid node creation ...
var e = new Event(event).stop();
e.preventDefault();
});
elipse.addEventListener('dblclick', function(event) {
elipse.addEvent('dblclick', function(event) {
// Avoid node creation ...
event = new Event(event).stop();
event.preventDefault();
});
elipse.addEventListener('mouseover', function(event) {
this.setFill('#009900');
elipse.addEvent('mouseover', function(event) {
this.setFill('rgb(153, 0, 255)');
});
elipse.addEventListener('mouseout', function(event) {
elipse.addEvent('mouseout', function(event) {
var color = topic.getBackgroundColor();
this.setFill(color);
});

View File

@ -45,7 +45,7 @@ mindplot.TextEditor = new Class({
var inputText = new Element('input', {type:"text",tabindex:'-1', value:""});
inputText.setStyles({
border:"none",
background:"transparent"
background:"red"
});
inputText.inject(inputContainer);

View File

@ -43,11 +43,11 @@ mindplot.Topic = new Class({
this.setMouseEventsEnabled(true);
// Prevent click on the topics being propagated ...
this.addEventListener('click', function(event) {
this.addEvent('click', function(event) {
event.stopPropagation();
});
this.addEventListener('dblclick', function (event) {
this.addEvent('dblclick', function (event) {
this._textEditor.show();
event.stopPropagation(true);
}.bind(this));
@ -83,7 +83,7 @@ mindplot.Topic = new Class({
if ($defined(dispatcher)) {
for (var i = 1; i < dispatcher._listeners.length; i++) {
innerShape.addEventListener('mousedown', dispatcher._listeners[i]);
innerShape.addEvent('mousedown', dispatcher._listeners[i]);
}
}
@ -373,17 +373,8 @@ mindplot.Topic = new Class({
this._icon = null;
}
}
/*var elem = this;
var executor = function(editor)
{
return function()
{
elem.updateNode();
};
};
setTimeout(executor(this), 0);*/
core.Executor.instance.delay(this.updateNode, 0, this);
this.updateNode.delay(0, this);
this._note = null;
this._hasNote = false;
},
@ -414,7 +405,7 @@ mindplot.Topic = new Class({
if (!disableEventsListeners) {
// Propagate mouse events ...
var topic = this;
result.addEventListener('mousedown', function(event) {
result.addEvent('mousedown', function(event) {
var eventDispatcher = topic.getInnerShape()._dispatcherByEventType['mousedown'];
if ($defined(eventDispatcher)) {
eventDispatcher.eventListener(event);
@ -466,7 +457,7 @@ mindplot.Topic = new Class({
var model = this.getModel();
model.setFontFamily(value);
}
core.Executor.instance.delay(this.updateNode, 0, this, [updateModel]);
this.updateNode.delay(0, this, [updateModel]);
},
setFontSize : function(value, updateModel) {
@ -476,7 +467,7 @@ mindplot.Topic = new Class({
var model = this.getModel();
model.setFontSize(value);
}
core.Executor.instance.delay(this.updateNode, 0, this, [updateModel]);
this.updateNode.delay(0, this, [updateModel]);
},
@ -487,7 +478,7 @@ mindplot.Topic = new Class({
var model = this.getModel();
model.setFontStyle(value);
}
core.Executor.instance.delay(this.updateNode, 0, this, [updateModel]);
this.updateNode.delay(0, this, [updateModel]);
},
setFontWeight : function(value, updateModel) {
@ -561,7 +552,7 @@ mindplot.Topic = new Class({
_setText : function(text, updateModel) {
var textShape = this.getTextShape();
textShape.setText(text);
core.Executor.instance.delay(this.updateNode, 0, this, [updateModel]);
this.updateNode.delay(0, this, [updateModel]);
if ($defined(updateModel) && updateModel) {
var model = this.getModel();
@ -674,14 +665,14 @@ mindplot.Topic = new Class({
topic.handleMouseOver(event);
}
};
elem.addEventListener('mouseover', mouseOver);
elem.addEvent('mouseover', mouseOver);
var outout = function(event) {
if (topic.isMouseEventsEnabled()) {
topic.handleMouseOut(event);
}
};
elem.addEventListener('mouseout', outout);
elem.addEvent('mouseout', outout);
// Focus events ...
var mouseDown = function(event) {
@ -693,7 +684,7 @@ mindplot.Topic = new Class({
}
topic.setOnFocus(value);
}.bind(this);
elem.addEventListener('mousedown', mouseDown);
elem.addEvent('mousedown', mouseDown);
},
areChildrenShrinked : function() {
@ -937,23 +928,23 @@ mindplot.Topic = new Class({
* type:
* onfocus
*/
addEventListener : function(type, listener) {
addEvent : function(type, listener) {
// Translate to web 2d events ...
if (type == 'onfocus') {
type = 'mousedown';
}
var shape = this.get2DElement();
shape.addEventListener(type, listener);
shape.addEvent(type, listener);
},
removeEventListener : function(type, listener) {
removeEvent : function(type, listener) {
// Translate to web 2d events ...
if (type == 'onfocus') {
type = 'mousedown';
}
var shape = this.get2DElement();
shape.removeEventListener(type, listener);
shape.removeEvent(type, listener);
},
@ -1135,6 +1126,10 @@ mindplot.Topic = new Class({
if ($defined(targetTopic)) {
result.connectTo(targetTopic);
}
// If a drag node is create for it, let's hide the editor.
this._textEditor.close();
return result;
},

View File

@ -87,12 +87,12 @@ mindplot.Workspace = new Class({
}
},
addEventListener: function(type, listener) {
this._workspace.addEventListener(type, listener);
addEvent: function(type, listener) {
this._workspace.addEvent(type, listener);
},
removeEventListener: function(type, listener) {
this._workspace.removeEventListener(type, listener);
removeEvent: function(type, listener) {
this._workspace.removeEvent(type, listener);
},
getSize: function() {

View File

@ -52,7 +52,7 @@ mindplot.layout.FreeMindLayoutManager = mindplot.layout.BaseLayoutManager.extend
var id = topic.getId();
// Register node listeners ...
var designer = this.getDesigner();
topic.addEventListener('click', function(event)
topic.addEvent('click', function(event)
{
designer.onObjectFocusEvent.attempt([topic, event], designer);
});
@ -60,7 +60,7 @@ mindplot.layout.FreeMindLayoutManager = mindplot.layout.BaseLayoutManager.extend
// Add drag behaviour ...
if (topic.getType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE)
{
topic.addEventListener("mousedown",this._reconnectMouseDownListener.bindWithEvent(this,[topic]));
topic.addEvent("mousedown",this._reconnectMouseDownListener.bindWithEvent(this,[topic]));
}
},
@ -97,11 +97,11 @@ mindplot.layout.FreeMindLayoutManager = mindplot.layout.BaseLayoutManager.extend
// Register mouse move listener ...
this._mouseMoveListenerInstance = this._mouseMoveListener.bindWithEvent(this,[topic]);
screen.addEventListener('mousemove', this._mouseMoveListenerInstance);
screen.addEvent('mousemove', this._mouseMoveListenerInstance);
// Register mouse up listeners ...
this._mouseUpListenerInstance = this._mouseUpListener.bindWithEvent(this,[topic]);
screen.addEventListener('mouseup', this._mouseUpListenerInstance);
screen.addEvent('mouseup', this._mouseUpListenerInstance);
// Change cursor.
window.document.body.style.cursor = 'move';
@ -192,8 +192,8 @@ mindplot.layout.FreeMindLayoutManager = mindplot.layout.BaseLayoutManager.extend
var screen = this._designer.getWorkSpace().getScreenManager();
// Remove all the events.
screen.removeEventListener('mousemove', this._mouseMoveListenerInstance);
screen.removeEventListener('mouseup', this._mouseUpListenerInstance);
screen.removeEvent('mousemove', this._mouseMoveListenerInstance);
screen.removeEvent('mouseup', this._mouseUpListenerInstance);
delete this._mouseMoveListenerInstance;
delete this._mouseUpListenerInstance;
@ -289,7 +289,7 @@ mindplot.layout.FreeMindLayoutManager = mindplot.layout.BaseLayoutManager.extend
mindplot.EventBus.instance.addEvent(mindplot.EventBus.events.NodeMouseOverEvent,show);
mindplot.EventBus.instance.addEvent(mindplot.EventBus.events.NodeMouseOutEvent,hide);
node.addHelper(moveShape);
moveShape.addEventListener("mousedown",this._mousedownListener.bindWithEvent(this,[node]));
moveShape.addEvent("mousedown",this._mousedownListener.bindWithEvent(this,[node]));
},
needsPrepositioning:function(){
@ -320,10 +320,10 @@ mindplot.layout.FreeMindLayoutManager = mindplot.layout.BaseLayoutManager.extend
topics[i].setMouseEventsEnabled(false);
if(topics[i].getId()!=topic.getId()){
var overListener = this._reconnectMouseOverListener.bindWithEvent(topics[i],[this]);
topics[i].addEventListener('mouseover',overListener);
topics[i].addEvent('mouseover',overListener);
this._mouseOverListeners.set(topics[i].getId(),overListener);
var outListener = this._reconnectMouseOutListener.bindWithEvent(topics[i],[this]);
topics[i].addEventListener('mouseout',outListener);
topics[i].addEvent('mouseout',outListener);
this._mouseOutListeners.set(topics[i].getId(),outListener);
}
}
@ -342,11 +342,11 @@ mindplot.layout.FreeMindLayoutManager = mindplot.layout.BaseLayoutManager.extend
// Register mouse move listener ...
this._mouseMoveListenerInstance = this._reconnectMouseMoveListener.bindWithEvent(this,[topic]);
screen.addEventListener('mousemove', this._mouseMoveListenerInstance);
screen.addEvent('mousemove', this._mouseMoveListenerInstance);
// Register mouse up listeners ...
this._mouseUpListenerInstance = this._reconnectMouseUpListener.bindWithEvent(this,[topic]);
screen.addEventListener('mouseup', this._mouseUpListenerInstance);
screen.addEvent('mouseup', this._mouseUpListenerInstance);
// Change cursor.
window.document.body.style.cursor = 'move';
@ -390,8 +390,8 @@ mindplot.layout.FreeMindLayoutManager = mindplot.layout.BaseLayoutManager.extend
_reconnectMouseUpListener:function(event, node){
var screen = this._designer.getWorkSpace().getScreenManager();
// Remove all the events.
screen.removeEventListener('mousemove', this._mouseMoveListenerInstance);
screen.removeEventListener('mouseup', this._mouseUpListenerInstance);
screen.removeEvent('mousemove', this._mouseMoveListenerInstance);
screen.removeEvent('mouseup', this._mouseUpListenerInstance);
delete this._mouseMoveListenerInstance;
delete this._mouseUpListenerInstance;
@ -402,9 +402,9 @@ mindplot.layout.FreeMindLayoutManager = mindplot.layout.BaseLayoutManager.extend
topics[i].setMouseEventsEnabled(true);
if(topics[i].getId()!=node.getId()){
var overListener = this._mouseOverListeners.get(topics[i].getId());
topics[i].removeEventListener('mouseover',overListener);
topics[i].removeEvent('mouseover',overListener);
var outListener = this._mouseOutListeners.get(topics[i].getId());
topics[i].removeEventListener('mouseout',outListener);
topics[i].removeEvent('mouseout',outListener);
}
}

View File

@ -83,19 +83,19 @@ mindplot.layout.OriginalLayoutManager = new Class({
var dragTopicPositioner = this.getDragTopicPositioner();
dragger.addEventListener('startdragging', function(event, node) {
dragger.addEvent('startdragging', function(event, node) {
// Enable all mouse events.
for (var i = 0; i < topics.length; i++) {
topics[i].setMouseEventsEnabled(false);
}
});
dragger.addEventListener('dragging', function(event, dragTopic) {
dragger.addEvent('dragging', function(event, dragTopic) {
// Update the state and connections of the topic ...
dragTopicPositioner.positionateDragTopic(dragTopic);
});
dragger.addEventListener('enddragging', function(event, dragTopic) {
dragger.addEvent('enddragging', function(event, dragTopic) {
// Enable all mouse events.
for (var i = 0; i < topics.length; i++) {
topics[i].setMouseEventsEnabled(true);

View File

@ -56,7 +56,7 @@ mindplot.widget.Menu = new Class({
},
setValue: function(value) {
designer.setFont2SelectedNode(value);
designer.changeFontFamily(value);
}
};
@ -77,7 +77,7 @@ mindplot.widget.Menu = new Class({
return result;
},
setValue: function(value) {
designer.setFontSize2SelectedNode(value);
designer.changeFontSize(value);
}
};
this._toolbarElems.push(new mindplot.widget.FontSizePanel("fontSize", fontSizeModel));
@ -97,7 +97,7 @@ mindplot.widget.Menu = new Class({
return result;
},
setValue: function(value) {
designer.setShape2SelectedNode(value);
designer.changeTopicShape(value);
}
};
this._toolbarElems.push(new mindplot.widget.TopicShapePanel("topicShape", topicShapeModel));
@ -108,7 +108,7 @@ mindplot.widget.Menu = new Class({
return null;
},
setValue: function(value) {
designer.addIconType2SelectedNode(value);
designer.addIconType(value);
}
};
this._toolbarElems.push(new mindplot.widget.IconPanel('topicIcon', topicIconModel));
@ -130,7 +130,7 @@ mindplot.widget.Menu = new Class({
return result;
},
setValue : function (hex) {
designer.setBackColor2SelectedNode(hex);
designer.changeBackgroundColor(hex);
}
};
this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicColor', topicColorModel, baseUrl));
@ -152,7 +152,7 @@ mindplot.widget.Menu = new Class({
return result;
},
setValue : function (hex) {
designer.setBorderColor2SelectedNode(hex);
designer.changeBorderColor(hex);
}
};
this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('topicBorder', borderColorModel, baseUrl));
@ -174,7 +174,7 @@ mindplot.widget.Menu = new Class({
return result;
},
setValue : function (hex) {
designer.setFontColor2SelectedNode(hex);
designer.changeFontColor(hex);
}
};
this._toolbarElems.push(new mindplot.widget.ColorPalettePanel('fontColor', fontColorModel, baseUrl));
@ -214,16 +214,16 @@ mindplot.widget.Menu = new Class({
$('topicLink').addEvent('click', function(event) {
designer.addLink2SelectedNode();
designer.addLink();
});
$('topicRelation').addEvent('click', function(event) {
designer.addRelationShip2SelectedNode(event);
designer.addRelationShip(event);
});
$('topicNote').addEvent('click', function(event) {
designer.addNote2SelectedNode();
designer.addNote();
});
@ -235,7 +235,7 @@ mindplot.widget.Menu = new Class({
designer.changeFontStyle();
});
designer.addEventListener("modelUpdate", function(event) {
designer.addEvent("modelUpdate", function(event) {
if (event.undoSteps > 0) {
$("undoEdition").setStyle("background-image", "url(../images/file_undo.png)");
} else {

View File

@ -114,20 +114,17 @@
<table class="palette-table" cellspacing="0" cellpadding="0" role="grid">
<tbody class="palette-body">
<tr class="palette-row">
<td class="palette-cell"
>
<td class="palette-cell">
<div class="palette-colorswatch"
style="background-color: rgb(244, 204, 204);"
title="RGB (244, 204, 204)"></div>
</td>
<td class="palette-cell"
>
<td class="palette-cell">
<div class="palette-colorswatch"
style="background-color: rgb(252, 229, 205);"
title="RGB (252, 229, 205)"></div>
</td>
<td class="palette-cell"
>
<td class="palette-cell">
<div class="palette-colorswatch"
style="background-color: rgb(255, 242, 204);"
title="RGB (255, 242, 204)"></div>
@ -337,7 +334,7 @@
<td class="palette-cell"
>
<div class="palette-colorswatch"
style="background-color: #525c61;"
style="background-color: rgb(53, 28, 117)"
title="RGB (53, 28, 117)"></div>
</td>
<td class="palette-cell"

View File

@ -93,7 +93,7 @@ web2d.Element.prototype._supportedEvents = ["click","dblclick","mousemove","mous
* The following events types are supported:
*
*/
web2d.Element.prototype.addEventListener = function(type, listener)
web2d.Element.prototype.addEvent = function(type, listener)
{
if (!this._supportedEvents.include(type))
{
@ -106,7 +106,7 @@ web2d.Element.prototype.addEventListener = function(type, listener)
this._dispatcherByEventType[type] = new web2d.EventDispatcher(this);
var eventListener = this._dispatcherByEventType[type].eventListener;
this._peer.addEventListener(type, eventListener);
this._peer.addEvent(type, eventListener);
}
this._dispatcherByEventType[type].addListener(type, listener);
@ -122,7 +122,7 @@ web2d.Element.prototype.addEventListener = function(type, listener)
* The listener parameter takes an interface implemented by the user which contains the methods to be called when the event occurs.
* This interace will be invoked passing an event as argument and the 'this' referece in the function will be the element.
*/
web2d.Element.prototype.removeEventListener = function(type, listener)
web2d.Element.prototype.removeEvent = function(type, listener)
{
var dispatcher = this._dispatcherByEventType[type];
if (dispatcher == null)
@ -134,7 +134,7 @@ web2d.Element.prototype.removeEventListener = function(type, listener)
// If there is not listeners, EventDispatcher must be removed.
if (dispatcher.getListenersCount() <= 0)
{
this._peer.removeEventListener(type, dispatcher.eventListener);
this._peer.removeEvent(type, dispatcher.eventListener);
this._dispatcherByEventType[type] = null;
}
};

View File

@ -1,25 +1,23 @@
/*
* 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.
*/
web2d.peer.svg.ElementPeer = function(svgElement)
{
web2d.peer.svg.ElementPeer = function(svgElement) {
this._native = svgElement;
this._dblClickListeners = new Hash();
this._size = {width:1,height:1};
this._changeListeners = {};
// http://support.adobe.com/devsup/devsup.nsf/docs/50493.htm
@ -28,34 +26,28 @@ web2d.peer.svg.ElementPeer = function(svgElement)
web2d.peer.svg.ElementPeer.prototype.svgNamespace = 'http://www.w3.org/2000/svg';
web2d.peer.svg.ElementPeer.prototype.linkNamespace = 'http://www.w3.org/1999/xlink';
web2d.peer.svg.ElementPeer.prototype.setChildren = function(children)
{
web2d.peer.svg.ElementPeer.prototype.setChildren = function(children) {
this._children = children;
};
web2d.peer.svg.ElementPeer.prototype.getChildren = function()
{
web2d.peer.svg.ElementPeer.prototype.getChildren = function() {
var result = this._children;
if (!$defined(result))
{
if (!$defined(result)) {
result = [];
this._children = result;
}
return result;
};
web2d.peer.svg.ElementPeer.prototype.getParent = function()
{
web2d.peer.svg.ElementPeer.prototype.getParent = function() {
return this._parent;
};
web2d.peer.svg.ElementPeer.prototype.setParent = function(parent)
{
web2d.peer.svg.ElementPeer.prototype.setParent = function(parent) {
this._parent = parent;
};
web2d.peer.svg.ElementPeer.prototype.appendChild = function(elementPeer)
{
web2d.peer.svg.ElementPeer.prototype.appendChild = function(elementPeer) {
// Store parent and child relationship.
elementPeer.setParent(this);
var children = this.getChildren();
@ -69,8 +61,7 @@ web2d.peer.svg.ElementPeer.prototype.appendChild = function(elementPeer)
};
web2d.peer.svg.ElementPeer.prototype.removeChild = function(elementPeer)
{
web2d.peer.svg.ElementPeer.prototype.removeChild = function(elementPeer) {
// Store parent and child relationship.
elementPeer.setParent(null);
var children = this.getChildren();
@ -81,85 +72,34 @@ web2d.peer.svg.ElementPeer.prototype.removeChild = function(elementPeer)
children.erase(elementPeer);
var newLength = children.length;
if (newLength >= length)
{
if (newLength >= length) {
throw "Could not remove the element.";
}
/*var found = false;
children = children.reject(function(iter)
{
var equals = (iter._native == elementPeer._native);
if (equals)
{
found = true;
}
return equals;
});
// Could found the element ?
if (!found)
{
throw "Could not remove the element.";
}*/
// Append element as a child.
this._native.removeChild(elementPeer._native);
};
/**
* http://www.w3.org/TR/DOM-Level-3-Events/events.html
* http://developer.mozilla.org/en/docs/addEventListener
* http://developer.mozilla.org/en/docs/addEvent
*/
web2d.peer.svg.ElementPeer.prototype.addEventListener = function(type, listener)
{
if (type == 'dblclick')
{
// This is workaround to support double click...
var dblListener = function(e)
{
if (e.detail >= 2)
{
listener.call(this, e);
}
};
web2d.peer.svg.ElementPeer.prototype.addEvent = function(type, listener) {
this._native.addEventListener(type, listener, false);
this._dblClickListeners[listener] = dblListener;
this._native.addEventListener(type, dblListener, false);
} else
{
this._native.addEventListener(type, listener, false);
}
};
web2d.peer.svg.ElementPeer.prototype.removeEventListener = function(type, listener)
{
if (type == 'dblclick')
{
// This is workaround to support double click...
var dblClickListener = this._dblClickListeners[listener];
if (dblClickListener == null)
{
throw "Could not find listener to remove";
}
type = 'click';
this._native.removeEventListener(type, dblClickListener, false);
delete this._dblClickListeners[listener];
} else
{
this._native.removeEventListener(type, listener, false);
}
web2d.peer.svg.ElementPeer.prototype.removeEvent = function(type, listener) {
this._native.removeEventListener(type, listener, false);
};
web2d.peer.svg.ElementPeer.prototype.setSize = function(width, height)
{
if ($defined(width) && this._size.width != parseInt(width))
{
web2d.peer.svg.ElementPeer.prototype.setSize = function(width, height) {
if ($defined(width) && this._size.width != parseInt(width)) {
this._size.width = parseInt(width);
this._native.setAttribute('width', parseInt(width));
}
if ($defined(height) && this._size.height != parseInt(height))
{
if ($defined(height) && this._size.height != parseInt(height)) {
this._size.height = parseInt(height);
this._native.setAttribute('height', parseInt(height));
}
@ -167,32 +107,26 @@ web2d.peer.svg.ElementPeer.prototype.setSize = function(width, height)
web2d.peer.utils.EventUtils.broadcastChangeEvent(this, "strokeStyle");
};
web2d.peer.svg.ElementPeer.prototype.getSize = function()
{
web2d.peer.svg.ElementPeer.prototype.getSize = function() {
return {width:this._size.width,height:this._size.height};
};
web2d.peer.svg.ElementPeer.prototype.setFill = function(color, opacity)
{
if ($defined(color))
{
web2d.peer.svg.ElementPeer.prototype.setFill = function(color, opacity) {
if ($defined(color)) {
this._native.setAttribute('fill', color);
}
if ($defined(opacity))
{
if ($defined(opacity)) {
this._native.setAttribute('fill-opacity', opacity);
}
};
web2d.peer.svg.ElementPeer.prototype.getFill = function()
{
web2d.peer.svg.ElementPeer.prototype.getFill = function() {
var color = this._native.getAttribute('fill');
var opacity = this._native.getAttribute('fill-opacity');
return {color:color, opacity:Number(opacity)};
};
web2d.peer.svg.ElementPeer.prototype.getStroke = function()
{
web2d.peer.svg.ElementPeer.prototype.getStroke = function() {
var vmlStroke = this._native;
var color = vmlStroke.getAttribute('stroke');
var dashstyle = this._stokeStyle;
@ -202,18 +136,14 @@ web2d.peer.svg.ElementPeer.prototype.getStroke = function()
};
web2d.peer.svg.ElementPeer.prototype.__stokeStyleToStrokDasharray = {solid:[],dot:[1,3],dash:[4,3],longdash:[10,2],dashdot:[5,3,1,3]};
web2d.peer.svg.ElementPeer.prototype.setStroke = function(width, style, color, opacity)
{
if ($defined(width))
{
web2d.peer.svg.ElementPeer.prototype.setStroke = function(width, style, color, opacity) {
if ($defined(width)) {
this._native.setAttribute('stroke-width', width + "px");
}
if ($defined(color))
{
if ($defined(color)) {
this._native.setAttribute('stroke', color);
}
if ($defined(style))
{
if ($defined(style)) {
// Scale the dash array in order to be equal to VML. In VML, stroke style doesn't scale.
var dashArrayPoints = this.__stokeStyleToStrokDasharray[style];
var scale = 1 / web2d.peer.utils.TransformUtil.workoutScale(this).width;
@ -222,8 +152,7 @@ web2d.peer.svg.ElementPeer.prototype.setStroke = function(width, style, color, o
strokeWidth = parseFloat(strokeWidth);
var scaledPoints = [];
for (var i = 0; i < dashArrayPoints.length; i++)
{
for (var i = 0; i < dashArrayPoints.length; i++) {
// VML scale the stroke based on the stroke width.
scaledPoints[i] = dashArrayPoints[i] * strokeWidth;
@ -235,53 +164,43 @@ web2d.peer.svg.ElementPeer.prototype.setStroke = function(width, style, color, o
this._stokeStyle = style;
}
if ($defined(opacity))
{
if ($defined(opacity)) {
this._native.setAttribute('stroke-opacity', opacity);
}
};
/*
* style='visibility: visible'
*/
web2d.peer.svg.ElementPeer.prototype.setVisibility = function(isVisible)
{
* style='visibility: visible'
*/
web2d.peer.svg.ElementPeer.prototype.setVisibility = function(isVisible) {
this._native.setAttribute('visibility', (isVisible) ? 'visible' : 'hidden');
};
web2d.peer.svg.ElementPeer.prototype.isVisible = function()
{
web2d.peer.svg.ElementPeer.prototype.isVisible = function() {
var visibility = this._native.getAttribute('visibility');
return !(visibility == 'hidden');
};
web2d.peer.svg.ElementPeer.prototype.updateStrokeStyle = function()
{
web2d.peer.svg.ElementPeer.prototype.updateStrokeStyle = function() {
var strokeStyle = this._stokeStyle;
if (this.getParent())
{
if (strokeStyle && strokeStyle != 'solid')
{
if (this.getParent()) {
if (strokeStyle && strokeStyle != 'solid') {
this.setStroke(null, strokeStyle);
}
}
};
web2d.peer.svg.ElementPeer.prototype.attachChangeEventListener = function(type, listener)
{
web2d.peer.svg.ElementPeer.prototype.attachChangeEventListener = function(type, listener) {
var listeners = this.getChangeEventListeners(type);
if (!$defined(listener))
{
if (!$defined(listener)) {
throw "Listener can not be null";
}
listeners.push(listener);
};
web2d.peer.svg.ElementPeer.prototype.getChangeEventListeners = function(type)
{
web2d.peer.svg.ElementPeer.prototype.getChangeEventListeners = function(type) {
var listeners = this._changeListeners[type];
if (!$defined(listeners))
{
if (!$defined(listeners)) {
listeners = [];
this._changeListeners[type] = listeners;
}
@ -291,20 +210,17 @@ web2d.peer.svg.ElementPeer.prototype.getChangeEventListeners = function(type)
/**
* Move element to the front
*/
web2d.peer.svg.ElementPeer.prototype.moveToFront = function()
{
web2d.peer.svg.ElementPeer.prototype.moveToFront = function() {
this._native.parentNode.appendChild(this._native);
};
/**
* Move element to the back
*/
web2d.peer.svg.ElementPeer.prototype.moveToBack = function()
{
web2d.peer.svg.ElementPeer.prototype.moveToBack = function() {
this._native.parentNode.insertBefore(this._native, this._native.parentNode.firstChild);
};
web2d.peer.svg.ElementPeer.prototype.setCursor = function(type)
{
web2d.peer.svg.ElementPeer.prototype.setCursor = function(type) {
this._native.style.cursor = type;
};

View File

@ -239,8 +239,8 @@ function testElementEventHandling()
var listener = function() { /* Dummy event listener */
};
elem.addEventListener(eventType, listener);
elem.removeEventListener(eventType, listener);
elem.addEvent(eventType, listener);
elem.removeEvent(eventType, listener);
};
testEventHandling(workspace, null, 'mouseover');

View File

@ -59,13 +59,13 @@ function testEventTest()
alert("My Listener 2");
};
workspace.addEventListener("click", firstListener);
workspace.addEvent("click", firstListener);
// Handle gracefully invalid event types...
var catchException = false
try
{
workspace.addEventListener("click2", firstListener);
workspace.addEvent("click2", firstListener);
} catch(e)
{
catchException = true;
@ -77,7 +77,7 @@ function testEventTest()
catchException = false
try
{
workspace.removeEventListener("click", secondListener);
workspace.removeEvent("click", secondListener);
} catch(e)
{
catchException = true;
@ -85,13 +85,13 @@ function testEventTest()
assert("Invalid remove operation seems to be broken", catchException);
//// Remove a valid listener.
workspace.removeEventListener("click", firstListener);
workspace.removeEvent("click", firstListener);
//// It has been removed?
catchException = false;
try
{
workspace.removeEventListener("click", firstListener);
workspace.removeEvent("click", firstListener);
} catch(e)
{
catchException = true;
@ -101,16 +101,16 @@ function testEventTest()
// Check multiple registation of a type ...
//// Add two listeners ...
workspace.addEventListener("dblclick", firstListener);
workspace.addEventListener("dblclick", secondListener);
workspace.addEvent("dblclick", firstListener);
workspace.addEvent("dblclick", secondListener);
//// Remove it ...
workspace.removeEventListener("dblclick", firstListener);
workspace.removeEventListener("dblclick", secondListener);
workspace.removeEvent("dblclick", firstListener);
workspace.removeEvent("dblclick", secondListener);
/// Check multiple registration on different types ...
workspace.addEventListener("click", firstListener);
workspace.addEventListener("mouseover", secondListener);
workspace.addEvent("click", firstListener);
workspace.addEvent("mouseover", secondListener);
}

View File

@ -73,10 +73,10 @@
this._enable = !this._enable;
if (this._enable)
{
this._element.addEventListener(this._type, this._listener);
this._element.addEvent(this._type, this._listener);
} else
{
this._element.removeEventListener(this._type, this._listener);
this._element.removeEvent(this._type, this._listener);
}
return this._enable;
};
@ -95,7 +95,7 @@
alert("Listener #:" + count);
};
this._listeners.push(listener);
this._element.addEventListener(this._type, listener);
this._element.addEvent(this._type, listener);
}
@ -109,7 +109,7 @@
if (this._listeners.length > 0)
{
var listener = this._listeners.pop();
this._element.removeEventListener(this._type, listener);
this._element.removeEvent(this._type, listener);
}
}

View File

@ -135,9 +135,9 @@
var listener = function(e) {
alert("Click event on:" + this.getType())
};
group.addEventListener("click", listener);
elipseLeft.addEventListener("click", listener);
elipseRight.addEventListener("click", listener);
group.addEvent("click", listener);
elipseLeft.addEvent("click", listener);
elipseRight.addEvent("click", listener);
workspace.addItAsChildTo($("groupEventsContainer"));
}
@ -301,7 +301,7 @@
group.setSize(100, 100);
group.setPosition(0, 0);
group.setCoordSize(100, 100);
group.addEventListener("mouseover", function() {
group.addEvent("mouseover", function() {
alert("Mouse Over Group");
});
workspace.appendChild(group);
@ -309,7 +309,7 @@
elipseOuter = new web2d.Elipse();
elipseOuter.setPosition(50, 50);
elipseOuter.setSize(50, 50);
group.addEventListener("mouseover", function() {
group.addEvent("mouseover", function() {
alert("Mouse Over elipseOuter");
});
group.appendChild(elipseOuter);

View File

@ -112,17 +112,17 @@
workspace.appendChild(nodeGroup);
// Add behaviour ...
inerRect.addEventListener("mouseover", function() {
inerRect.addEvent("mouseover", function() {
outerRect.setVisibility(true);
});
inerRect.addEventListener("mouseout", function() {
inerRect.addEvent("mouseout", function() {
if (!nodeGroup._drag)
{
outerRect.setVisibility(false);
}
});
nodeGroup.addEventListener("mousedown", function(e)
nodeGroup.addEvent("mousedown", function(e)
{
var shadowGroup = new web2d.Group();
shadowGroup.setSize(200, 60);
@ -165,7 +165,7 @@
shadowGroup.setPosition(posx - 50, posy - 150);
};
}
workspace.addEventListener("mousemove", workspace._moveFunction);
workspace.addEvent("mousemove", workspace._moveFunction);
var mouseUp = function(e)
{
@ -175,11 +175,11 @@
nodeGroup.setPosition(pos.x, pos.y);
nodeGroup._drag = false;
outerRect.setVisibility(true);
workspace.removeEventListener("mousemove", workspace._moveFunction);
workspace.removeEventListener("mouseup", mouseUp);
workspace.removeEvent("mousemove", workspace._moveFunction);
workspace.removeEvent("mouseup", mouseUp);
};
workspace.addEventListener("mouseup", mouseUp);
workspace.addEvent("mouseup", mouseUp);
});

View File

@ -246,7 +246,7 @@
var rect = new web2d.Rect(0, rectAttributes);
rect.setPosition(120, 20);
workspace.appendChild(rect);
rect.addEventListener("mouseover", function() {
rect.addEvent("mouseover", function() {
alert("Mouse Over");
});

View File

@ -84,9 +84,9 @@ web2d.Loader =
web2d.Loader.checkLoaded(filename);
}
if(typeof(js.addEventListener) != 'undefined') {
if(typeof(js.addEvent) != 'undefined') {
/* The FF, Chrome, Safari, Opera way */
js.addEventListener('load',calltheCBcmn,false);
js.addEvent('load',calltheCBcmn,false);
}
else {
/* The MS IE 8+ way (may work with others - I dunno)*/

View File

@ -1,6 +1,7 @@
- Ver de que algunos de los colores de las paleta sean los utilizados.
- Resize de la ventana ajuste el workspace
- Fixiar metodo de drag del workspace...
- Cambiar el nodo on type
- f2
- documentar el select and unselect all
- documentar el select , unselect all y otros
- Implementar el f1
- Ver como re-implementar el log4j para que vuelva loguear los errores en el server. Se borro por que pesa mucho.

View File

@ -13,7 +13,7 @@
<!--<script type='text/javascript' src='../js/wiseLibrary.js'></script>-->
<script type='text/javascript' src='../js/mootools-core-1.3.2-full-compat.js'></script>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js'></script>
<script type='text/javascript' src='../js/mootools-more-1.3.2.1-yui.js'></script>
<!--<script type='text/javascript' src='../js/common.js'></script>-->

View File

@ -68,7 +68,7 @@ return false
}if(!Log4js.loggers[categoryName]){Log4js.loggers[categoryName]=new Log4js.Logger(categoryName)
}return Log4js.loggers[categoryName]
},getDefaultLogger:function(){return Log4js.getLogger("[default]")
},attachEvent:function(element,name,observer){if(element.addEventListener){element.addEventListener(name,observer,false)
},attachEvent:function(element,name,observer){if(element.addEvent){element.addEvent(name,observer,false)
}else{if(element.attachEvent){element.attachEvent("on"+name,observer)
}}}};
Log4js.extend=function(destination,source){for(property in source){destination[property]=source[property]

View File

@ -11,6 +11,6 @@ function C(){var b=document.getElementsByTagName(hb);for(var c=0,d=b.length;c<d;
function D(a){var b=s[a];return b==null?null:b}
function E(a,b){var c=v;for(var d=0,e=a.length-1;d<e;++d){c=c[a[d]]||(c[a[d]]=[])}c[a[e]]=b}
function F(a){var b=u[a](),c=t[a];if(b in c){return b}var d=[];for(var e in c){d[c[e]]=e}if(y){y(a,d,b)}throw null}
u[tb]=function(){var c=navigator.userAgent.toLowerCase();var d=function(a){return parseInt(a[1])*1000+parseInt(a[2])};if(function(){return c.indexOf(ub)!=-1}())return ub;if(function(){return c.indexOf(vb)!=-1||function(){if(c.indexOf(wb)!=-1){return true}if(typeof window[xb]!=bb){try{var b=new ActiveXObject(yb);if(b){b.registerBhoIfNeeded();return true}}catch(a){}}return false}()}())return zb;if(function(){return c.indexOf(Ab)!=-1&&m.documentMode>=9}())return Bb;if(function(){return c.indexOf(Ab)!=-1&&m.documentMode>=8}())return Cb;if(function(){var a=/msie ([0-9]+)\.([0-9]+)/.exec(c);if(a&&a.length==3)return d(a)>=6000}())return Db;if(function(){return c.indexOf(Eb)!=-1}())return Fb;return Gb};t[tb]={gecko1_8:0,ie6:1,ie8:2,ie9:3,opera:4,safari:5};jsapi.onScriptLoad=function(a){jsapi.onScriptLoad=null;p=a;A()};if(z()){alert(Hb+Ib);return}C();B();n&&n({moduleName:M,sessionId:o,subSystem:N,evtGroup:O,millis:(new Date).getTime(),type:Jb});var G;try{E([Db],Kb);E([zb],Lb);E([ub],Mb);E([Fb],Nb);E([Cb],Ob);E([Bb],Pb);G=v[F(tb)];var H=G.indexOf(Qb);if(H!=-1){w=Number(G.substring(H+1));G=G.substring(0,H)}}catch(a){return}var I;function J(){if(!q){q=true;A();if(m.removeEventListener){m.removeEventListener(Rb,J,false)}if(I){clearInterval(I)}}}
if(m.addEventListener){m.addEventListener(Rb,function(){J()},false)}var I=setInterval(function(){if(/loaded|complete/.test(m.readyState)){J()}},50);n&&n({moduleName:M,sessionId:o,subSystem:N,evtGroup:O,millis:(new Date).getTime(),type:U});n&&n({moduleName:M,sessionId:o,subSystem:N,evtGroup:Sb,millis:(new Date).getTime(),type:P});var K=Tb+r+G+Ub;m.write(Vb+Wb+Xb+Yb+Zb+$b+_b+Yb+Zb+ac+bc+cc+K+dc+ec+fc+gc)}
u[tb]=function(){var c=navigator.userAgent.toLowerCase();var d=function(a){return parseInt(a[1])*1000+parseInt(a[2])};if(function(){return c.indexOf(ub)!=-1}())return ub;if(function(){return c.indexOf(vb)!=-1||function(){if(c.indexOf(wb)!=-1){return true}if(typeof window[xb]!=bb){try{var b=new ActiveXObject(yb);if(b){b.registerBhoIfNeeded();return true}}catch(a){}}return false}()}())return zb;if(function(){return c.indexOf(Ab)!=-1&&m.documentMode>=9}())return Bb;if(function(){return c.indexOf(Ab)!=-1&&m.documentMode>=8}())return Cb;if(function(){var a=/msie ([0-9]+)\.([0-9]+)/.exec(c);if(a&&a.length==3)return d(a)>=6000}())return Db;if(function(){return c.indexOf(Eb)!=-1}())return Fb;return Gb};t[tb]={gecko1_8:0,ie6:1,ie8:2,ie9:3,opera:4,safari:5};jsapi.onScriptLoad=function(a){jsapi.onScriptLoad=null;p=a;A()};if(z()){alert(Hb+Ib);return}C();B();n&&n({moduleName:M,sessionId:o,subSystem:N,evtGroup:O,millis:(new Date).getTime(),type:Jb});var G;try{E([Db],Kb);E([zb],Lb);E([ub],Mb);E([Fb],Nb);E([Cb],Ob);E([Bb],Pb);G=v[F(tb)];var H=G.indexOf(Qb);if(H!=-1){w=Number(G.substring(H+1));G=G.substring(0,H)}}catch(a){return}var I;function J(){if(!q){q=true;A();if(m.removeEvent){m.removeEvent(Rb,J,false)}if(I){clearInterval(I)}}}
if(m.addEvent){m.addEvent(Rb,function(){J()},false)}var I=setInterval(function(){if(/loaded|complete/.test(m.readyState)){J()}},50);n&&n({moduleName:M,sessionId:o,subSystem:N,evtGroup:O,millis:(new Date).getTime(),type:U});n&&n({moduleName:M,sessionId:o,subSystem:N,evtGroup:Sb,millis:(new Date).getTime(),type:P});var K=Tb+r+G+Ub;m.write(Vb+Wb+Xb+Yb+Zb+$b+_b+Yb+Zb+ac+bc+cc+K+dc+ec+fc+gc)}
jsapi();

View File

@ -1338,7 +1338,7 @@ if (document.execCommand) try {
} catch (e){}
/*<ltIE9>*/
if (this.attachEvent && !this.addEventListener){
if (this.attachEvent && !this.addEvent){
var unloadEvent = function(){
this.detachEvent('onunload', unloadEvent);
document.head = document.html = document.window = null;
@ -3758,13 +3758,13 @@ Element.implement('hasChild', function(element){
} else {
collected[$uid(this)] = this;
}
if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]);
if (this.addEvent) this.addEvent(type, fn, !!arguments[2]);
else this.attachEvent('on' + type, fn);
return this;
},
removeListener: function(type, fn){
if (this.removeEventListener) this.removeEventListener(type, fn, !!arguments[2]);
if (this.removeEvent) this.removeEvent(type, fn, !!arguments[2]);
else this.detachEvent('on' + type, fn);
return this;
},
@ -3790,7 +3790,7 @@ Element.implement('hasChild', function(element){
});
/*<ltIE9>*/
if (window.attachEvent && !window.addEventListener) window.addListener('unload', function(){
if (window.attachEvent && !window.addEvent) window.addListener('unload', function(){
Object.each(collected, clean);
if (window.CollectGarbage) CollectGarbage();
});

View File

@ -1075,7 +1075,7 @@ if (document.execCommand) try {
} catch (e){}
/*<ltIE9>*/
if (this.attachEvent && !this.addEventListener){
if (this.attachEvent && !this.addEvent){
var unloadEvent = function(){
this.detachEvent('onunload', unloadEvent);
document.head = document.html = document.window = null;
@ -3348,13 +3348,13 @@ if (!document.createElement('div').contains) Element.implement(contains);
} else {
collected[$uid(this)] = this;
}
if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]);
if (this.addEvent) this.addEvent(type, fn, !!arguments[2]);
else this.attachEvent('on' + type, fn);
return this;
},
removeListener: function(type, fn){
if (this.removeEventListener) this.removeEventListener(type, fn, !!arguments[2]);
if (this.removeEvent) this.removeEvent(type, fn, !!arguments[2]);
else this.detachEvent('on' + type, fn);
return this;
},
@ -3380,7 +3380,7 @@ if (!document.createElement('div').contains) Element.implement(contains);
});
/*<ltIE9>*/
if (window.attachEvent && !window.addEventListener) window.addListener('unload', function(){
if (window.attachEvent && !window.addEvent) window.addListener('unload', function(){
Object.each(collected, clean);
if (window.CollectGarbage) CollectGarbage();
});

View File

@ -144,11 +144,11 @@ var bkLib = {
isMSIE : (navigator.appVersion.indexOf("MSIE") != -1),
addEvent : function(obj, type, fn) {
(obj.addEventListener) ? obj.addEventListener( type, fn, false ) : obj.attachEvent("on"+type, fn);
(obj.addEvent) ? obj.addEvent( type, fn, false ) : obj.attachEvent("on"+type, fn);
},
removeEvent : function(obj, type, fn) {
(obj.removeEventListener) ? obj.removeEventListener( type, fn, false ) : obj.detachEvent("on"+type, fn);
(obj.removeEvent) ? obj.removeEvent( type, fn, false ) : obj.detachEvent("on"+type, fn);
},
toArray : function(iterable) {
@ -194,8 +194,8 @@ var bkLib = {
},
onDomLoaded : function(fireThis) {
this.domLoad.push(fireThis);
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", bkLib.domLoaded, null);
if (document.addEvent) {
document.addEvent("DOMContentLoaded", bkLib.domLoaded, null);
} else if(bkLib.isMSIE) {
document.write("<style>.nicEdit-main p { margin: 0; }</style><scr"+"ipt id=__ie_onload defer " + ((location.protocol == "https:") ? "src='javascript:void(0)'" : "src=//0") + "><\/scr"+"ipt>");
$BK("__ie_onload").onreadystatechange = function() {