From 7acfd763fa1dac2470955f3c985f7dc2dda62e00 Mon Sep 17 00:00:00 2001 From: Pablo Luna Date: Wed, 16 Mar 2011 11:40:48 +0000 Subject: [PATCH] removing VML support from client side --- core-js/src/main/javascript/UserAgent.js | 16 - mindplot/pom.xml | 15 - .../src/main/javascript/MindmapDesigner.js | 9 +- .../src/main/javascript/PersistanceManager.js | 5 +- mindplot/src/main/javascript/TextEditor.js | 9 +- web2d/pom.xml | 38 +- web2d/src/main/javascript/Toolkit.js | 103 +---- web2d/src/main/javascript/Workspace.js | 2 +- web2d/src/main/javascript/header.js | 3 +- .../src/main/javascript/peer/vml/ArialFont.js | 35 -- .../main/javascript/peer/vml/ElementPeer.js | 360 ------------------ .../main/javascript/peer/vml/ElipsePeer.js | 57 --- web2d/src/main/javascript/peer/vml/Font.js | 88 ----- .../src/main/javascript/peer/vml/GroupPeer.js | 76 ---- .../src/main/javascript/peer/vml/ImagePeer.js | 37 -- .../src/main/javascript/peer/vml/LinePeer.js | 68 ---- .../main/javascript/peer/vml/PolyLinePeer.js | 150 -------- .../src/main/javascript/peer/vml/RectPeer.js | 46 --- .../main/javascript/peer/vml/TahomaFont.js | 35 -- .../main/javascript/peer/vml/TextBoxPeer.js | 235 ------------ .../src/main/javascript/peer/vml/TextPeer.js | 118 ------ .../src/main/javascript/peer/vml/TimesFont.js | 35 -- .../main/javascript/peer/vml/VerdanaFont.js | 35 -- .../main/javascript/peer/vml/WorkspacePeer.js | 93 ----- web2d/src/test/javascript/render/arrow.html | 17 +- .../test/javascript/render/curvedLine.html | 17 +- web2d/src/test/javascript/render/events.html | 17 +- web2d/src/test/javascript/render/group.html | 17 +- web2d/src/test/javascript/render/line.html | 17 +- .../src/test/javascript/render/polyLine.html | 17 +- .../src/test/javascript/render/prototype.html | 17 +- web2d/src/test/javascript/render/rect.html | 17 +- .../javascript/render/relationshipLine.html | 17 +- web2d/src/test/javascript/render/shapes.html | 17 +- web2d/src/test/javascript/render/text.html | 26 +- .../javascript/render/web2dLibraryLoader.js | 19 +- .../src/test/javascript/render/workspace.html | 17 +- .../com/wisemapping/dwr/MapEditorService.java | 12 +- wise-webapp/src/main/webapp/js/editor.js | 16 +- wise-webapp/src/main/webapp/js/embedded.js | 9 +- .../src/main/webapp/jsp/mindmapList.jsp | 4 - 41 files changed, 27 insertions(+), 1914 deletions(-) delete mode 100644 web2d/src/main/javascript/peer/vml/ArialFont.js delete mode 100644 web2d/src/main/javascript/peer/vml/ElementPeer.js delete mode 100644 web2d/src/main/javascript/peer/vml/ElipsePeer.js delete mode 100644 web2d/src/main/javascript/peer/vml/Font.js delete mode 100644 web2d/src/main/javascript/peer/vml/GroupPeer.js delete mode 100644 web2d/src/main/javascript/peer/vml/ImagePeer.js delete mode 100644 web2d/src/main/javascript/peer/vml/LinePeer.js delete mode 100644 web2d/src/main/javascript/peer/vml/PolyLinePeer.js delete mode 100644 web2d/src/main/javascript/peer/vml/RectPeer.js delete mode 100644 web2d/src/main/javascript/peer/vml/TahomaFont.js delete mode 100644 web2d/src/main/javascript/peer/vml/TextBoxPeer.js delete mode 100644 web2d/src/main/javascript/peer/vml/TextPeer.js delete mode 100644 web2d/src/main/javascript/peer/vml/TimesFont.js delete mode 100644 web2d/src/main/javascript/peer/vml/VerdanaFont.js delete mode 100644 web2d/src/main/javascript/peer/vml/WorkspacePeer.js diff --git a/core-js/src/main/javascript/UserAgent.js b/core-js/src/main/javascript/UserAgent.js index 8b205b83..67c65d3b 100644 --- a/core-js/src/main/javascript/UserAgent.js +++ b/core-js/src/main/javascript/UserAgent.js @@ -17,22 +17,6 @@ */ core.UserAgent = { - _isVMLSupported:null, - isVMLSupported: function() - { - if (!core.Utils.isDefined()) - { - this._isVMLSupported = navigator.appVersion.match(/MSIE (\d\.\d)/); - if(this._isVMLSupported == null || parseInt(this._isVMLSupported[1])>=9){ - this._isVMLSupported = false; - } - } - return this._isVMLSupported; - }, - isSVGSupported: function() - { - return !core.UserAgent.isVMLSupported(); - }, isMozillaFamily: function() { return this.browser == "Netscape" || this.browser == "Firefox"; diff --git a/mindplot/pom.xml b/mindplot/pom.xml index ee7ebcbe..ed34db57 100644 --- a/mindplot/pom.xml +++ b/mindplot/pom.xml @@ -112,14 +112,6 @@ - - - - - - - - ${basedir}/target/classes/mindplot.vml-min.js - - ${basedir}/../web2d/target/classes/web2d.vml-min.js - ${basedir}/target/tmp/mindplot-min.js - - ${basedir}/target/classes/mindplot.svg-min.js diff --git a/mindplot/src/main/javascript/MindmapDesigner.js b/mindplot/src/main/javascript/MindmapDesigner.js index 0eaf47bd..7c909656 100644 --- a/mindplot/src/main/javascript/MindmapDesigner.js +++ b/mindplot/src/main/javascript/MindmapDesigner.js @@ -445,15 +445,8 @@ mindplot.MindmapDesigner.prototype.save = function(onSavedHandler, saveHistory) var mindmap = this._mindmap; var xmlChart = this._workspace.dumpNativeChart(); - var chatType = core.UserAgent.isVMLSupported() ? "VML" : "SVG"; - if (core.UserAgent.isVMLSupported()) - { - // Remove first line: "" - xmlChart = xmlChart.replace('', ""); - } - var properties = {zoom:this._zoom}; - persistantManager.save(mindmap, chatType, xmlChart, properties, onSavedHandler, saveHistory); + persistantManager.save(mindmap, xmlChart, properties, onSavedHandler, saveHistory); this._fireEvent("save", {type:saveHistory}); // Refresh undo state... diff --git a/mindplot/src/main/javascript/PersistanceManager.js b/mindplot/src/main/javascript/PersistanceManager.js index 253523d6..af8b4517 100644 --- a/mindplot/src/main/javascript/PersistanceManager.js +++ b/mindplot/src/main/javascript/PersistanceManager.js @@ -18,10 +18,9 @@ mindplot.PersistanceManager = {}; -mindplot.PersistanceManager.save = function(mindmap, chartType, xmlChart, editorProperties, onSavedHandler,saveHistory) +mindplot.PersistanceManager.save = function(mindmap, xmlChart, editorProperties, onSavedHandler,saveHistory) { core.assert(mindmap, "mindmap can not be null"); - core.assert(chartType, "chartType can not be null"); core.assert(xmlChart, "xmlChart can not be null"); core.assert(editorProperties, "editorProperties can not be null"); @@ -32,7 +31,7 @@ mindplot.PersistanceManager.save = function(mindmap, chartType, xmlChart, editor var xmlMapStr = core.Utils.innerXML(xmlMap); var pref = Json.toString(editorProperties); - window.MapEditorService.saveMap(mapId, xmlMapStr, chartType, xmlChart, pref,saveHistory, + window.MapEditorService.saveMap(mapId, xmlMapStr, xmlChart, pref,saveHistory, { callback:function(response) { diff --git a/mindplot/src/main/javascript/TextEditor.js b/mindplot/src/main/javascript/TextEditor.js index c4aa786c..d9549909 100644 --- a/mindplot/src/main/javascript/TextEditor.js +++ b/mindplot/src/main/javascript/TextEditor.js @@ -87,10 +87,7 @@ mindplot.TextEditor = function(screenManager,actionRunner) this._currentNode = null; } - if (core.UserAgent.isSVGSupported()) - { setTimeout("$('ffoxWorkarroundInput').focus();", 0); - } }; this.fx = new Fx.Style(this.inputText, 'opacity', { duration: 10}); this.fx.addEvent('onComplete', onComplete.bind(this)); @@ -240,11 +237,7 @@ mindplot.TextEditor.prototype.init = function (nodeGraph) } var position = {x:0,y:0}; position.x = pos.x - ((textWidth * scale.width) / 2) + ((iconGroupSize.width * scale.width)/2); - var fixError = 0; - if (core.UserAgent.isSVGSupported()) - { - fixError = 4; - } + var fixError = 4; position.y = pos.y - ((textHeight * scale.height) / 2) - fixError; editor.setEditorSize(elemSize.width, elemSize.height, scale); diff --git a/web2d/pom.xml b/web2d/pom.xml index 8b81ec61..11dbe453 100644 --- a/web2d/pom.xml +++ b/web2d/pom.xml @@ -3,7 +3,7 @@ 4.0.0 web2d jar - Web 2D SVG/VML Abstraction + Web 2D SVG Abstraction org.wisemapping @@ -44,42 +44,6 @@ src/main/javascript/ target/tmp/ - - ${basedir}/target/classes/web2d.vml-min.js - - ${basedir}/target/tmp/header-min.js - ${basedir}/target/tmp/peer/utils/EventUtils-min.js - ${basedir}/target/tmp/peer/utils/TransformUtils-min.js - ${basedir}/target/tmp/peer/vml/ElementPeer-min.js - ${basedir}/target/tmp/peer/vml/Font-min.js - ${basedir}/target/tmp/peer/vml/ArialFont-min.js - ${basedir}/target/tmp/peer/vml/PolyLinePeer-min.js - ${basedir}/target/tmp/peer/vml/TextBoxPeer-min.js - ${basedir}/target/tmp/peer/vml/VerdanaFont-min.js - ${basedir}/target/tmp/peer/vml/GroupPeer-min.js - ${basedir}/target/tmp/peer/vml/RectPeer-min.js - ${basedir}/target/tmp/peer/vml/ImagePeer-min.js - ${basedir}/target/tmp/peer/vml/TextPeer-min.js - ${basedir}/target/tmp/peer/vml/WorkspacePeer-min.js - ${basedir}/target/tmp/peer/vml/ElipsePeer-min.js - ${basedir}/target/tmp/peer/vml/LinePeer-min.js - ${basedir}/target/tmp/peer/vml/TahomaFont-min.js - ${basedir}/target/tmp/peer/vml/TimesFont-min.js - - ${basedir}/target/tmp/Element-min.js - ${basedir}/target/tmp/Elipse-min.js - ${basedir}/target/tmp/EventDispatcher-min.js - ${basedir}/target/tmp/Font-min.js - ${basedir}/target/tmp/Group-min.js - ${basedir}/target/tmp/Image-min.js - ${basedir}/target/tmp/Line-min.js - ${basedir}/target/tmp/PolyLine-min.js - ${basedir}/target/tmp/Rect-min.js - ${basedir}/target/tmp/Text-min.js - ${basedir}/target/tmp/Toolkit-min.js - ${basedir}/target/tmp/Workspace-min.js - - ${basedir}/target/classes/web2d.svg-min.js diff --git a/web2d/src/main/javascript/Toolkit.js b/web2d/src/main/javascript/Toolkit.js index 138e37da..7c2e4292 100644 --- a/web2d/src/main/javascript/Toolkit.js +++ b/web2d/src/main/javascript/Toolkit.js @@ -16,101 +16,6 @@ * limitations under the License. */ -web2d.peer.ToolkitVML = -{ - init: function() - { - var domDocument = window.document; - //ownerDocument; - // Add VML includes and namespace - var style = domDocument.createStyleSheet(); - try - { - domDocument.namespaces.add("v", "urn:schemas-microsoft-com:vml"); - } catch(j) - { - try - { - domDocument.namespaces.add("v", "urn:schemas-microsoft-com:vml", "#default#VML"); - } catch(k) - { - - } - } - - try - { - style.addRule("v\\:*", "behavior:url(#default#VML); display:inline-block"); - } catch(e) - { - style.addRule('v\\:polyline', 'behavior: url(#default#VML);display:inline-block'); - style.addRule('v\\:fill', 'behavior: url(#default#VML);display:inline-block'); - style.addRule('v\\:stroke', 'behavior: url(#default#VML);display:inline-block'); - style.addRule('v\\:oval', 'behavior: url(#default#VML);display:inline-block'); - style.addRule('v\\:group', 'behavior: url(#default#VML);display:inline-block'); - style.addRule('v\\:image', 'behavior: url(#default#VML);display:inline-block'); - style.addRule('v\\:line', 'behavior: url(#default#VML);display:inline-block'); - style.addRule('v\\:rect', 'behavior: url(#default#VML);display:inline-block'); - style.addRule('v\\:roundrect', 'behavior: url(#default#VML);display:inline-block'); - style.addRule('v\\:shape', 'behavior: url(#default#VML);display:inline-block'); - style.addRule('v\\:textbox', 'behavior: url(#default#VML);display:inline-block'); - } - - }, - createWorkspace: function(element) - { - return new web2d.peer.vml.WorkspacePeer(element); - }, - createGroup: function() - { - return new web2d.peer.vml.GroupPeer(); - }, - createElipse: function() - { - return new web2d.peer.vml.ElipsePeer(); - }, - createLine: function() - { - return new web2d.peer.vml.LinePeer(); - }, - createCurvedLine: function() - { - }, - createArrow: function() - { - }, - createImage: function () - { - return new web2d.peer.vml.ImagePeer(); - }, - createText: function () - { - return new web2d.peer.vml.TextBoxPeer(); - }, - createRect: function(arc) - - { - return new web2d.peer.vml.RectPeer(arc); - }, - createArialFont: function() - { - return new web2d.peer.vml.ArialFont(); - }, - createTimesFont: function() - { - return new web2d.peer.vml.TimesFont(); - }, - createVerdanaFont: function() - { - return new web2d.peer.vml.VerdanaFont(); - }, - createTahomaFont: function() - { - return new web2d.peer.vml.TahomaFont(); - } - -}; - web2d.peer.ToolkitSVG = { init: function() @@ -174,10 +79,4 @@ web2d.peer.ToolkitSVG = } }; -if (core.UserAgent.isSVGSupported()) -{ - web2d.peer.Toolkit = web2d.peer.ToolkitSVG; -} else -{ - web2d.peer.Toolkit = web2d.peer.ToolkitVML; -} \ No newline at end of file +web2d.peer.Toolkit = web2d.peer.ToolkitSVG; \ No newline at end of file diff --git a/web2d/src/main/javascript/Workspace.js b/web2d/src/main/javascript/Workspace.js index 03d84cf3..fa97fc87 100644 --- a/web2d/src/main/javascript/Workspace.js +++ b/web2d/src/main/javascript/Workspace.js @@ -175,7 +175,7 @@ web2d.Workspace.prototype.getCoordOrigin = function() // Private method declaration area /** - * All the VML or SVG elements will be children of this HTML element. + * All the SVG elements will be children of this HTML element. */ web2d.Workspace.prototype._getHtmlContainer = function() { diff --git a/web2d/src/main/javascript/header.js b/web2d/src/main/javascript/header.js index 34e97b7a..89fa6cb1 100644 --- a/web2d/src/main/javascript/header.js +++ b/web2d/src/main/javascript/header.js @@ -19,7 +19,6 @@ var web2d = {}; web2d.peer = { -svg: {}, -vml: {} +svg: {} }; web2d.peer.utils = {}; diff --git a/web2d/src/main/javascript/peer/vml/ArialFont.js b/web2d/src/main/javascript/peer/vml/ArialFont.js deleted file mode 100644 index b4fbc674..00000000 --- a/web2d/src/main/javascript/peer/vml/ArialFont.js +++ /dev/null @@ -1,35 +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. -*/ - -web2d.peer.vml.ArialFont = function() -{ - web2d.peer.vml.Font.call(this); - this._fontFamily="Arial"; -}; - -objects.extend(web2d.peer.vml.ArialFont, web2d.peer.vml.Font); - -web2d.peer.vml.ArialFont.prototype.getFontFamily=function () -{ - return this._fontFamily; -}; - -web2d.peer.vml.ArialFont.prototype.getFont=function () -{ - return web2d.Font.ARIAL; -}; \ No newline at end of file diff --git a/web2d/src/main/javascript/peer/vml/ElementPeer.js b/web2d/src/main/javascript/peer/vml/ElementPeer.js deleted file mode 100644 index f39d5b23..00000000 --- a/web2d/src/main/javascript/peer/vml/ElementPeer.js +++ /dev/null @@ -1,360 +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. -*/ - -web2d.peer.vml.ElementPeer = function(vmlElement) -{ - this._native = vmlElement; - this._native.style.position = 'absolute'; - this._position = {x:0,y:0}; - this._strokeWidth = -1; - this._changeListeners = {}; -}; - -/** - * http://www.quirksmode.org/js/events_advanced.html - * - * Drawbacks - * - * When compared to the W3C model, the Microsoft model has two important drawbacks: - - * 1. Events always bubble, no capturing possibility. - * 2. The event handling function is referenced, not copied, so the this keyword always refers to the window and is completely useless. - * - * The result of these two weaknesses is that when an event bubbles up it is impossible to know which HTML element currently handles the event. I explain this problem more fully on the Event order page. - * Since the Microsoft event adding model is only supported by Explorer 5 and higher on Windows, it cannot be used for cross�browser scripts. But even for Explorer�on�Windows only applications it�s best not to use it, since the bubbling problem can be quite nasty in complex applications. - */ -web2d.peer.vml.ElementPeer.prototype.addEventListener = function(type, listener) -{ - var element = this.getElementToAttachEvent(); - element.attachEvent("on" + type, listener); -}; - -web2d.peer.vml.ElementPeer.prototype.getElementToAttachEvent = function() -{ - return this._native; -}; - -web2d.peer.vml.ElementPeer.prototype.removeEventListener = function(type, listener, useCapture) -{ - var element = this.getElementToAttachEvent(); - element.detachEvent("on" + type, listener); -}; - -web2d.peer.vml.ElementPeer.prototype.getChangeEventListeners = function(type) -{ - var listeners = this._changeListeners[type]; - if (!listeners) - { - listeners = []; - this._changeListeners[type] = listeners; - } - return listeners; -}; - -web2d.peer.vml.ElementPeer.prototype.attachChangeEventListener = function(type, listener) -{ - var listeners = this.getChangeEventListeners(type); - if (!listener) - { - throw "Listener can not be null"; - } - listeners.push(listener); -}; - -web2d.peer.vml.ElementPeer.prototype.setSize = function(width, height) -{ - // First set the size of the group element. - if (core.Utils.isDefined(width)) - { - this._native.style.width = parseInt(width); - } - - if (core.Utils.isDefined(height)) - { - this._native.style.height = parseInt(height); - } -}; - -web2d.peer.vml.ElementPeer.prototype.getChildren = function() -{ - var result = this._children; - if (!result) - { - result = []; - this._children = result; - } - return result; -}; - -web2d.peer.vml.ElementPeer.prototype.setChildren = function(children) -{ - this._children = children; -}; - -web2d.peer.vml.ElementPeer.prototype.removeChild = function(elementPeer) -{ - // Store parent and child relationship. - elementPeer.setParent(null); - var children = this.getChildren(); - - // Remove from children array ... - var length = children.length; - - children.remove(elementPeer); - - var newLength = children.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); -}; - -web2d.peer.vml.ElementPeer.prototype.appendChild = function(elementPeer) -{ - // Warning: Posible memory leak. - // Store parent and child relationship. - elementPeer.setParent(this); - - var children = this.getChildren(); - children.push(elementPeer); - - // Add native element .. - this._native.appendChild(elementPeer._native); - - elementPeer._appededToParent(); - - // Broadcast events ... - web2d.peer.utils.EventUtils.broadcastChangeEvent(this, "onChangeCoordSize"); -}; - - -// IE 8 hack ... -web2d.peer.vml.ElementPeer.prototype._appededToParent = function() -{ - var fillElem = this.getVMLFill(); - this._native.appendChild(fillElem); - - var strokeElem = this.getVMLStroke(); - this._native.appendChild(strokeElem); -} - - -web2d.peer.vml.ElementPeer.prototype.getSize = function() -{ - return { - width:parseFloat(this._native.style.width), - height:parseFloat(this._native.style.height) - }; -}; - -web2d.peer.vml.ElementPeer.prototype.setPosition = function(x, y) -{ - if (core.Utils.isDefined(x)) - { - this._position.x = parseInt(x); - this._native.style.left = x; - } - - if (core.Utils.isDefined(y)) - { - this._position.y = parseInt(y); - this._native.style.top = y; - } -}; - -web2d.peer.vml.ElementPeer.prototype.getPosition = function() -{ - return {x:this._position.x, y:this._position.y}; -}; - -web2d.peer.vml.ElementPeer.prototype.getVMLFill = function() -{ - if (!this._vmlFill) - { - this._vmlFill = window.document.createElement('v:fill'); - } - return this._vmlFill; -}; - -web2d.peer.vml.ElementPeer.prototype.setFill = function(color, opacity) -{ - var vmlFill = this.getVMLFill(); - if (core.Utils.isDefined(color)) - { - vmlFill.color = color; - } - - if (core.Utils.isDefined(opacity)) - { - vmlFill.opacitopacity; - } - -}; - -web2d.peer.vml.ElementPeer.prototype.getFill = function() -{ - var vmlFill = this.getVMLFill(); - var color = vmlFill.getAttribute('color'); - - var opacity = vmlFill.getAttribute('opacity'); - opacity = opacity.toFixed(1); - - return {color:String(color), opacity:Number(opacity)}; -}; - -web2d.peer.vml.ElementPeer.prototype.getVMLStroke = function() -{ - if (!this._vmlStroke) - { - this._vmlStroke = window.document.createElement('v:stroke'); - } - return this._vmlStroke; -}; - -web2d.peer.vml.ElementPeer.prototype.getStroke = function() -{ - var vmlStroke = this.getVMLStroke(); - var color = vmlStroke.getAttribute('color'); - var dashstyle = vmlStroke.getAttribute('dashstyle'); - var opacity = vmlStroke.getAttribute('opacity'); - var width = this._strokeWidth; - if (width == -1) - { - width = 0; - } - return {color: color, style: dashstyle, opacity: opacity, width: width}; -}; - -/* -* http://msdn.microsoft.com/workshop/author/VML/ref/adv2.asp -* "solid|dot|dash|dashdot|longdash|longdashdot|longdashdotdot". -* /** -* The opacity of the entire shape. A fraction between 0 (completely transparent) and 1 (completely opaque.) -*/ -web2d.peer.vml.ElementPeer.prototype.setStroke = function(width, style, color, opacity) -{ - var vmlStroke = this.getVMLStroke(); - if (core.Utils.isDefined(color)) - { - vmlStroke.setAttribute('color', color); - } - - if (core.Utils.isDefined(style)) - { - vmlStroke.setAttribute('dashstyle', style); - } - - if (core.Utils.isDefined(opacity)) - { - vmlStroke.setAttribute('opacity', opacity); - } - - if (core.Utils.isDefined(width)) - { - var scaleStrokeWidth = 0; - if (width !== 0) - { - this._strokeWidth = width; - var scale = web2d.peer.utils.TransformUtil.workoutScale(this); - - scaleStrokeWidth = scale.width * this._strokeWidth; - scaleStrokeWidth = scaleStrokeWidth.toFixed(2); - vmlStroke.setAttribute('weight', scaleStrokeWidth + "px"); - vmlStroke.setAttribute('on', 'true'); - } - else - { - vmlStroke.setAttribute('strokeweight', 0); - vmlStroke.setAttribute('on', 'false'); - } - } -}; - -/** - * If hidden the shape is not rendered and does not generate mouse events. - */ -web2d.peer.vml.ElementPeer.prototype.setVisibility = function(isVisible) -{ - this._native.style.visibility = (isVisible) ? 'visible' : 'hidden'; -}; - -web2d.peer.vml.ElementPeer.prototype.isVisible = function(isVisible) -{ - var visibility = this._native.style.visibility; - return !(visibility == 'hidden'); -}; -; - -web2d.peer.vml.ElementPeer.prototype._updateStrokeWidth = function() -{ - if (this.getParent()) - { - this.setStroke(this._strokeWidth); - } -}; - -web2d.peer.vml.ElementPeer.prototype.getParent = function() -{ - return this._parent; -}; - -web2d.peer.vml.ElementPeer.prototype.setParent = function(parent) -{ - this._parent = parent; -}; - -/** - * Move element to the front - */ -web2d.peer.vml.ElementPeer.prototype.moveToFront = function() -{ - this._native.parentNode.appendChild(this._native); -}; - -/** - * Move element to the back - */ -web2d.peer.vml.ElementPeer.prototype.moveToBack = function() -{ - this._native.parentNode.insertBefore(this._native, this._native.parentNode.firstChild); -}; - -web2d.peer.vml.ElementPeer.prototype.setCursor = function(type) -{ - this._native.style.cursor = type; -}; diff --git a/web2d/src/main/javascript/peer/vml/ElipsePeer.js b/web2d/src/main/javascript/peer/vml/ElipsePeer.js deleted file mode 100644 index 675d590c..00000000 --- a/web2d/src/main/javascript/peer/vml/ElipsePeer.js +++ /dev/null @@ -1,57 +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. -*/ - -web2d.peer.vml.ElipsePeer = function() -{ - var vmlElement = window.document.createElement('v:oval'); - web2d.peer.vml.ElementPeer.call(this, vmlElement); - this.attachChangeEventListener("onChangeCoordSize", web2d.peer.vml.ElementPeer.prototype._updateStrokeWidth); -}; - -objects.extend(web2d.peer.vml.ElipsePeer, web2d.peer.vml.ElementPeer); - -web2d.peer.vml.ElipsePeer.prototype.setPosition = function(cx, cy) -{ - // VML position is positioned the coorner of the oval. - // That's why, I have to move the circle to the center by hand. - if (core.Utils.isDefined(cx)) - { - this._position.x = parseInt(cx); - this._native.style.left = cx;// + parseInt(this.getSize().width / 2); - } - - if (core.Utils.isDefined(cy)) - { - this._position.y = parseInt(cy); - this._native.style.top = cy;// + parseInt(this.getSize().height / 2); - } -}; - - -web2d.peer.vml.ElementPeer.prototype.getPosition = function() -{ - return {x:this._position.x, y:this._position.y}; -}; - -web2d.peer.vml.ElipsePeer.prototype.setSize = function(width, height) -{ - web2d.peer.vml.ElipsePeer.superClass.setSize.call(this, width, height); - - var coord = this.getPosition(); - this.setPosition(coord.x, coord.y); -}; diff --git a/web2d/src/main/javascript/peer/vml/Font.js b/web2d/src/main/javascript/peer/vml/Font.js deleted file mode 100644 index af7c8aec..00000000 --- a/web2d/src/main/javascript/peer/vml/Font.js +++ /dev/null @@ -1,88 +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. -*/ - -web2d.peer.vml.Font = function() -{ - this._size = 10; - this._style = "normal"; - this._weight = "normal"; -}; - -web2d.peer.vml.Font.prototype.init = function(args) -{ - if (core.Utils.isDefined(args.size)) - { - this._size = parseInt(args.size); - } - if (core.Utils.isDefined(args.style)) - { - this._style = args.style; - } - if (core.Utils.isDefined(args.weight)) - { - this._weight = args.weight; - } -}; - -web2d.peer.vml.Font.prototype.getHtmlSize = function (scale) -{ - var result = this._size * scale.height * 43 / 32; - return result; -}; - -web2d.peer.vml.Font.prototype.getGraphSize = function (scale) -{ - var result = parseInt(this._size) * scale.height * 43 / 32; - return result; -}; - -web2d.peer.vml.Font.prototype.getSize = function () -{ - return parseInt(this._size); -}; - -web2d.peer.vml.Font.prototype.getStyle = function () -{ - return this._style; -}; - -web2d.peer.vml.Font.prototype.getWeight = function () -{ - return this._weight; -}; - -web2d.peer.vml.Font.prototype.setSize = function (size) -{ - this._size = size; -}; - -web2d.peer.vml.Font.prototype.setStyle = function (style) -{ - this._style = style; -}; - -web2d.peer.vml.Font.prototype.setWeight = function (weight) -{ - this._weight = weight; -}; - -web2d.peer.vml.Font.prototype.getWidthMargin = function () -{ - var result = 0; - return result; -}; \ No newline at end of file diff --git a/web2d/src/main/javascript/peer/vml/GroupPeer.js b/web2d/src/main/javascript/peer/vml/GroupPeer.js deleted file mode 100644 index 48e2257d..00000000 --- a/web2d/src/main/javascript/peer/vml/GroupPeer.js +++ /dev/null @@ -1,76 +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. -*/ - -web2d.peer.vml.GroupPeer = function() -{ - var vmlElement = window.document.createElement('v:group'); - web2d.peer.vml.ElementPeer.call(this, vmlElement); - this._native.style.cursor = 'move'; -}; - -objects.extend(web2d.peer.vml.GroupPeer, web2d.peer.vml.ElementPeer); - -web2d.peer.vml.ElementPeer.prototype.setCoordOrigin = function(x, y) -{ - this._native.coordorigin = x + "," + y; -}; - -web2d.peer.vml.GroupPeer.prototype.setCoordSize = function(width, height) -{ - this._native.coordsize = width + "," + height; - web2d.peer.utils.EventUtils.broadcastChangeEvent(this, "onChangeCoordSize"); -}; - -web2d.peer.vml.GroupPeer.prototype.getCoordSize = function() -{ - var coordSize = this._native.coordsize + ""; - var coord; - if (coordSize) - { - coord = coordSize.split(","); - } else - { - coord = [1,1]; - } - return { width:coord[0], height:coord[1] }; -}; - -web2d.peer.vml.GroupPeer.prototype.setSize = function(width, height) -{ - web2d.peer.vml.ElipsePeer.superClass.setSize.call(this, width, height); - web2d.peer.utils.EventUtils.broadcastChangeEvent(this, "onChangeCoordSize"); -}; -web2d.peer.vml.GroupPeer.prototype.appendChild = function(child) -{ - web2d.peer.vml.GroupPeer.superClass.appendChild.call(this, child); - web2d.peer.utils.EventUtils.broadcastChangeEvent(child, "onChangeCoordSize"); -}; - -web2d.peer.vml.GroupPeer.prototype.getCoordOrigin = function() -{ - var coordOrigin = this._native.coordorigin + ""; - var coord; - if (coordOrigin) - { - coord = coordOrigin.split(","); - } else - { - coord = [1,1]; - } - return { x:coord[0], y:coord[1] }; -}; diff --git a/web2d/src/main/javascript/peer/vml/ImagePeer.js b/web2d/src/main/javascript/peer/vml/ImagePeer.js deleted file mode 100644 index d1dc90f7..00000000 --- a/web2d/src/main/javascript/peer/vml/ImagePeer.js +++ /dev/null @@ -1,37 +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. -*/ - -web2d.peer.vml.ImagePeer = function() -{ - var vmlElement = window.document.createElement('v:image'); - web2d.peer.vml.ElementPeer.call(this, vmlElement); -}; - -objects.extend(web2d.peer.vml.ImagePeer, web2d.peer.vml.ElementPeer); - -web2d.peer.vml.ImagePeer.prototype.setHref = function(url) -{ - this._native.setAttribute("src", url); - this._href = url; -}; - -web2d.peer.vml.ImagePeer.prototype.getHref = function() -{ - return this._href; -}; - diff --git a/web2d/src/main/javascript/peer/vml/LinePeer.js b/web2d/src/main/javascript/peer/vml/LinePeer.js deleted file mode 100644 index 74ccb216..00000000 --- a/web2d/src/main/javascript/peer/vml/LinePeer.js +++ /dev/null @@ -1,68 +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. -*/ - -web2d.peer.vml.LinePeer = function() -{ - var vmlElement = window.document.createElement('v:line'); - web2d.peer.vml.ElementPeer.call(this, vmlElement); - this._native.setAttribute('fillcolor', 'none'); -}; - -objects.extend(web2d.peer.vml.LinePeer, web2d.peer.vml.ElementPeer); - -web2d.peer.vml.LinePeer.prototype.setFrom = function(x1, y1) -{ - this._native.setAttribute('from', x1 + "," + y1); -}; - -web2d.peer.vml.LinePeer.prototype.setTo = function(x2, y2) -{ - this._native.setAttribute('to', x2 + "," + y2); -}; - - -web2d.peer.vml.LinePeer.prototype.setStroke = function(width, style, color, opacity) -{ - web2d.peer.vml.LinePeer.superClass.setStroke.call(this, width, style, color, opacity); - - if (core.Utils.isDefined(width)) - { - this._vmlStroke.setAttribute('weight', width + "px"); - } -}; - -web2d.peer.vml.LinePeer.prototype.setArrowStyle = function(startStyle, endStyle) -{ - var vmlStroke = this.getVMLStroke(); - if (core.Utils.isDefined(startStyle)) - { - vmlStroke.setAttribute('startarrow', startStyle); - vmlStroke.setAttribute('startarrowwidth', 'narrow'); - vmlStroke.setAttribute('startarrowlength', 'short'); - } - - if (core.Utils.isDefined(endStyle)) - { - vmlStroke.setAttribute('endarrow', endStyle); - vmlStroke.setAttribute('endarrowwidth', 'narrow'); - vmlStroke.setAttribute('endarrowlength', 'short'); - - } -}; - - diff --git a/web2d/src/main/javascript/peer/vml/PolyLinePeer.js b/web2d/src/main/javascript/peer/vml/PolyLinePeer.js deleted file mode 100644 index e6c6025d..00000000 --- a/web2d/src/main/javascript/peer/vml/PolyLinePeer.js +++ /dev/null @@ -1,150 +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. -*/ - -web2d.peer.vml.PolyLinePeer = function() -{ - var vmlElement = window.document.createElement('v:polyline'); - web2d.peer.vml.ElementPeer.call(this, vmlElement); - this._native.setAttribute('filled', 'false'); - this.breakDistance = 10; -}; - -objects.extend(web2d.peer.vml.PolyLinePeer, web2d.peer.vml.ElementPeer); - -web2d.peer.vml.PolyLinePeer.prototype.setFrom = function(x1, y1) -{ - this._x1 = x1; - this._y1 = y1; - this._updatePath(); -}; - -web2d.peer.vml.PolyLinePeer.prototype.setTo = function(x2, y2) -{ - this._x2 = x2; - this._y2 = y2; - this._updatePath(); - -}; - - -web2d.peer.vml.PolyLinePeer.prototype.setStyle = function(style) -{ - this._style = style; - this._updatePath(); -}; - -web2d.peer.vml.PolyLinePeer.prototype.getStyle = function() -{ - return this._style; -}; - -web2d.peer.vml.PolyLinePeer.prototype._updatePath = function() -{ - if (this._style == "Curved") - { - this._updateMiddleCurvePath(); - } - else if (this._style == "Straight") - { - this._updateStraightPath(); - } - else - { - this._updateCurvePath(); - } -}; - -web2d.peer.vml.PolyLinePeer.prototype._updateStraightPath = function() -{ - if (core.Utils.isDefined(this._x1) && core.Utils.isDefined(this._x2) && core.Utils.isDefined(this._y1) && core.Utils.isDefined(this._y2)) - { - this.buildStraightPath(this.breakDistance, this._x1, this._y1, this._x2, this._y2); - - // Hack: I could not solve why this is happening... - if (!this._native.points) - { - this._native.setAttribute('points', path); - } else - { - this._native.points.value = path; - } - } -}; - -web2d.peer.vml.PolyLinePeer.prototype._updateMiddleCurvePath = function() -{ - var x1 = this._x1; - var y1 = this._y1; - var x2 = this._x2; - var y2 = this._y2; - if (core.Utils.isDefined(x1) && core.Utils.isDefined(x2) && core.Utils.isDefined(y1) && core.Utils.isDefined(y2)) - { - var diff = x2 - x1; - var middlex = (diff / 2) + x1; - var signx = 1; - var signy = 1; - if (diff < 0) - { - signx = -1; - } - if (y2 < y1) - { - signy = -1; - } - - - var path = x1 + ", " + y1 + " " + (middlex - 10 * signx) + ", " + y1 + " " + middlex + ", " + (y1 + 10 * signy) + " " + middlex + ", " + (y2 - 10 * signy) + " " + (middlex + 10 * signx) + ", " + y2 + " " + x2 + ", " + y2; - - // Hack: I could not solve why this is happening... - if (!this._native.points) - { - this._native.setAttribute('points', path); - } else - { - this._native.points.value = path; - } - } -}; - -web2d.peer.vml.PolyLinePeer.prototype._updateCurvePath = function() -{ - if (core.Utils.isDefined(this._x1) && core.Utils.isDefined(this._x2) && core.Utils.isDefined(this._y1) && core.Utils.isDefined(this._y2)) - { - var path = web2d.PolyLine.buildCurvedPath(this.breakDistance, this._x1, this._y1, this._x2, this._y2); - - // Hack: I could not solve why this is happening... - if (!this._native.points) - { - this._native.setAttribute('points', path); - } else - { - this._native.points.value = path; - this._native.xPoints = path; - } - } -}; - -web2d.peer.vml.PolyLinePeer.prototype.setStroke = function(width, style, color, opacity) -{ - web2d.peer.vml.LinePeer.superClass.setStroke.call(this, null, style, color, opacity); - - if (core.Utils.isDefined(width)) - { - this._vmlStroke.setAttribute('weight', width + "px"); - } -}; diff --git a/web2d/src/main/javascript/peer/vml/RectPeer.js b/web2d/src/main/javascript/peer/vml/RectPeer.js deleted file mode 100644 index 0c466882..00000000 --- a/web2d/src/main/javascript/peer/vml/RectPeer.js +++ /dev/null @@ -1,46 +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. -*/ - -/** - * http://www.w3.org/TR/NOTE-VML#_Toc416858381 - * VML arcsize number "0.2" - * Defines rounded corners as a percentage of half the smaller dimension of the rectangle. 0.0 (0%) - * square corners, 1.0 (100%) - smaller dimension forms a semi-circle. - */ -web2d.peer.vml.RectPeer = function(arc) -{ - this.__act = arc; - var vmlElement; - if (!arc) - { - vmlElement = window.document.createElement('v:rect'); - } else - { - vmlElement = window.document.createElement('v:roundrect'); - - // In all examples, arc size 1 looks similiar to 0.5 arc size. This helps to solve look and feel incompatibilities with Fire - arc = arc / 2; - vmlElement.setAttribute('arcsize', arc); - } - - web2d.peer.vml.ElementPeer.call(this, vmlElement); - this.attachChangeEventListener("onChangeCoordSize", web2d.peer.vml.ElementPeer.prototype._updateStrokeWidth); -}; - - -objects.extend(web2d.peer.vml.RectPeer, web2d.peer.vml.ElementPeer); \ No newline at end of file diff --git a/web2d/src/main/javascript/peer/vml/TahomaFont.js b/web2d/src/main/javascript/peer/vml/TahomaFont.js deleted file mode 100644 index 71f75cbd..00000000 --- a/web2d/src/main/javascript/peer/vml/TahomaFont.js +++ /dev/null @@ -1,35 +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. -*/ - -web2d.peer.vml.TahomaFont = function() -{ - web2d.peer.vml.Font.call(this); - this._fontFamily="tahoma"; -}; - -objects.extend(web2d.peer.vml.TahomaFont, web2d.peer.vml.Font); - -web2d.peer.vml.TahomaFont.prototype.getFontFamily=function () -{ - return this._fontFamily; -}; - -web2d.peer.vml.TahomaFont.prototype.getFont=function () -{ - return web2d.Font.TAHOMA; -}; \ No newline at end of file diff --git a/web2d/src/main/javascript/peer/vml/TextBoxPeer.js b/web2d/src/main/javascript/peer/vml/TextBoxPeer.js deleted file mode 100644 index 226b86c8..00000000 --- a/web2d/src/main/javascript/peer/vml/TextBoxPeer.js +++ /dev/null @@ -1,235 +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. -*/ - -web2d.peer.vml.TextBoxPeer = function() -{ - var container = window.document.createElement('v:shape'); - this._textElement = window.document.createElement('v:textbox'); - web2d.peer.vml.ElementPeer.call(this, container); - this._native.appendChild(this._textElement); - this._container = window.document.createElement('span'); - this._container.style.width = "100%"; - this._container.style.height = "100%"; - this._textContainer = window.document.createElement('span'); - this._container.appendChild(this._textContainer); - this._textElement.appendChild(this._container); - container.style.position = "absolute"; - container.style.top = "0"; - container.style.left = "0"; - container.style.width = "1"; - container.style.height = "1"; - container.style.antialias = "true"; - container.style.zIndex = 10; - this._textElement.style.position = "absolute"; - this._textElement.style.overflow = "visible"; - this._textElement.inset = "0 0 0 0"; - this.attachChangeEventListener("onChangeCoordSize", web2d.peer.vml.TextBoxPeer.prototype._updateTextSize); - this._font = new web2d.Font("Arial", this); -}; - -objects.extend(web2d.peer.vml.TextBoxPeer, web2d.peer.vml.ElementPeer); - -web2d.peer.vml.TextBoxPeer.prototype._updateTextSize = function() -{ - if (core.Utils.isDefined(this._font.getSize())) - { - this._updateFontStyle(); - } -}; - -//todo: use ths method to specify the maximum size of the text box -/*web2d.web2d.peer.vml.TextBoxPeer.prototype.setSize = function(width, height) -{ - web2d.web2d.peer.vml.TextBoxPeer.superClass.setSize.call(this,width,height); - this._native.setAttribute('rx', width / 2); - this._native.setAttribute('ry', height /ose 2); -}; -*/ - -web2d.peer.vml.TextBoxPeer.prototype.appendChild = function(element) -{ - this._native.appendChild(element._native); -}; - -web2d.peer.vml.TextBoxPeer.prototype.setText = function(text) -{ - text = core.Utils.escapeInvalidTags(text); - //remove previous text - //var child = this._textContainer.firstChild; - var child = this._textContainer.firstChild; - if (child) - { - this._textContainer.removeChild(child); - } - - this._text = text; - var textNode = window.document.createTextNode(text); - this._textContainer.appendChild(textNode); - this._updateSize(); -}; - -web2d.peer.vml.TextBoxPeer.prototype.getText = function() -{ - //todo(discutir): deberiamos buscar recursivamente por todos los hijos (textspan)? - return this._text; -}; - -web2d.peer.vml.TextBoxPeer.prototype._updateSize = function() -{ - var size = 0; - if (this._font.getSize()) - { - size = this._font.getSize(); - } - var length = 0; - if (this._text) - { - length = this._text.length; - } - this._native.style.width = length * size; - //this._textElement.style.marginleft="0px"; -}; - -web2d.peer.vml.TextBoxPeer.prototype.setPosition = function(x, y) -{ - if (core.Utils.isDefined(x)) - { - this._position.x = parseInt(x); - var leftmargin = 0; - //0.375; - this._native.style.left = x - leftmargin; - } - - if (core.Utils.isDefined(y)) - { - this._position.y = parseInt(y); - var topmargin = 0; - //2.375; - this._native.style.top = y - topmargin; - } -}; - -web2d.peer.vml.TextBoxPeer.prototype.setFont = function(font, size, style, weight) -{ - if (core.Utils.isDefined(font)) - { - this._font = new web2d.Font(font, this); - } - if (core.Utils.isDefined(style)) - { - this._font.setStyle(style); - } - if (core.Utils.isDefined(weight)) - { - this._font.setWeight(weight); - } - if (core.Utils.isDefined(size)) - { - this._font.setSize(size); - } - this._updateFontStyle(); -}; - -web2d.peer.vml.TextBoxPeer.prototype.setColor = function(color) -{ - this._textElement.style.color = color; -}; - -web2d.peer.vml.TextBoxPeer.prototype.getColor = function() -{ - return this._textElement.style.color; -}; - -web2d.peer.vml.TextBoxPeer.prototype.setTextSize = function (size) -{ - this._font.setSize(size); - this._updateFontStyle(); -}; - -web2d.peer.vml.TextBoxPeer.prototype.setStyle = function (style) -{ - this._font.setStyle(style); - this._updateFontStyle(); -}; - -web2d.peer.vml.TextBoxPeer.prototype.setWeight = function (weight) -{ - this._font.setWeight(weight); - this._updateFontStyle(); -}; - -web2d.peer.vml.TextBoxPeer.prototype.setSize = function (size) -{ - this._font.setSize(size); - this._updateFontStyle(); -}; - -web2d.peer.vml.TextBoxPeer.prototype.setFontFamily = function (family) -{ - var oldFont = this._font; - this._font = new web2d.Font(family, this); - this._font.setSize(oldFont.getSize()); - this._font.setStyle(oldFont.getStyle()); - this._font.setWeight(oldFont.getWeight()); - this._updateFontStyle(); -}; - -web2d.peer.vml.TextBoxPeer.prototype._updateFontStyle = function () -{ - this._textElement.style.font = this._font.getStyle() + " " + this._font.getWeight() + " " + this._font.getGraphSize() + " " + this._font.getFontFamily(); - this._updateSize(); - - var scale = this._font.getFontScale(); - this._textElement.xFontScale = scale.toFixed(1); -}; - - -web2d.peer.vml.TextBoxPeer.prototype.setContentSize = function(width, height) -{ - this._textElement.xTextSize = width.toFixed(1) + "," + height.toFixed(1); -}; - -web2d.peer.vml.TextBoxPeer.prototype.getFont = function() -{ - return { - font:this._font.getFont(), - size:parseInt(this._font.getSize()), - style:this._font.getStyle(), - weight:this._font.getWeight() - }; -}; - -web2d.peer.vml.TextBoxPeer.prototype.getWidth = function () -{ - var scale = web2d.peer.utils.TransformUtil.workoutScale(this); - var size = (this._textContainer.offsetWidth / scale.width); - return size; -}; - -web2d.peer.vml.TextBoxPeer.prototype.getHeight = function () -{ - //return this._font.getGraphSize(); - var scale = web2d.peer.utils.TransformUtil.workoutScale(this); - var size = (this._textContainer.offsetHeight / scale.height); - return size; -}; - -web2d.peer.vml.TextBoxPeer.prototype.getHtmlFontSize = function () -{ - return this._font.getHtmlSize(); -}; \ No newline at end of file diff --git a/web2d/src/main/javascript/peer/vml/TextPeer.js b/web2d/src/main/javascript/peer/vml/TextPeer.js deleted file mode 100644 index c2a7a284..00000000 --- a/web2d/src/main/javascript/peer/vml/TextPeer.js +++ /dev/null @@ -1,118 +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. -*/ - -web2d.peer.vml.TextPeer = function() -{ - var container = window.document.createElement('v:shape'); - this._textElement = window.document.createElement('v:textpath'); - web2d.peer.vml.ElementPeer.call(this, container); - this._native.appendChild(this._textElement); - container.style.position = "absolute"; - container.style.top = "1"; - container.style.left = "1"; - container.style.width = "2"; - container.style.height = "2"; - container.style.antialias = "true"; - container.style.zIndex = 10; - // Create the path object - var myPath = document.createElement("v:path"); - myPath.textpathok = "True"; - myPath.v = "m 0,0 l 10,0 m 0,20 l 10,20"; - - // Add it to the DOM hierarchy - container.appendChild(myPath); - - // Create the fill object - this._fontColor = document.createElement("v:fill"); - this._fontColor.on = "true"; - this._fontColor.color = "red"; - - // Add it to the DOM hierarchy - container.appendChild(this._fontColor); - - // The border is not going to be shown. To show it change .on to true - this._fontBorderColor = document.createElement("v:stroke"); - this._fontBorderColor.on = "false"; - this._fontBorderColor.color="red"; - - // Add it to the DOM hierarchy - container.appendChild(this._fontBorderColor); - - this._textElement.on = "true"; - this._textElement.fitpath = "false"; - this._textElement.style.setAttribute("V-Text-Align","left"); - this._size=12; -}; - -objects.extend(web2d.peer.vml.TextPeer, web2d.peer.vml.ElementPeer); - -web2d.peer.vml.TextPeer.prototype.setPosition = function(x, y) -{ - // VML position is positioned the coorner of the oval. - // That's why, I have to move the circle to the center by hand. - if (core.Utils.isDefined(x)) - { - this._position.x = parseInt(x); - this._native.style.left = x; - } - - if (core.Utils.isDefined(y)) - { - this._position.y = parseInt(y); - this._native.style.top = y - parseInt(parseInt(this._size)/8); - } -}; - -web2d.peer.vml.TextPeer.prototype.getPosition = function() -{ - return this._position; -}; - -web2d.peer.vml.TextPeer.prototype.appendChild = function(element) -{ - this._textElement.appendChild(element._native); -}; - -web2d.peer.vml.TextPeer.prototype.setText = function(text) -{ - this._text = text; - this._textElement.string=text; -}; - -web2d.peer.vml.TextPeer.prototype.getText = function() -{ - return this._text; -}; - -web2d.peer.vml.TextPeer.prototype.setFont = function(font, size, style, weight) -{ - var scale=web2d.peer.utils.TransformUtil.workoutScale(this); - this._size=parseInt(size)*scale.height*43/32; - this._textElement.style.font = style + " " + weight + " " + this._size + " " + font; -}; - -web2d.peer.vml.TextPeer.prototype.setColor = function(color) -{ - this._fontColor.color=color; - this._fontBorderColor.color=color; -}; - -web2d.peer.vml.TextPeer.prototype.getHtmlFontSize = function () -{ - return this._font.getHtmlSize(); -}; \ No newline at end of file diff --git a/web2d/src/main/javascript/peer/vml/TimesFont.js b/web2d/src/main/javascript/peer/vml/TimesFont.js deleted file mode 100644 index ddabb302..00000000 --- a/web2d/src/main/javascript/peer/vml/TimesFont.js +++ /dev/null @@ -1,35 +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. -*/ - -web2d.peer.vml.TimesFont = function() -{ - web2d.peer.vml.Font.call(this); - this._fontFamily="times"; -}; - -objects.extend(web2d.peer.vml.TimesFont, web2d.peer.vml.Font); - -web2d.peer.vml.TimesFont.prototype.getFontFamily=function () -{ - return this._fontFamily; -}; - -web2d.peer.vml.TimesFont.prototype.getFont=function () -{ - return web2d.Font.TIMES; -}; \ No newline at end of file diff --git a/web2d/src/main/javascript/peer/vml/VerdanaFont.js b/web2d/src/main/javascript/peer/vml/VerdanaFont.js deleted file mode 100644 index 4d208424..00000000 --- a/web2d/src/main/javascript/peer/vml/VerdanaFont.js +++ /dev/null @@ -1,35 +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. -*/ - -web2d.peer.vml.VerdanaFont = function() -{ - web2d.peer.vml.Font.call(this); - this._fontFamily="verdana"; -}; - -objects.extend(web2d.peer.vml.VerdanaFont, web2d.peer.vml.Font); - -web2d.peer.vml.VerdanaFont.prototype.getFontFamily=function () -{ - return this._fontFamily; -}; - -web2d.peer.vml.VerdanaFont.prototype.getFont=function () -{ - return web2d.Font.VERDANA; -}; \ No newline at end of file diff --git a/web2d/src/main/javascript/peer/vml/WorkspacePeer.js b/web2d/src/main/javascript/peer/vml/WorkspacePeer.js deleted file mode 100644 index 8d979b93..00000000 --- a/web2d/src/main/javascript/peer/vml/WorkspacePeer.js +++ /dev/null @@ -1,93 +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. -*/ - -web2d.peer.vml.WorkspacePeer = function(element) -{ - var vmlElement = window.document.createElement('v:group'); - this._element = element; - web2d.peer.vml.ElementPeer.call(this, vmlElement); -}; - -objects.extend(web2d.peer.vml.WorkspacePeer, web2d.peer.vml.ElementPeer); - -// Note: For some reason, VML groups are not able to receive events such as "onclick". -// As a workaround, all the workspace events will be registered in the container div element. -web2d.peer.vml.WorkspacePeer.prototype.getElementToAttachEvent = function() -{ - return this._element; -}; - -web2d.peer.vml.WorkspacePeer.prototype.setCoordOrigin = function(x, y) -{ - this._native.coordorigin = x + "," + y; -}; - -web2d.peer.vml.WorkspacePeer.prototype.setCoordSize = function(width, height) -{ - this._native.coordsize = width + "," + height; - web2d.peer.utils.EventUtils.broadcastChangeEvent(this, "onChangeCoordSize"); - //web2d.peer.utils.EventUtils.broadcastChangeEvent(this, "textSize"); -}; - -web2d.peer.vml.WorkspacePeer.prototype.getCoordSize = function() -{ - var coordSize = this._native.coordsize + ""; - var coord; - if (coordSize) - { - coord = coordSize.split(","); - } else - { - coord = [1,1]; - } - - return { width:coord[0], height:coord[1] }; -}; - -web2d.peer.vml.WorkspacePeer.prototype.setSize = function(width, height) -{ - web2d.peer.vml.ElipsePeer.superClass.setSize.call(this, width, height); -}; - -web2d.peer.vml.WorkspacePeer.prototype.appendChild = function(child) -{ - web2d.peer.vml.WorkspacePeer.superClass.appendChild.call(this, child); - web2d.peer.utils.EventUtils.broadcastChangeEvent(child, "onChangeCoordSize"); -}; - -web2d.peer.vml.WorkspacePeer.prototype.getCoordOrigin = function() -{ - var coordOrigin = this._native.coordorigin + ""; - var coord; - if (coordOrigin) - { - coord = coordOrigin.split(","); - } else - { - coord = [1,1]; - } - - var y = parseFloat(coord[1]); - var x = parseFloat(coord[0]); - return { x:x, y:y }; -}; - -web2d.peer.vml.WorkspacePeer.prototype.getPosition = function() -{ - return {x:0,y:0}; -}; diff --git a/web2d/src/test/javascript/render/arrow.html b/web2d/src/test/javascript/render/arrow.html index 7f1db761..666ca424 100644 --- a/web2d/src/test/javascript/render/arrow.html +++ b/web2d/src/test/javascript/render/arrow.html @@ -13,8 +13,7 @@ web2d.peer = { - svg: {}, - vml: {} + svg: {} }; web2d.peer.utils = {}; @@ -23,49 +22,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -