From 11ee13fb60ed1fdb1af0855342af150bb38dcbe2 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Sun, 14 Jun 2009 13:02:27 +0000 Subject: [PATCH] Fix minor loading issue. --- trunk/core-js/src/main/javascript/Utils.js | 4 -- trunk/core-js/src/main/javascript/footer.js | 14 +--- .../src/main/javascript/TextEditor.js | 70 +++++++++---------- trunk/mindplot/src/main/javascript/footer.js | 4 +- trunk/web2d/src/main/javascript/Toolkit.js | 40 +++++------ .../wise-webapp/src/main/webapp/js/editor.js | 33 +++++---- .../src/main/webapp/js/embedded.js | 7 +- 7 files changed, 80 insertions(+), 92 deletions(-) diff --git a/trunk/core-js/src/main/javascript/Utils.js b/trunk/core-js/src/main/javascript/Utils.js index 36acc802..1666db89 100644 --- a/trunk/core-js/src/main/javascript/Utils.js +++ b/trunk/core-js/src/main/javascript/Utils.js @@ -68,10 +68,6 @@ core.assert = function(assert, message) }; -core.findElement = function(name) -{ - return $(name); -} Math.sign = function(value) { diff --git a/trunk/core-js/src/main/javascript/footer.js b/trunk/core-js/src/main/javascript/footer.js index 8d205d37..a6c9c603 100644 --- a/trunk/core-js/src/main/javascript/footer.js +++ b/trunk/core-js/src/main/javascript/footer.js @@ -88,16 +88,4 @@ window.onerror = function(sMsg, sUrl, sLine) wLogger.fatal(msg); return true; -}; - -window.__coreLoad = function() -{ - if (window.afterCoreLoading) - { - window.afterCoreLoading(); - } else - { - setTimeout("window.__coreLoad()", 2000); - } -} -window.__coreLoad(); +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/TextEditor.js b/trunk/mindplot/src/main/javascript/TextEditor.js index 80259cbb..ee5bd215 100644 --- a/trunk/mindplot/src/main/javascript/TextEditor.js +++ b/trunk/mindplot/src/main/javascript/TextEditor.js @@ -1,22 +1,22 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* 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. -* -* $Id: file 64488 2006-03-10 17:32:09Z paulo $ -*/ - +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* 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. +* +* $Id: file 64488 2006-03-10 17:32:09Z paulo $ +*/ + mindplot.TextEditor = function(screenManager,actionRunner) { this._screenManager = screenManager; @@ -55,8 +55,8 @@ mindplot.TextEditor = function(screenManager,actionRunner) break; default: - var span =core.findElement('spanText'); - var input = core.findElement('inputText'); + var span =$('spanText'); + var input = $('inputText'); span.innerHTML = input.value; var size = input.value.length + 1; input.size= size; @@ -90,7 +90,7 @@ mindplot.TextEditor = function(screenManager,actionRunner) if (core.UserAgent.isSVGSupported()) { - setTimeout("core.findElement('ffoxWorkarroundInput').focus();", 0); + setTimeout("$('ffoxWorkarroundInput').focus();", 0); } }; this.fx = new Fx.Style(this.inputText, 'opacity', { duration: 10}); @@ -262,8 +262,8 @@ mindplot.TextEditor.prototype.init = function (nodeGraph) mindplot.TextEditor.prototype.setStyle = function (fontStyle) { - var inputField = core.findElement("inputText"); - var spanField = core.findElement("spanText"); + var inputField = $("inputText"); + var spanField = $("spanText"); if (!core.Utils.isDefined(fontStyle.font)) { fontStyle.font = "Arial"; @@ -293,18 +293,18 @@ mindplot.TextEditor.prototype.setStyle = function (fontStyle) mindplot.TextEditor.prototype.setText = function(text) { - var inputField = core.findElement("inputText"); + var inputField = $("inputText"); inputField.size = text.length + 1; //this._myOverlay.cfg.setProperty("width", (inputField.size * parseInt(inputField.style.fontSize) + 100) + "px"); this._myOverlay.style.width = (inputField.size * parseInt(inputField.style.fontSize) + 100) + "px"; - var spanField = core.findElement("spanText"); + var spanField = $("spanText"); spanField.innerHTML = text; inputField.value = text; }; mindplot.TextEditor.prototype.getText = function() { - return core.findElement('inputText').value; + return $('inputText').value; }; @@ -320,7 +320,7 @@ mindplot.TextEditor.prototype.setEditorSize = function (width, height, scale) mindplot.TextEditor.prototype.getSize = function () { - return {width:core.findElement("spanText").offsetWidth,height:core.findElement("spanText").offsetHeight}; + return {width:$("spanText").offsetWidth,height:$("spanText").offsetHeight}; }; @@ -343,12 +343,12 @@ mindplot.TextEditor.prototype.showTextEditor = function(selectText) //elem._myOverlay.cfg.setProperty("xy", [0, 0]); //elem._myOverlay.cfg.setProperty("visible", true); //select the text in the input - core.findElement('inputText').disabled = false; + $('inputText').disabled = false; - if (core.findElement('inputText').createTextRange) //ie + if ($('inputText').createTextRange) //ie { - var range = core.findElement('inputText').createTextRange(); - var pos = core.findElement('inputText').value.length; + var range = $('inputText').createTextRange(); + var pos = $('inputText').value.length; if(selectText) { range.select(); @@ -362,7 +362,7 @@ mindplot.TextEditor.prototype.showTextEditor = function(selectText) } else if(selectText) { - core.findElement('inputText').setSelectionRange(0, core.findElement('inputText').value.length); + $('inputText').setSelectionRange(0, $('inputText').value.length); } var executor = function(editor) @@ -370,7 +370,7 @@ mindplot.TextEditor.prototype.showTextEditor = function(selectText) return function() { try { - core.findElement('inputText').focus(); + $('inputText').focus(); } catch (e) { @@ -389,7 +389,7 @@ mindplot.TextEditor.prototype.lostFocus = function(bothBrowsers) if (this._isVisible()) { //the editor is opened in another node. lets Finish it. - var fireOnThis = core.findElement('inputText'); + var fireOnThis = $('inputText'); fireOnThis.fireEvent('blur'); } }; diff --git a/trunk/mindplot/src/main/javascript/footer.js b/trunk/mindplot/src/main/javascript/footer.js index 955e2715..59449f5b 100644 --- a/trunk/mindplot/src/main/javascript/footer.js +++ b/trunk/mindplot/src/main/javascript/footer.js @@ -17,7 +17,7 @@ * $Id: file 64488 2006-03-10 17:32:09Z paulo $ */ -if(afterWisemapLoading) +if(afterMindpotLibraryLoading) { -afterWisemapLoading(); + afterMindpotLibraryLoading(); } diff --git a/trunk/web2d/src/main/javascript/Toolkit.js b/trunk/web2d/src/main/javascript/Toolkit.js index 3e187cba..27cdf9fc 100644 --- a/trunk/web2d/src/main/javascript/Toolkit.js +++ b/trunk/web2d/src/main/javascript/Toolkit.js @@ -1,22 +1,22 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* 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. -* -* $Id: file 64488 2006-03-10 17:32:09Z paulo $ -*/ - +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* 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. +* +* $Id: file 64488 2006-03-10 17:32:09Z paulo $ +*/ + web2d.peer.ToolkitVML = { init: function() @@ -24,7 +24,7 @@ web2d.peer.ToolkitVML = var domDocument = window.document; //ownerDocument; // Add VML includes and namespace - domDocument.namespaces.add("v", "urn:schemas-microsoft-com:vml"); + domDocument.namespaces.add("v", "urn:schemas-microsoft-com:vml", "#default#VML"); var style = domDocument.createStyleSheet(); style.addRule('v\\:*', "behavior: url(#default#VML);"); diff --git a/trunk/wise-webapp/src/main/webapp/js/editor.js b/trunk/wise-webapp/src/main/webapp/js/editor.js index 745f12f0..9221ad01 100644 --- a/trunk/wise-webapp/src/main/webapp/js/editor.js +++ b/trunk/wise-webapp/src/main/webapp/js/editor.js @@ -17,6 +17,23 @@ * $Id: file 64488 2006-03-10 17:32:09Z paulo $ */ + +function afterCoreLoading() +{ + + if (core.UserAgent.isVMLSupported()) + { + $import("../js/mindplot.vml.js"); + } else + { + $import("../js/mindplot.svg.js"); + + } +}; +afterCoreLoading(); + + + /*Extend mootools known keys*/ ExtendedKeys = { 'insert': 45, @@ -163,23 +180,9 @@ Tabs.Init(); // Hide the content while waiting for the onload event to trigger. var contentId = window.location.hash || "#Introduction"; -function afterCoreLoading() -{ - - if (core.UserAgent.isVMLSupported()) - { - $import("../js/mindplot.vml.js"); - } else - { - $import("../js/mindplot.svg.js"); - - } -} -; - var iconPanel = null; -function afterWisemapLoading() +function afterMindpotLibraryLoading() { buildMindmapDesigner(); diff --git a/trunk/wise-webapp/src/main/webapp/js/embedded.js b/trunk/wise-webapp/src/main/webapp/js/embedded.js index dcb9faa7..9d03ebaa 100644 --- a/trunk/wise-webapp/src/main/webapp/js/embedded.js +++ b/trunk/wise-webapp/src/main/webapp/js/embedded.js @@ -27,10 +27,11 @@ function afterCoreLoading() $import("../js/mindplot.svg.js"); } -} -; +}; -function afterWisemapLoading() +afterCoreLoading(); + +function afterMindpotLibraryLoading() { buildMindmapDesigner();