Keep migration to jQuery ...

This commit is contained in:
Paulo Gustavo Veiga 2014-03-04 22:48:31 -03:00
parent 18d956fa08
commit f1fa99a85e
20 changed files with 196 additions and 252 deletions

View File

@ -29,7 +29,7 @@ mindplot.Designer = new Class({
this._options = options; this._options = options;
// Set full div elem render area ... // Set full div elem render area ...
divElement.setStyles(options.size); divElement.css(options.size);
// Dispatcher manager ... // Dispatcher manager ...
var commandContext = new mindplot.CommandContext(this); var commandContext = new mindplot.CommandContext(this);
@ -83,7 +83,7 @@ mindplot.Designer = new Class({
var screenManager = workspace.getScreenManager(); var screenManager = workspace.getScreenManager();
// Zoom In and Zoom Out must active event // Zoom In and Zoom Out must active event
document.id(document).addEvent('mousewheel', function (event) { $(document).bind('mousewheel', function (event) {
// Change mousewheel handling so we let the default // Change mousewheel handling so we let the default
//event happen if we are outside the container. //event happen if we are outside the container.
var coords = screenManager.getContainer().getCoordinates(); var coords = screenManager.getContainer().getCoordinates();

View File

@ -17,7 +17,7 @@
*/ */
mindplot.DesignerKeyboard = new Class({ mindplot.DesignerKeyboard = new Class({
Extends:Keyboard, // Extends:Keyboard,
Static:{ Static:{
register:function (designer) { register:function (designer) {
this._instance = new mindplot.DesignerKeyboard(designer); this._instance = new mindplot.DesignerKeyboard(designer);
@ -30,6 +30,7 @@ mindplot.DesignerKeyboard = new Class({
}, },
initialize:function (designer) { initialize:function (designer) {
console.error("Re-impl required ....");
$assert(designer, "designer can not be null"); $assert(designer, "designer can not be null");
this.parent({defaultEventType:'keydown'}); this.parent({defaultEventType:'keydown'});
this._registerEvents(designer); this._registerEvents(designer);

View File

@ -166,7 +166,7 @@ mindplot.MultilineTextEditor = new Class({
if (!this.isVisible()) { if (!this.isVisible()) {
//Create editor ui //Create editor ui
var containerElem = this._buildEditor(); var containerElem = this._buildEditor();
containerElem.inject(document.id(document.body)); containerElem.inject($(document.body)[0]);
this._containerElem = containerElem; this._containerElem = containerElem;
this._registerEvents(containerElem); this._registerEvents(containerElem);

View File

@ -121,7 +121,7 @@ mindplot.TextEditor = new Class({
if (!this.isVisible()) { if (!this.isVisible()) {
//Create editor ui //Create editor ui
var editorElem = this._buildEditor(); var editorElem = this._buildEditor();
editorElem.inject(document.id(document.body)); editorElem.inject($(document.body)[0]);
this._containerElem = editorElem; this._containerElem = editorElem;
this._registerEvents(editorElem); this._registerEvents(editorElem);

View File

@ -1 +1,5 @@
document.id(document).fireEvent('loadcomplete', 'mind'); try {
$(document).trigger('loadcomplete', 'mind');
} catch (e) {
console.error(e.stack);
}

View File

@ -137,7 +137,7 @@ mindplot.layout.LayoutManager = new Class({
// Collect changes ... // Collect changes ...
this._collectChanges(); this._collectChanges();
if (!document.id(fireEvents) || fireEvents) { if ($(fireEvents).length>0 || fireEvents) {
this._flushEvents(); this._flushEvents();
} }

View File

@ -3,10 +3,10 @@
MooTools: the javascript framework MooTools: the javascript framework
web build: web build:
- http://mootools.net/core/30dc994a4420f76eb0c11148d7715bbc - http://mootools.net/core/2e62fb2661a9a95b8ceb9103e4681556
packager build: packager build:
- packager build Core/Core Core/Event Core/Class - packager build Core/Core Core/Event Core/Class Core/Class.Extras
copyrights: copyrights:
- [MooTools](http://mootools.net) - [MooTools](http://mootools.net)
@ -114,76 +114,14 @@
return i;};var f=function(h,i,g){if(a.Mutators.hasOwnProperty(h)){i=a.Mutators[h].call(this,i);if(i==null){return this;}}if(typeOf(i)=="function"){if(i.$hidden){return this; return i;};var f=function(h,i,g){if(a.Mutators.hasOwnProperty(h)){i=a.Mutators[h].call(this,i);if(i==null){return this;}}if(typeOf(i)=="function"){if(i.$hidden){return this;
}this.prototype[h]=(g)?i:b(this,h,i);}else{Object.merge(this.prototype,h,i);}return this;};var d=function(g){g.$prototyping=true;var h=new g;delete g.$prototyping; }this.prototype[h]=(g)?i:b(this,h,i);}else{Object.merge(this.prototype,h,i);}return this;};var d=function(g){g.$prototyping=true;var h=new g;delete g.$prototyping;
return h;};a.implement("implement",f.overloadSetter());a.Mutators={Extends:function(g){this.parent=g;this.prototype=d(g);},Implements:function(g){Array.from(g).each(function(j){var h=new j; return h;};a.implement("implement",f.overloadSetter());a.Mutators={Extends:function(g){this.parent=g;this.prototype=d(g);},Implements:function(g){Array.from(g).each(function(j){var h=new j;
for(var i in h){f.call(this,i,h[i],true);}},this);}};})(); for(var i in h){f.call(this,i,h[i],true);}},this);}};})();(function(){this.Chain=new Class({$chain:[],chain:function(){this.$chain.append(Array.flatten(arguments));
return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false;},clearChain:function(){this.$chain.empty();
return this;}});var a=function(b){return b.replace(/^on([A-Z])/,function(c,d){return d.toLowerCase();});};this.Events=new Class({$events:{},addEvent:function(d,c,b){d=a(d);
this.$events[d]=(this.$events[d]||[]).include(c);if(b){c.internal=true;}return this;},addEvents:function(b){for(var c in b){this.addEvent(c,b[c]);}return this;
},fireEvent:function(e,c,b){e=a(e);var d=this.$events[e];if(!d){return this;}c=Array.from(c);d.each(function(f){if(b){f.delay(b,this,c);}else{f.apply(this,c);
}},this);return this;},removeEvent:function(e,d){e=a(e);var c=this.$events[e];if(c&&!d.internal){var b=c.indexOf(d);if(b!=-1){delete c[b];}}return this;
},removeEvents:function(d){var e;if(typeOf(d)=="object"){for(e in d){this.removeEvent(e,d[e]);}return this;}if(d){d=a(d);}for(e in this.$events){if(d&&d!=e){continue;
}var c=this.$events[e];for(var b=c.length;b--;){if(b in c){this.removeEvent(e,c[b]);}}}return this;}});this.Options=new Class({setOptions:function(){var b=this.options=Object.merge.apply(null,[{},this.options].append(arguments));
if(this.addEvent){for(var c in b){if(typeOf(b[c])!="function"||!(/^on[A-Z]/).test(c)){continue;}this.addEvent(c,b[c]);delete b[c];}}return this;}});})();
/*
---
MooTools: the javascript framework
web build:
- http://mootools.net/more/f2525bc6fff0bd7c116ab195534ce396
packager build:
- packager build More/Assets More/Keyboard More/Keyboard.Extras
copyrights:
- [MooTools](http://mootools.net)
licenses:
- [MIT License](http://mootools.net/license.txt)
...
*/
MooTools.More={version:"1.4.0.1",build:"a4244edf2aa97ac8a196fc96082dd35af1abab87"};var Asset={javascript:function(d,b){if(!b){b={};}var a=new Element("script",{src:d,type:"text/javascript"}),e=b.document||document,c=b.onload||b.onLoad;
delete b.onload;delete b.onLoad;delete b.document;if(c){if(typeof a.onreadystatechange!="undefined"){a.addEvent("readystatechange",function(){if(["loaded","complete"].contains(this.readyState)){c.call(this);
}});}else{a.addEvent("load",c);}}return a.set(b).inject(e.head);},css:function(d,a){if(!a){a={};}var b=new Element("link",{rel:"stylesheet",media:"screen",type:"text/css",href:d});
var c=a.onload||a.onLoad,e=a.document||document;delete a.onload;delete a.onLoad;delete a.document;if(c){b.addEvent("load",c);}return b.set(a).inject(e.head);
},image:function(c,b){if(!b){b={};}var d=new Image(),a=document.id(d)||new Element("img");["load","abort","error"].each(function(e){var g="on"+e,f="on"+e.capitalize(),h=b[g]||b[f]||function(){};
delete b[f];delete b[g];d[g]=function(){if(!d){return;}if(!a.parentNode){a.width=d.width;a.height=d.height;}d=d.onload=d.onabort=d.onerror=null;h.delay(1,a,a);
a.fireEvent(e,a,1);};});d.src=a.src=c;if(d&&d.complete){d.onload.delay(1);}return a.set(b);},images:function(c,b){c=Array.from(c);var d=function(){},a=0;
b=Object.merge({onComplete:d,onProgress:d,onError:d,properties:{}},b);return new Elements(c.map(function(f,e){return Asset.image(f,Object.append(b.properties,{onload:function(){a++;
b.onProgress.call(this,a,e,f);if(a==c.length){b.onComplete();}},onerror:function(){a++;b.onError.call(this,a,e,f);if(a==c.length){b.onComplete();}}}));
}));}};(function(){Events.Pseudos=function(h,e,f){var d="_monitorEvents:";var c=function(i){return{store:i.store?function(j,k){i.store(d+j,k);}:function(j,k){(i._monitorEvents||(i._monitorEvents={}))[j]=k;
},retrieve:i.retrieve?function(j,k){return i.retrieve(d+j,k);}:function(j,k){if(!i._monitorEvents){return k;}return i._monitorEvents[j]||k;}};};var g=function(k){if(k.indexOf(":")==-1||!h){return null;
}var j=Slick.parse(k).expressions[0][0],p=j.pseudos,i=p.length,o=[];while(i--){var n=p[i].key,m=h[n];if(m!=null){o.push({event:j.tag,value:p[i].value,pseudo:n,original:k,listener:m});
}}return o.length?o:null;};return{addEvent:function(m,p,j){var n=g(m);if(!n){return e.call(this,m,p,j);}var k=c(this),r=k.retrieve(m,[]),i=n[0].event,l=Array.slice(arguments,2),o=p,q=this;
n.each(function(s){var t=s.listener,u=o;if(t==false){i+=":"+s.pseudo+"("+s.value+")";}else{o=function(){t.call(q,s,u,arguments,o);};}});r.include({type:i,event:p,monitor:o});
k.store(m,r);if(m!=i){e.apply(this,[m,p].concat(l));}return e.apply(this,[i,o].concat(l));},removeEvent:function(m,l){var k=g(m);if(!k){return f.call(this,m,l);
}var n=c(this),j=n.retrieve(m);if(!j){return this;}var i=Array.slice(arguments,2);f.apply(this,[m,l].concat(i));j.each(function(o,p){if(!l||o.event==l){f.apply(this,[o.type,o.monitor].concat(i));
}delete j[p];},this);n.store(m,j);return this;}};};var b={once:function(e,f,d,c){f.apply(this,d);this.removeEvent(e.event,c).removeEvent(e.original,f);
},throttle:function(d,e,c){if(!e._throttled){e.apply(this,c);e._throttled=setTimeout(function(){e._throttled=false;},d.value||250);}},pause:function(d,e,c){clearTimeout(e._pause);
e._pause=e.delay(d.value||250,this,c);}};Events.definePseudo=function(c,d){b[c]=d;return this;};Events.lookupPseudo=function(c){return b[c];};var a=Events.prototype;
Events.implement(Events.Pseudos(b,a.addEvent,a.removeEvent));["Request","Fx"].each(function(c){if(this[c]){this[c].implement(Events.prototype);}});})();
(function(){var d={relay:false},c=["once","throttle","pause"],b=c.length;while(b--){d[c[b]]=Events.lookupPseudo(c[b]);}DOMEvent.definePseudo=function(e,f){d[e]=f;
return this;};var a=Element.prototype;[Element,Window,Document].invoke("implement",Events.Pseudos(d,a.addEvent,a.removeEvent));})();(function(){var a="$moo:keys-pressed",b="$moo:keys-keyup";
DOMEvent.definePseudo("keys",function(d,e,c){var g=c[0],f=[],h=this.retrieve(a,[]);f.append(d.value.replace("++",function(){f.push("+");return"";}).split("+"));
h.include(g.key);if(f.every(function(j){return h.contains(j);})){e.apply(this,c);}this.store(a,h);if(!this.retrieve(b)){var i=function(j){(function(){h=this.retrieve(a,[]).erase(j.key);
this.store(a,h);}).delay(0,this);};this.store(b,i).addEvent("keyup",i);}});DOMEvent.defineKeys({"16":"shift","17":"control","18":"alt","20":"capslock","33":"pageup","34":"pagedown","35":"end","36":"home","144":"numlock","145":"scrolllock","186":";","187":"=","188":",","190":".","191":"/","192":"`","219":"[","220":"\\","221":"]","222":"'","107":"+"}).defineKey(Browser.firefox?109:189,"-");
})();(function(){var a=this.Keyboard=new Class({Extends:Events,Implements:[Options],options:{defaultEventType:"keydown",active:false,manager:null,events:{},nonParsedEvents:["activate","deactivate","onactivate","ondeactivate","changed","onchanged"]},initialize:function(f){if(f&&f.manager){this._manager=f.manager;
delete f.manager;}this.setOptions(f);this._setup();},addEvent:function(h,g,f){return this.parent(a.parse(h,this.options.defaultEventType,this.options.nonParsedEvents),g,f);
},removeEvent:function(g,f){return this.parent(a.parse(g,this.options.defaultEventType,this.options.nonParsedEvents),f);},toggleActive:function(){return this[this.isActive()?"deactivate":"activate"]();
},activate:function(f){if(f){if(f.isActive()){return this;}if(this._activeKB&&f!=this._activeKB){this.previous=this._activeKB;this.previous.fireEvent("deactivate");
}this._activeKB=f.fireEvent("activate");a.manager.fireEvent("changed");}else{if(this._manager){this._manager.activate(this);}}return this;},isActive:function(){return this._manager?(this._manager._activeKB==this):(a.manager==this);
},deactivate:function(f){if(f){if(f===this._activeKB){this._activeKB=null;f.fireEvent("deactivate");a.manager.fireEvent("changed");}}else{if(this._manager){this._manager.deactivate(this);
}}return this;},relinquish:function(){if(this.isActive()&&this._manager&&this._manager.previous){this._manager.activate(this._manager.previous);}else{this.deactivate();
}return this;},manage:function(f){if(f._manager){f._manager.drop(f);}this._instances.push(f);f._manager=this;if(!this._activeKB){this.activate(f);}return this;
},drop:function(f){f.relinquish();this._instances.erase(f);if(this._activeKB==f){if(this.previous&&this._instances.contains(this.previous)){this.activate(this.previous);
}else{this._activeKB=this._instances[0];}}return this;},trace:function(){a.trace(this);},each:function(f){a.each(this,f);},_instances:[],_disable:function(f){if(this._activeKB==f){this._activeKB=null;
}},_setup:function(){this.addEvents(this.options.events);if(a.manager&&!this._manager){a.manager.manage(this);}if(this.options.active){this.activate();
}else{this.relinquish();}},_handle:function(h,g){if(h.preventKeyboardPropagation){return;}var f=!!this._manager;if(f&&this._activeKB){this._activeKB._handle(h,g);
if(h.preventKeyboardPropagation){return;}}this.fireEvent(g,h);if(!f&&this._activeKB){this._activeKB._handle(h,g);}}});var b={};var c=["shift","control","alt","meta"];
var e=/^(?:shift|control|ctrl|alt|meta)$/;a.parse=function(h,g,k){if(k&&k.contains(h.toLowerCase())){return h;}h=h.toLowerCase().replace(/^(keyup|keydown):/,function(m,l){g=l;
return"";});if(!b[h]){var f,j={};h.split("+").each(function(l){if(e.test(l)){j[l]=true;}else{f=l;}});j.control=j.control||j.ctrl;var i=[];c.each(function(l){if(j[l]){i.push(l);
}});if(f){i.push(f);}b[h]=i.join("+");}return g+":keys("+b[h]+")";};a.each=function(f,g){var h=f||a.manager;while(h){g.run(h);h=h._activeKB;}};a.stop=function(f){f.preventKeyboardPropagation=true;
};a.manager=new a({active:true});a.trace=function(f){f=f||a.manager;var g=window.console&&console.log;if(g){console.log("the following items have focus: ");
}a.each(f,function(h){if(g){console.log(document.id(h.widget)||h.wiget||h);}});};var d=function(g){var f=[];c.each(function(h){if(g[h]){f.push(h);}});if(!e.test(g.key)){f.push(g.key);
}a.manager._handle(g,g.type+":keys("+f.join("+")+")");};document.addEvents({keyup:d,keydown:d});})();Keyboard.prototype.options.nonParsedEvents.combine(["rebound","onrebound"]);
Keyboard.implement({addShortcut:function(b,a){this._shortcuts=this._shortcuts||[];this._shortcutIndex=this._shortcutIndex||{};a.getKeyboard=Function.from(this);
a.name=b;this._shortcutIndex[b]=a;this._shortcuts.push(a);if(a.keys){this.addEvent(a.keys,a.handler);}return this;},addShortcuts:function(b){for(var a in b){this.addShortcut(a,b[a]);
}return this;},removeShortcut:function(b){var a=this.getShortcut(b);if(a&&a.keys){this.removeEvent(a.keys,a.handler);delete this._shortcutIndex[b];this._shortcuts.erase(a);
}return this;},removeShortcuts:function(a){a.each(this.removeShortcut,this);return this;},getShortcuts:function(){return this._shortcuts||[];},getShortcut:function(a){return(this._shortcutIndex||{})[a];
}});Keyboard.rebind=function(b,a){Array.from(a).each(function(c){c.getKeyboard().removeEvent(c.keys,c.handler);c.getKeyboard().addEvent(b,c.handler);c.keys=b;
c.getKeyboard().fireEvent("rebound");});};Keyboard.getActiveShortcuts=function(b){var a=[],c=[];Keyboard.each(b,[].push.bind(a));a.each(function(d){c.extend(d.getShortcuts());
});return c;};Keyboard.getShortcut=function(c,b,d){d=d||{};var a=d.many?[]:null,e=d.many?function(g){var f=g.getShortcut(c);if(f){a.push(f);}}:function(f){if(!a){a=f.getShortcut(c);
}};Keyboard.each(b,e);return a;};Keyboard.getShortcuts=function(b,a){return Keyboard.getShortcut(b,a,{many:true});};

View File

@ -17,8 +17,9 @@
*/ */
mindplot.util.FadeEffect = new Class({ mindplot.util.FadeEffect = new Class({
Extends: Fx, // Extends: Fx,
initialize: function(elements, isVisible) { initialize: function(elements, isVisible) {
console.error("Re-impl required ....");
this.parent({duration:3000,frames:15,transition:'linear'}); this.parent({duration:3000,frames:15,transition:'linear'});
this._isVisible = isVisible; this._isVisible = isVisible;
this._element = elements; this._element = elements;

View File

@ -17,49 +17,50 @@
*/ */
mindplot.widget.LinkEditor = new Class({ mindplot.widget.LinkEditor = new Class({
Extends:MooDialog, // Extends:MooDialog,
initialize:function (model) { initialize:function (model) {
$assert(model, "model can not be null"); $assert(model, "model can not be null");
var panel = this._buildPanel(model); var panel = this._buildPanel(model);
this.parent({ console.error("Re-impl required ....");
closeButton:true, // this.parent({
destroyOnClose:true, // closeButton:true,
title:$msg('LINK'), // destroyOnClose:true,
onInitialize:function (wrapper) { // title:$msg('LINK'),
wrapper.setStyle('opacity', 0); // onInitialize:function (wrapper) {
this.fx = new Fx.Morph(wrapper, { // wrapper.setStyle('opacity', 0);
duration:600, // this.fx = new Fx.Morph(wrapper, {
transition:Fx.Transitions.Bounce.easeOut // duration:600,
}); // transition:Fx.Transitions.Bounce.easeOut
}, // });
// },
onBeforeOpen:function () { //
this.overlay = new Overlay(this.options.inject, { // onBeforeOpen:function () {
duration:this.options.duration // this.overlay = new Overlay(this.options.inject, {
}); // duration:this.options.duration
if (this.options.closeOnOverlayClick) // });
this.overlay.addEvent('click', this.close.bind(this)); // if (this.options.closeOnOverlayClick)
// this.overlay.addEvent('click', this.close.bind(this));
this.overlay.open(); //
// this.overlay.open();
this.fx.start({ //
'margin-top':[-200, -100], // this.fx.start({
opacity:[0, 1] // 'margin-top':[-200, -100],
}).chain(function () { // opacity:[0, 1]
this.fireEvent('show'); // }).chain(function () {
}.bind(this)); // this.fireEvent('show');
}, // }.bind(this));
// },
onBeforeClose:function () { //
this.fx.start({ // onBeforeClose:function () {
'margin-top':[-100, 0], // this.fx.start({
opacity:0 // 'margin-top':[-100, 0],
}).chain(function () { // opacity:0
this.fireEvent('hide'); // }).chain(function () {
}.bind(this)); // this.fireEvent('hide');
this.overlay.destroy(); // }.bind(this));
} // this.overlay.destroy();
}); // }
// });
this.setContent(panel); this.setContent(panel);
}, },

View File

@ -434,7 +434,7 @@ mindplot.widget.Menu = new Class({
} }
var videoElem = document.id("tutorialVideo"); var videoElem = $('#tutorialVideo');
if (videoElem) { if (videoElem) {
var width = 900; var width = 900;
var height = 500; var height = 500;

View File

@ -17,80 +17,82 @@
*/ */
mindplot.widget.ModalDialogNotifier = new Class({ mindplot.widget.ModalDialogNotifier = new Class({
Extends:MooDialog, // Extends:MooDialog,
initialize:function () { initialize: function () {
this.parent({ console.error("Re-impl required ....");
closeButton:false, // this.parent(
destroyOnClose:false, // {
autoOpen:true, // closeButton:false,
useEscKey:false, // destroyOnClose:false,
closeOnOverlayClick:false, // autoOpen:true,
title:"", // useEscKey:false,
onInitialize:function (wrapper) { // closeOnOverlayClick:false,
wrapper.setStyle('opacity', 0); // title:"",
this.wrapper.setStyle('display', 'none'); // onInitialize:function (wrapper) {
this.fx = new Fx.Morph(wrapper, { // wrapper.setStyle('opacity', 0);
duration:100, // this.wrapper.setStyle('display', 'none');
transition:Fx.Transitions.Bounce.easeOut // this.fx = new Fx.Morph(wrapper, {
}); // duration:100,
}, // transition:Fx.Transitions.Bounce.easeOut
// });
onBeforeOpen:function () { // },
var panel = this._buildPanel(); //
this.setContent(panel); // onBeforeOpen:function () {
// var panel = this._buildPanel();
this.overlay = new Overlay(this.options.inject, { // this.setContent(panel);
duration:this.options.duration //
}); // this.overlay = new Overlay(this.options.inject, {
if (this.options.closeOnOverlayClick) // duration:this.options.duration
this.overlay.addEvent('click', this.close.bind(this)); // });
this.overlay.open(); // if (this.options.closeOnOverlayClick)
this.fx.start({ // this.overlay.addEvent('click', this.close.bind(this));
'margin-top':[-200, -100], // this.overlay.open();
opacity:[0, 1] // this.fx.start({
}).chain(function () { // 'margin-top':[-200, -100],
this.fireEvent('show'); // opacity:[0, 1]
this.wrapper.setStyle('display', 'block'); // }).chain(function () {
}.bind(this)); // this.fireEvent('show');
}, // this.wrapper.setStyle('display', 'block');
// }.bind(this));
onBeforeClose:function () { // },
this.fx.start({ //
'margin-top':[-100, 0], // onBeforeClose:function () {
opacity:0, // this.fx.start({
duration:200 // 'margin-top':[-100, 0],
}).chain(function () { // opacity:0,
this.wrapper.setStyle('display', 'none'); // duration:200
this.fireEvent('hide'); // }).chain(function () {
// this.wrapper.setStyle('display', 'none');
}.bind(this)); // this.fireEvent('hide');
}} //
); // }.bind(this));
this.message = null; // }}
// );
// this.message = null;
}, },
show:function (message, title) { show: function (message, title) {
$assert(message, "message can not be null"); $assert(message, "message can not be null");
this._messsage = message; this._messsage = message;
this.options.title = $defined(title) ? title : "Outch!!. An unexpected error has occurred"; this.options.title = $defined(title) ? title : "Outch!!. An unexpected error has occurred";
this.open(); this.open();
}, },
destroy:function () { destroy: function () {
this.parent(); this.parent();
this.overlay.destroy(); this.overlay.destroy();
}, },
_buildPanel:function () { _buildPanel: function () {
var result = new Element('div'); var result = new Element('div');
result.setStyles({ result.setStyles({
'text-align':'center', 'text-align': 'center',
width:'400px' width: '400px'
}); });
var p = new Element('p', {'text':this._messsage}); var p = new Element('p', {'text': this._messsage});
p.inject(result); p.inject(result);
var img = new Element('img', {'src':'images/alert-sign.png'}); var img = new Element('img', {'src': 'images/alert-sign.png'});
img.inject(result); img.inject(result);
return result; return result;

View File

@ -17,49 +17,50 @@
*/ */
mindplot.widget.NoteEditor = new Class({ mindplot.widget.NoteEditor = new Class({
Extends:MooDialog, // Extends:MooDialog,
initialize:function (model) { initialize:function (model) {
console.log("Re-impl required ....");
$assert(model, "model can not be null"); $assert(model, "model can not be null");
var panel = this._buildPanel(model); var panel = this._buildPanel(model);
this.parent({ // this.parent({
closeButton:true, // closeButton:true,
destroyOnClose:true, // destroyOnClose:true,
title:$msg('NOTE'), // title:$msg('NOTE'),
onInitialize:function (wrapper) { // onInitialize:function (wrapper) {
wrapper.setStyle('opacity', 0); // wrapper.setStyle('opacity', 0);
this.fx = new Fx.Morph(wrapper, { // this.fx = new Fx.Morph(wrapper, {
duration:600, // duration:600,
transition:Fx.Transitions.Bounce.easeOut // transition:Fx.Transitions.Bounce.easeOut
}); // });
}, // },
//
onBeforeOpen:function () { // onBeforeOpen:function () {
this.overlay = new Overlay(this.options.inject, { // this.overlay = new Overlay(this.options.inject, {
duration:this.options.duration // duration:this.options.duration
}); // });
if (this.options.closeOnOverlayClick) // if (this.options.closeOnOverlayClick)
this.overlay.addEvent('click', this.close.bind(this)); // this.overlay.addEvent('click', this.close.bind(this));
this.overlay.open(); // this.overlay.open();
//
this.fx.start({ // this.fx.start({
'margin-top':[-200, -100], // 'margin-top':[-200, -100],
opacity:[0, 1] // opacity:[0, 1]
}).chain(function () { // }).chain(function () {
this.fireEvent('show'); // this.fireEvent('show');
}.bind(this)); // }.bind(this));
}, // },
//
onBeforeClose:function () { // onBeforeClose:function () {
this.fx.start({ // this.fx.start({
'margin-top':[-100, 0], // 'margin-top':[-100, 0],
opacity:0 // opacity:0
}).chain(function () { // }).chain(function () {
this.fireEvent('hide'); // this.fireEvent('hide');
}.bind(this)); // }.bind(this));
this.overlay.destroy(); // this.overlay.destroy();
} // }
}); // });
this.setContent(panel); // this.setContent(panel);
}, },
_buildPanel:function (model) { _buildPanel:function (model) {

View File

@ -32,7 +32,7 @@ mindplot.widget.ToolbarItem = new Class({
_registerTip: function() { _registerTip: function() {
return new mindplot.widget.FloatingTip(document.id(this._buttonId), { return new mindplot.widget.FloatingTip($("#"+this._buttonId), {
html: false, html: false,
position: 'bottom', position: 'bottom',
arrowOffset : 5, arrowOffset : 5,

View File

@ -19,7 +19,7 @@ mindplot.layout.BalancedTestSuite = new Class({
Extends: mindplot.layout.TestSuite, Extends: mindplot.layout.TestSuite,
initialize:function() { initialize:function() {
document.id("balancedTest").setStyle("display","block"); $('#balancedTest').setStyle("display","block");
this.testBalanced(); this.testBalanced();
this.testBalancedPredict(); this.testBalancedPredict();

View File

@ -19,7 +19,7 @@ mindplot.layout.FreeTestSuite = new Class({
Extends: mindplot.layout.TestSuite, Extends: mindplot.layout.TestSuite,
initialize:function() { initialize:function() {
document.id("freeTest").setStyle("display","block"); $('#freeTest').setStyle("display","block");
this.testFreePosition(); this.testFreePosition();
this.testFreePredict(); this.testFreePredict();

View File

@ -19,7 +19,7 @@ mindplot.layout.SymmetricTestSuite = new Class({
Extends: mindplot.layout.TestSuite, Extends: mindplot.layout.TestSuite,
initialize:function() { initialize:function() {
document.id("symmetricTest").setStyle("display","block"); $('#symmetricTest').setStyle("display","block");
this.testSymmetry(); this.testSymmetry();
this.testSymmetricPredict(); this.testSymmetricPredict();

View File

@ -19,7 +19,7 @@ mindplot.layout.TestSuite = new Class({
Extends: mindplot.layout.ChildrenSorterStrategy, Extends: mindplot.layout.ChildrenSorterStrategy,
initialize:function() { initialize:function() {
document.id("basicTest").setStyle("display","block"); $('#basicTest').setStyle("display","block");
// this.testAligned(); // this.testAligned();
this.testBaselineAligned1(); this.testBaselineAligned1();

View File

@ -22,7 +22,7 @@
<script type="text/javascript"> <script type="text/javascript">
var mapId = 'welcome'; var mapId = 'welcome';
$(document).addEvent('loadcomplete', function(resource) { $(document).bind('loadcomplete', function (resource) {
// Set readonly option ... // Set readonly option ...
var options = loadDesignerOptions(); var options = loadDesignerOptions();
@ -34,7 +34,7 @@
var mindmap; var mindmap;
try { try {
mindmap = persistence.load(mapId); mindmap = persistence.load(mapId);
} catch(e) { } catch (e) {
// If the map could not be loaded, create a new empty map... // If the map could not be loaded, create a new empty map...
mindmap = mindplot.model.Mindmap.buildEmpty(mapId); mindmap = mindplot.model.Mindmap.buildEmpty(mapId);
} }

View File

@ -20,7 +20,7 @@ var designer = null;
function buildDesigner(options) { function buildDesigner(options) {
var container = document.id(options.container); var container = $("#"+options.container);
$assert(container, 'container could not be null'); $assert(container, 'container could not be null');
// Register load events ... // Register load events ...
@ -219,4 +219,4 @@ editor = {};
//waitDialog.show(); //waitDialog.show();
// Loading libraries ... // Loading libraries ...
Asset.javascript("js/mindplot-min.js"); jQuery.getScript("js/mindplot-min.js");

View File

@ -4,25 +4,21 @@
function JSPomLoader(pomUrl, callback) { function JSPomLoader(pomUrl, callback) {
console.log("POM Load URL:" + pomUrl); console.log("POM Load URL:" + pomUrl);
var jsUrls; var jsUrls;
var request = new Request({ new jQuery.ajax({
url: pomUrl, url: pomUrl,
method: 'get', method: 'get'
onRequest: function() { }).done(function (data) {
console.log("loading ...");
},
onSuccess: function(responseText, responseXML) {
// Collect JS Urls ... // Collect JS Urls ...
var concatRoot = responseXML.getElementsByTagName('includes'); var concatRoot = data.getElementsByTagName('includes');
var fileSetArray = Array.filter(concatRoot[0].childNodes, function(elem) { var fileSetArray = Array.filter(concatRoot[0].childNodes, function (elem) {
return elem.nodeType == Node.ELEMENT_NODE return elem.nodeType == Node.ELEMENT_NODE
}); });
jsUrls = new Array(); jsUrls = new Array();
Array.each(fileSetArray, function(elem) { Array.each(fileSetArray, function (elem) {
var jsUrl = elem.firstChild.nodeValue; var jsUrl = elem.firstChild.nodeValue;
if (jsUrl.indexOf("${basedir}") != -1) { if (jsUrl.indexOf("${basedir}") != -1) {
jsUrls.push(pomUrl.substring(0, pomUrl.lastIndexOf('/')) + jsUrl.replace("${basedir}","")); jsUrls.push(pomUrl.substring(0, pomUrl.lastIndexOf('/')) + jsUrl.replace("${basedir}", ""));
} else { } else {
jsUrls.push(pomUrl.substring(0, pomUrl.lastIndexOf('/')) + "/src/main/javascript/" + jsUrl); jsUrls.push(pomUrl.substring(0, pomUrl.lastIndexOf('/')) + "/src/main/javascript/" + jsUrl);
@ -39,30 +35,30 @@ function JSPomLoader(pomUrl, callback) {
callback(); callback();
} else { } else {
var url = urls.pop(); var url = urls.pop();
Asset.javascript(url, { $.ajax({
onLoad: function() { url: url,
jsRecLoad(urls) dataType: "script",
success: function () {
jsRecLoad(urls);
},
error: function(){
console.error("Unexpected error loading:"+url);
console.error(arguments);
} }
}); });
} }
} }
jsRecLoad(jsUrls); jsRecLoad(jsUrls);
},
onFailure: function() {
console.log('Sorry, your request failed :(');
} }
}); );
request.send();
} }
Asset.javascript("../../../../../web2d/target/classes/web2d.svg-min.js", { jQuery.getScript("../../../../../web2d/target/classes/web2d.svg-min.js", function () {
onLoad: function() { JSPomLoader('../../../../../mindplot/pom.xml', function () {
JSPomLoader('../../../../../mindplot/pom.xml', function() { });
});
}
}); });