commit fab4f67e9dba699929f9a99577c447dcdfede9fb Author: Paulo Veiga Date: Sun Jun 7 18:59:43 2009 +0000 WiseMapping diff --git a/trunk/ToDo.txt b/trunk/ToDo.txt new file mode 100644 index 00000000..a89f863a --- /dev/null +++ b/trunk/ToDo.txt @@ -0,0 +1,3 @@ +- Check mail jars +- Google Tracking +- Customizable JSP Replacements \ No newline at end of file diff --git a/trunk/core-js/pom.xml b/trunk/core-js/pom.xml new file mode 100644 index 00000000..1e11e749 --- /dev/null +++ b/trunk/core-js/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + core-js + jar + Core JavaScript Utils Libraries + + + org.wisemapping + wisemapping + ../pom.xml + 1.0-SNAPSHOT + + + + + + maven-antrun-plugin + + + merge-js-resources + generate-resources + + run + + + + + + + + + + + + net.sf.alchim + yuicompressor-maven-plugin + + + generate-resources + + compress + + + src/main/javascript/ + target/tmp/ + + + ${basedir}/target/classes/core.js + + ${basedir}/target/tmp/header-min.js + ${basedir}/target/tmp/ColorPicker-min.js + ${basedir}/target/tmp/Loader-min.js + ${basedir}/target/tmp/Logger-min.js + ${basedir}/target/tmp/Monitor-min.js + ${basedir}/target/tmp/Point-min.js + ${basedir}/target/tmp/UserAgent-min.js + ${basedir}/target/tmp/Utils-min.js + ${basedir}/target/tmp/WaitDialog-min.js + ${basedir}/target/tmp/footer-min.js + + + + true + false + + + + + + + diff --git a/trunk/core-js/src/main/javascript/ColorPicker.js b/trunk/core-js/src/main/javascript/ColorPicker.js new file mode 100644 index 00000000..40c0ea0e --- /dev/null +++ b/trunk/core-js/src/main/javascript/ColorPicker.js @@ -0,0 +1,95 @@ +/* +* 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 $ +*/ + +core.ColorPicker = function() +{ + this.palette = "7x10"; + this._palettes = {"7x10": [["fff", "fcc", "fc9", "ff9", "ffc", "9f9", "9ff", "cff", "ccf", "fcf"], + ["ccc", "f66", "f96", "ff6", "ff3", "6f9", "3ff", "6ff", "99f", "f9f"], + ["c0c0c0", "f00", "f90", "fc6", "ff0", "3f3", "6cc", "3cf", "66c", "c6c"], + ["999", "c00", "f60", "fc3", "fc0", "3c0", "0cc", "36f", "63f", "c3c"], + ["666", "900", "c60", "c93", "990", "090", "399", "33f", "60c", "939"], + ["333", "600", "930", "963", "660", "060", "366", "009", "339", "636"], + ["000", "300", "630", "633", "330", "030", "033", "006", "309", "303"]], + + "3x4": [["ffffff"/*white*/, "00ff00"/*lime*/, "008000"/*green*/, "0000ff"/*blue*/], + ["c0c0c0"/*silver*/, "ffff00"/*yellow*/, "ff00ff"/*fuchsia*/, "000080"/*navy*/], + ["808080"/*gray*/, "ff0000"/*red*/, "800080"/*purple*/, "000000"/*black*/]] + //["00ffff"/*aqua*/, "808000"/*olive*/, "800000"/*maroon*/, "008080"/*teal*/]]; + }; +}; + +core.ColorPicker.buildRendering = function () +{ + this.domNode = document.createElement("table"); + // dojo.html.disableSelection(this.domNode); + // dojo.event.connect(this.domNode, "onmousedown", function (e) { + // e.preventDefault(); + // }); + with (this.domNode) { // set the table's properties + cellPadding = "0"; + cellSpacing = "1"; + border = "1"; + style.backgroundColor = "white"; + } + var colors = this._palettes[this.palette]; + for (var i = 0; i < colors.length; i++) { + var tr = this.domNode.insertRow(-1); + for (var j = 0; j < colors[i].length; j++) { + if (colors[i][j].length == 3) { + colors[i][j] = colors[i][j].replace(/(.)(.)(.)/, "$1$1$2$2$3$3"); + } + + var td = tr.insertCell(-1); + with (td.style) { + backgroundColor = "#" + colors[i][j]; + border = "1px solid gray"; + width = height = "15px"; + fontSize = "1px"; + } + + td.color = "#" + colors[i][j]; + + td.onmouseover = function (e) { + this.style.borderColor = "white"; + }; + td.onmouseout = function (e) { + this.style.borderColor = "gray"; + }; + // dojo.event.connect(td, "onmousedown", this, "onClick"); + + td.innerHTML = " "; + } + } +}; + +core.ColorPicker.onClick = function(/*Event*/ e) +{ + this.onColorSelect(e.currentTarget.color); + e.currentTarget.style.borderColor = "gray"; +}; + +core.ColorPicker.onColorSelect = function(color) +{ + // summary: + // Callback when a color is selected. + // color: String + // Hex value corresponding to color. +}; + diff --git a/trunk/core-js/src/main/javascript/Loader.js b/trunk/core-js/src/main/javascript/Loader.js new file mode 100644 index 00000000..d44b6be1 --- /dev/null +++ b/trunk/core-js/src/main/javascript/Loader.js @@ -0,0 +1,87 @@ +/* +* 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 $ +*/ + +core.Loader = +{ + load: function(scriptPath, stylePath,jsFileName) + { + var headElement = document.getElementsByTagName('head'); + var htmlDoc = headElement.item(0); + var baseUrl = this.baseUrl(jsFileName); + if (scriptPath && scriptPath.length > 0) + { + for (var i = 0; i < scriptPath.length; i++) + { + this.includeScriptNode(baseUrl + scriptPath[i]); + } + } + if (stylePath && stylePath.length > 0) + { + for (var i = 0; i < stylePath.length; i++) + { + this.includeStyleNode(baseUrl + stylePath[i]); + } + } + }, + baseUrl: function(jsFileName) + { + var headElement = document.getElementsByTagName('head'); + var htmlDoc = headElement.item(0); + var headChildren = htmlDoc.childNodes; + var result = null; + for (var i = 0; i < headChildren.length; i++) + { + var node = headChildren.item(i); + if (node.nodeName && node.nodeName.toLowerCase() == "script") + { + var libraryUrl = node.src; + if (libraryUrl.indexOf(jsFileName) != -1) + { + var index = libraryUrl.lastIndexOf("/"); + index = libraryUrl.lastIndexOf("/", index - 1); + result = libraryUrl.substring(0, index); + } + } + } + + if (result == null) + { + throw "Could not obtain the base url directory."; + } + return result; + }, + includeScriptNode: function(filename) { + var html_doc = document.getElementsByTagName('head').item(0); + var js = document.createElement('script'); + js.setAttribute('language', 'javascript'); + js.setAttribute('type', 'text/javascript'); + js.setAttribute('src', filename); + html_doc.appendChild(js); + return false; + }, + includeStyleNode: function(filename) { + var html_doc = document.getElementsByTagName('head').item(0); + var js = document.createElement('link'); + js.setAttribute('rel', 'stylesheet'); + js.setAttribute('type', 'text/css'); + js.setAttribute('href', filename); + html_doc.appendChild(js); + return false; + } +}; diff --git a/trunk/core-js/src/main/javascript/Logger.js b/trunk/core-js/src/main/javascript/Logger.js new file mode 100644 index 00000000..1754686c --- /dev/null +++ b/trunk/core-js/src/main/javascript/Logger.js @@ -0,0 +1,129 @@ +/* +* 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 $ +*/ + +core.Logger = +{ + _enabled: false, + setEnabled: function (enabled) { + this._enabled = enabled; + },init: function(serverLogger) +{ + this._serverLogger = serverLogger; + if (window.onerror) { + // Save any previously defined handler to call + core.Logger._origOnWindowError = window.onerror; + } + window.onerror = core.Logger._onWindowError; +}, + log: function(message, severity, src) + { + if (!severity) + { + severity = core.LoggerSeverity.DEBUG; + } + + // Error messages must be loggued in the server ... + if (severity >= core.LoggerSeverity.ERROR) + { + if (this._serverLogger) + { + try + { + this._serverLogger.logError(core.LoggerSeverity.ERROR, message); + } catch(e) + { + } + } + } + + // // Finally, log the error in debug console if it's enabled. + if (this._enabled) + { + this._browserLogger(message); + } + }, + _browserLogger: function(message) { + // Firebug is not enabled. + + if (core.Logger._origOnWindowError) { + core.Logger._origOnWindowError(); + } + + if (!console) + { + if (!this._isInitialized) + { + this._console = window.document.createElement("div"); + this._console.style.position = "absolute"; + this._console.style.width = "300px"; + this._console.style.height = "200px"; + this._console.style.bottom = 0; + this._console.style.right = 0; + this._console.style.border = '1px solid black'; + this._console.style.background = 'yellow'; + this._console.style.zIndex = 60000; + + this._textArea = window.document.createElement("textarea"); + this._textArea.cols = "40"; + this._textArea.rows = "10"; + this._console.appendChild(this._textArea); + + window.document.body.appendChild(this._console); + this._isInitialized = true; + } + this._textArea.value = this._textArea.value + "\n" + msg; + + } else + { + // Firebug console... + console.log(message); + } + }, +/** + * Handles logging of messages due to window error events. + * + * @method _onWindowError + * @param sMsg {String} The error message. + * @param sUrl {String} URL of the error. + * @param sLine {String} Line number of the error. + * @private + */ + _onWindowError: function(sMsg, sUrl, sLine) { + // Logger is not in scope of this event handler + // http://cfis.savagexi.com/articles/2007/05/08/what-went-wrong-with-my-javascript + try { + core.Logger.log(sMsg + ' (' + sUrl + ', line ' + sLine + ')', core.LoggerSeverity.ERROR, "window"); + } + catch(e) { + return false; + } + return true; + }, + logError: function(msg) { + core.Logger.log(msg, core.LoggerSeverity.ERROR, "code"); + } +}; + +core.LoggerSeverity = +{ + DEBUG: 1, + WARNING: 2, + ERROR: 3, + WINDOW: 4 +}; \ No newline at end of file diff --git a/trunk/core-js/src/main/javascript/Monitor.js b/trunk/core-js/src/main/javascript/Monitor.js new file mode 100644 index 00000000..38cd0aa8 --- /dev/null +++ b/trunk/core-js/src/main/javascript/Monitor.js @@ -0,0 +1,142 @@ +/* +* 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 $ +*/ + +core.Monitor = function(fadeElement, logContentElem) +{ + core.assert(fadeElement, "fadeElement can not be null"); + core.assert(logContentElem, "logContentElem can not be null"); + + this.pendingMessages = []; + this.inProgress = false; + this._container = fadeElement; + this._currentMessage = null; + this._logContentElem = logContentElem; + + this._fxOpacity = fadeElement.effect('opacity', { duration: 6000 }); + +}; + +core.Monitor.prototype._logMessage = function(msg, msgKind) +{ + this._fxOpacity.clearTimer(); + if (msgKind == core.Monitor.MsgKind.ERROR) + { + msg = "
" + msg + "
"; + } + this._currentMessage = msg; + this._fxOpacity.start(1, 0); + this._logContentElem.innerHTML = msg; + +}; + +core.Monitor.prototype.logError = function(userMsg) +{ + this.logMessage(userMsg, core.Monitor.MsgKind.ERROR); +}; + +core.Monitor.prototype.logFatal = function(userMsg) +{ + this.logMessage(userMsg, core.Monitor.MsgKind.FATAL); +}; + +core.Monitor.prototype.logMessage = function(msg, msgKind) +{ + if (!msgKind) + { + msgKind = core.Monitor.MsgKind.INFO; + } + + if (msgKind == core.Monitor.MsgKind.FATAL) + { + // In this case, a modal dialog must be shown... No recovery is possible. + new Windoo.Alert(msg, + { + 'window': { theme:Windoo.Themes.aero, + title:"Outch!!. An unexpected error.", + 'onClose':function() { + } + } + }); + } else + { + var messages = this.pendingMessages; + var monitor = this; + + if (!this.executer) + { + // Log current message ... + monitor._logMessage(msg, msgKind); + + // Start worker thread ... + var disptacher = function() + { + if (messages.length > 0) + { + var msgToDisplay = messages.shift(); + monitor._logMessage(msgToDisplay); + } + + // Stop thread? + if (messages.length == 0) + { + $clear(monitor.executer); + monitor.executer = null; + monitor._fxOpacity.hide(); + this._currentMessage = null; + } + }; + this.executer = disptacher.periodical(600); + } else + { + if (this._currentMessage != msg) + { + messages.push(msg); + } + } + } +}; + +core.Monitor.setInstance = function(monitor) +{ + this.monitor = monitor; +}; + +core.Monitor.getInstance = function() +{ + var result = this.monitor; + if (result == null) + { + result = { + logError: function() { + }, + logMessage: function() { + } + }; + } + return result; +}; + + +core.Monitor.MsgKind = +{ + INFO:1, + WARNING:2, + ERROR:3, + FATAL:4 +}; \ No newline at end of file diff --git a/trunk/core-js/src/main/javascript/Point.js b/trunk/core-js/src/main/javascript/Point.js new file mode 100644 index 00000000..3eec455b --- /dev/null +++ b/trunk/core-js/src/main/javascript/Point.js @@ -0,0 +1,40 @@ +/* +* 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 $ +*/ + +core.Point = function(x, y) +{ + this.x = x; + this.y = y; +}; + +core.Point.prototype.setValue = function(x, y) +{ + this.x = x; + this.y = y; +}; + +core.Point.prototype.inspect = function() +{ + return "{x:" + this.x + ",y:" + this.y + "}"; +}; + +core.Point.prototype.clone = function() +{ + return new core.Point(this.x, this.y); +}; \ No newline at end of file diff --git a/trunk/core-js/src/main/javascript/UserAgent.js b/trunk/core-js/src/main/javascript/UserAgent.js new file mode 100644 index 00000000..c6586eff --- /dev/null +++ b/trunk/core-js/src/main/javascript/UserAgent.js @@ -0,0 +1,148 @@ +/* +* 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 $ +*/ + +core.UserAgent = { + _isVMLSupported:null, + isVMLSupported: function() + { + if (!core.Utils.isDefined()) + { + this._isVMLSupported = navigator.appVersion.match(/MSIE (\d\.\d)/); + } + return this._isVMLSupported; + }, + isSVGSupported: function() + { + return !core.UserAgent.isVMLSupported(); + }, + isIframeWorkaroundRequired: function() + { + return core.UserAgent.OS == "Mac" && core.UserAgent.browser == "Firefox" && core.UserAgent.version < 3; + }, + isMozillaFamily: function() + { + return this.browser == "Netscape" || this.browser == "Firefox"; + }, + isIE: function() + { + return this.browser == "Explorer"; + }, + init: function () { + this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; + this.version = this.searchVersion(navigator.userAgent) + || this.searchVersion(navigator.appVersion) + || "an unknown version"; + this.OS = this.searchString(this.dataOS) || "an unknown OS"; + }, + searchString: function (data) { + for (var i = 0; i < data.length; i++) { + var dataString = data[i].string; + var dataProp = data[i].prop; + this.versionSearchString = data[i].versionSearch || data[i].identity; + if (dataString) { + if (dataString.indexOf(data[i].subString) != -1) + return data[i].identity; + } + else if (dataProp) + return data[i].identity; + } + }, + searchVersion: function (dataString) { + var index = dataString.indexOf(this.versionSearchString); + if (index == -1) return; + return parseFloat(dataString.substring(index + this.versionSearchString.length + 1)); + }, + dataBrowser: [ + { string: navigator.userAgent, + subString: "OmniWeb", + versionSearch: "OmniWeb/", + identity: "OmniWeb" + }, + { + string: navigator.vendor, + subString: "Apple", + identity: "Safari" + }, + { + prop: window.opera, + identity: "Opera" + }, + { + string: navigator.vendor, + subString: "iCab", + identity: "iCab" + }, + { + string: navigator.vendor, + subString: "KDE", + identity: "Konqueror" + }, + { + string: navigator.userAgent, + subString: "Firefox", + identity: "Firefox" + }, + { + string: navigator.vendor, + subString: "Camino", + identity: "Camino" + }, + { // for newer Netscapes (6+) + string: navigator.userAgent, + subString: "Netscape", + identity: "Netscape" + }, + { + string: navigator.userAgent, + subString: "MSIE", + identity: "Explorer", + versionSearch: "MSIE" + }, + { + string: navigator.userAgent, + subString: "Gecko", + identity: "Mozilla", + versionSearch: "rv" + }, + { // for older Netscapes (4-) + string: navigator.userAgent, + subString: "Mozilla", + identity: "Netscape", + versionSearch: "Mozilla" + } + ], + dataOS : [ + { + string: navigator.platform, + subString: "Win", + identity: "Windows" + }, + { + string: navigator.platform, + subString: "Mac", + identity: "Mac" + }, + { + string: navigator.platform, + subString: "Linux", + identity: "Linux" + } + ] +}; +core.UserAgent.init(); \ No newline at end of file diff --git a/trunk/core-js/src/main/javascript/Utils.js b/trunk/core-js/src/main/javascript/Utils.js new file mode 100644 index 00000000..3179e3d5 --- /dev/null +++ b/trunk/core-js/src/main/javascript/Utils.js @@ -0,0 +1,257 @@ +/* +* 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 $ +*/ + +core.Utils = +{ + isDefined: function(val) + { + return val !== null && val !== undefined; + }, + escapeInvalidTags: function (text) + { + //todo:Pablo. scape invalid tags in a text + return text; + } +}; + +/** + * http://kevlindev.com/tutorials/javascript/inheritance/index.htm + * A function used to extend one class with another + * + * @param {Object} subClass + * The inheriting class, or subclass + * @param {Object} baseClass + * The class from which to inherit + */ +objects = {}; +objects.extend = function(subClass, baseClass) { + function inheritance() { + } + inheritance.prototype = baseClass.prototype; + + subClass.prototype = new inheritance(); + subClass.prototype.constructor = subClass; + subClass.baseConstructor = baseClass; + subClass.superClass = baseClass.prototype; +}; + +core.assert = function(assert, message) +{ + if (!assert) + { + var stack; + try + { + null.eval(); + } catch(e) + { + stack = e; + } + core.Logger.logError(message + "," + stack); + } + +}; + +core.findElement = function(name) +{ + var result; + if (core.UserAgent.isIframeWorkaroundRequired()) + { + var iframe = $('mindplotIFrame'); + var doc = iframe.contentDocument; + if (doc == undefined || doc == null) + doc = iframe.contentWindow.document; + result = $(doc.getElementById(name)); + } + if (!result) + { + result = $(name); + } + + return result; +} + +Math.sign = function(value) +{ + return (value >= 0) ? 1 : -1; +}; + + +// Extensions .... +function $import(src) { + var scriptElem = document.createElement('script'); + scriptElem.setAttribute('src', src); + scriptElem.setAttribute('type', 'text/javascript'); + document.getElementsByTagName('head')[0].appendChild(scriptElem); +} + +/** + * Retrieve the mouse position. + */ +core.Utils.getMousePosition = function(event) +{ + var xcoord = -1; + var ycoord = -1; + + if (!event) { + if (window.event) { + //Internet Explorer + event = window.event; + } else { + //total failure, we have no way of referencing the event + throw "Could not obtain mouse position"; + } + } + if (typeof( event.pageX ) == 'number') { + //most browsers + xcoord = event.pageX; + ycoord = event.pageY; + } else if (typeof( event.clientX ) == 'number') { + //Internet Explorer and older browsers + //other browsers provide this, but follow the pageX/Y branch + xcoord = event.clientX; + ycoord = event.clientY; + var badOldBrowser = ( window.navigator.userAgent.indexOf('Opera') + 1 ) || + ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) || + ( navigator.vendor == 'KDE' ); + if (!badOldBrowser) { + if (document.body && ( document.body.scrollLeft || document.body.scrollTop )) { + //IE 4, 5 & 6 (in non-standards compliant mode) + xcoord += document.body.scrollLeft; + ycoord += document.body.scrollTop; + } else if (document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop )) { + //IE 6 (in standards compliant mode) + xcoord += document.documentElement.scrollLeft; + ycoord += document.documentElement.scrollTop; + } + } + } else { + throw "Could not obtain mouse position"; + } + + + return {x:xcoord,y:ycoord}; +}; + + +/** + * Calculate the position of the passed element. + */ +core.Utils.workOutDivElementPosition = function(divElement) +{ + var curleft = 0; + var curtop = 0; + if (divElement.offsetParent) { + curleft = divElement.offsetLeft; + curtop = divElement.offsetTop; + while (divElement = divElement.offsetParent) { + curleft += divElement.offsetLeft; + curtop += divElement.offsetTop; + } + } + return {x:curleft,y:curtop}; +}; + + +core.Utils.innerXML = function(/*Node*/node) { + // summary: + // Implementation of MS's innerXML function. + if (node.innerXML) { + return node.innerXML; + // string + } else if (node.xml) { + return node.xml; + // string + } else if (typeof XMLSerializer != "undefined") { + return (new XMLSerializer()).serializeToString(node); + // string + } +}; + +core.Utils.createDocument = function() { + // summary: + // cross-browser implementation of creating an XML document object. + var doc = null; + var _document = window.document; + if (window.ActiveXObject) { + var prefixes = [ "MSXML2", "Microsoft", "MSXML", "MSXML3" ]; + for (var i = 0; i < prefixes.length; i++) { + try { + doc = new ActiveXObject(prefixes[i] + ".XMLDOM"); + } catch(e) { /* squelch */ + } + ; + + if (doc) { + break; + } + } + } else if ((_document.implementation) && + (_document.implementation.createDocument)) { + doc = _document.implementation.createDocument("", "", null); + } + + return doc; + // DOMDocument +}; + +core.Utils.createDocumentFromText = function(/*string*/str, /*string?*/mimetype) { + // summary: + // attempts to create a Document object based on optional mime-type, + // using str as the contents of the document + if (!mimetype) { + mimetype = "text/xml"; + } + if (window.DOMParser) + { + var parser = new DOMParser(); + return parser.parseFromString(str, mimetype); + // DOMDocument + } else if (window.ActiveXObject) { + var domDoc = core.Utils.createDocument(); + if (domDoc) { + domDoc.async = false; + domDoc.loadXML(str); + return domDoc; + // DOMDocument + } else { + //dojo.debug("toXml didn't work?"); + } + } else { + // var _document = dojo.doc(); + // if(_document.createElement){ + // // FIXME: this may change all tags to uppercase! + // var tmp = _document.createElement("xml"); + // tmp.innerHTML = str; + // if(_document.implementation && _document.implementation.createDocument){ + // var xmlDoc = _document.implementation.createDocument("foo", "", null); + // for(var i = 0; i < tmp.childNodes.length; i++) { + // xmlDoc.importNode(tmp.childNodes.item(i), true); + // } + // return xmlDoc; // DOMDocument + // } + // // FIXME: probably not a good idea to have to return an HTML fragment + // // FIXME: the tmp.doc.firstChild is as tested from IE, so it may not + // // work that way across the board + // return ((tmp.document)&& + // (tmp.document.firstChild ? tmp.document.firstChild : tmp)); // DOMDocument + // } + } + return null; +}; diff --git a/trunk/core-js/src/main/javascript/WaitDialog.js b/trunk/core-js/src/main/javascript/WaitDialog.js new file mode 100644 index 00000000..9ab35f10 --- /dev/null +++ b/trunk/core-js/src/main/javascript/WaitDialog.js @@ -0,0 +1,216 @@ +/* +* 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 $ +*/ + +/* +Created By: Chris Campbell +Website: http://particletree.com +Date: 2/1/2006 + +Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/ +*/ + +/*-------------------------------GLOBAL VARIABLES------------------------------------*/ + +var detect = navigator.userAgent.toLowerCase(); +var OS,browser,version,total,thestring; + +/*-----------------------------------------------------------------------------------------------*/ + +//Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/ + +function getBrowserInfo(evt) { + if (checkIt('konqueror')) { + browser = "Konqueror"; + OS = "Linux"; + } + else if (checkIt('safari')) browser = "Safari" + else if (checkIt('omniweb')) browser = "OmniWeb" + else if (checkIt('opera')) browser = "Opera" + else if (checkIt('webtv')) browser = "WebTV"; + else if (checkIt('icab')) browser = "iCab" + else if (checkIt('msie')) browser = "Internet Explorer" + else if (!checkIt('compatible')) { + browser = "Netscape Navigator" + version = detect.charAt(8); + } + else browser = "An unknown browser"; + + if (!version) version = detect.charAt(place + thestring.length); + + if (!OS) { + if (checkIt('linux')) OS = "Linux"; + else if (checkIt('x11')) OS = "Unix"; + else if (checkIt('mac')) OS = "Mac" + else if (checkIt('win')) OS = "Windows" + else OS = "an unknown operating system"; + } +} + +function checkIt(string) { + place = detect.indexOf(string) + 1; + thestring = string; + return place; +} + +/*-----------------------------------------------------------------------------------------------*/ + +$(window).addEvent('load', getBrowserInfo); + +core.WaitDialog = new Class({ + + initialize: function(contentId) { + this.content = $(contentId); + }, + + yPos : 0, + + xPos : 0, + +// Turn everything on - mainly the IE fixes + activate: function(changeCursor) + { + // if (browser == 'Internet Explorer'){ + //// this.getScroll(); + // this.prepareIE('100%', 'hidden'); + //// this.setScroll(0,0); + //// this.hideSelects('hidden'); + // } + this.displayLightbox("block"); + + // Change to loading cursor. + if (changeCursor) + { + window.document.body.style.cursor = "wait"; + } + }, + +// Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox + prepareIE: function(height, overflow) { + bod = document.getElementsByTagName('body')[0]; + bod.style.height = height; + bod.style.overflow = overflow; + + htm = document.getElementsByTagName('html')[0]; + htm.style.height = height; + htm.style.overflow = overflow; + }, + +// In IE, select elements hover on top of the lightbox + hideSelects: function(visibility) { + selects = document.getElementsByTagName('select'); + for (i = 0; i < selects.length; i++) { + selects[i].style.visibility = visibility; + } + }, + +// Taken from lightbox implementation found at http://www.huddletogether.com/projects/lightbox/ + getScroll: function() { + if (self.pageYOffset) { + this.yPos = self.pageYOffset; + } else if (document.documentElement && document.documentElement.scrollTop) { + this.yPos = document.documentElement.scrollTop; + } else if (document.body) { + this.yPos = document.body.scrollTop; + } + }, + + setScroll: function(x, y) { + window.scrollTo(x, y); + }, + + displayLightbox: function(display) { + $('overlay').style.display = display; + $('lightbox').style.display = display; + if (display != 'none') + this.processInfo(); + }, + +// Display Ajax response + processInfo: function() { + var info = new Element('div').setProperty('id', 'lbContent'); + info.setHTML(this.content.innerHTML); + info.injectBefore($('lbLoadMessage')); + $('lightbox').className = "done"; + }, + +// Search through new links within the lightbox, and attach click event + actions: function() { + lbActions = document.getElementsByClassName('lbAction'); + + for (i = 0; i < lbActions.length; i++) { + $(lbActions[i]).addEvent('click', function() { + this[lbActions[i].rel].pass(this) + }.bind(this)); + lbActions[i].onclick = function() { + return false; + }; + } + + }, + +// Example of creating your own functionality once lightbox is initiated + insert: function(e) { + var event = new Event(e); + link = event.target; + if ($('lbContent')) + $('lbContent').remove(); + + var myAjax = new Ajax.Request( + link.href, + {method: 'post', parameters: "", onComplete: this.processInfo.pass(this)} + ); + + }, + +// Example of creating your own functionality once lightbox is initiated + deactivate: function(time) { + + if ($('lbContent')) + $('lbContent').remove(); + // + // if (browser == "Internet Explorer"){ + // this.setScroll(0,this.yPos); + // this.prepareIE("auto", "auto"); + // this.hideSelects("visible"); + // } + this.displayLightbox("none"); + + window.document.body.style.cursor = "default"; + } +}); + +/*-----------------------------------------------------------------------------------------------*/ + +// Onload, make all links that need to trigger a lightbox active +function initialize() { + addLightboxMarkup(); + valid = new core.WaitDialog($('sampleDialog')); +} + +// Add in markup necessary to make this work. Basically two divs: +// Overlay holds the shadow +// Lightbox is the centered square that the content is put into. +function addLightboxMarkup() { + var body = document.getElementsByTagName('body')[0]; + overlay = new Element('div').setProperty('id', 'overlay').injectInside(document.body); + var lb = new Element('div').setProperty('id', 'lightbox'); + lb.addClass('loading'); + var tmp = new Element('div').setProperty('id', 'lbLoadMessage').injectInside(lb); + lb.injectInside(document.body); +} \ No newline at end of file diff --git a/trunk/core-js/src/main/javascript/footer.js b/trunk/core-js/src/main/javascript/footer.js new file mode 100644 index 00000000..b68760ab --- /dev/null +++ b/trunk/core-js/src/main/javascript/footer.js @@ -0,0 +1,30 @@ +/* +* 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 $ +*/ + +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/core-js/src/main/javascript/header.js b/trunk/core-js/src/main/javascript/header.js new file mode 100644 index 00000000..9208f24c --- /dev/null +++ b/trunk/core-js/src/main/javascript/header.js @@ -0,0 +1,20 @@ +/* +* 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 $ +*/ + +var core = {}; \ No newline at end of file diff --git a/trunk/mindplot/pom.xml b/trunk/mindplot/pom.xml new file mode 100644 index 00000000..cff8d57d --- /dev/null +++ b/trunk/mindplot/pom.xml @@ -0,0 +1,141 @@ + + + 4.0.0 + mindplot + jar + Mindmap Draw JavaScript Library + + + org.wisemapping + wisemapping + ../pom.xml + 1.0-SNAPSHOT + + + + + org.wisemapping + web2d + 1.0-SNAPSHOT + runtime + + + + + + + maven-antrun-plugin + + + merge-js-resources + generate-resources + + run + + + + + + + + + + + net.sf.alchim + yuicompressor-maven-plugin + + + generate-resources + + compress + + + src/main/javascript/ + target/tmp/ + + + + ${basedir}/target/tmp/mindplot-min.js + + header-min.js + Mindmap-min.js + NodeModel-min.js + MindmapDesigner-min.js + ScreenManager-min.js + Workspace-min.js + ShrinkConnector-min.js + NodeGraph-min.js + Topic-min.js + CentralTopic-min.js + MainTopic-min.js + DragTopic-min.js + DragManager-min.js + DragPivot-min.js + TopicBoard-min.js + CentralTopicBoard-min.js + MainTopicBoard-min.js + ConnectionLine-min.js + DragTopicPositioner-min.js + Board-min.js + TextEditor-min.js + VariableDistanceBoard-min.js + util/Shape-min.js + FixedDistanceBoard-min.js + BoardEntry-min.js + XMLMindmapSerializer-min.js + PersistanceManager-min.js + EditorProperties-min.js + IconGroup-min.js + BubbleTip-min.js + Tip-min.js + Icon-min.js + LinkIcon-min.js + Note-min.js + ImageIcon-min.js + IconModel-min.js + LinkModel-min.js + NoteModel-min.js + + Command-min.js + DesignerActionRunner-min.js + DesignerUndoManager-min.js + + commands/GenericFunctionCommand-min.js + commands/DeleteTopicCommand-min.js + commands/DragTopicCommand-min.js + commands/AddTopicCommand-min.js + commands/AddLinkToTopicCommand-min.js + commands/RemoveLinkFromTopicCommand-min.js + commands/AddIconToTopicCommand-min.js + commands/RemoveIconFromTopicCommand-min.js + commands/AddNoteToTopicCommand-min.js + commands/RemoveNoteFromTopicCommand-min.js + + footer-min.js + + + + + ${basedir}/target/classes/mindplot.vml.js + + ${basedir}/../web2d/target/classes/web2d.vml-min.js + ${basedir}/target/tmp/mindplot-min.js + + + + ${basedir}/target/classes/mindplot.svg.js + + ${basedir}/../web2d/target/classes/web2d.svg-min.js + ${basedir}/target/tmp/mindplot-min.js + + + + true + false + + + + + + + diff --git a/trunk/mindplot/src/main/javascript/Board.js b/trunk/mindplot/src/main/javascript/Board.js new file mode 100644 index 00000000..adfb589e --- /dev/null +++ b/trunk/mindplot/src/main/javascript/Board.js @@ -0,0 +1,125 @@ +/* +* 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.Board = function(defaultHeight, referencePoint) +{ + this.initialize(defaultHeight, referencePoint); +}; + +mindplot.Board.prototype.initialize = function(defaultHeight, referencePoint) +{ + core.assert(referencePoint, "referencePoint can not be null"); + this._defaultWidth = defaultHeight; + this._entries = new mindplot.BidirectionalArray(); + this._referencePoint = referencePoint; +}; + +mindplot.Board.prototype.getReferencePoint = function() +{ + return this._referencePoint; +}; + +/** + * --------------------------------------- + */ +mindplot.BidirectionalArray = function() +{ + this._leftElem = []; + this._rightElem = []; +}; + +mindplot.BidirectionalArray.prototype.get = function(index, sign) +{ + core.assert(core.Utils.isDefined(index), 'Illegal argument, index must be passed.'); + if (core.Utils.isDefined(sign)) + { + core.assert(index >= 0, 'Illegal absIndex value'); + index = index * sign; + } + + var result = null; + if (index >= 0 && index < this._rightElem.length) + { + result = this._rightElem[index]; + } else if (index < 0 && Math.abs(index) < this._leftElem.length) + { + result = this._leftElem[Math.abs(index)]; + } + return result; +}; + +mindplot.BidirectionalArray.prototype.set = function(index, elem) +{ + core.assert(core.Utils.isDefined(index), 'Illegal index value'); + + var array = (index >= 0) ? this._rightElem : this._leftElem; + array[Math.abs(index)] = elem; +}; + +mindplot.BidirectionalArray.prototype.length = function(index) +{ + core.assert(core.Utils.isDefined(index), 'Illegal index value'); + return (index >= 0) ? this._rightElem.length : this._leftElem.length; +}; + +mindplot.BidirectionalArray.prototype.upperLength = function() +{ + return this.length(1); +}; + +mindplot.BidirectionalArray.prototype.lowerLength = function() +{ + return this.length(-1); +}; + +mindplot.BidirectionalArray.prototype.inspect = function() +{ + var result = '{'; + var lenght = this._leftElem.length; + for (var i = 0; i < lenght; i++) + { + var entry = this._leftElem[lenght - i - 1]; + if (entry != null) + { + if (i != 0) + { + result += ', '; + } + result += entry.inspect(); + } + } + + lenght = this._rightElem.length; + for (var i = 0; i < lenght; i++) + { + var entry = this._rightElem[i]; + if (entry != null) + { + if (i != 0) + { + result += ', '; + } + result += entry.inspect(); + } + } + result += '}'; + + return result; + +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/BoardEntry.js b/trunk/mindplot/src/main/javascript/BoardEntry.js new file mode 100644 index 00000000..dc0ffd23 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/BoardEntry.js @@ -0,0 +1,161 @@ +/* +* 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.BoardEntry = function(lowerLimit, upperLimit, order) +{ + if (lowerLimit && upperLimit) + { + core.assert(lowerLimit < upperLimit, 'lowerLimit can not be greater that upperLimit'); + } + this._upperLimit = upperLimit; + this._lowerLimit = lowerLimit; + this._order = order; + this._topic = null; + this._xPos = null; +}; + +mindplot.BoardEntry.prototype.getUpperLimit = function() +{ + return this._upperLimit; +}; + +mindplot.BoardEntry.prototype.setXPosition = function(xPosition) +{ + this._xPos = xPosition; +}; + +mindplot.BoardEntry.prototype.workoutEntryYCenter = function() +{ + return this._lowerLimit + ((this._upperLimit - this._lowerLimit) / 2); +}; + +mindplot.BoardEntry.prototype.setUpperLimit = function(value) +{ + core.assert(core.Utils.isDefined(value), "upper limit can not be null"); + core.assert(!isNaN(value), "illegal value"); + this._upperLimit = value; +}; + +mindplot.BoardEntry.prototype.isCoordinateIn = function(coord) +{ + return this._lowerLimit <= coord && coord < this._upperLimit; +}; + +mindplot.BoardEntry.prototype.getLowerLimit = function() +{ + return this._lowerLimit; +}; + +mindplot.BoardEntry.prototype.setLowerLimit = function(value) +{ + core.assert(core.Utils.isDefined(value), "upper limit can not be null"); + core.assert(!isNaN(value), "illegal value"); + this._lowerLimit = value; +}; + +mindplot.BoardEntry.prototype.setOrder = function(value) +{ + this._order = value; +}; + +mindplot.BoardEntry.prototype.getWidth = function() +{ + return Math.abs(this._upperLimit - this._lowerLimit); +}; + + +mindplot.BoardEntry.prototype.getTopic = function() +{ + return this._topic; +}; + + +mindplot.BoardEntry.prototype.removeTopic = function() +{ + core.assert(!this.isAvailable(), "Entry doesn't have a topic."); + var topic = this.getTopic(); + this.setTopic(null); + topic.setOrder(null); +}; + + +mindplot.BoardEntry.prototype.update = function() +{ + var topic = this.getTopic(); + this.setTopic(topic); +}; + +mindplot.BoardEntry.prototype.setTopic = function(topic, updatePosition) +{ + if (!core.Utils.isDefined(updatePosition)) + { + updatePosition = true; + } + + this._topic = topic; + if (topic) + { + // Fixed positioning. Only for main topic ... + var position = null; + var topicPosition = topic.getPosition(); + + // Must update position base on the border limits? + if (this._xPos) + { + position = new core.Point(); + + // Update x position ... + var topicSize = topic.getSize(); + var halfTopicWidh = parseInt(topicSize.width / 2); + halfTopicWidh = (this._xPos > 0) ? halfTopicWidh:-halfTopicWidh; + position.x = this._xPos + halfTopicWidh; + position.y = this.workoutEntryYCenter(); + } else { + + // Central topic + this._height = topic.getSize().height; + var xPos = topicPosition.x; + var yPos = this.workoutEntryYCenter(); + position = new core.Point(xPos, yPos); + } + + // @todo: No esta de mas... + topic.setPosition(position); + topic.setOrder(this._order); + } + else + { + this._height = this._defaultWidth; + } +}; + +mindplot.BoardEntry.prototype.isAvailable = function() +{ + return !core.Utils.isDefined(this._topic); +}; + +mindplot.BoardEntry.prototype.getOrder = function() +{ + return this._order; +}; + +mindplot.BoardEntry.prototype.inspect = function() +{ + return '(order: ' + this._order + ', lowerLimit:' + this._lowerLimit + ', upperLimit: ' + this._upperLimit + ', available:' + this.isAvailable() + ')'; +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/BubbleTip.js b/trunk/mindplot/src/main/javascript/BubbleTip.js new file mode 100644 index 00000000..b3e5ff83 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/BubbleTip.js @@ -0,0 +1,264 @@ +/* +* 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.BubbleTip = function(divContainer){ + this.initialize(divContainer); + }; +mindplot.BubbleTip.prototype.initialize=function(divContainer){ + this.options={ + panel:null, + container:null, + divContainer:divContainer, + content:null, + onShowComplete:Class.empty, + onHideComplete:Class.empty, + width:null, + height:null, + form:null + }; + if($chk(this.options.form)) + this.scanElements(this.options.form); + this.buildBubble(); + this._isMouseOver=false; + this._open=false; + }; +mindplot.BubbleTip.prototype.scanElements=function(form){ + $$($(form).getElements('a')).each(function(el) { + if (el.href && el.hasClass('bubble') && !el.onclick) { + el.addEvent('mouseover',this.click.bindWithEvent(this,el)); + } + }, this); + }; +mindplot.BubbleTip.prototype.buildBubble=function(invert){ + var opts = this.options; + + var panel = new Element('div').addClass('bubbleContainer'); + if($chk(opts.height)) + panel.setStyle('height', opts.height); + if($chk(opts.width)) + panel.setStyle('width', opts.width); + + var topClass=""; + var bottomClass="Hint"; + if($chk(invert)){ + var tmpClass = topClass; + topClass=bottomClass; + bottomClass=tmpClass; + } + + //build top part of bubble + this.topContainer = new Element('div').addClass('bublePartContainer'); + this.topLeft = new Element('div').addClass('bubblePart').addClass('bubble'+topClass+'TopLeftBlue'); + this.top = new Element('div').addClass('bubblePart').addClass('bubble'+topClass+'TopBlue'); + this.topHint =new Element('div').addClass('bubblePart').addClass('bubbleTop'+topClass+'Blue').setStyle('width',58); + this.top2 = new Element('div').addClass('bubblePart').addClass('bubble'+topClass+'TopBlue'); + this.topRight = new Element('div').addClass('bubblePart').addClass('bubble'+topClass+'TopRightBlue'); + this.topLeft.inject(this.topContainer); + this.top.inject(this.topContainer); + this.topHint.inject(this.topContainer); + this.top2.inject(this.topContainer); + this.topRight.inject(this.topContainer); + + //build middle part of bubble + this.middleContainer = new Element('div').addClass('bublePartContainer'); + this.left = new Element('div').addClass('bubblePart').addClass('bubbleLeftBlue'); + this.center = new Element('div').addClass('bubblePart').addClass('bubbleCenterBlue'); + this.right = new Element('div').addClass('bubblePart').addClass('bubbleRightBlue'); + this.left.inject(this.middleContainer); + this.center.inject(this.middleContainer); + this.right.inject(this.middleContainer); + + //build bottom part of bubble + this.bottomContainer = new Element('div').addClass('bublePartContainer'); + this.bottomLeft = new Element('div').addClass('bubblePart').addClass('bubble'+bottomClass+'BottomLeftBlue'); + this.bottom = new Element('div').addClass('bubblePart').addClass('bubble'+bottomClass+'BottomBlue'); + this.bottomHint =new Element('div').addClass('bubblePart').addClass('bubbleBottom'+bottomClass+'Blue').setStyle('width',58); + this.bottom2 = new Element('div').addClass('bubblePart').addClass('bubble'+bottomClass+'BottomBlue'); + this.bottomRight = new Element('div').addClass('bubblePart').addClass('bubble'+bottomClass+'BottomRightBlue'); + this.bottomLeft.inject(this.bottomContainer); + this.bottom.inject(this.bottomContainer); + this.bottomHint.inject(this.bottomContainer); + this.bottom2.inject(this.bottomContainer); + this.bottomRight.inject(this.bottomContainer); + + this.topContainer.inject(panel); + this.middleContainer.inject(panel); + this.bottomContainer.inject(panel); + + if(!$chk(opts.divContainer)) + { + opts.divContainer=document.body; + } + panel.injectTop(opts.divContainer); + opts.panel = $(panel); + opts.panel.setStyle('opacity',0); + opts.panel.addEvent('mouseover',function(){this._isMouseOver=true;}.bind(this)); + opts.panel.addEvent('mouseleave',function(event){this.close(event);}.bindWithEvent(this));//this.close.bindWithEvent(this) + + }; +mindplot.BubbleTip.prototype.click= function(event, el) { + return this.open(event, el); + }; +mindplot.BubbleTip.prototype.open= function(event, content, source){ + this._isMouseOver=true; + this._evt = new Event(event); + this.doOpen.delay(500, this,[content,source]); + }; +mindplot.BubbleTip.prototype.doOpen= function(content, source){ + if($chk(this._isMouseOver) &&!$chk(this._open) && !$chk(this._opening)) + { + this._opening=true; + var container = new Element('div'); + $(content).inject(container); + this.options.content=content; + this.options.container=container; + $(this.options.container).inject(this.center); + this.init(this._evt,source); + $(this.options.panel).effect('opacity',{duration:500, onComplete:function(){this._open=true; this._opening = false;}.bind(this)}).start(0,100); + } + }; +mindplot.BubbleTip.prototype.updatePosition=function(event){ + this._evt = new Event(event); + }; +mindplot.BubbleTip.prototype.close=function(event){ + this._isMouseOver=false; + this.doClose.delay(50,this,new Event(event)); + }; +mindplot.BubbleTip.prototype.doClose=function(event){ + + if(!$chk(this._isMouseOver) && $chk(this._opening)) + this.doClose.delay(500,this,this._evt); + + if(!$chk(this._isMouseOver) && $chk(this._open)) + { + this.forceClose(); + } + }; +mindplot.BubbleTip.prototype.forceClose=function(){ + this.options.panel.effect('opacity',{duration:100, onComplete:function(){ + this._open=false; + $(this.options.panel).setStyles({left:0,top:0}); + $(this.top2).setStyle('width', 3); + $(this.bottom2).setStyle('width', 3); + $(this.top).setStyle('width', 3); + $(this.bottom).setStyle('width', 3); + $(this.left).setStyle('height', 4); + $(this.right).setStyle('height', 4); + $(this.options.container).remove(); + }.bind(this)}).start(100,0); + }; +mindplot.BubbleTip.prototype.init=function(event,source){ + var opts = this.options; + var coordinates = $(opts.panel).getCoordinates(); + var panelHeight = coordinates.height; //not total height, but close enough + + var offset = designer.getWorkSpace().getScreenManager().getWorkspaceIconPosition(source); + + var containerCoords = $(opts.divContainer).getCoordinates(); + var screenWidth = containerCoords.width; + var screenHeight = containerCoords.height; + + var invert = false; + var picoFix=20; + + var centerWidth = $(this.center).getCoordinates().width; + + if(offset.y > panelHeight){ //hint goes on the bottom + if(!$(this.topLeft).hasClass('bubbleTopLeftBlue')){ + $(this.options.panel).remove(); + this.buildBubble(false); + $(this.options.container).inject(this.center); + } + } + else{ + invert=true; + picoFix=0; + if($(this.topLeft).hasClass('bubbleTopLeftBlue')){ + $(this.options.panel).remove(); + this.buildBubble(invert); + $(this.options.container).inject(this.center); + } + centerWidth = centerWidth-1; + } + + offset.y = offset.y + picoFix; + var width = centerWidth - $(this.topHint).getCoordinates().width; + + if((screenWidth -offset.x)>coordinates.width){ + width= width-$(this.top).getCoordinates().width; + $(this.top2).setStyle('width', width); + $(this.bottom2).setStyle('width', width); + } + else{ + width= width-$(this.top2).getCoordinates().width; + $(this.top).setStyle('width', width); + $(this.bottom).setStyle('width', width); + } + + width = centerWidth + $(this.topLeft).getCoordinates().width; + //width = width + $(this.top).getCoordinates().width; + //width = width + $(this.topHint).getCoordinates().width; + width = width + $(this.topRight).getCoordinates().width; + + var height = $(this.center).getCoordinates().height; + $(this.left).setStyle('height', height); + $(this.right).setStyle('height', height); + + height = height+ $(this.topLeft).getCoordinates().height; + height = height+ $(this.bottomLeft).getCoordinates().height; + $(opts.panel).setStyles({width:width,height:height}); + + this.moveTopic(offset, $(opts.panel).getCoordinates().height, invert); + }; +mindplot.BubbleTip.prototype.moveTopic=function(offset, panelHeight, invert){ + var f = 1; + if($chk(invert)) + f=0; + var opts = this.options; + var width = $(this.bottomLeft).getCoordinates().width+$(this.bottom).getCoordinates().width-(2*(f-1)); + $(opts.panel).setStyles({left:offset.x - width, top:offset.y - (panelHeight*f)}); + }; + +mindplot.BubbleTip.getInstance = function(divContainer) +{ + var result = mindplot.BubbleTip.instance; + if(!result) + { + mindplot.BubbleTip.instance = new mindplot.BubbleTip(divContainer); + result = mindplot.BubbleTip.instance; + } + return result; +}; + + +/* +buildAnchorContent:function(el, title){ + var imgContainer= new Element('div'); + var img = new Element('img'); + img.src='http://open.thumbshots.org/image.pxf?url='+el.href; + img.inject(imgContainer); + + var attribution = new Element('div'); + attribution.innerHTML="About Thumbshots thumbnails"; + + var element = new Element('div'); + imgContainer.inject(element); + attribution.inject(element); + return element; + }*/ diff --git a/trunk/mindplot/src/main/javascript/CentralTopic.js b/trunk/mindplot/src/main/javascript/CentralTopic.js new file mode 100644 index 00000000..38c9ce0a --- /dev/null +++ b/trunk/mindplot/src/main/javascript/CentralTopic.js @@ -0,0 +1,137 @@ +/* +* 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.CentralTopic = function(model) +{ + core.assert(model, "Model can not be null"); + this.setModel(model); + var topicBoard = new mindplot.CentralTopicBoard(this); + mindplot.CentralTopic.superClass.initialize.call(this, topicBoard); + this.__onLoad = true; +}; + +objects.extend(mindplot.CentralTopic, mindplot.Topic); + + +mindplot.CentralTopic.prototype.workoutIncomingConnectionPoint = function(sourcePosition) +{ + return this.getPosition(); +}; + +mindplot.CentralTopic.prototype.getTopicType = function() +{ + return mindplot.NodeModel.CENTRAL_TOPIC_TYPE; +}; + +mindplot.CentralTopic.prototype.setCursor = function(type) +{ + type = (type == 'move') ? 'default' : type; + mindplot.CentralTopic.superClass.setCursor.call(this, type); +}; + +mindplot.CentralTopic.prototype.isConnectedToCentralTopic = function() +{ + return false; +}; + +mindplot.CentralTopic.prototype.createChildModel = function() +{ + // Create a new node ... + var model = this.getModel(); + var mindmap = model.getMindmap(); + var childModel = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE); + + if (!core.Utils.isDefined(this.___siblingDirection)) + { + this.___siblingDirection = 1; + } + + // Positionate following taking into account this internal flag ... + if (this.___siblingDirection == 1) + { + + childModel.setPosition(100, 0); + } else + { + childModel.setPosition(-100, 0); + } + this.___siblingDirection = -this.___siblingDirection; + + // Create a new node ... + childModel.setOrder(0); + + return childModel; +}; + +mindplot.CentralTopic.prototype._defaultShapeType = function() +{ + return mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT; +}; + + +mindplot.CentralTopic.prototype.updateTopicShape = function() +{ + +}; +mindplot.CentralTopic.prototype._updatePositionOnChangeSize = function(oldSize, newSize) { + + // Center main topic ... + var zeroPoint = new core.Point(0, 0); + this.setPosition(zeroPoint); + + // Update children position based on the new figure size ... + var xOffset = newSize.width - oldSize.width; + xOffset = Math.round(xOffset / 2); + + if (!this.__onLoad) + { + // HACK: on load ignore changes of position in order to avoid adding + // several times the central topic distance to all the child nodes... + + var topicBoard = this.getTopicBoard(); + topicBoard.updateChildrenPosition(this, xOffset); + this.__onLoad = false; + } +}; + +mindplot.CentralTopic.prototype._defaultText = function() +{ + return "Central Topic"; +}; + +mindplot.CentralTopic.prototype._defaultBackgroundColor = function() +{ + return "#f7f7f7"; +}; + +mindplot.CentralTopic.prototype._defaultBorderColor = function() +{ + return "#023BB9"; +}; + +mindplot.CentralTopic.prototype._defaultFontStyle = function() +{ + return { + font:"Verdana", + size: 10, + style:"normal", + weight:"bold", + color:"#023BB9" + }; +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/CentralTopicBoard.js b/trunk/mindplot/src/main/javascript/CentralTopicBoard.js new file mode 100644 index 00000000..00761c25 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/CentralTopicBoard.js @@ -0,0 +1,123 @@ +/* +* 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.CentralTopicBoard = function(centralTopic) +{ + var point = new core.Point(0, 0); + this._rightBoard = new mindplot.VariableDistanceBoard(50, point); + this._leftBoard = new mindplot.VariableDistanceBoard(50, point); + this._centralTopic = centralTopic; +}; + +objects.extend(mindplot.CentralTopicBoard, mindplot.TopicBoard); + +mindplot.CentralTopicBoard.prototype._getBoard = function(position) +{ + return (position.x >= 0) ? this._rightBoard : this._leftBoard; +}; + +mindplot.CentralTopicBoard.prototype._updateHeight = function() +{ + +}; + + +mindplot.CentralTopicBoard.prototype.positionateDragTopic = function(dragTopic) +{ + core.assert(dragTopic != null, 'dragTopic can not be null'); + core.assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance'); + + // This node is a main topic node. Position + var dragPos = dragTopic.getPosition(); + var board = this._getBoard(dragPos); + + // Look for entry ... + var entry = board.lookupEntryByPosition(dragPos); + + // Calculate 'y' position base on the entry ... + var yCoord; + if (!entry.isAvailable() && entry.getTopic() != dragTopic.getDraggedTopic()) + { + yCoord = entry.getLowerLimit(); + } else + { + yCoord = entry.workoutEntryYCenter(); + } + + + // MainTopic can not be positioned over the drag topic ... + var centralTopic = this._centralTopic; + var centralTopicSize = centralTopic.getSize(); + var halfWidth = (centralTopicSize.width / 2); + if (Math.abs(dragPos.x) < halfWidth + 60) + { + var distance = halfWidth + 60; + dragPos.x = (dragPos.x > 0)? distance:-distance; + } + + // Update board position. + var pivotPos = new core.Point(dragPos.x, yCoord); + dragTopic.setBoardPosition(pivotPos); +}; + + +mindplot.CentralTopicBoard.prototype.addBranch = function(topic) +{ + // Update topic position ... + var position = topic.getPosition(); + + var order = topic.getOrder(); + var board = this._getBoard(position); + var entry = null; + if (order != null) + { + entry = board.lookupEntryByOrder(order); + } else + { + entry = board.lookupEntryByPosition(position); + } + + // If the entry is not available, I must swap the the entries... + if (!entry.isAvailable()) + { + board.freeEntry(entry); + } + + // Add it to the board ... + entry.setTopic(topic); + board.update(entry); +}; + +mindplot.CentralTopicBoard.prototype.updateChildrenPosition = function(topic, xOffset) +{ + var board = this._rightBoard; + var oldReferencePosition = board.getReferencePoint(); + var newReferencePosition = new core.Point(oldReferencePosition.x + xOffset, oldReferencePosition.y); + board.updateReferencePoint(newReferencePosition); + + board = this._leftBoard; + oldReferencePosition = board.getReferencePoint(); + newReferencePosition = new core.Point(oldReferencePosition.x - xOffset, oldReferencePosition.y); + board.updateReferencePoint(newReferencePosition); +}; + +mindplot.CentralTopicBoard.prototype.repositionate = function() +{ + //@todo: implement .. +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/Command.js b/trunk/mindplot/src/main/javascript/Command.js new file mode 100644 index 00000000..354cf3a3 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/Command.js @@ -0,0 +1,49 @@ +/* +* 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.Command = new Class( +{ + initialize: function() + { + this._id = mindplot.Command._nextUUID(); + }, + execute: function(commandContext) + { + throw "execute must be implemented."; + }, + undoExecute: function(commandContext) + { + throw "undo must be implemented."; + }, + getId:function() + { + return this._id; + } +}); + +mindplot.Command._nextUUID = function() +{ + if (!mindplot.Command._uuid) + { + mindplot.Command._uuid = 1; + } + + mindplot.Command._uuid = mindplot.Command._uuid + 1; + return mindplot.Command._uuid; +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/ConnectionLine.js b/trunk/mindplot/src/main/javascript/ConnectionLine.js new file mode 100644 index 00000000..11bf0282 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/ConnectionLine.js @@ -0,0 +1,125 @@ +/* +* 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.ConnectionLine = function(sourceNode, targetNode) +{ + core.assert(targetNode, 'parentNode node can not be null'); + core.assert(sourceNode, 'childNode node can not be null'); + core.assert(sourceNode != targetNode, 'Cilcular connection'); + + this._targetTopic = targetNode; + this._sourceTopic = sourceNode; + + var strokeColor = mindplot.ConnectionLine.getStrokeColor(); + var line; + if (targetNode.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + line = new web2d.Line(); + line.setStroke(1, 'solid', strokeColor); + } else + { + line = new web2d.PolyLine(); + line.setStroke(1, 'solid', strokeColor); + } + + this._line2d = line; +}; + +mindplot.ConnectionLine.getStrokeColor = function() +{ + return '#495879'; +}; + +mindplot.ConnectionLine.prototype.setVisibility = function(value) +{ + var line2d = this._line2d; + line2d.setVisibility(value); +}; + +mindplot.ConnectionLine.prototype.redraw = function() +{ + var line2d = this._line2d; + var sourceTopic = this._sourceTopic; + var sourcePosition = sourceTopic.getPosition(); + + var targetTopic = this._targetTopic; + var targetPosition = targetTopic.getPosition(); + + var sPos = sourceTopic.workoutOutgoingConnectionPoint(targetPosition); + line2d.setTo(sPos.x, sPos.y); + + var tPos = targetTopic.workoutIncomingConnectionPoint(sourcePosition); + line2d.setFrom(tPos.x, tPos.y); + + line2d.moveToBack(); + + // Add connector ... + this._positionateConnector(targetTopic); + +}; + +mindplot.ConnectionLine.prototype._positionateConnector = function(targetTopic) +{ + var targetPosition = targetTopic.getPosition(); + var offset = mindplot.Topic.CONNECTOR_WIDTH / 2; + var targetTopicSize = targetTopic.getSize(); + var y; + if (targetTopic.getShapeType() == mindplot.NodeModel.SHAPE_TYPE_LINE) + { + y = targetTopicSize.height; + } else + { + y = targetTopicSize.height / 2; + } + y = y - offset; + + var connector = targetTopic.getShrinkConnector(); + if (targetPosition.x >= 0) + { + var x = targetTopicSize.width; + connector.setPosition(x, y); + } + else + { + var x = -mindplot.Topic.CONNECTOR_WIDTH; + connector.setPosition(x, y); + } +}; + +mindplot.ConnectionLine.prototype.setStroke = function(color, style, opacity) +{ + var line2d = this._line2d; + this._line2d.setStroke(null, null, color, opacity); +}; + + +mindplot.ConnectionLine.prototype.addToWorkspace = function(workspace) +{ + workspace.appendChild(this._line2d); +}; + +mindplot.ConnectionLine.prototype.removeFromWorkspace = function(workspace) +{ + workspace.removeChild(this._line2d); +}; + +mindplot.ConnectionLine.prototype.getTargetTopic = function() +{ + return this._targetTopic; +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/DesignerActionRunner.js b/trunk/mindplot/src/main/javascript/DesignerActionRunner.js new file mode 100644 index 00000000..05d6f45a --- /dev/null +++ b/trunk/mindplot/src/main/javascript/DesignerActionRunner.js @@ -0,0 +1,131 @@ +/* +* 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.DesignerActionRunner = new Class({ + execute:function(command) + { + core.assert(command, "command can not be null"); + // Execute action ... + command.execute(this._context); + + // Enqueue it ... + this._undoManager.enqueue(command); + + // Fire event + var event = this._undoManager._buildEvent(); + this._designer._fireEvent("change", event); + }, + initialize: function(designer) + { + this._designer = designer; + this._undoManager = new mindplot.DesignerUndoManager(); + this._context = new mindplot.CommandContext(this._designer); + }, + undo: function() + { + this._undoManager.execUndo(this._context); + + // Fire event + var event = this._undoManager._buildEvent(); + this._designer._fireEvent("change", event); + }, + redo: function() + { + this._undoManager.execRedo(this._context); + + // Fire event + var event = this._undoManager._buildEvent(); + this._designer._fireEvent("change", event); + + }, + markAsChangeBase: function() + { + return this._undoManager.markAsChangeBase(); + }, + hasBeenChanged: function() + { + return this._undoManager.hasBeenChanged(); + } +}); + +mindplot.CommandContext = new Class({ + initialize: function(designer) + { + this._designer = designer; + }, + findTopics:function(topicsIds) + { + var designerTopics = this._designer._topics; + if (!(topicsIds instanceof Array)) + { + topicsIds = [topicsIds]; + } + + var result = designerTopics.filter(function(topic) { + var found = false; + if (topic != null) + { + var topicId = topic.getId(); + found = topicsIds.contains(topicId); + } + return found; + + }); + return result; + }, + deleteTopic:function(topic) + { + this._designer._removeNode(topic); + }, + createTopic:function(model) + { + core.assert(model, "model can not be null"); + var topic = this._designer._nodeModelToNodeGraph(model); + + // @todo: Is this required ? + var designer = this._designer; + designer.onNodeFocusEvent.attempt(topic, designer); + + return topic; + }, + createModel:function() + { + var mindmap = this._designer.getMindmap(); + var model = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE); + return model; + }, + connect:function(childTopic, parentTopic) + { + childTopic.connectTo(parentTopic, this._designer._workspace); + } , + disconnect:function(topic) + { + topic.disconnect(this._designer._workspace); + } +}); + +mindplot.DesignerActionRunner.setInstance = function(actionRunner) +{ + mindplot.DesignerActionRunner._instance = actionRunner; +}; + +mindplot.DesignerActionRunner.getInstance = function() +{ + return mindplot.DesignerActionRunner._instance; +}; diff --git a/trunk/mindplot/src/main/javascript/DesignerUndoManager.js b/trunk/mindplot/src/main/javascript/DesignerUndoManager.js new file mode 100644 index 00000000..f5a36ea0 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/DesignerUndoManager.js @@ -0,0 +1,93 @@ +/* +* 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.DesignerUndoManager = new Class({ + initialize: function() + { + this._undoQueue = []; + this._redoQueue = []; + this._baseId = 0; + }, + enqueue:function(command) + { + core.assert(command, "Command can not be null"); + var length = this._undoQueue.length; + if (command.discartDuplicated && length > 0) + { + // Skip duplicated events ... + var lastItem = this._undoQueue[length - 1]; + if (lastItem.discartDuplicated != command.discartDuplicated) + { + this._undoQueue.push(command); + } + } else + { + this._undoQueue.push(command); + } + this._redoQueue = []; + }, + execUndo: function(commandContext) + { + if (this._undoQueue.length > 0) + { + var command = this._undoQueue.pop(); + this._redoQueue.push(command); + + command.undoExecute(commandContext); + } + }, + execRedo: function(commandContext) + { + if (this._redoQueue.length > 0) + { + var command = this._redoQueue.pop(); + this._undoQueue.push(command); + command.execute(commandContext); + } + }, + _buildEvent: function() + { + return {undoSteps: this._undoQueue.length, redoSteps:this._redoQueue.length}; + }, + markAsChangeBase: function() + { + var undoLenght = this._undoQueue.length; + if (undoLenght > 0) + { + var command = this._undoQueue[undoLenght - 1]; + this._baseId = command.getId(); + } else + { + this._baseId = 0; + } + }, + hasBeenChanged: function() + { + var result = true; + var undoLenght = this._undoQueue.length; + if (undoLenght == 0 && this._baseId == 0) + { + result = false; + } else if(undoLenght>0) + { + var command = this._undoQueue[undoLenght - 1]; + result = (this._baseId != command.getId()); + } + return result; + }}); \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/DragManager.js b/trunk/mindplot/src/main/javascript/DragManager.js new file mode 100644 index 00000000..69194c2e --- /dev/null +++ b/trunk/mindplot/src/main/javascript/DragManager.js @@ -0,0 +1,177 @@ +/* +* 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.DragManager = function(workspace) +{ + this._workspace = workspace; + this._listeners = {}; + this._processMouseMoveEvent = true; + var dragManager = this; + this._precitionUpdater = null; +}; + +mindplot.DragManager.prototype.add = function(node) +{ + // Add behaviour ... + var workspace = this._workspace; + var screen = workspace.getScreenManager(); + var dragManager = this; + + var mouseDownListener = function(event) + { + if (workspace.isWorkspaceEventsEnabled()) + { + // Disable double drag... + workspace.enableWorkspaceEvents(false); + + // Set initial position. + var dragNode = node.createDragNode(); + var mousePos = screen.getWorkspaceMousePosition(event); + dragNode.setPosition(mousePos.x, mousePos.y); + var periodicalFunction = function() { + dragManager._processMouseMoveEvent = true; + }; + // Start precision timer updater ... + dragManager._precitionUpdater = periodicalFunction.periodical(mindplot.DragManager.DRAG_PRECISION_IN_SEG); + + // Register mouse move listener ... + var mouseMoveListener = dragManager._buildMouseMoveListener(workspace, dragNode, dragManager); + workspace.addEventListener('mousemove', mouseMoveListener); + + // Register mouse up listeners ... + var mouseUpListener = dragManager._buildMouseUpListener(workspace, node, dragNode, dragManager); + workspace.addEventListener('mouseup', mouseUpListener); + + // Execute Listeners .. + var startDragListener = dragManager._listeners['startdragging']; + startDragListener(event, node); + + // Change cursor. + window.document.body.style.cursor = 'move'; + } + }; + dragManager._mouseMoveListener = mouseDownListener; + + node.addEventListener('mousedown', mouseDownListener); +}; + +mindplot.DragManager.prototype.remove = function(node) +{ + var nodes = this._topics; + var contained = false; + var index = -1; + for (var i = 0; i < nodes.length; i++) { + if (nodes[i] == node) { + contained = true; + index = i; + } + } + if (contained) + { + elem = new Array(); + } +}; + +mindplot.DragManager.prototype._buildMouseMoveListener = function(workspace, dragNode, dragManager) +{ + var screen = workspace.getScreenManager(); + var result = function(event) { + if (dragManager._processMouseMoveEvent) + { + // Disable mouse move rendering ... + dragManager._processMouseMoveEvent = false; + if (!dragNode._isInTheWorkspace) + { + // Add shadow node to the workspace. + workspace.appendChild(dragNode); + dragNode._isInTheWorkspace = true; + } + + var pos = screen.getWorkspaceMousePosition(event); + dragNode.setPosition(pos.x, pos.y); + + // Call mouse move listeners ... + var dragListener = dragManager._listeners['dragging']; + if (dragListener) + { + dragListener(event, dragNode); + } + } + }; + dragManager._mouseMoveListener = result; + return result; +}; + +mindplot.DragManager.prototype._buildMouseUpListener = function(workspace, node, dragNode, dragManager) +{ + var screen = workspace.getScreenManager(); + var result = function(event) { + + core.assert(dragNode.isDragTopic, 'dragNode must be an DragTopic'); + + // Remove drag node from the workspace. + var hasBeenDragged = dragNode._isInTheWorkspace; + if (dragNode._isInTheWorkspace) + { + dragNode.removeFromWorkspace(workspace); + } + + // Remove all the events. + workspace.removeEventListener('mousemove', dragManager._mouseMoveListener); + workspace.removeEventListener('mouseup', dragManager._mouseUpListener); + + // Help GC + dragManager._mouseMoveListener = null; + dragManager._mouseUpListener = null; + + // Execute Listeners only if the node has been moved. + var endDragListener = dragManager._listeners['enddragging']; + endDragListener(event, dragNode); + + if (hasBeenDragged) + { + dragNode._isInTheWorkspace = false; + } + + // Stop presition updater listener ... + $clear(dragManager._precitionUpdater); + dragManager._precitionUpdater = null; + + // Change the cursor to the default. + window.document.body.style.cursor = 'default'; + + workspace.enableWorkspaceEvents(true); + + }; + dragManager._mouseUpListener = result; + return result; +}; + +/** + * type: + * - startdragging. + * - dragging + * - enddragging + */ +mindplot.DragManager.prototype. addEventListener = function(type, listener) +{ + this._listeners[type] = listener; +}; + +mindplot.DragManager.DRAG_PRECISION_IN_SEG = 100; diff --git a/trunk/mindplot/src/main/javascript/DragPivot.js b/trunk/mindplot/src/main/javascript/DragPivot.js new file mode 100644 index 00000000..b603ab22 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/DragPivot.js @@ -0,0 +1,252 @@ +/* +* 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.DragPivot = function() +{ + this._position = new core.Point(); + this._size = mindplot.DragTopic.PIVOT_SIZE; + this._line = null; + + this._straightLine = this._buildStraightLine(); + this._curvedLine = this._buildCurvedLine(); + this._dragPivot = this._buildRect(); + this._connectRect = this._buildRect(); + this._targetTopic = null; +}; + +mindplot.DragPivot.prototype.getTargetTopic = function() +{ + return this._targetTopic; +}; + +mindplot.DragPivot.prototype._buildStraightLine = function() +{ + var line = new web2d.Line(); + line.setStroke(1, 'solid', '#CC0033'); + line.setOpacity(0.4); + line.setVisibility(false); + return line; +}; + +mindplot.DragPivot.prototype._buildCurvedLine = function() +{ + var line = new web2d.PolyLine(); + line.setStroke(1, 'solid', '#CC0033'); + line.setOpacity(0.4); + line.setVisibility(false); + return line; +}; + +mindplot.DragPivot.prototype._redraw = function(pivotPosition) +{ + // Update line position. + core.assert(this.getTargetTopic(), 'Illegal invocation. Target node can not be null'); + + var pivotRect = this._getPivotRect(); + var currentPivotPositon = pivotRect.getPosition(); + + // Pivot position has not changed. In this case, position change is not required. + var targetTopic = this.getTargetTopic(); + if (currentPivotPositon.x != pivotPosition.x || currentPivotPositon.y != pivotPosition.y) + { + var position = this._position; + var fromPoint = targetTopic.workoutIncomingConnectionPoint(position); + + // Calculate pivot connection point ... + var size = this._size; + var targetPosition = targetTopic.getPosition(); + var line = this._line; + + // Update Line position. + var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, position); + var pivotPoint = mindplot.util.Shape.calculateRectConnectionPoint(position, size, isAtRight); + line.setFrom(pivotPoint.x, pivotPoint.y); + + // Update rect position + pivotRect.setPosition(pivotPosition.x, pivotPosition.y); + + // Display elements if it's requiered... + if (!pivotRect.isVisible()) + { + // Make line visible only when the position has been already changed. + // This solve several strange effects ;) + var targetPoint = targetTopic.workoutIncomingConnectionPoint(pivotPoint); + line.setTo(targetPoint.x, targetPoint.y); + + this.setVisibility(true); + } + } +}; + +mindplot.DragPivot.prototype.setPosition = function(point) +{ + this._position = point; + + // Update visual position. + var pivotRect = this._getPivotRect(); + var size = this.getSize(); + + var cx = point.x - (parseInt(size.width) / 2); + var cy = point.y - (parseInt(size.height) / 2); + + // Update line ... + if (this.getTargetTopic()) + { + var pivotPosition = {x:cx,y:cy}; + this._redraw(pivotPosition); + } +}; + +mindplot.DragPivot.prototype.getPosition = function() +{ + return this._position; +}; + +mindplot.DragPivot.prototype._buildRect = function() +{ + var size = this._size; + var rectAttributes = {fillColor:'#CC0033',opacity:0.4,width:size.width,height:size.height,strokeColor:'#FF9933'}; + var rect = new web2d.Rect(0, rectAttributes); + rect.setVisibility(false); + return rect; +}; + +mindplot.DragPivot.prototype._buildConnectRect = function() +{ + var size = this._size; + var rectAttributes = {fillColor:'#CC0033',opacity:0.4,width:size.width,height:size.height,strokeColor:'#FF9933'}; + var result = new web2d.Rect(0, rectAttributes); + return result; +}; + +mindplot.DragPivot.prototype._getPivotRect = function() +{ + return this._dragPivot; +}; + +mindplot.DragPivot.prototype.getSize = function() +{ + var elem2d = this._getPivotRect(); + return elem2d.getSize(); +}; + +mindplot.DragPivot.prototype.setVisibility = function(value) +{ + var pivotRect = this._getPivotRect(); + pivotRect.setVisibility(value); + + var connectRect = this._connectRect; + connectRect.setVisibility(value); + if (this._line) + { + this._line.setVisibility(value); + } +}; + +mindplot.DragPivot.prototype.addToWorkspace = function(workspace) +{ + var pivotRect = this._getPivotRect(); + workspace.appendChild(pivotRect); + + var connectToRect = this._connectRect; + workspace.appendChild(connectToRect); + + // Add a hidden straight line ... + var straighLine = this._straightLine; + straighLine.setVisibility(false); + workspace.appendChild(straighLine); + straighLine.moveToBack(); + + // Add a hidden curved line ... + var curvedLine = this._curvedLine; + curvedLine.setVisibility(false); + workspace.appendChild(curvedLine); + curvedLine.moveToBack(); + + // Add a connect rect ... + var connectRect = this._connectRect; + connectRect.setVisibility(false); + workspace.appendChild(connectRect); + connectRect.moveToBack(); +}; + +mindplot.DragPivot.prototype.removeFromWorkspace = function(workspace) +{ + var shape = this._getPivotRect(); + workspace.removeChild(shape); + + var connectToRect = this._connectRect; + workspace.removeChild(connectToRect); + + if (this._straightLine) + { + workspace.removeChild(this._straightLine); + } + + if (this._curvedLine) + { + workspace.removeChild(this._curvedLine); + } +}; + +mindplot.DragPivot.prototype.connectTo = function(targetTopic) +{ + core.assert(!this._outgoingLine, 'Could not connect an already connected node'); + core.assert(targetTopic != this, 'Cilcular connection are not allowed'); + core.assert(targetTopic, 'parent can not be null'); + + this._targetTopic = targetTopic; + if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + this._line = this._straightLine; + } else + { + this._line = this._curvedLine; + } + + // Show pivot ... + var line = this._line; + + // Connected to Rect ... + var connectRect = this._connectRect; + var targetSize = targetTopic.getSize(); + var width = targetSize.width + 6; + var height = targetSize.height + 6; + connectRect.setSize(width, height); + + var targetPosition = targetTopic.getPosition(); + var cx = Math.round(targetPosition.x - (width / 2)); + var cy = Math.round(targetPosition.y - (height / 2)); + connectRect.setPosition(cx, cy); + + // Change elements position ... + var pivotRect = this._getPivotRect(); + pivotRect.moveToFront(); + +}; + +mindplot.DragPivot.prototype.disconnect = function(workspace) +{ + core.assert(workspace, 'workspace can not be null.'); + core.assert(this._targetTopic, 'There are not connected topic.'); + + this.setVisibility(false); + this._targetTopic = null; + this._line = null; +}; diff --git a/trunk/mindplot/src/main/javascript/DragTopic.js b/trunk/mindplot/src/main/javascript/DragTopic.js new file mode 100644 index 00000000..a35389bf --- /dev/null +++ b/trunk/mindplot/src/main/javascript/DragTopic.js @@ -0,0 +1,242 @@ +/* +* 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.DragTopic = function(dragShape, draggedNode) +{ + core.assert(core.Utils.isDefined(dragShape), 'Rect can not be null.'); + core.assert(core.Utils.isDefined(draggedNode), 'draggedNode can not be null.'); + + this._elem2d = dragShape; + this._order = null; + this._draggedNode = draggedNode; + this._position = new core.Point(); +}; + +mindplot.DragTopic.initialize = function(workspace) +{ + var pivot = mindplot.DragTopic.__getDragPivot(); + workspace.appendChild(pivot); +}; + +mindplot.DragTopic.prototype.setOrder = function(order) +{ + this._order = order; +}; + +mindplot.DragTopic.prototype.setPosition = function(x, y) +{ + this._position.setValue(x, y); + + // Elements are positioned in the center. + // All topic element must be positioned based on the innerShape. + var draggedNode = this._draggedNode; + var size = draggedNode.getSize(); + + var cx = x - (size.width / 2); + var cy = y - (size.height / 2); + + // Update visual position. + this._elem2d.setPosition(cx, cy); +}; + +mindplot.DragTopic.prototype.getInnerShape = function() +{ + return this._elem2d; +}; + +mindplot.DragTopic.prototype.disconnect = function(workspace) +{ + // Clear connection line ... + var dragPivot = this._getDragPivot(); + dragPivot.disconnect(workspace); +}; + +mindplot.DragTopic.prototype.canBeConnectedTo = function(targetTopic) +{ + core.assert(core.Utils.isDefined(targetTopic), 'parent can not be null'); + + var result = true; + if (!targetTopic.areChildrenShrinked() && !targetTopic.isCollapsed()) + { + // Dragged node can not be connected to himself. + if (targetTopic == this._draggedNode) + { + result = false; + } else + { + var draggedNode = this.getDraggedTopic(); + var topicPosition = this.getPosition(); + + var targetTopicModel = targetTopic.getModel(); + var childTopicModel = draggedNode.getModel(); + + var targetTopicBoard = targetTopic.getTopicBoard(); + var height = targetTopicBoard.getHeight(); + result = targetTopicModel.canBeConnected(childTopicModel, topicPosition, height); + } + } else + { + result = false; + } + return result; +}; + +mindplot.DragTopic.prototype.connectTo = function(parent) +{ + core.assert(parent, 'Parent connection node can not be null.'); + + var dragPivot = this._getDragPivot(); + dragPivot.connectTo(parent); +}; + +mindplot.DragTopic.prototype.getDraggedTopic = function() +{ + return this._draggedNode; +}; + + +mindplot.DragTopic.prototype.removeFromWorkspace = function(workspace) +{ + // Remove drag shadow. + workspace.removeChild(this._elem2d); + + // Remove pivot shape. To improve performace it will not be removed. Only the visilility will be changed. + var dragPivot = this._getDragPivot(); + dragPivot.setVisibility(false); +}; + +mindplot.DragTopic.prototype.addToWorkspace = function(workspace) +{ + workspace.appendChild(this._elem2d); + var dragPivot = this._getDragPivot(); + + dragPivot.addToWorkspace(workspace); + dragPivot.setVisibility(true); +}; + +mindplot.DragTopic.prototype._getDragPivot = function() +{ + return mindplot.DragTopic.__getDragPivot(); +}; + +mindplot.DragTopic.__getDragPivot = function() +{ + var result = mindplot.DragTopic._dragPivot; + if (!result) + { + result = new mindplot.DragPivot(); + mindplot.DragTopic._dragPivot = result; + } + return result; +}; + + +mindplot.DragTopic.prototype.getPosition = function() +{ + return this._position; +}; + +mindplot.DragTopic.prototype.isDragTopic = function() +{ + return true; +}; + +mindplot.DragTopic.prototype.updateDraggedTopic = function(workspace) +{ + core.assert(workspace, 'workspace can not be null'); + + var dragPivot = this._getDragPivot(); + var draggedTopic = this.getDraggedTopic(); + + var isDragConnected = this.isConnected(); + var actionRunner = mindplot.DesignerActionRunner.getInstance(); + var topicId = draggedTopic.getId(); + var command = new mindplot.commands.DragTopicCommand(topicId); + + if (isDragConnected) + { + + var targetTopic = this.getConnectedToTopic(); + if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + // Update topic position ... + var dragPivotPosition = dragPivot.getPosition(); + + // Must positionate the dragged topic taking into account the current node size. + var pivotSize = dragPivot.getSize(); + var draggedTopicSize = draggedTopic.getSize(); + var xOffset = draggedTopicSize.width - pivotSize.width; + xOffset = Math.round(xOffset / 2); + + if (dragPivotPosition.x > 0) + { + dragPivotPosition.x = parseInt(dragPivotPosition.x) + xOffset; + } + else + { + dragPivotPosition.x = parseInt(dragPivotPosition.x) - xOffset; + } + // Set new position ... + command.setPosition(dragPivotPosition); + + } else + { + // Main topic connections can be positioned only with the order ... + command.setOrder(this._order); + } + + // Set new parent topic .. + command.setParetTopic(targetTopic); + } else { + + // If the node is not connected, positionate based on the original drag topic position. + var dragPosition = this.getPosition(); + command = new mindplot.commands.DragTopicCommand(topicId, dragPosition); + command.setPosition(dragPosition); + } + actionRunner.execute(command) +}; + +mindplot.DragTopic.prototype.setBoardPosition = function(point) +{ + core.assert(point, 'point can not be null'); + var dragPivot = this._getDragPivot(); + dragPivot.setPosition(point); +}; + + +mindplot.DragTopic.prototype.getBoardPosition = function(point) +{ + core.assert(point, 'point can not be null'); + var dragPivot = this._getDragPivot(); + return dragPivot.getPosition(); +}; + +mindplot.DragTopic.prototype.getConnectedToTopic = function() +{ + var dragPivot = this._getDragPivot(); + return dragPivot.getTargetTopic(); +}; + +mindplot.DragTopic.prototype.isConnected = function() +{ + return this.getConnectedToTopic() != null; +}; + +mindplot.DragTopic.PIVOT_SIZE = {width:50,height:10}; diff --git a/trunk/mindplot/src/main/javascript/DragTopicPositioner.js b/trunk/mindplot/src/main/javascript/DragTopicPositioner.js new file mode 100644 index 00000000..967a582f --- /dev/null +++ b/trunk/mindplot/src/main/javascript/DragTopicPositioner.js @@ -0,0 +1,121 @@ +/* +* 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.DragTopicPositioner = function(workspace, topics) +{ + core.assert(workspace, 'workspace can not be null'); + core.assert(topics, 'topics can not be null'); + + this._workspace = workspace; + this._topics = topics; +}; + +mindplot.DragTopicPositioner.prototype.positionateDragTopic = function(dragTopic) +{ + // Workout the real position of the element on the board. + var dragTopicPosition = dragTopic.getPosition(); + var draggedTopic = dragTopic.getDraggedTopic(); + + // Topic can be connected ? + this._checkDragTopicConnection(dragTopic); + + // Position topic in the board + if (dragTopic.isConnected()) + { + var targetTopic = dragTopic.getConnectedToTopic(); + var topicBoard = targetTopic.getTopicBoard(); + topicBoard.positionateDragTopic(dragTopic); + } +}; + +mindplot.DragTopicPositioner.CENTRAL_TO_MAINTOPIC_MAX_HORIZONTAL_DISTANCE = 300; + +mindplot.DragTopicPositioner.prototype._checkDragTopicConnection = function(dragTopic) +{ + var topics = this._topics; + + // Must be disconnected from their current connection ?. + var mainTopicToMainTopicConnection = this._lookUpForMainTopicToMainTopicConnection(dragTopic); + var currentConnection = dragTopic.getConnectedToTopic(); + if (currentConnection) + { + // MainTopic->MainTopicConnection. + if (currentConnection.getType()==mindplot.NodeModel.MAIN_TOPIC_TYPE) + { + if(mainTopicToMainTopicConnection != currentConnection) + { + dragTopic.disconnect(this._workspace); + } + } + else if (currentConnection.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + // Distance if greater that the allowed. + var dragXPosition = dragTopic.getPosition().x; + var currentXPosition = currentConnection.getPosition().x; + + if(mainTopicToMainTopicConnection) + { + // I have to change the current connection to a main topic. + dragTopic.disconnect(this._workspace); + }else + if (Math.abs(dragXPosition-currentXPosition) > mindplot.DragTopicPositioner.CENTRAL_TO_MAINTOPIC_MAX_HORIZONTAL_DISTANCE) + { + dragTopic.disconnect(this._workspace); + } + } + } + + // Finally, connect nodes ... + if (!dragTopic.isConnected()) + { + var centalTopic = topics[0]; + if (mainTopicToMainTopicConnection) + { + dragTopic.connectTo(mainTopicToMainTopicConnection); + } else if (Math.abs(dragTopic.getPosition().x - centalTopic.getPosition().x) <= mindplot.DragTopicPositioner.CENTRAL_TO_MAINTOPIC_MAX_HORIZONTAL_DISTANCE) + { + dragTopic.connectTo(centalTopic); + } + } +}; + +mindplot.DragTopicPositioner.prototype._lookUpForMainTopicToMainTopicConnection = function(dragTopic) +{ + var topics = this._topics; + var result = null; + var clouserDistance = -1; + var draggedNode = dragTopic.getDraggedTopic(); + + // Check MainTopic->MainTopic connection... + for (var i = 0; i < topics.length; i++) + { + var targetTopic = topics[i]; + var position = dragTopic.getPosition(); + if (targetTopic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE && targetTopic != draggedNode) + { + var canBeConnected = dragTopic.canBeConnectedTo(targetTopic); + if (canBeConnected) + { + result = targetTopic; + break; + } + } + } + return result; +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/EditorProperties.js b/trunk/mindplot/src/main/javascript/EditorProperties.js new file mode 100644 index 00000000..fa153911 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/EditorProperties.js @@ -0,0 +1,43 @@ +/* +* 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.EditorProperties = function() +{ + this._zoom = 0; + this._position = 0; +}; + +mindplot.EditorProperties.prototype.setZoom = function(zoom) +{ + this._zoom = zoom; +}; + +mindplot.EditorProperties.prototype.getZoom = function() +{ + return this._zoom; +}; + +mindplot.EditorProperties.prototype.asProperties = function() +{ + return "zoom=" + this._zoom + "\n"; +}; + + + + diff --git a/trunk/mindplot/src/main/javascript/FixedDistanceBoard.js b/trunk/mindplot/src/main/javascript/FixedDistanceBoard.js new file mode 100644 index 00000000..9346d032 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/FixedDistanceBoard.js @@ -0,0 +1,317 @@ +/* +* 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.FixedDistanceBoard = function(defaultHeight, topic) +{ + this._topic = topic; + var reference = topic.getPosition(); + mindplot.FixedDistanceBoard.superClass.initialize.call(this, defaultHeight, reference); + this._height = defaultHeight; + this._entries = []; +}; + +objects.extend(mindplot.FixedDistanceBoard, mindplot.Board); + +mindplot.FixedDistanceBoard.prototype.getHeight = function() +{ + return this._height; +}; + +mindplot.FixedDistanceBoard.prototype.lookupEntryByOrder = function(order) +{ + var result = null; + var entries = this._entries; + if (order < entries.length) + { + result = entries[order]; + } + + if (result == null) + { + var defaultHeight = this._defaultWidth; + var reference = this.getReferencePoint(); + if (entries.length == 0) + { + var yReference = reference.y; + result = this.createBoardEntry(yReference - (defaultHeight / 2), yReference + (defaultHeight / 2), 0); + } else + { + var entriesLenght = entries.length; + var lastEntry = entries[entriesLenght - 1]; + var lowerLimit = lastEntry.getUpperLimit(); + var upperLimit = lowerLimit + defaultHeight; + result = this.createBoardEntry(lowerLimit, upperLimit, entriesLenght + 1); + } + } + return result; +}; + +mindplot.FixedDistanceBoard.prototype.createBoardEntry = function(lowerLimit, upperLimit, order) +{ + var result = new mindplot.BoardEntry(lowerLimit, upperLimit, order); + var xPos = this.workoutXBorderDistance(); + result.setXPosition(xPos); + return result; +}; + +mindplot.FixedDistanceBoard.prototype.updateReferencePoint = function() +{ + var entries = this._entries; + var parentTopic = this.getTopic(); + var parentPosition = parentTopic.workoutIncomingConnectionPoint(parentTopic); + var referencePoint = this.getReferencePoint(); + var yOffset = parentPosition.y - referencePoint.y; + + for (var i = 0; i < entries.length; i++) + { + var entry = entries[i]; + + var upperLimit = entry.getUpperLimit() + yOffset; + var lowerLimit = entry.getLowerLimit() + yOffset; + entry.setUpperLimit(upperLimit); + entry.setLowerLimit(lowerLimit); + + // Fix x position ... + var xPos = this.workoutXBorderDistance(); + entry.setXPosition(xPos); + entry.update(); + } + this._referencePoint = parentPosition.clone(); + +}; + +mindplot.FixedDistanceBoard.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE = 20; + + +/** + * This x distance does't take into account the size of the shape. + */ +mindplot.FixedDistanceBoard.prototype.workoutXBorderDistance = function() +{ + var topic = this.getTopic(); + + var topicPosition = topic.getPosition(); + var topicSize = topic.getSize(); + var halfTargetWidth = topicSize.width / 2; + var result; + if (topicPosition.x >= 0) + { + // It's at right. + result = topicPosition.x + halfTargetWidth + mindplot.FixedDistanceBoard.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE; + } else + { + result = topicPosition.x - (halfTargetWidth + mindplot.FixedDistanceBoard.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE); + } + return result; +}; + +mindplot.FixedDistanceBoard.prototype.getTopic = function() +{ + return this._topic; +}; + +mindplot.FixedDistanceBoard.INTER_TOPIC_DISTANCE = 6; + +mindplot.FixedDistanceBoard.prototype.freeEntry = function(entry) +{ + var newEntries = []; + var entries = this._entries; + var order = 0; + for (var i = 0; i < entries.length; i++) + { + var e = entries[i]; + if (e == entry) + { + order++; + } + newEntries[order] = e; + order++; + } + this._entries = newEntries; +}; + +mindplot.FixedDistanceBoard.prototype.repositionate = function() +{ + // Workout width and update topic height. + var entries = this._entries; + var height = 0; + var model = this._topic.getModel(); + if (entries.length >= 1 && !model.areChildrenShrinked()) + { + for (var i = 0; i < entries.length; i++) + { + var e = entries[i]; + if (e && e.getTopic()) + { + var topic = e.getTopic(); + var topicBoard = topic.getTopicBoard(); + var topicBoardHeight = topicBoard.getHeight(); + + + height += topicBoardHeight + mindplot.FixedDistanceBoard.INTER_TOPIC_DISTANCE; + } + } + } + else { + var topic = this._topic; + height = topic.getSize().height + mindplot.FixedDistanceBoard.INTER_TOPIC_DISTANCE; + } + + var oldHeight = this._height; + this._height = height; + + // I must update all the parent nodes first... + if (oldHeight != this._height) + { + var topic = this._topic; + var parentTopic = topic.getParent(); + if (parentTopic != null) + { + var board = parentTopic.getTopicBoard(); + board.repositionate(); + } + } + + + // @todo: Esto hace backtraking. Hay que cambiar la implementacion del set position de + // forma tal que no se mande a hacer el update de todos los hijos. + + // Workout center the new topic center... + var refence = this.getReferencePoint(); + var lowerLimit; + if (entries.length > 0) + { + var topic = entries[0].getTopic(); + var firstNodeHeight = topic.getSize().height; + lowerLimit = refence.y - (height / 2) - (firstNodeHeight / 2) + 1; + } + + var upperLimit = null; + + // Start moving all the elements ... + var newEntries = []; + var order = 0; + for (var i = 0; i < entries.length; i++) + { + var e = entries[i]; + if (e && e.getTopic()) + { + + var currentTopic = e.getTopic(); + e.setLowerLimit(lowerLimit); + + // Update entry ... + var topicBoard = currentTopic.getTopicBoard(); + var topicBoardHeight = topicBoard.getHeight(); + + upperLimit = lowerLimit + topicBoardHeight + mindplot.FixedDistanceBoard.INTER_TOPIC_DISTANCE; + e.setUpperLimit(upperLimit); + lowerLimit = upperLimit; + + e.setOrder(order); + currentTopic.setOrder(order); + + e.update(); + newEntries[order] = e; + order++; + } + } + this._entries = newEntries; +}; + +mindplot.FixedDistanceBoard.prototype.removeTopic = function(topic) +{ + var order = topic.getOrder(); + var entry = this.lookupEntryByOrder(order); + core.assert(!entry.isAvailable(), "Illegal state"); + + entry.setTopic(null); + topic.setOrder(null); + this._entries.remove(entry); + + // Repositionate all elements ... + this.repositionate(); +}; + +mindplot.FixedDistanceBoard.prototype.addTopic = function(order, topic) +{ + + // If the entry is not available, I must swap the the entries... + var entry = this.lookupEntryByOrder(order); + if (!entry.isAvailable()) + { + this.freeEntry(entry); + // Create a dummy entry ... + // Puaj, do something with this... + entry = this.createBoardEntry(-1, 0, order); + this._entries[order] = entry; + } + this._entries[order] = entry; + + // Add to the board ... + entry.setTopic(topic, false); + + // Repositionate all elements ... + this.repositionate(); +}; + +mindplot.FixedDistanceBoard.prototype.lookupEntryByPosition = function(pos) +{ + core.assert(core.Utils.isDefined(pos), 'position can not be null'); + + var entries = this._entries; + var result = null; + for (var i = 0; i < entries.length; i++) + { + var entry = entries[i]; + if (pos.y < entry.getUpperLimit() && pos.y >= entry.getLowerLimit()) + { + result = entry; + } + } + + if (result == null) + { + var defaultHeight = this._defaultWidth; + if (entries.length == 0) + { + var reference = this.getReferencePoint(); + var yReference = reference.y; + result = this.createBoardEntry(yReference - (defaultHeight / 2), yReference + (defaultHeight / 2), 0); + } else + { + var firstEntry = entries[0]; + if (pos.y < firstEntry.getLowerLimit()) + { + var upperLimit = firstEntry.getLowerLimit(); + var lowerLimit = upperLimit + defaultHeight; + result = this.createBoardEntry(lowerLimit, upperLimit, -1); + } else + { + var entriesLenght = entries.length; + var lastEntry = entries[entriesLenght - 1]; + var lowerLimit = lastEntry.getUpperLimit(); + var upperLimit = lowerLimit + defaultHeight; + result = this.createBoardEntry(lowerLimit, upperLimit, entriesLenght); + } + } + } + + return result; +}; diff --git a/trunk/mindplot/src/main/javascript/Icon.js b/trunk/mindplot/src/main/javascript/Icon.js new file mode 100644 index 00000000..eaf6df03 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/Icon.js @@ -0,0 +1,42 @@ +/* +* 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.Icon = function(url){ + this._image = new web2d.Image(); + this._image.setHref(url); + this._image.setSize(12,12); +}; + +mindplot.Icon.prototype.getImage= function(){ + return this._image; +}; + +mindplot.Icon.prototype.setGroup= function(group){ + this._group=group; +}; + +mindplot.Icon.prototype.getGroup= function() { + return this._group; +}; + +mindplot.Icon.prototype.getSize=function(){ + return this._image.getSize(); +}; + + diff --git a/trunk/mindplot/src/main/javascript/IconGroup.js b/trunk/mindplot/src/main/javascript/IconGroup.js new file mode 100644 index 00000000..b9e4312a --- /dev/null +++ b/trunk/mindplot/src/main/javascript/IconGroup.js @@ -0,0 +1,183 @@ +/* +* 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.IconGroup = function(topic) { + var offset = topic.getOffset(); + this.options = { + width:0, + height:0, + x:offset / 2, + y:offset / 2, + icons:[], + topic:topic, + nativeElem:new web2d.Group({width: 2, height:2,x: offset / 2, y:offset / 2, coordSizeWidth:1,coordSizeHeight:1}) + }; + this.registerListeners(); +}; + +mindplot.IconGroup.prototype.setPosition = function(x, y) { + this.options.x = x; + this.options.y = y; + this.options.nativeElem.setPosition(x, y); +}; + +mindplot.IconGroup.prototype.getPosition = function() { + return {x:this.options.x, y:this.options.y}; +}; + +mindplot.IconGroup.prototype.setSize = function(width, height) { + this.options.width = width; + this.options.height = height; + this.options.nativeElem.setSize(width, height); + this.options.nativeElem.setCoordSize(width, height); +}; + +mindplot.IconGroup.prototype.getSize = function() +{ + return {width:this.options.width, height:this.options.height}; +}; + +mindplot.IconGroup.prototype.addIcon = function(icon) { + icon.setGroup(this); + var newIcon = icon.getImage(); + var nativeElem = this.options.nativeElem; + var iconSize = newIcon.getSize(); + var size = nativeElem.getSize(); + newIcon.setPosition(size.width, 0); + this.options.icons.extend([icon]); + + nativeElem.appendChild(newIcon); + + size.width = size.width + iconSize.width; + if (iconSize.height > size.height) + { + size.height = iconSize.height; + } + + nativeElem.setCoordSize(size.width, size.height); + nativeElem.setSize(size.width, size.height); + this.options.width = size.width; + this.options.height = size.height; +}; +mindplot.IconGroup.prototype.getIcons = function() { + return this.options.icons; +}; +mindplot.IconGroup.prototype.removeIcon = function(url) { + this._removeIcon(this.getIcon(url)); +}; + +mindplot.IconGroup.prototype.removeImageIcon = function(icon) { + + var imgIcon = this.getImageIcon(icon); + this._removeIcon(imgIcon); +}; + +mindplot.IconGroup.prototype.getIcon = function(url) { + var result = null; + this.options.icons.each(function(el, index) { + var nativeImage = el.getImage(); + if (nativeImage.getHref() == url) + { + result = el; + } + }, this); + return result; +}; + +mindplot.IconGroup.prototype.getImageIcon=function(icon){ + var result = null; + this.options.icons.each(function(el,index){ + if(result == null && $chk(el.getModel().isIconModel) && el.getId()==icon.getId() && el.getUiId() == icon.getUiId()) + { + result = el; + } + },this); + return result; +}; + +mindplot.IconGroup.prototype.findIconFromModel=function(iconModel){ + var result = null; + this.options.icons.each(function(el,index){ + var elModel = el.getModel(); + if(result == null && $chk(elModel.isIconModel) && elModel.getId()==iconModel.getId()) + { + result = el; + } + },this); + + if(result==null) + { + throw "Icon can no be found."; + } + + return result; +}; + + +mindplot.IconGroup.prototype._removeIcon = function(icon) { + var nativeImage = icon.getImage(); + this.options.icons.remove(icon); + var iconSize = nativeImage.getSize(); + var size = this.options.nativeElem.getSize(); + var position = nativeImage.getPosition(); + var childs = this.options.nativeElem.removeChild(nativeImage); + this.options.icons.each(function(icon,index){ + var img = icon.getImage(); + var pos = img.getPosition(); + if(pos.x > position.x){ + img.setPosition(pos.x-iconSize.width, 0); + } + }.bind(this)); + size.width = size.width - iconSize.width; + this.setSize(size.width, size.height); +}; +mindplot.IconGroup.prototype.getNativeElement = function() { + return this.options.nativeElem; +}; +mindplot.IconGroup.prototype.moveToFront = function() { + this.options.nativeElem.moveToFront(); +} +mindplot.IconGroup.prototype.registerListeners = function() { + this.options.nativeElem.addEventListener('click', function(event) { + // Avoid node creation ... + if (event.stopPropagation) + { + event.stopPropagation(true); + } else + { + event.cancelBubble = true; + } + + }); + this.options.nativeElem.addEventListener('dblclick', function(event) + { + // Avoid node creation ... + if (event.stopPropagation) + { + event.stopPropagation(true); + } else + { + event.cancelBubble = true; + } + + }); +}; +mindplot.IconGroup.prototype.getTopic = function() { + return this.options.topic; +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/IconModel.js b/trunk/mindplot/src/main/javascript/IconModel.js new file mode 100644 index 00000000..f934cb6b --- /dev/null +++ b/trunk/mindplot/src/main/javascript/IconModel.js @@ -0,0 +1,69 @@ +/* +* 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.IconModel = function(iconType, topic) +{ + core.assert(iconType, 'Icon id can not be null'); + core.assert(topic, 'topic can not be null'); + this._iconType = iconType; + this._id = mindplot.IconModel._nextUUID(); + this._topic = topic; +}; + +mindplot.IconModel.prototype.getId = function() +{ + return this._id; +}; + +mindplot.IconModel.prototype.getIconType = function() +{ + return this._iconType; +}; + + +mindplot.IconModel.prototype.setIconType = function(iconType) +{ + this._iconType = iconType; +}; + +mindplot.IconModel.prototype.getTopic = function() +{ + return this._topic; +}; + +mindplot.IconModel.prototype.isIconModel = function() +{ + return true; +}; + + +/** + * @todo: This method must be implemented. + */ +mindplot.IconModel._nextUUID = function() +{ + if (!this._uuid) + { + this._uuid = 0; + } + + this._uuid = this._uuid + 1; + return this._uuid; +}; + diff --git a/trunk/mindplot/src/main/javascript/ImageIcon.js b/trunk/mindplot/src/main/javascript/ImageIcon.js new file mode 100644 index 00000000..a4cb9917 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/ImageIcon.js @@ -0,0 +1,369 @@ +/* +* 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.ImageIcon = function(iconModel, topic, designer) { + + core.assert(iconModel, 'iconModel can not be null'); + core.assert(topic, 'topic can not be null'); + core.assert(designer, 'designer can not be null'); + this._topic = topic; + this._iconModel = iconModel; + this._designer = designer; + + // Build graph image representation ... + var iconType = iconModel.getIconType(); + var imgUrl = this._getImageUrl(iconType); + mindplot.Icon.call(this, imgUrl); + + //Remove + var divContainer = designer.getWorkSpace().getScreenManager().getContainer(); + var tip = mindplot.Tip.getInstance(divContainer); + + var container = new Element('div'); + var removeImage = new Element('img'); + removeImage.src = "../images/bin.png"; + removeImage.inject(container); + + if (!designer._viewMode) + { + + removeImage.addEvent('click', function(event) { + // @Todo: actionRunner should not be exposed ... + var actionRunner = designer._actionRunner; + var command = new mindplot.commands.RemoveIconFromTopicCommand(this._topic.getId(), iconModel); + actionRunner.execute(command); + tip.forceClose(); + }.bindWithEvent(this)); + + //Icon + var image = this.getImage(); + image.addEventListener('click', function(event) { + var iconType = iconModel.getIconType(); + var newIconType = this._getNextFamilyIconId(iconType); + iconModel.setIconType(newIconType); + + var imgUrl = this._getImageUrl(newIconType); + this._image.setHref(imgUrl); + + // // @Todo: Support revert of change icon ... + // var actionRunner = designer._actionRunner; + // var command = new mindplot.commands.ChangeIconFromTopicCommand(this._topic.getId()); + // this._actionRunner.execute(command); + + + }.bindWithEvent(this)); + + var imageIcon = this; + image.addEventListener('mouseover', function(event) { + tip.open(event, container, imageIcon); + }); + image.addEventListener('mouseout', function(event) { + tip.close(event); + }); + image.addEventListener('mousemove', function(event) { + tip.updatePosition(event); + }); + + } +}; + +objects.extend(mindplot.ImageIcon, mindplot.Icon); + +mindplot.ImageIcon.prototype.initialize = function() { + +}; + +mindplot.ImageIcon.prototype._getImageUrl = function(id) { + return mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[id]; +}; + +mindplot.ImageIcon.prototype.getModel = function() { + return this._iconModel; +}; + + +mindplot.ImageIcon.prototype._getNextFamilyIconId = function(id) { + + var familyIcons = this._getFamilyIcons(id); + core.assert(familyIcons != null, "Family Icon not found!"); + + var result = null; + for (var i = 0; i < familyIcons.length && result == null; i++) + { + if (familyIcons[i] == id) { + var nextIconId; + //Is last one? + if (i == (familyIcons.length - 1)) { + result = familyIcons[0]; + } else { + result = familyIcons[i + 1]; + } + break; + } + } + + return result; +}; + +mindplot.ImageIcon.prototype._getFamilyIcons = function(id) { + core.assert(id != null, "id must not be null"); + core.assert(id.indexOf("_") != -1, "Invalid icon id (it must contain '_')"); + var result = null; + for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i++) + { + var family = mindplot.ImageIcon.prototype.ICON_FAMILIES[i]; + var familyPrefix = id.substr(0, id.indexOf("_")); + if (family[0].match(familyPrefix) != null) { + result = family; + break; + } + } + return result; +}; + +mindplot.ImageIcon.prototype.getId = function() +{ + return this._iconType; +}; + +mindplot.ImageIcon.prototype.getUiId = function() +{ + return this._uiId; +}; + +mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX = 'flag_'; +mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX = 'bullet_'; +mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX = 'tag_'; +mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX = 'face_'; +mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX = 'facefuny_'; +mindplot.ImageIcon.ICON_FAMILIY_ARROW_PREFIX = 'arrow_'; +mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX = 'arrowc_'; + +mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX = 'chart_'; +mindplot.ImageIcon.ICON_FAMILIY_ONOFF_PREFIX = 'onoff_'; +mindplot.ImageIcon.ICON_FAMILIY_THUMB_PREFIX = 'thumb_'; +mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX = 'money_'; +mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX = 'number_'; +mindplot.ImageIcon.ICON_FAMILIY_TICK_PREFIX = 'tick_'; +mindplot.ImageIcon.ICON_FAMILIY_CONNECT_PREFIX = 'conn_'; +mindplot.ImageIcon.ICON_FAMILIY_BULB_PREFIX = 'bulb_' +mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX = 'task_'; + +mindplot.ImageIcon.ICON_TYPE_ARROW_UP = mindplot.ImageIcon.ICON_FAMILIY_ARROW_PREFIX + 'up'; +mindplot.ImageIcon.ICON_TYPE_ARROW_DOWN = mindplot.ImageIcon.ICON_FAMILIY_ARROW_PREFIX + 'down'; +mindplot.ImageIcon.ICON_TYPE_ARROW_LEFT = mindplot.ImageIcon.ICON_FAMILIY_ARROW_PREFIX + 'left'; +mindplot.ImageIcon.ICON_TYPE_ARROW_RIGHT = mindplot.ImageIcon.ICON_FAMILIY_ARROW_PREFIX + 'right'; + +mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_LEFT = mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX + 'turn_left'; +mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_RIGHT = mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX + 'turn_right'; +mindplot.ImageIcon.ICON_TYPE_ARROWC_UNDO = mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX + 'undo'; +mindplot.ImageIcon.ICON_TYPE_ARROWC_ANTICLOCKWISE = mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX + 'rotate_anticlockwise'; +mindplot.ImageIcon.ICON_TYPE_ARROWC_CLOCKWISE = mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX + 'rotate_clockwise'; + +mindplot.ImageIcon.ICON_TYPE_FACE_PLAIN = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'plain'; +mindplot.ImageIcon.ICON_TYPE_FACE_SAD = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'sad'; +mindplot.ImageIcon.ICON_TYPE_FACE_SMILE_BIG = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'smilebig'; +mindplot.ImageIcon.ICON_TYPE_FACE_SMILE = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'smile'; +mindplot.ImageIcon.ICON_TYPE_FACE_SURPRISE = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'surprise'; +mindplot.ImageIcon.ICON_TYPE_FACE_WINK = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'wink'; +mindplot.ImageIcon.ICON_TYPE_FACE_CRYING = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'crying'; + +mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_ANGEL = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'angel'; +mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_DEVIL = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'devilish'; +mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_GLASSES = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'glasses'; +mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_GRIN = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'grin'; +mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_KISS = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'kiss'; +mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_MONKEY = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'monkey'; + +mindplot.ImageIcon.ICON_TYPE_CHART_BAR = mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX + 'bar'; +mindplot.ImageIcon.ICON_TYPE_CHART_LINE = mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX + 'line'; +mindplot.ImageIcon.ICON_TYPE_CHART_CURVE = mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX + 'curve'; +mindplot.ImageIcon.ICON_TYPE_CHART_PIE = mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX + 'pie'; +mindplot.ImageIcon.ICON_TYPE_CHART_ORGANISATION = mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX + 'organisation'; + +mindplot.ImageIcon.ICON_TYPE_FLAG_BLUE = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'blue'; +mindplot.ImageIcon.ICON_TYPE_FLAG_GREEN = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'green'; +mindplot.ImageIcon.ICON_TYPE_FLAG_ORANGE = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'orange'; +mindplot.ImageIcon.ICON_TYPE_FLAG_PINK = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'pink'; +mindplot.ImageIcon.ICON_TYPE_FLAG_PURPLE = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'purple'; +mindplot.ImageIcon.ICON_TYPE_FLAG_YELLOW = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'yellow'; + +mindplot.ImageIcon.ICON_TYPE_BULLET_BLACK = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'black'; +mindplot.ImageIcon.ICON_TYPE_BULLET_BLUE = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'blue'; +mindplot.ImageIcon.ICON_TYPE_BULLET_GREEN = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'green'; +mindplot.ImageIcon.ICON_TYPE_BULLET_ORANGE = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'orange'; +mindplot.ImageIcon.ICON_TYPE_BULLET_RED = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'red'; +mindplot.ImageIcon.ICON_TYPE_BULLET_PINK = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'pink'; +mindplot.ImageIcon.ICON_TYPE_BULLET_PURPLE = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'purple'; + +mindplot.ImageIcon.ICON_TYPE_TAG_BLUE = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'blue'; +mindplot.ImageIcon.ICON_TYPE_TAG_GREEN = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'green'; +mindplot.ImageIcon.ICON_TYPE_TAG_ORANGE = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'orange'; +mindplot.ImageIcon.ICON_TYPE_TAG_RED = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'red'; +mindplot.ImageIcon.ICON_TYPE_TAG_PINK = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'pink'; +mindplot.ImageIcon.ICON_TYPE_TAG_YELLOW = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'yellow'; +mindplot.ImageIcon.ICON_TYPE_TAG_PURPLE = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'purple'; + +mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_UP = mindplot.ImageIcon.ICON_FAMILIY_THUMB_PREFIX + 'thumb_up'; +mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_DOWN = mindplot.ImageIcon.ICON_FAMILIY_THUMB_PREFIX + 'thumb_down'; + +mindplot.ImageIcon.ICON_TYPE_TICK_ON = mindplot.ImageIcon.ICON_FAMILIY_TICK_PREFIX + 'tick'; +mindplot.ImageIcon.ICON_TYPE_TICK_OFF = mindplot.ImageIcon.ICON_FAMILIY_TICK_PREFIX + 'cross'; + +mindplot.ImageIcon.ICON_TYPE_BULB_ON = mindplot.ImageIcon.ICON_FAMILIY_BULB_PREFIX + 'light_on'; +mindplot.ImageIcon.ICON_TYPE_BULB_OFF = mindplot.ImageIcon.ICON_FAMILIY_BULB_PREFIX + 'light_off'; + +mindplot.ImageIcon.ICON_TYPE_CONNECT_ON = mindplot.ImageIcon.ICON_FAMILIY_CONNECT_PREFIX + 'connect'; +mindplot.ImageIcon.ICON_TYPE_CONNECT_OFF = mindplot.ImageIcon.ICON_FAMILIY_CONNECT_PREFIX + 'disconnect'; + +mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK = mindplot.ImageIcon.ICON_FAMILIY_ONOFF_PREFIX + 'clock'; +mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK_RED = mindplot.ImageIcon.ICON_FAMILIY_ONOFF_PREFIX + 'clock_red'; +mindplot.ImageIcon.ICON_TYPE_ONOFF_ADD = mindplot.ImageIcon.ICON_FAMILIY_ONOFF_PREFIX + 'add'; +mindplot.ImageIcon.ICON_TYPE_ONOFF_DELETE = mindplot.ImageIcon.ICON_FAMILIY_ONOFF_PREFIX + 'delete'; + +mindplot.ImageIcon.ICON_TYPE_MONEY_MONEY = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'money'; +mindplot.ImageIcon.ICON_TYPE_MONEY_DOLLAR = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'dollar'; +mindplot.ImageIcon.ICON_TYPE_MONEY_EURO = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'euro'; +mindplot.ImageIcon.ICON_TYPE_MONEY_POUND = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'pound'; +mindplot.ImageIcon.ICON_TYPE_MONEY_YEN = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'yen'; +mindplot.ImageIcon.ICON_TYPE_MONEY_COINS = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'coins'; +mindplot.ImageIcon.ICON_TYPE_MONEY_RUBY = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'ruby'; + +mindplot.ImageIcon.ICON_TYPE_NUMBER_ONE = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'one'; +mindplot.ImageIcon.ICON_TYPE_NUMBER_TWO = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'two'; +mindplot.ImageIcon.ICON_TYPE_NUMBER_THREE = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'three'; +mindplot.ImageIcon.ICON_TYPE_NUMBER_FOUR = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'four'; +mindplot.ImageIcon.ICON_TYPE_NUMBER_FIVE = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'five'; +mindplot.ImageIcon.ICON_TYPE_NUMBER_SIX = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'six'; +mindplot.ImageIcon.ICON_TYPE_NUMBER_SEVEN = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'seven'; +mindplot.ImageIcon.ICON_TYPE_NUMBER_EIGHT = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'eight'; +mindplot.ImageIcon.ICON_TYPE_NUMBER_NINE = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'nine'; + +mindplot.ImageIcon.ICON_TYPE_TASK_ONE = mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX + 'one'; +mindplot.ImageIcon.ICON_TYPE_TASK_TWO = mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX + 'two'; +mindplot.ImageIcon.ICON_TYPE_TASK_THREE = mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX + 'three'; +mindplot.ImageIcon.ICON_TYPE_TASK_FOUR = mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX + 'four'; +mindplot.ImageIcon.ICON_TYPE_TASK_FIVE = mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX + 'five'; + + +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP = new Object(); +//FLAG +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_BLUE] = "../images/flag_blue.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_GREEN] = "../images/flag_green.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_ORANGE] = "../images/flag_orange.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_PINK] = "../images/flag_pink.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_PURPLE] = "../images/flag_purple.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_YELLOW] = "../images/flag_yellow.png"; +//BULLET +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_BLACK] = "../images/bullet_black.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_BLUE] = "../images/bullet_blue.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_GREEN] = "../images/bullet_blue.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_ORANGE] = "../images/bullet_green.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_RED] = "../images/bullet_orange.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_PINK] = "../images/bullet_pink.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_PURPLE] = "../images/bullet_purple.png"; +//TAGS +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_BLUE] = "../images/tag_blue.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_GREEN] = "../images/tag_green.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_ORANGE] = "../images/tag_orange.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_RED] = "../images/tag_red.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_PINK] = "../images/tag_pink.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_YELLOW] = "../images/tag_yellow.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_PURPLE] = "../images/tag_purple.png"; +//FACES +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_ANGEL] = "../images/face-angel.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_DEVIL] = "../images/face-devilish.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_GLASSES] = "../images/face-glasses.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_KISS] = "../images/face-kiss.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_MONKEY] = "../images/face-monkey.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_PLAIN] = "../images/face-plain.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_CRYING] = "../images/face-crying.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_SAD] = "../images/face-sad.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_SMILE] = "../images/face-smile.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_SURPRISE] = "../images/face-surprise.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_WINK] = "../images/face-wink.png"; + +//ARROWS +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROW_UP] = "../images/arrow_up.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROW_DOWN] = "../images/arrow_down.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROW_LEFT] = "../images/arrow_left.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROW_RIGHT] = "../images/arrow_right.png"; + +// ARROWS COMPLEX. +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_LEFT] = "../images/arrow_turn_left.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_RIGHT] = "../images/arrow_turn_right.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROWC_UNDO] = "../images/arrow_undo.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROWC_ANTICLOCKWISE] = "../images/arrow_rotate_anticlockwise.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROWC_CLOCKWISE] = "../images/arrow_rotate_clockwise.png"; + +//CHARTS +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CHART_BAR] = "../images/chart_bar.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CHART_LINE] = "../images/chart_line.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CHART_CURVE] = "../images/chart_curve.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CHART_PIE] = "../images/chart_pie.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CHART_ORGANISATION] = "../images/chart_organisation.png"; + +// THUMB +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_UP] = "../images/thumb_up.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_DOWN] = "../images/thumb_down.png"; + +// ON OFF +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TICK_ON] = "../images/tick.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TICK_OFF] = "../images/cross.png"; + +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULB_ON] = "../images/lightbulb.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULB_OFF] = "../images/lightbulb_off.png"; + +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CONNECT_ON] = "../images/connect.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CONNECT_OFF] = "../images/disconnect.png"; + +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK] = "../images/clock.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK_RED] = "../images/clock_red.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_ADD] = "../images/add.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_DELETE] = "../images/delete.png"; +//MONEY +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_MONEY] = "../images/money.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_DOLLAR] = "../images/money_dollar.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_EURO] = "../images/money_euro.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_POUND] = "../images/money_pound.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_YEN] = "../images/money_yen.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_COINS] = "../images/coins.png"; +mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_RUBY] = "../images/ruby.png"; + + +//FAMILIES +mindplot.ImageIcon.prototype.ICON_FLAG_FAMILY = [mindplot.ImageIcon.ICON_TYPE_FLAG_BLUE, mindplot.ImageIcon.ICON_TYPE_FLAG_GREEN,mindplot.ImageIcon.ICON_TYPE_FLAG_ORANGE,mindplot.ImageIcon.ICON_TYPE_FLAG_PINK, mindplot.ImageIcon.ICON_TYPE_FLAG_PURPLE, mindplot.ImageIcon.ICON_TYPE_FLAG_YELLOW]; +mindplot.ImageIcon.prototype.ICON_TAG_FAMILY = [mindplot.ImageIcon.ICON_TYPE_TAG_BLUE, mindplot.ImageIcon.ICON_TYPE_TAG_GREEN,mindplot.ImageIcon.ICON_TYPE_TAG_ORANGE,mindplot.ImageIcon.ICON_TYPE_TAG_PINK, mindplot.ImageIcon.ICON_TYPE_TAG_PURPLE, mindplot.ImageIcon.ICON_TYPE_TAG_YELLOW]; +mindplot.ImageIcon.prototype.ICON_BULLET_FAMILY = [mindplot.ImageIcon.ICON_TYPE_BULLET_BLACK, mindplot.ImageIcon.ICON_TYPE_BULLET_BLUE, mindplot.ImageIcon.ICON_TYPE_BULLET_GREEN,mindplot.ImageIcon.ICON_TYPE_BULLET_ORANGE,mindplot.ImageIcon.ICON_TYPE_BULLET_RED, mindplot.ImageIcon.ICON_TYPE_BULLET_PINK, mindplot.ImageIcon.ICON_TYPE_BULLET_PURPLE]; +mindplot.ImageIcon.prototype.ICON_FUNY_FACE_FAMILY = [mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_ANGEL, mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_DEVIL, mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_GLASSES, mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_KISS, mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_MONKEY]; +mindplot.ImageIcon.prototype.ICON_FACE_FAMILY = [mindplot.ImageIcon.ICON_TYPE_FACE_PLAIN, mindplot.ImageIcon.ICON_TYPE_FACE_SAD, mindplot.ImageIcon.ICON_TYPE_FACE_CRYING, mindplot.ImageIcon.ICON_TYPE_FACE_SMILE, mindplot.ImageIcon.ICON_TYPE_FACE_SURPRISE, mindplot.ImageIcon.ICON_TYPE_FACE_WINK]; +mindplot.ImageIcon.prototype.ICON_ARROW_FAMILY = [mindplot.ImageIcon.ICON_TYPE_ARROW_UP, mindplot.ImageIcon.ICON_TYPE_ARROW_DOWN, mindplot.ImageIcon.ICON_TYPE_ARROW_LEFT, mindplot.ImageIcon.ICON_TYPE_ARROW_RIGHT]; +mindplot.ImageIcon.prototype.ICON_COMPLEX_ARROW_FAMILY = [mindplot.ImageIcon.ICON_TYPE_ARROWC_UNDO, mindplot.ImageIcon.ICON_TYPE_ARROWC_ANTICLOCKWISE, mindplot.ImageIcon.ICON_TYPE_ARROWC_CLOCKWISE,mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_LEFT, mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_RIGHT]; +mindplot.ImageIcon.prototype.ICON_CHART_FAMILY = [mindplot.ImageIcon.ICON_TYPE_CHART_BAR, mindplot.ImageIcon.ICON_TYPE_CHART_LINE, mindplot.ImageIcon.ICON_TYPE_CHART_CURVE, mindplot.ImageIcon.ICON_TYPE_CHART_PIE, mindplot.ImageIcon.ICON_TYPE_CHART_ORGANISATION]; +mindplot.ImageIcon.prototype.ICON_TICK_FAMILY = [ mindplot.ImageIcon.ICON_TYPE_TICK_ON, mindplot.ImageIcon.ICON_TYPE_TICK_OFF]; + +mindplot.ImageIcon.prototype.ICON_CONNECT_FAMILY = [ mindplot.ImageIcon.ICON_TYPE_CONNECT_ON, mindplot.ImageIcon.ICON_TYPE_CONNECT_OFF]; +mindplot.ImageIcon.prototype.ICON_BULB_FAMILY = [ mindplot.ImageIcon.ICON_TYPE_BULB_ON, mindplot.ImageIcon.ICON_TYPE_BULB_OFF]; +mindplot.ImageIcon.prototype.ICON_ONOFF_FAMILY = [ mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK, mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK_RED, mindplot.ImageIcon.ICON_TYPE_ONOFF_ADD, mindplot.ImageIcon.ICON_TYPE_ONOFF_DELETE]; + +mindplot.ImageIcon.prototype.ICON_THUMB_FAMILY = [mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_UP, mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_DOWN]; +mindplot.ImageIcon.prototype.ICON_MONEY_FAMILY = [mindplot.ImageIcon.ICON_TYPE_MONEY_MONEY,mindplot.ImageIcon.ICON_TYPE_MONEY_DOLLAR,mindplot.ImageIcon.ICON_TYPE_MONEY_EURO,mindplot.ImageIcon.ICON_TYPE_MONEY_POUND,mindplot.ImageIcon.ICON_TYPE_MONEY_YEN,mindplot.ImageIcon.ICON_TYPE_MONEY_COINS,mindplot.ImageIcon.ICON_TYPE_MONEY_RUBY]; + + +mindplot.ImageIcon.prototype.ICON_FAMILIES = [mindplot.ImageIcon.prototype.ICON_FACE_FAMILY, mindplot.ImageIcon.prototype.ICON_FUNY_FACE_FAMILY,mindplot.ImageIcon.prototype.ICON_ARROW_FAMILY,mindplot.ImageIcon.prototype.ICON_COMPLEX_ARROW_FAMILY, mindplot.ImageIcon.prototype.ICON_CONNECT_FAMILY,mindplot.ImageIcon.prototype.ICON_BULB_FAMILY,mindplot.ImageIcon.prototype.ICON_THUMB_FAMILY, mindplot.ImageIcon.prototype.ICON_TICK_FAMILY,mindplot.ImageIcon.prototype.ICON_ONOFF_FAMILY, mindplot.ImageIcon.prototype.ICON_MONEY_FAMILY, mindplot.ImageIcon.prototype.ICON_CHART_FAMILY, mindplot.ImageIcon.prototype.ICON_FLAG_FAMILY, mindplot.ImageIcon.prototype.ICON_BULLET_FAMILY, mindplot.ImageIcon.prototype.ICON_TAG_FAMILY]; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/Issue.txt b/trunk/mindplot/src/main/javascript/Issue.txt new file mode 100644 index 00000000..155b8213 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/Issue.txt @@ -0,0 +1,19 @@ + +Pablo +---------- + +Paulo +------ +* El mouse over se rompe una vez que se hace el select de algun node. Debe estar rompiendo el + lister o algo parecido. +** Evitar los cambios de size inecesarios y posicion inecesarios, de esta manera menos flick. Esto en el updater. +* Queda un ratro raro cuando se hace drag and drop en explorer. + + + +Later +------- +* Cuanto mas grande el grafo, mas lento de hace el primer momento del drag. Con lo cual, es conveniente reutilizar los +nodos en vez de borrarlos. +* Menu contextual para agregar nodos. +* Es necesario manejar para los central topic to main topic correctamente el concepto de height. diff --git a/trunk/mindplot/src/main/javascript/LinkIcon.js b/trunk/mindplot/src/main/javascript/LinkIcon.js new file mode 100644 index 00000000..932cea28 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/LinkIcon.js @@ -0,0 +1,196 @@ +/* +* 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.LinkIcon = function(urlModel, topic, designer) { + var divContainer=designer.getWorkSpace().getScreenManager().getContainer(); + var bubbleTip = mindplot.BubbleTip.getInstance(divContainer); + mindplot.Icon.call(this, mindplot.LinkIcon.IMAGE_URL); + this._linkModel = urlModel; + this._topic = topic; + this._designer = designer; + var image = this.getImage(); + var imgContainer = new Element('div').setStyles({textAlign:'center', cursor:'pointer'}); + this._img = new Element('img'); + var url = urlModel.getUrl(); + this._img.src = 'http://open.thumbshots.org/image.pxf?url=' + url; + + if (url.indexOf('http:') == -1) + { + url = 'http://' + url; + } + this._img.alt = url; + this._url=url; + var openWindow = function() { + var wOpen; + var sOptions; + + sOptions = 'status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes'; + sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString(); + sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString(); + sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0'; + var url = this._img.alt; + wOpen = window.open(url, "link", "width=100px, height=100px"); + wOpen.focus(); + wOpen.moveTo(0, 0); + wOpen.resizeTo(screen.availWidth, screen.availHeight); + }; + this._img.addEvent('click', openWindow.bindWithEvent(this)); + this._img.inject(imgContainer); + + var attribution = new Element('div').setStyles({fontSize:10, textAlign:"center"}); + attribution.innerHTML = "About Thumbshots thumbnails"; + + var container = new Element('div'); + var element = new Element('div').setStyles({borderBottom:'1px solid #e5e5e5'}); + + var title = new Element('div').setStyles({fontSize:12, textAlign:'center'}); + this._link = new Element('span'); + this._link.href = url; + this._link.innerHTML = url; + this._link.setStyle("text-decoration", "underline"); + this._link.setStyle("cursor", "pointer"); + this._link.inject(title); + this._link.addEvent('click', openWindow.bindWithEvent(this)); + title.inject(element); + + imgContainer.inject(element); + attribution.inject(element); + element.inject(container); + + if(!designer._viewMode){ + var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'center'}); + var editBtn = new Element('input', {type:'button', 'class':'btn-primary', value:'Edit','class':'btn-primary'}).addClass('button').inject(buttonContainer); + var removeBtn = new Element('input', {type:'button', value:'Remove','class':'btn-primary'}).addClass('button').inject(buttonContainer); + + editBtn.setStyle("margin-right", "3px"); + removeBtn.setStyle("margin-left", "3px"); + + removeBtn.addEvent('click', function(event) { + var command = new mindplot.commands.RemoveLinkFromTopicCommand(this._topic.getId()); + designer._actionRunner.execute(command); + bubbleTip.forceClose(); + }.bindWithEvent(this)); + + var okButtonId = 'okLinkButtonId' + editBtn.addEvent('click', function(event) { + var topic = this._topic; + var designer = this._designer; + var link = this; + var okFunction = function(e) { + var result = false; + var url = urlInput.value; + if ("" != url.trim()) + { + link._img.src = 'http://open.thumbshots.org/image.pxf?url=' + url; + link._img.alt = url; + link._link.href = url; + link._link.innerHTML = url; + this._linkModel.setUrl(url); + result = true; + } + return result; + }; + var msg = new Element('div'); + var urlText = new Element('div').inject(msg); + urlText.innerHTML = "URL:" + + var formElem = new Element('form', {'action': 'none', 'id':'linkFormId'}); + var urlInput = new Element('input', {'type': 'text', 'size':30,'value':url}); + urlInput.inject(formElem); + formElem.inject(msg) + + formElem.addEvent('submit', function(e) + { + $(okButtonId).fireEvent('click', e); + e = new Event(e); + e.stop(); + }); + + + var dialog = mindplot.LinkIcon.buildDialog(designer, okFunction, okButtonId); + dialog.adopt(msg).show(); + + }.bindWithEvent(this)); + buttonContainer.inject(container); + } + + + var linkIcon = this; + image.addEventListener('mouseover', function(event) { + bubbleTip.open(event, container, linkIcon); + }); + image.addEventListener('mousemove', function(event) { + bubbleTip.updatePosition(event); + }); + image.addEventListener('mouseout', function(event) { + bubbleTip.close(event); + }); +}; + +objects.extend(mindplot.LinkIcon, mindplot.Icon); + +mindplot.LinkIcon.prototype.initialize = function() { + +}; + +mindplot.LinkIcon.prototype.getUrl=function(){ + return this._url; +}; + +mindplot.LinkIcon.prototype.getModel=function(){ + return this._linkModel; +}; + +mindplot.LinkIcon.buildDialog = function(designer, okFunction, okButtonId) { + var windoo = new Windoo({ + title: 'Write link URL', + theme: Windoo.Themes.wise, + modal:true, + buttons:{'menu':false, 'close':false, 'minimize':false, 'roll':false, 'maximize':false}, + destroyOnClose:true, + height:130 + }); + + var cancel = new Element('input', {'type': 'button', 'class':'btn-primary', 'value': 'Cancel','class':'btn-primary'}).setStyle('margin-right', "5px"); + cancel.setStyle('margin-left', "5px"); + cancel.addEvent('click', function(event) { + $(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer)); + windoo.close(); + }.bindWithEvent(this)); + + var ok = new Element('input', {'type': 'button', 'class':'btn-primary','value': 'Ok','class':'btn-primary','id':okButtonId}).setStyle('marginRight', 10); + ok.addEvent('click', function(event) { + var couldBeUpdated = okFunction.attempt(); + if (couldBeUpdated) + { + $(document).addEvent('keydown', designer.keyEventHandler.bindWithEvent(designer)); + windoo.close(); + } + }.bindWithEvent(this)); + + var panel = new Element('div', {'styles': {'padding-top': 10, 'text-align': 'right'}}).adopt(ok, cancel); + + windoo.addPanel(panel); + $(document).removeEvents('keydown'); + return windoo; +}; + +mindplot.LinkIcon.IMAGE_URL = "../images/world_link.png"; + + \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/LinkModel.js b/trunk/mindplot/src/main/javascript/LinkModel.js new file mode 100644 index 00000000..759cad9b --- /dev/null +++ b/trunk/mindplot/src/main/javascript/LinkModel.js @@ -0,0 +1,45 @@ +/* +* 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.LinkModel = function(url, topic) +{ + core.assert(url, 'link url can not be null'); + core.assert(topic, 'mindmap can not be null'); + this._url = url; + this._topic = topic; +}; + +mindplot.LinkModel.prototype.getUrl = function() +{ + return this._url; +}; + +mindplot.LinkModel.prototype.setUrl = function(url){ + this._url = url; +} + +mindplot.LinkModel.prototype.getTopic = function() +{ + return this._topic; +}; + +mindplot.LinkModel.prototype.isLinkModel = function() +{ + return true; +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/MainTopic.js b/trunk/mindplot/src/main/javascript/MainTopic.js new file mode 100644 index 00000000..69279bb6 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/MainTopic.js @@ -0,0 +1,355 @@ +/* +* 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.MainTopic = function(model) +{ + core.assert(model, "Model can not be null"); + this.setModel(model); + var topicBoard = new mindplot.MainTopicBoard(this); + mindplot.MainTopic.superClass.initialize.call(this, topicBoard); +}; + +objects.extend(mindplot.MainTopic, mindplot.Topic); + +mindplot.MainTopic.prototype.INNER_RECT_ATTRIBUTES = {stroke:'0.5 solid #009900'}; + +mindplot.MainTopic.prototype.createSiblingModel = function() +{ + var siblingModel = null; + var parentTopic = this.getOutgoingConnectedTopic(); + if (parentTopic != null) + { + // Create a new node ... + var model = this.getModel(); + var mindmap = model.getMindmap(); + siblingModel = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE); + + // Positionate following taking into account the sibling positon. + if (parentTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + var pos = this.getPosition(); + siblingModel.setPosition(pos.x, pos.y); + } + + // Create a new node ... + var order = this.getOrder() + 1; + siblingModel.setOrder(order); + } + return siblingModel; +}; + +mindplot.MainTopic.prototype.createChildModel = function() +{ + // Create a new node ... + var model = this.getModel(); + var mindmap = model.getMindmap(); + var childModel = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE); + + // Get the hights model order position ... + var children = this._getChildren(); + var order = -1; + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + if (child.getOrder() > order) + { + order = child.getOrder(); + } + } + // Create a new node ... + childModel.setOrder(order + 1); + return childModel; +}; + + +mindplot.MainTopic.prototype._buildDragShape = function() +{ + var innerShape = this.buildShape(this.INNER_RECT_ATTRIBUTES); + var size = this.getSize(); + innerShape.setSize(size.width, size.height); + innerShape.setPosition(0, 0); + innerShape.setOpacity(0.5); + innerShape.setCursor('default'); + innerShape.setVisibility(true); + + var brColor = this.getBorderColor(); + innerShape.setAttribute("strokeColor", brColor); + + var bgColor = this.getBackgroundColor(); + innerShape.setAttribute("fillColor", bgColor); + + // Create group ... + var groupAttributes = {width: 100, height:100,coordSizeWidth:100,coordSizeHeight:100}; + var group = new web2d.Group(groupAttributes); + group.appendChild(innerShape); + + // Add Text ... + var textShape = this._buildTextShape(true); + var text = this.getText(); + textShape.setText(text); + textShape.setOpacity(0.5); + group.appendChild(textShape); + + return group; +}; + + +mindplot.MainTopic.prototype._defaultShapeType = function() +{ + var targetTopic = this.getOutgoingConnectedTopic(); + var result; + if (targetTopic) + { + if (targetTopic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + result = mindplot.NodeModel.SHAPE_TYPE_LINE; + + } else + { + result = mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT; + } + } else + { + result = mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT; + } + return result; +}; + +mindplot.MainTopic.prototype.updateTopicShape = function(targetTopic, workspace) +{ + // Change figure based on the connected topic ... + if (targetTopic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + var model = this.getModel(); + var shapeType = model.getShapeType(); + if (!shapeType) + { + // Get the real shape type ... + shapeType = this.getShapeType(); + this._setShapeType(mindplot.NodeModel.SHAPE_TYPE_LINE, false); + } + } +}; + +mindplot.MainTopic.prototype.disconnect = function(workspace) +{ + mindplot.MainTopic.superClass.disconnect.call(this, workspace); + var size = this.getSize(); + + var model = this.getModel(); + var shapeType = model.getShapeType(); + if (!shapeType) + { + // Change figure ... + shapeType = this.getShapeType(); + this._setShapeType(mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT, false); + } +}; + +mindplot.MainTopic.prototype.getTopicType = function() +{ + return "MainTopic"; +}; + + +mindplot.MainTopic.prototype._updatePositionOnChangeSize = function(oldSize, newSize) { + + var xOffset = (newSize.width - oldSize.width) / 2; + var pos = this.getPosition(); + if (core.Utils.isDefined(pos)) + { + if (pos.x > 0) + { + pos.x = pos.x + xOffset; + } else + { + pos.x = pos.x - xOffset; + } + this.setPosition(pos); + + // If height has changed, I must repositionate all elements ... + if (oldSize.height != newSize.height) + { + var topicBoard = this.getTopicBoard(); + // topicBoard.repositionate(); + } + } +}; + +mindplot.MainTopic.prototype.setPosition = function(point) +{ + mindplot.MainTopic.superClass.setPosition.call(this, point); + + // Update board zero entry position... + var topicBoard = this.getTopicBoard(); + topicBoard.updateChildrenPosition(this); +}; + +mindplot.MainTopic.prototype.workoutIncomingConnectionPoint = function(sourcePosition) +{ + core.assert(sourcePosition, 'sourcePoint can not be null'); + var pos = this.getPosition(); + var size = this.getSize(); + + var isAtRight = mindplot.util.Shape.isAtRight(sourcePosition, pos); + var result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight); + if (this.getShapeType() == mindplot.NodeModel.SHAPE_TYPE_LINE) + { + result.y = result.y + (this.getSize().height / 2); + } + + // Move a little the position... + var offset = mindplot.Topic.CONNECTOR_WIDTH / 2; + if (this.getPosition().x > 0) + { + result.x = result.x + offset; + } else + { + result.x = result.x - offset; + } + return result; + +}; + +mindplot.MainTopic.prototype.workoutOutgoingConnectionPoint = function(targetPosition) +{ + core.assert(targetPosition, 'targetPoint can not be null'); + var pos = this.getPosition(); + var size = this.getSize(); + + var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos); + var result; + if (this.getShapeType() == mindplot.NodeModel.SHAPE_TYPE_LINE) + { + if (!this.isConnectedToCentralTopic()) + { + result = new core.Point(); + if (!isAtRight) + { + result.x = pos.x - (size.width / 2); + } else + { + result.x = pos.x + (size.width / 2); + } + result.y = pos.y + (size.height / 2); + } else + { + // In this case, connetion line is not used as shape figure. + result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight, true); + result.y = pos.y + (size.height / 2); + + // Correction factor ... + if (!isAtRight) + { + result.x = result.x + 2; + } else + { + result.x = result.x - 2; + } + + } + } else + { + result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight, true); + } + return result; +}; + + +mindplot.MainTopic.prototype.isConnectedToCentralTopic = function() +{ + var model = this.getModel(); + var parent = model.getParent(); + + return parent && parent.getType() === mindplot.NodeModel.CENTRAL_TOPIC_TYPE; +}; + +mindplot.MainTopic.prototype._defaultText = function() +{ + var targetTopic = this.getOutgoingConnectedTopic(); + var result = ""; + if (targetTopic) + { + if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + result = "Main Topic"; + } else + { + result = "Sub Topic"; + } + } else + { + result = "Isolated Topic"; + } + return result; +}; + +mindplot.MainTopic.prototype._defaultFontStyle = function() +{ + var targetTopic = this.getOutgoingConnectedTopic(); + var result; + if (targetTopic) + { + if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + result = { + font:"Arial", + size: 8, + style:"normal", + weight:"normal", + color:"#525c61" + }; + } else + { + result = { + font:"Arial", + size: 6, + style:"normal", + weight:"normal", + color:"#525c61" + }; + } + } else + { + result = { + font:"Verdana", + size: 8, + style:"normal", + weight:"normal", + color:"#525c61" + }; + } + return result; +}; + +mindplot.MainTopic.prototype._defaultBackgroundColor = function() +{ + return "#E0E5EF"; +}; + +mindplot.MainTopic.prototype._defaultBorderColor = function() +{ + return '#023BB9'; +}; +mindplot.MainTopic.prototype.addSibling = function() +{ + var order = this.getOrder(); + + +}; diff --git a/trunk/mindplot/src/main/javascript/MainTopicBoard.js b/trunk/mindplot/src/main/javascript/MainTopicBoard.js new file mode 100644 index 00000000..96d625f6 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/MainTopicBoard.js @@ -0,0 +1,144 @@ +/* +* 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.MainTopicBoard = function(topic) +{ + this._topic = topic; + this._board = null; + this._height = 0; +}; + +objects.extend(mindplot.MainTopicBoard, mindplot.TopicBoard); + +mindplot.MainTopicBoard.DEFAULT_MAIN_TOPIC_HEIGHT = 18; + +mindplot.MainTopicBoard.prototype._getBoard = function() +{ + if (!this._board) + { + var topic = this._topic; + this._board = new mindplot.FixedDistanceBoard(mindplot.MainTopicBoard.DEFAULT_MAIN_TOPIC_HEIGHT, topic); + } + return this._board; +}; + +mindplot.MainTopicBoard.prototype.updateReferencePoint = function(position) +{ + this._board.updateReferencePoint(position); +}; + +mindplot.MainTopicBoard.prototype.updateChildrenPosition = function(topic) +{ + var board = this._getBoard(); + board.updateReferencePoint(); +}; + +mindplot.MainTopicBoard.prototype.positionateDragTopic = function(dragTopic) +{ + core.assert(dragTopic != null, 'dragTopic can not be null'); + core.assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance'); + + // This node is a main topic node. Position + var dragPos = dragTopic.getPosition(); + var board = this._getBoard(); + + // Look for entry ... + var entry = board.lookupEntryByPosition(dragPos); + + // Calculate 'y' position base on the entry ... + var yCoord; + if (!entry.isAvailable() && entry.getTopic() != dragTopic.getDraggedTopic()) + { + yCoord = entry.getLowerLimit(); + } else + { + yCoord = entry.workoutEntryYCenter(); + } + + // Update board position. + var targetTopic = dragTopic.getConnectedToTopic(); + var xCoord = this._workoutXBorderDistance(targetTopic); + + // Add the size of the pivot to the distance ... + var halfPivotWidth = mindplot.DragTopic.PIVOT_SIZE.width / 2; + xCoord = xCoord + ((dragPos.x > 0) ? halfPivotWidth : -halfPivotWidth); + + var pivotPos = new core.Point(xCoord, yCoord); + dragTopic.setBoardPosition(pivotPos); + + var order = entry.getOrder(); + dragTopic.setOrder(order); +}; + +/** + * This x distance does't take into account the size of the shape. + */ +mindplot.MainTopicBoard.prototype._workoutXBorderDistance = function(topic) +{ + core.assert(topic, 'topic can not be null'); + var board = this._getBoard(); + return board.workoutXBorderDistance(topic); +}; + +mindplot.MainTopicBoard.prototype.addBranch = function(topic) +{ + var order = topic.getOrder(); + core.assert(core.Utils.isDefined(order), "Order must be defined"); + + // If the entry is not available, I must swap the the entries... + var board = this._getBoard(); + var entry = board.lookupEntryByOrder(order); + if (!entry.isAvailable()) + { + board.freeEntry(entry); + } + + // Add the topic to the board ... + board.addTopic(order, topic); + + // Repositionate all the parent topics ... + var currentTopic = this._topic; + if (currentTopic.getOutgoingConnectedTopic()) + { + var parentTopic = currentTopic.getOutgoingConnectedTopic(); + var parentTopicBoard = parentTopic.getTopicBoard(); + parentTopicBoard.repositionate(); + } +}; + +mindplot.MainTopicBoard.prototype.repositionate = function() +{ + var board = this._getBoard(); + board.repositionate(); +}; + +mindplot.MainTopicBoard.prototype.removeTopicFromBoard = function(topic) +{ + var board = this._getBoard(); + board.removeTopic(topic); + + // Repositionate all the parent topics ... + var parentTopic = this._topic; + if (parentTopic.getOutgoingConnectedTopic()) + { + var connectedTopic = parentTopic.getOutgoingConnectedTopic(); + var topicBoard = connectedTopic.getTopicBoard(); + topicBoard.repositionate(); + } +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/Mindmap.js b/trunk/mindplot/src/main/javascript/Mindmap.js new file mode 100644 index 00000000..f268b3a1 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/Mindmap.js @@ -0,0 +1,171 @@ +/* +* 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.Mindmap = function() +{ + this._branches = []; + this._name = null; + this._description = null; +}; + +mindplot.Mindmap.prototype.getCentralTopic = function() +{ + return this._branches[0]; +}; + +mindplot.Mindmap.prototype.getDescription = function() +{ + return this._description; +}; + +mindplot.Mindmap.prototype.getId = function() +{ + return this._iconType; +}; + + +mindplot.Mindmap.prototype.setId = function(id) +{ + this._iconType = id; +}; + +mindplot.Mindmap.prototype.addBranch = function(nodeModel) +{ + core.assert(nodeModel && nodeModel.isNodeModel(), 'Add node must be invoked with model objects'); + if (this._branches.length == 0) + { + core.assert(nodeModel.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE, "First element must be the central topic"); + nodeModel.setPosition(0, 0); + } else + { + core.assert(nodeModel.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE, "Mindmaps only have one cental topic"); + } + + this._branches.push(nodeModel); +}; + +mindplot.Mindmap.prototype.getBranches = function() +{ + return this._branches; +}; + +mindplot.Mindmap.prototype.connect = function(parent, child) +{ + // Child already has a parent ? + var branches = this.getBranches(); + core.assert(!child.getParent(), 'Child model seems to be already connected'); + + // Connect node... + parent._appendChild(child); + + // Remove from the branch ... + branches.remove(child); +}; + +mindplot.Mindmap.prototype.disconnect = function(child) +{ + var parent = child.getParent(); + core.assert(child, 'Child can not be null.'); + core.assert(parent, 'Child model seems to be already connected'); + + parent._removeChild(child); + + var branches = this.getBranches(); + branches.push(child); + +}; + +mindplot.Mindmap.prototype.hasAlreadyAdded = function(node) +{ + var result = false; + + // Check in not connected nodes. + var branches = this._branches; + for (var i = 0; i < branches.length; i++) + { + result = branches[i]._isChildNode(node); + if (result) + { + break; + } + } +}; + +mindplot.Mindmap.prototype.createNode = function(type) +{ + core.assert(type, "node type can not be null"); + return this._createNode(type); +}; + +mindplot.Mindmap.prototype._createNode = function(type) +{ + core.assert(type, 'Node type must be specified.'); + var result = new mindplot.NodeModel(type, this); + return result; +}; + +mindplot.Mindmap.prototype.inspect = function() +{ + var result = ''; + result = '{ '; + + var branches = this.getBranches(); + for (var i = 0; i < branches.length; i++) + { + var node = branches[i]; + if (i != 0) + { + result = result + ', '; + } + + result = result + this._toString(node); + } + + result = result + ' } '; + + return result; +}; + +mindplot.Mindmap.prototype._toString = function(node) +{ + var result = node.inspect(); + var children = node.getChildren(); + + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + + if (i == 0) + { + result = result + '-> {'; + } else + { + result = result + ', '; + } + + result = result + this._toString(child); + + if (i == children.length - 1) + { + result = result + '}'; + } + } + + return result; +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/MindmapDesigner.js b/trunk/mindplot/src/main/javascript/MindmapDesigner.js new file mode 100644 index 00000000..d4b7c9d3 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/MindmapDesigner.js @@ -0,0 +1,1230 @@ +/* +* 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.MindmapDesigner = function(profile, divElement, persistanManager) +{ + core.assert(persistanManager, "Persistant manager must be defined"); + core.assert(core.Utils.isDefined(profile.zoom), "zoom must be defined"); + + // Undo manager ... + this._actionRunner = new mindplot.DesignerActionRunner(this); + mindplot.DesignerActionRunner.setInstance(this._actionRunner); + + // Initial Zoom + this._zoom = profile.zoom; + this._viewMode = profile.viewMode; + + // Init Screen manager.. + var screenManager = new mindplot.ScreenManager(profile.width, profile.height, divElement); + + //create editor + this._editor = new mindplot.TextEditor(screenManager, this._actionRunner); + + var workspace = new mindplot.Workspace(profile, screenManager, this._zoom); + this._workspace = workspace; + + + // Init layout managers ... + this._topics = []; + this._dragTopicPositioner = new mindplot.DragTopicPositioner(this._workspace, this._topics); + + // Register handlers.. + this._registerEvents(); + + // Selected node + this._nodeOnFocus = null; + + // Init dragger manager. + this._dragger = this._buildDragManager(workspace); + + this._persistantManager = persistanManager; + + // Add shapes to speed up the loading process ... + mindplot.DragTopic.initialize(workspace); + + this._events = {}; +}; + + +mindplot.MindmapDesigner.prototype.getDragTopicPositioner = function() +{ + return this._dragTopicPositioner; +}; + +mindplot.MindmapDesigner.prototype._getTopics = function() +{ + return this._topics; +}; + +mindplot.MindmapDesigner.prototype.getCentralTopic = function() +{ + var topics = this._getTopics(); + return topics[0]; +}; + + +mindplot.MindmapDesigner.prototype.addEventListener = function(eventType, listener) +{ + + this._events[eventType] = listener; + +} + +mindplot.MindmapDesigner.prototype._fireEvent = function(eventType, event) +{ + var listener = this._events[eventType]; + if (listener != null) + { + listener(event); + } +} + +mindplot.MindmapDesigner.prototype._buildDragManager = function(workspace) +{ + // Init dragger manager. + var dragger = new mindplot.DragManager(workspace); + var screen = workspace.getScreenManager(); + var topics = this._getTopics(); + + var dragTopicPositioner = this.getDragTopicPositioner(); + var mindmapDesigner = this; + var elem = this; + + dragger.addEventListener('startdragging', function(event, node) + { + // Enable all mouse events. + for (var i = 0; i < topics.length; i++) + { + topics[i].setMouseEventsEnabled(false); + } + }); + + dragger.addEventListener('dragging', function(event, dragTopic) + { + // Update the state and connections of the topic ... + dragTopicPositioner.positionateDragTopic(dragTopic); + }); + + dragger.addEventListener('enddragging', function(event, dragTopic) + { + // Enable all mouse events. + for (var i = 0; i < topics.length; i++) + { + topics[i].setMouseEventsEnabled(true); + } + // Topic must be positioned in the real board postion. + if (dragTopic._isInTheWorkspace) + { + var draggedTopic = dragTopic.getDraggedTopic(); + + // Hide topic during draw ... + draggedTopic.setBranchVisibility(false); + var parentNode = draggedTopic.getParent(); + dragTopic.updateDraggedTopic(workspace); + + + // Make all node visible ... + draggedTopic.setVisibility(true); + if (parentNode != null) + { + parentNode.setBranchVisibility(true); + } + } + }); + + return dragger; +}; + +mindplot.MindmapDesigner.prototype._registerEvents = function() +{ + var mindmapDesigner = this; + var workspace = this._workspace; + var screenManager = workspace.getScreenManager(); + + if (!this._viewMode) + { + + // Initialize workspace event listeners. + // Create nodes on double click... + workspace.addEventListener('click', function(event) + { + mindmapDesigner.getEditor().lostFocus(); + // @todo: Puaj hack... + mindmapDesigner._cleanScreen(); + }); + + workspace.addEventListener('dblclick', function(event) + { + mindmapDesigner.getEditor().lostFocus(); + // Get mouse position + var pos = screenManager.getWorkspaceMousePosition(event); + + // Create a new topic model ... + var mindmap = mindmapDesigner.getMindmap(); + var model = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE); + model.setPosition(pos.x, pos.y); + + // Get central topic ... + var centralTopic = mindmapDesigner.getCentralTopic(); + var centralTopicId = centralTopic.getId(); + + // Execute action ... + var command = new mindplot.commands.AddTopicCommand(model, centralTopicId); + this._actionRunner.execute(command); + }.bind(this)); + } + ; +}; + +mindplot.MindmapDesigner.prototype._buildNodeGraph = function(model) +{ + var workspace = this._workspace; + var elem = this; + + // Create node graph ... + var topic = mindplot.NodeGraph.create(model); + + // Append it to the workspace ... + var topics = this._topics; + topics.push(topic); + + // Add Topic events ... + this._registerListenersOnNode(topic); + + // Connect Topic ... + var isConnected = model.isConnected(); + if (isConnected) + { + // Improve this ... + var targetTopicModel = model.getParent(); + var targetTopicId = targetTopicModel.getId(); + var targetTopic = null; + + for (var i = 0; i < topics.length; i++) + { + var t = topics[i]; + if (t.getModel() == targetTopicModel) + { + targetTopic = t; + // Disconnect the node. It will be connected again later ... + model.disconnect(); + break; + } + } + core.assert(targetTopic, "Could not find a topic to connect"); + topic.connectTo(targetTopic, workspace); + } + + return topic; +}; + +mindplot.MindmapDesigner.prototype.onNodeFocusEvent = function(topicGraph, event) +{ + this.getEditor().lostFocus(); + var topics = this._topics; + // Disable all nodes on focus but not the current if Ctrl key isn't being pressed + if (!core.Utils.isDefined(event) || event.ctrlKey == false) + { + for (var i = 0; i < topics.length; i++) + { + var node = topics[i]; + if (node.isOnFocus() && node != topicGraph) + { + node.setOnFocus(false); + } + } + } +}; + +mindplot.MindmapDesigner.prototype._registerListenersOnNode = function(topic) +{ + // Register node listeners ... + var elem = this; + var topics = this._topics; + topic.addEventListener('onfocus', function(event) + { + elem.onNodeFocusEvent.attempt([topic, event], elem); + }); + + // Add drag behaviour ... + if (topic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + + // Central Topic doesn't support to be dragged + var dragger = this._dragger; + dragger.add(topic); + } + + // Register editor events ... + if (!this._viewMode) + { + this._editor.listenEventOnNode(topic, 'dblclick', true); + } + +}; +mindplot.MindmapDesigner.prototype.zoomOut = function() +{ + var scale = this._zoom * 1.2; + if (scale <= 4) + { + this._zoom = scale; + this._workspace.setZoom(this._zoom); + } + else + { + core.Monitor.getInstance().logMessage('Sorry, no more zoom can be applied. \n Why do you need more?'); + } + +}; + +mindplot.MindmapDesigner.prototype.zoomIn = function() +{ + var scale = this._zoom / 1.2; + if (scale >= 0.3) + { + this._zoom = scale; + this._workspace.setZoom(this._zoom); + } + else + { + core.Monitor.getInstance().logMessage('Sorry, no more zoom can be applied. \n Why do you need more?'); + } +}; + +mindplot.MindmapDesigner.prototype.createChildForSelectedNode = function() +{ + + var nodes = this._getSelectedNodes(); + if (nodes.length <= 0) + { + // If there are more than one node selected, + core.Monitor.getInstance().logMessage('Could not create a topic. Only one node must be selected.'); + return; + + } + if (nodes.length > 1) + { + + // If there are more than one node selected, + core.Monitor.getInstance().logMessage('Could not create a topic. One topic must be selected.'); + return; + } + + // Add new node ... + var centalTopic = nodes[0]; + var parentTopicId = centalTopic.getId(); + var childModel = centalTopic.createChildModel(); + + var command = new mindplot.commands.AddTopicCommand(childModel, parentTopicId); + this._actionRunner.execute(command); +}; + +mindplot.MindmapDesigner.prototype.createSiblingForSelectedNode = function() +{ + var nodes = this._getSelectedNodes(); + if (nodes.length <= 0) + { + // If there are more than one node selected, + core.Monitor.getInstance().logMessage('Could not create a topic. Only one node must be selected.'); + return; + + } + if (nodes.length > 1) + { + // If there are more than one node selected, + core.Monitor.getInstance().logMessage('Could not create a topic. One topic must be selected.'); + return; + } + + var topic = nodes[0]; + if (topic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + // Central topic doesn't have siblings ... + this.createChildForSelectedNode(); + + } else + { + var parentTopic = topic.getOutgoingConnectedTopic(); + var siblingModel = topic.createSiblingModel(); + var parentTopicId = parentTopic.getId(); + var command = new mindplot.commands.AddTopicCommand(siblingModel, parentTopicId); + + this._actionRunner.execute(command); + } +}; + +mindplot.MindmapDesigner.prototype.needsSave = function() +{ + return this._actionRunner.hasBeenChanged(); +} + +mindplot.MindmapDesigner.prototype.autoSaveEnabled = function(value) +{ + if (value) + { + var autosave = function() { + + if (this.needsSave()) + { + this.save(null, false); + } + }; + autosave.bind(this).periodical(30000); + } +} + +mindplot.MindmapDesigner.prototype.save = function(onSavedHandler, saveHistory) +{ + var persistantManager = this._persistantManager; + 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); + this._fireEvent("save", {type:saveHistory}); + + // Refresh undo state... + this._actionRunner.markAsChangeBase(); +}; + +mindplot.MindmapDesigner.prototype.loadFromXML = function(mapId, xmlContent) +{ + core.assert(xmlContent, 'mindmapId can not be null'); + core.assert(xmlContent, 'xmlContent can not be null'); + + // Explorer Hack with local files ... + var domDocument = core.Utils.createDocumentFromText(xmlContent); + + var serializer = new mindplot.XMLMindmapSerializer(); + var mindmap = serializer.loadFromDom(domDocument); + + this._loadMap(mapId, mindmap); + + // Place the focus on the Central Topic + var centralTopic = this.getCentralTopic(); + this._goToNode.attempt(centralTopic, this); +}; + +mindplot.MindmapDesigner.prototype.load = function(mapId) +{ + core.assert(mapId, 'mapName can not be null'); + + // Build load function ... + var persistantManager = this._persistantManager; + + // Loading mindmap ... + var mindmap = persistantManager.load(mapId); + + // Finally, load the map in the editor ... + this._loadMap(mapId, mindmap); + + // Place the focus on the Central Topic + var centralTopic = this.getCentralTopic(); + this._goToNode.attempt(centralTopic, this); +}; + +mindplot.MindmapDesigner.prototype._loadMap = function(mapId, mindmapModel) +{ + var designer = this; + if (mindmapModel != null) + { + mindmapModel.setId(mapId); + designer._mindmap = mindmapModel; + + // Building node graph ... + var branches = mindmapModel.getBranches(); + for (var i = 0; i < branches.length; i++) + { + // NodeModel -> NodeGraph ... + var nodeModel = branches[i]; + var nodeGraph = this._nodeModelToNodeGraph(nodeModel); + + // Update shrink render state... + nodeGraph.setBranchVisibility(true); + } + } +}; + + +mindplot.MindmapDesigner.prototype.getMindmap = function() +{ + return this._mindmap; +}; + +mindplot.MindmapDesigner.prototype.undo = function() +{ + this._actionRunner.undo(); +}; + +mindplot.MindmapDesigner.prototype.redo = function() +{ + this._actionRunner.redo(); +}; + +mindplot.MindmapDesigner.prototype._nodeModelToNodeGraph = function(nodeModel) +{ + core.assert(nodeModel, "Node model can not be null"); + var nodeGraph = this._buildNodeGraph(nodeModel); + + var children = nodeModel.getChildren().slice(); + + // Sort children by order to solve adding order ... + if (children.length > 0) + { + var oldChildren = children; + children = []; + for (var i = 0; i < oldChildren.length; i++) + { + var child = oldChildren[i]; + var order = child.getOrder(); + if (order != null) + { + children[order] = child; + } else + { + children.push(child); + } + } + } + + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + this._nodeModelToNodeGraph(children[i]); + } + + var workspace = this._workspace; + workspace.appendChild(nodeGraph); + return nodeGraph; +}; + +mindplot.MindmapDesigner.prototype.getEditor = function() +{ + return this._editor; +}; + +mindplot.MindmapDesigner.prototype._removeNode = function(node) +{ + if (node.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + var parent = node._parent; + node.disconnect(this._workspace); + + //remove children + while (node._getChildren().length > 0) + { + this._removeNode(node._getChildren()[0]); + } + + this._workspace.removeChild(node); + this._topics.remove(node); + + // Delete this node from the model... + var model = node.getModel(); + model.deleteNode(); + + if (parent) + { + this._goToNode(parent); + } + } +}; + +mindplot.MindmapDesigner.prototype.deleteCurrentNode = function() +{ + + var validateFunc = function(topic) { + return topic.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE + }; + var validateError = 'Central topic can not be deleted.'; + var topicsIds = this._setValidSelectedTopicsIds(validateFunc, validateError); + if (topicsIds.length > 0) + { + var command = new mindplot.commands.DeleteTopicCommand(topicsIds); + this._actionRunner.execute(command); + } + +}; + +mindplot.MindmapDesigner.prototype.setFont2SelectedNode = function(font) +{ + var topicsIds = this._setValidSelectedTopicsIds(); + if (topicsIds.length > 0) + { + var commandFunc = function(topic, font) + { + var result = topic.getFontFamily(); + topic.setFontFamily(font, true); + + var updated = function() { + topic.updateNode(); + }; + updated.delay(0); + return result; + } + var command = new mindplot.commands.GenericFunctionCommand(commandFunc, font, topicsIds); + this._actionRunner.execute(command); + } +}; + +mindplot.MindmapDesigner.prototype.setStyle2SelectedNode = function() +{ + var topicsIds = this._setValidSelectedTopicsIds(); + if (topicsIds.length > 0) + { + var commandFunc = function(topic) + { + var result = topic.getFontStyle(); + var style = (result == "italic") ? "normal" : "italic"; + topic.setFontStyle(style, true); + return result; + } + var command = new mindplot.commands.GenericFunctionCommand(commandFunc, "", topicsIds); + this._actionRunner.execute(command); + } +}; + +mindplot.MindmapDesigner.prototype.setFontColor2SelectedNode = function(color) +{ + var topicsIds = this._setValidSelectedTopicsIds(); + if (topicsIds.length > 0) + { + var commandFunc = function(topic, color) + { + var result = topic.getFontColor(); + topic.setFontColor(color, true); + return result; + } + var command = new mindplot.commands.GenericFunctionCommand(commandFunc, color, topicsIds); + command.discartDuplicated = "fontColorCommandId"; + this._actionRunner.execute(command); + } +}; + +mindplot.MindmapDesigner.prototype.setBackColor2SelectedNode = function(color) +{ + + var validateFunc = function(topic) { + return topic.getShapeType() != mindplot.NodeModel.SHAPE_TYPE_LINE + }; + var validateError = 'Color can not be setted to line topics.'; + var topicsIds = this._setValidSelectedTopicsIds(validateFunc, validateError); + + if (topicsIds.length > 0) + { + var commandFunc = function(topic, color) + { + var result = topic.getBackgroundColor(); + topic.setBackgroundColor(color); + return result; + } + var command = new mindplot.commands.GenericFunctionCommand(commandFunc, color, topicsIds); + command.discartDuplicated = "backColor"; + this._actionRunner.execute(command); + } +}; + + +mindplot.MindmapDesigner.prototype._setValidSelectedTopicsIds = function(validate, errorMsg) +{ + var result = []; + var selectedNodes = this._getSelectedNodes(); + if (selectedNodes.length == 0) + { + core.Monitor.getInstance().logMessage('At least one topic must be selected to execute this operation.'); + } else + { + for (var i = 0; i < selectedNodes.length; i++) + { + var selectedNode = selectedNodes[i]; + var isValid = true; + if (validate) + { + isValid = validate(selectedNode); + } + + // Add node only if it's valid. + if (isValid) + { + result.push(selectedNode.getId()); + } else + { + core.Monitor.getInstance().logMessage(errorMsg); + } + } + } + return result; +} + +mindplot.MindmapDesigner.prototype.setBorderColor2SelectedNode = function(color) +{ + var validateFunc = function(topic) { + return topic.getShapeType() != mindplot.NodeModel.SHAPE_TYPE_LINE + }; + var validateError = 'Color can not be setted to line topics.'; + var topicsIds = this._setValidSelectedTopicsIds(validateFunc, validateError); + + if (topicsIds.length > 0) + { + var commandFunc = function(topic, color) + { + var result = topic.getBorderColor(); + topic.setBorderColor(color); + return result; + } + var command = new mindplot.commands.GenericFunctionCommand(commandFunc, color, topicsIds); + command.discartDuplicated = "borderColorCommandId"; + this._actionRunner.execute(command); + } +}; + +mindplot.MindmapDesigner.prototype.setFontSize2SelectedNode = function(size) +{ + var topicsIds = this._setValidSelectedTopicsIds(); + if (topicsIds.length > 0) + { + var commandFunc = function(topic, size) + { + var result = topic.getFontSize(); + topic.setFontSize(size, true); + + var updated = function() { + topic.updateNode(); + }; + updated.delay(0); + return result; + } + var command = new mindplot.commands.GenericFunctionCommand(commandFunc, size, topicsIds); + this._actionRunner.execute(command); + } +}; + +mindplot.MindmapDesigner.prototype.setShape2SelectedNode = function(shape) +{ + var validateFunc = function(topic) { + return !(topic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE && shape == mindplot.NodeModel.SHAPE_TYPE_LINE) + }; + var validateError = 'Central Topic shape can not be changed to line figure.'; + var topicsIds = this._setValidSelectedTopicsIds(validateFunc, validateError); + + if (topicsIds.length > 0) + { + var commandFunc = function(topic, size) + { + var result = topic.getShapeType(); + topic.setShapeType(size, true); + return result; + } + var command = new mindplot.commands.GenericFunctionCommand(commandFunc, shape, topicsIds); + this._actionRunner.execute(command); + } +}; + + +mindplot.MindmapDesigner.prototype.setWeight2SelectedNode = function() +{ + var topicsIds = this._setValidSelectedTopicsIds(); + if (topicsIds.length > 0) + { + var commandFunc = function(topic) + { + var result = topic.getFontWeight(); + var weight = (result == "bold") ? "normal" : "bold"; + topic.setFontWeight(weight, true); + + var updated = function() { + topic.updateNode(); + }; + updated.delay(0); + return result; + } + var command = new mindplot.commands.GenericFunctionCommand(commandFunc, "", topicsIds); + this._actionRunner.execute(command); + } +}; + +mindplot.MindmapDesigner.prototype.addImage2SelectedNode = function(iconType) +{ + + var topicsIds = this._setValidSelectedTopicsIds(); + if (topicsIds.length > 0) + { + + var command = new mindplot.commands.AddIconToTopicCommand(topicsIds[0], iconType); + this._actionRunner.execute(command); + } +}; + +mindplot.MindmapDesigner.prototype.addLink2Node = function(url) +{ + var topicsIds = this._setValidSelectedTopicsIds(); + if (topicsIds.length > 0) + { + var command = new mindplot.commands.AddLinkToTopicCommand(topicsIds[0], url); + this._actionRunner.execute(command); + } +}; + +mindplot.MindmapDesigner.prototype.addLink2SelectedNode = function() +{ + var selectedTopics = this.getSelectedNodes(); + var topic = null; + if (selectedTopics.length > 0) + { + topic = selectedTopics[0]; + if (!$chk(topic._hasLink)) { + var msg = new Element('div'); + var urlText = new Element('div').inject(msg); + urlText.innerHTML = "URL:" + var formElem = new Element('form', {'action': 'none', 'id':'linkFormId'}); + var urlInput = new Element('input', {'type': 'text', 'size':30}); + urlInput.inject(formElem); + formElem.inject(msg) + + var okButtonId = "linkOkButtonId"; + formElem.addEvent('submit', function(e) + { + $(okButtonId).fireEvent('click', e); + e = new Event(e); + e.stop(); + }); + + + var okFunction = function() { + var url = urlInput.value; + var result = false; + if ("" != url.trim()) + { + this.addLink2Node(url); + result = true; + } + return result; + }.bind(this); + var dialog = mindplot.LinkIcon.buildDialog(this, okFunction, okButtonId); + dialog.adopt(msg).show(); + + // IE doesn't like too much this focus action... + if(!core.UserAgent.isIE()) + { + urlInput.focus(); + } + } + } else + { + core.Monitor.getInstance().logMessage('At least one topic must be selected to execute this operation.'); + } +}; + +mindplot.MindmapDesigner.prototype.addNote2Node = function(text) +{ + var topicsIds = this._setValidSelectedTopicsIds(); + if (topicsIds.length > 0) + { + var command = new mindplot.commands.AddNoteToTopicCommand(topicsIds[0], text); + this._actionRunner.execute(command); + } +}; + +mindplot.MindmapDesigner.prototype.addNote2SelectedNode = function() +{ + var selectedTopics = this.getSelectedNodes(); + var topic = null; + if (selectedTopics.length > 0) + { + topic = selectedTopics[0]; + if (!$chk(topic._hasNote)) { + var msg = new Element('div'); + var text = new Element('div').inject(msg); + var formElem = new Element('form', {'action': 'none', 'id':'noteFormId'}); + var textInput = new Element('textarea').setStyles({'width':280, 'height':50}); + textInput.inject(formElem); + formElem.inject(msg); + + var okButtonId = "noteOkButtonId"; + formElem.addEvent('submit', function(e) + { + $(okButtonId).fireEvent('click', e); + e = new Event(e); + e.stop(); + }); + + + var okFunction = function() { + var text = textInput.value; + var result = false; + if ("" != text.trim()) + { + this.addNote2Node(text); + result = true; + } + return result; + }.bind(this); + var dialog = mindplot.Note.buildDialog(this, okFunction, okButtonId); + dialog.adopt(msg).show(); + + // IE doesn't like too much this focus action... + if(!core.UserAgent.isIE()) + { + textInput.focus(); + } + } + } else + { + core.Monitor.getInstance().logMessage('At least one topic must be selected to execute this operation.'); + } +}; + +mindplot.MindmapDesigner.prototype.removeLastImageFromSelectedNode = function() +{ + var nodes = this._getSelectedNodes(); + if (nodes.length == 0) + { + core.Monitor.getInstance().logMessage('A topic must be selected in order to execute this operation.'); + } else + { + var elem = nodes[0]; + elem.removeLastIcon(this); + var executor = function(editor) + { + return function() + { + elem.updateNode(); + }; + }; + + setTimeout(executor(this), 0); + } +}; + + +mindplot.MindmapDesigner.prototype._getSelectedNodes = function() +{ + var result = new Array(); + for (var i = 0; i < this._topics.length; i++) + { + if (this._topics[i].isOnFocus()) + { + result.push(this._topics[i]); + } + } + return result; +}; + +mindplot.MindmapDesigner.prototype.getSelectedNodes = function() +{ + return this._getSelectedNodes(); +}; + + +mindplot.MindmapDesigner.prototype.keyEventHandler = function(event) +{ + var evt = (event) ? event : window.event; + + if (evt.keyCode == 8) + { + if (event) + { + if (event.preventDefault) { + event.preventDefault(); + } else { + event.returnValue = false; + } + new Event(event).stop(); + } + else + evt.returnValue = false; + } + else + { + evt = new Event(event); + var key = evt.key; + if (!this._editor._isVisible()) + { + if (((evt.code >= 65 && evt.code <= 90) || (evt.code >= 48 && evt.code <= 57)) && !(evt.control || evt.meta)) + { + if($chk(evt.shift)){ + key = key.toUpperCase(); + } + this._showEditor(key); + } + else + { + switch (key) + { + case 'delete': + this.deleteCurrentNode(); + break; + case 'enter': + if (!evt.meta) + { + this.createSiblingForSelectedNode(); + break; + } + case 'insert': + this.createChildForSelectedNode(); + break; + case 'right': + var nodes = this._getSelectedNodes(); + if (nodes.length > 0) + { + var node = nodes[0]; + if (node.getTopicType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + this._goToSideChild(node, 'RIGHT'); + } + else + { + if (node.getPosition().x < 0) + { + this._goToParent(node); + } + else if (!node.areChildrenShrinked()) + { + this._goToChild(node); + } + } + } + break; + case 'left': + var nodes = this._getSelectedNodes(); + if (nodes.length > 0) + { + var node = nodes[0]; + if (node.getTopicType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + this._goToSideChild(node, 'LEFT'); + } + else + { + if (node.getPosition().x > 0) + { + this._goToParent(node); + } + else if (!node.areChildrenShrinked()) + { + this._goToChild(node); + } + } + } + break; + case'up': + var nodes = this._getSelectedNodes(); + if (nodes.length > 0) + { + var node = nodes[0]; + if (node.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + this._goToBrother(node, 'UP'); + } + } + break; + case 'down': + var nodes = this._getSelectedNodes(); + if (nodes.length > 0) + { + var node = nodes[0]; + if (node.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + this._goToBrother(node, 'DOWN'); + } + } + break; + case 'f2': + this._showEditor(); + break; + case 'space': + + var nodes = this._getSelectedNodes(); + if (nodes.length > 0) + { + var topic = nodes[0]; + + var model = topic.getModel(); + var isShrink = !model.areChildrenShrinked(); + topic.setChildrenShrinked(isShrink); + } + break; + case 'backspace': + evt.preventDefault(); + break; + case 'esc': + var nodes = this._getSelectedNodes(); + for (var i = 0; i < nodes.length; i++) + { + var node = nodes[i]; + node.setOnFocus(false); + } + break; + case 'z': + if (evt.control || evt.meta) + { + if (evt.shift) + { + this.redo(); + } + else + { + this.undo(); + } + } + break; + default: + break; + } + } + evt.stop(); + } + } +}; + +mindplot.MindmapDesigner.prototype._showEditor = function(key) +{ + var nodes = this._getSelectedNodes(); + if (nodes.length == 1) + { + var node = nodes[0]; + if (key && key != "") + { + this._editor.setInitialText(key); + } + this._editor.getFocusEvent.attempt(node, this._editor); + } +}; + +mindplot.MindmapDesigner.prototype._goToBrother = function(node, direction) +{ + var brothers = node._parent._getChildren(); + var target = node; + var y = node.getPosition().y; + var x = node.getPosition().x; + var dist = null; + for (var i = 0; i < brothers.length; i++) + { + var sameSide = (x * brothers[i].getPosition().x) >= 0; + if (brothers[i] != node && sameSide) + { + var brother = brothers[i]; + var brotherY = brother.getPosition().y; + if (direction == "DOWN" && brotherY > y) + { + var distancia = y - brotherY; + if (distancia < 0) + { + distancia = distancia * (-1); + } + if (dist == null || dist > distancia) + { + dist = distancia; + target = brothers[i]; + } + } + else if (direction == "UP" && brotherY < y) + { + var distancia = y - brotherY; + if (distancia < 0) + { + distancia = distancia * (-1); + } + if (dist == null || dist > distancia) + { + dist = distancia; + target = brothers[i]; + } + } + } + } + this._goToNode(target); +}; + +mindplot.MindmapDesigner.prototype._goToNode = function(node) +{ + node.setOnFocus(true); + this.onNodeFocusEvent.attempt(node, this); +}; + +mindplot.MindmapDesigner.prototype._goToSideChild = function(node, side) +{ + var children = node._getChildren(); + if (children.length > 0) + { + var target = children[0]; + var top = null; + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + var childY = child.getPosition().y; + if (side == 'LEFT' && child.getPosition().x < 0) + { + if (top == null || childY < top) + { + target = child; + top = childY; + } + } + if (side == 'RIGHT' && child.getPosition().x > 0) + { + if (top == null || childY < top) + { + target = child; + top = childY; + } + } + } + + this._goToNode(target); + } +}; + +mindplot.MindmapDesigner.prototype._goToParent = function(node) +{ + var parent = node._parent; + this._goToNode(parent); +}; + +mindplot.MindmapDesigner.prototype._goToChild = function(node) +{ + var children = node._getChildren(); + if (children.length > 0) + { + var target = children[0]; + var top = target.getPosition().y; + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + if (child.getPosition().y < top) + { + top = child.getPosition().y; + target = child; + } + } + this._goToNode(target); + } +}; + +mindplot.MindmapDesigner.prototype.getWorkSpace = function() +{ + return this._workspace; +}; diff --git a/trunk/mindplot/src/main/javascript/NodeGraph.js b/trunk/mindplot/src/main/javascript/NodeGraph.js new file mode 100644 index 00000000..d23b9937 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/NodeGraph.js @@ -0,0 +1,178 @@ +/* +* 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.NodeGraph = function(nodeModel) +{ + this._mouseEvents = true; + this.setModel(nodeModel); + this._onFocus = false; +}; + + +mindplot.NodeGraph.prototype.getType = function() +{ + var model = this.getModel(); + return model.getType(); +}; + +mindplot.NodeGraph.prototype.getId = function() +{ + return this.getModel().getId(); +}; + +mindplot.NodeGraph.prototype.setId = function(id) +{ + this.getModel().setId(id); +}; + +mindplot.NodeGraph.prototype._set2DElement = function(elem2d) +{ + this._elem2d = elem2d; +}; + +mindplot.NodeGraph.prototype.get2DElement = function() +{ + core.assert(this._elem2d, 'NodeGraph has not been initialized propertly'); + return this._elem2d; +}; + +mindplot.NodeGraph.prototype.setPosition = function(point) +{ + // Elements are positioned in the center. + var size = this._model.getSize(); + this._elem2d.setPosition(point.x - (size.width / 2), point.y - (size.height / 2)); + this._model.setPosition(point.x, point.y); +}; + +mindplot.NodeGraph.prototype.addEventListener = function(type, listener) +{ + var elem = this.get2DElement(); + elem.addEventListener(type, listener); +}; + +mindplot.NodeGraph.prototype.isNodeGraph = function() +{ + return true; +}; + +mindplot.NodeGraph.prototype.setMouseEventsEnabled = function(isEnabled) +{ + this._mouseEvents = isEnabled; +}; + +mindplot.NodeGraph.prototype.isMouseEventsEnabled = function() +{ + return this._mouseEvents; +}; + +mindplot.NodeGraph.prototype.getSize = function() +{ + return this._model.getSize(); +}; + +mindplot.NodeGraph.prototype.setSize = function(size) +{ + this._model.setSize(size.width, size.height); +}; + +mindplot.NodeGraph.create = function(nodeModel) +{ + core.assert(nodeModel, 'Model can not be null'); + + var type = nodeModel.getType(); + core.assert(type, 'Node model type can not be null'); + + var result; + if (type == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) + { + result = new mindplot.CentralTopic(nodeModel); + } else + if (type == mindplot.NodeModel.MAIN_TOPIC_TYPE) + { + result = new mindplot.MainTopic(nodeModel); + } else + { + assert(false, "unsupported node type:" + type); + } + + return result; +}; + +mindplot.NodeGraph.prototype.getModel = function() +{ + core.assert(this._model, 'Model has not been initialized yet'); + return this._model; +}; + +mindplot.NodeGraph.prototype.setModel = function(model) +{ + core.assert(model, 'Model can not be null'); + this._model = model; +}; + +mindplot.NodeGraph.prototype.getId = function() +{ + return this._model.getId(); +}; + +mindplot.NodeGraph.prototype.setOnFocus = function(focus) +{ + this._onFocus = focus; + var outerShape = this.getOuterShape(); + if (focus) + { + outerShape.setFill('#c7d8ff'); + outerShape.setOpacity(1); + + } else + { + // @todo: node must not know about the topic. + + outerShape.setFill(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES.fillColor); + outerShape.setOpacity(0); + } + this.setCursor('move'); +}; + +mindplot.NodeGraph.prototype.isOnFocus = function() +{ + return this._onFocus; +}; + +mindplot.NodeGraph.prototype.dispose = function(workspace) +{ + workspace.removeChild(this); +}; + +mindplot.NodeGraph.prototype.createDragNode = function() +{ + var dragShape = this._buildDragShape(); + return new mindplot.DragTopic(dragShape, this); +}; + +mindplot.NodeGraph.prototype._buildDragShape = function() +{ + core.assert(false, '_buildDragShape must be implemented by all nodes.'); +}; + +mindplot.NodeGraph.prototype.getPosition = function() +{ + var model = this.getModel(); + return model.getPosition(); +}; \ No newline at end of file diff --git a/trunk/mindplot/src/main/javascript/NodeModel.js b/trunk/mindplot/src/main/javascript/NodeModel.js new file mode 100644 index 00000000..2ab25521 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/NodeModel.js @@ -0,0 +1,507 @@ +/* +* 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.NodeModel = function(type, mindmap) +{ + core.assert(type, 'Node type can not be null'); + core.assert(mindmap, 'mindmap can not be null'); + + this._order = null; + this._type = type; + this._children = []; + this._icons = []; + this._links = []; + this._notes = []; + this._size = {width:50,height:20}; + this._position = null; + this._id = mindplot.NodeModel._nextUUID(); + this._mindmap = mindmap; + this._text = null; + this._shapeType = null; + this._fontFamily = null; + this._fontSize = null; + this._fontStyle = null; + this._fontWeight = null; + this._fontColor = null; + this._borderColor = null; + this._backgroundColor = null; + this._areChildrenShrinked = false; +}; + +mindplot.NodeModel.prototype.clone = function() +{ + var result = new mindplot.NodeModel(this._type, this._mindmap); + result._order = this._order; + result._type = this._type; + result._children = this._children.map(function(item,index) + { + var model = item.clone(); + model._parent = result; + return model; + }); + + + result._icons = this._icons; + result._links = this._links; + result._notes = this._notes; + result._size = this._size; + result._position = this._position; + result._id = this._id; + result._mindmap = this._mindmap; + result._text = this._text; + result._shapeType = this._shapeType; + result._fontFamily = this._fontFamily; + result._fontSize = this._fontSize; + result._fontStyle = this._fontStyle; + result._fontWeight = this._fontWeight; + result._fontColor = this._fontColor; + result._borderColor = this._borderColor; + result._backgroundColor = this._backgroundColor; + result._areChildrenShrinked = this._areChildrenShrinked; + return result; +}; + +mindplot.NodeModel.prototype.areChildrenShrinked = function() +{ + return this._areChildrenShrinked; +}; + +mindplot.NodeModel.prototype.setChildrenShrinked = function(value) +{ + this._areChildrenShrinked = value; +}; + +mindplot.NodeModel.prototype.getId = function() +{ + return this._id; +}; + + +mindplot.NodeModel.prototype.setId = function(id) +{ + this._id = id; +}; + +mindplot.NodeModel.prototype.getType = function() +{ + return this._type; +}; + +mindplot.NodeModel.prototype.setText = function(text) +{ + this._text = text; +}; + +mindplot.NodeModel.prototype.getText = function() +{ + return this._text; +}; + +mindplot.NodeModel.prototype.isNodeModel = function() +{ + return true; +}; + +mindplot.NodeModel.prototype.isConnected = function() +{ + return this._parent != null; +}; + +mindplot.NodeModel.prototype.createLink = function(url) +{ + core.assert(url, 'Link URL must be specified.'); + return new mindplot.LinkModel(url, this); +}; + +mindplot.NodeModel.prototype.addLink = function(link) +{ + core.assert(link && link.isLinkModel(), 'Only LinkModel can be appended to Mindmap object as links'); + this._links.push(link); +}; + +mindplot.NodeModel.prototype._removeLink = function(link) +{ + core.assert(link && link.isLinkModel(), 'Only LinkModel can be appended to Mindmap object as links'); + this._links.remove(link); +}; + +mindplot.NodeModel.prototype.createNote = function(text) +{ + core.assert(text, 'note text must be specified.'); + return new mindplot.NoteModel(text, this); +}; + +mindplot.NodeModel.prototype.addNote = function(note) +{ + core.assert(note && note.isNoteModel(), 'Only NoteModel can be appended to Mindmap object as links'); + this._notes.push(note); +}; + +mindplot.NodeModel.prototype._removeNote = function(note) +{ + core.assert(note && note.isNoteModel(), 'Only NoteModel can be appended to Mindmap object as links'); + this._notes.remove(note); +}; + +mindplot.NodeModel.prototype.createIcon = function(iconType) +{ + core.assert(iconType, 'IconType must be specified.'); + return new mindplot.IconModel(iconType, this); +}; + +mindplot.NodeModel.prototype.addIcon = function(icon) +{ + core.assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons'); + this._icons.push(icon); +}; + +mindplot.NodeModel.prototype._removeIcon = function(icon) +{ + core.assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons'); + this._icons.remove(icon); +}; + +mindplot.NodeModel.prototype.removeLastIcon = function() +{ + this._icons.pop(); +}; + +mindplot.NodeModel.prototype._appendChild = function(child) +{ + core.assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object'); + this._children.push(child); + child._parent = this; +}; + +mindplot.NodeModel.prototype._removeChild = function(child) +{ + core.assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object.'); + this._children.remove(child); + child._parent = null; +}; + +mindplot.NodeModel.prototype.setPosition = function(x, y) +{ + core.assert(core.Utils.isDefined(x), "x coordinate must be defined"); + core.assert(core.Utils.isDefined(y), "y coordinate must be defined"); + + if (!core.Utils.isDefined(this._position)) + { + this._position = new core.Point(); + } + this._position.x = parseInt(x); + this._position.y = parseInt(y); +}; + +mindplot.NodeModel.prototype.getPosition = function() +{ + return this._position; +}; + +mindplot.NodeModel.prototype.setSize = function(width, height) +{ + this._size.width = width; + this._size.height = height; +}; + +mindplot.NodeModel.prototype.getSize = function() +{ + return {width:this._size.width,height:this._size.height}; +}; + +mindplot.NodeModel.prototype.getChildren = function() +{ + return this._children; +}; + +mindplot.NodeModel.prototype.getIcons = function() +{ + return this._icons; +}; + +mindplot.NodeModel.prototype.getLinks = function() +{ + return this._links; +}; + +mindplot.NodeModel.prototype.getNotes = function() +{ + return this._notes; +}; + +mindplot.NodeModel.prototype.getParent = function() +{ + return this._parent; +}; + +mindplot.NodeModel.prototype.getMindmap = function() +{ + return this._mindmap; +}; + +mindplot.NodeModel.prototype.setParent = function(parent) +{ + core.assert(parent != this, 'The same node can not be parent and child if itself.'); + this._parent = parent; +}; + +mindplot.NodeModel.prototype.canBeConnected = function(sourceModel, sourcePosition, targetTopicHeight) +{ + core.assert(sourceModel != this, 'The same node can not be parent and child if itself.'); + core.assert(sourcePosition, 'childPosition can not be null.'); + core.assert(core.Utils.isDefined(targetTopicHeight), 'childrenWidth can not be null.'); + + // Only can be connected if the node is in the left or rigth. + var targetModel = this; + var mindmap = targetModel.getMindmap(); + var targetPosition = targetModel.getPosition(); + var result = false; + + if (sourceModel.getType() == mindplot.NodeModel.MAIN_TOPIC_TYPE) + { + // Finally, check current node ubication. + var targetTopicSize = targetModel.getSize(); + var yDistance = Math.abs(sourcePosition.y - targetPosition.y); + + if (yDistance <= targetTopicHeight / 2) + { + // Circular connection ? + if (!sourceModel._isChildNode(this)) + { + var toleranceDistance = (targetTopicSize.width / 2) + targetTopicHeight; + + var xDistance = sourcePosition.x - targetPosition.x; + var isTargetAtRightFromCentral = targetPosition.x >= 0; + + if (isTargetAtRightFromCentral) + { + if (xDistance >= 0 && xDistance <= mindplot.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE + (targetTopicSize.width / 2)) + { + result = true; + } + + } else + { + if (xDistance <= 0 && Math.abs(xDistance) <= mindplot.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE + (targetTopicSize.width / 2)) + { + result = true; + } + } + } + } + } else + { + throw "No implemented yet"; + } + return result; +}; + +mindplot.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE = 60; + +mindplot.NodeModel.prototype._isChildNode = function(node) +{ + var result = false; + if (node == this) + { + result = true; + } else + { + var children = this.getChildren(); + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + result = child._isChildNode(node); + if (result) + { + break; + } + } + } + return result; + +}; + +mindplot.NodeModel.prototype.connectTo = function(parent) +{ + var mindmap = this.getMindmap(); + mindmap.connect(parent, this); + this._parent = parent; +}; + +mindplot.NodeModel.prototype.disconnect = function() +{ + var mindmap = this.getMindmap(); + mindmap.disconnect(this); +}; + +mindplot.NodeModel.prototype.getOrder = function() +{ + return this._order; +}; + +mindplot.NodeModel.prototype.getShapeType = function() +{ + return this._shapeType; +}; + +mindplot.NodeModel.prototype.setShapeType = function(type) +{ + this._shapeType = type; +}; + +mindplot.NodeModel.prototype.setOrder = function(value) +{ + this._order = value; +}; + +mindplot.NodeModel.prototype.setFontFamily = function(value) +{ + this._fontFamily = value; +}; + +mindplot.NodeModel.prototype.getOrder = function() +{ + return this._order; +}; + +mindplot.NodeModel.prototype.setFontFamily = function(value) +{ + this._fontFamily = value; +}; + +mindplot.NodeModel.prototype.getFontFamily = function() +{ + return this._fontFamily; +}; + +mindplot.NodeModel.prototype.setFontStyle = function(value) +{ + this._fontStyle = value; +}; + +mindplot.NodeModel.prototype.getFontStyle = function() +{ + return this._fontStyle; +}; + +mindplot.NodeModel.prototype.setFontWeight = function(value) +{ + this._fontWeight = value; +}; + +mindplot.NodeModel.prototype.getFontWeight = function() +{ + return this._fontWeight; +}; + +mindplot.NodeModel.prototype.setFontColor = function(value) +{ + this._fontColor = value; +}; + +mindplot.NodeModel.prototype.getFontColor = function() +{ + return this._fontColor; +}; + +mindplot.NodeModel.prototype.setFontSize = function(value) +{ + this._fontSize = value; +}; + +mindplot.NodeModel.prototype.getFontSize = function() +{ + return this._fontSize; +}; + +mindplot.NodeModel.prototype.getBorderColor = function() +{ + return this._borderColor; +}; + +mindplot.NodeModel.prototype.setBorderColor = function(color) +{ + this._borderColor = color; +}; + +mindplot.NodeModel.prototype.getBackgroundColor = function() +{ + return this._backgroundColor; +}; + +mindplot.NodeModel.prototype.setBackgroundColor = function(color) +{ + this._backgroundColor = color; +}; + +mindplot.NodeModel.prototype.deleteNode = function() +{ + var mindmap = this._mindmap; + + // if it has children nodes, Their must be disconnected. + var lenght = this._children; + for (var i = 0; i < lenght; i++) + { + var child = this._children[i]; + mindmap.disconnect(child); + } + + var parent = this._parent; + if (parent) + { + // if it is connected, I must remove it from the parent.. + mindmap.disconnect(this); + } + + // It's an isolated node. It must be a hole branch ... + var branches = mindmap.getBranches(); + branches.remove(this); + +}; + +/** + * @todo: This method must be implemented. + */ +mindplot.NodeModel._nextUUID = function() +{ + if (!this._uuid) + { + this._uuid = 0; + } + + this._uuid = this._uuid + 1; + return this._uuid; +}; + + +mindplot.NodeModel.prototype.inspect = function() +{ + return '(type:' + this.getType() + ' , id: ' + this.getId() + ')'; +}; + +mindplot.NodeModel.CENTRAL_TOPIC_TYPE = 'CentralTopic'; +mindplot.NodeModel.MAIN_TOPIC_TYPE = 'MainTopic'; +mindplot.NodeModel.DRAGGED_TOPIC_TYPE = 'DraggedTopic'; + +mindplot.NodeModel.SHAPE_TYPE_RECT = 'rectagle'; +mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT = 'rounded rectagle'; +mindplot.NodeModel.SHAPE_TYPE_ELIPSE = 'elipse'; +mindplot.NodeModel.SHAPE_TYPE_LINE = 'line'; + + diff --git a/trunk/mindplot/src/main/javascript/Note.js b/trunk/mindplot/src/main/javascript/Note.js new file mode 100644 index 00000000..493f1839 --- /dev/null +++ b/trunk/mindplot/src/main/javascript/Note.js @@ -0,0 +1,166 @@ +/* +* 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.Note = function(textModel, topic, designer) { + var divContainer=designer.getWorkSpace().getScreenManager().getContainer(); + var bubbleTip = mindplot.BubbleTip.getInstance(divContainer); + mindplot.Icon.call(this, mindplot.Note.IMAGE_URL); + this._noteModel = textModel; + this._topic = topic; + this._designer = designer; + var image = this.getImage(); + var imgContainer = new Element('div').setStyles({textAlign:'center'}); + this._textElem = new Element('div').setStyles({'max-height':100,'max-width':300, 'overflow':'auto'}); + var text = unescape(textModel.getText()); + text = text.replace(/\n/ig,"
"); + text = text.replace(/ + + + + + +

JsUnit Test Suite

+ +

This page contains a suite of tests for testing JsUnit. Click here to + start running the test

+ +
+
+ + + + + + + + diff --git a/trunk/web2d/src/test/javascript/jsUnit/WorkspaceTestSuite.html b/trunk/web2d/src/test/javascript/jsUnit/WorkspaceTestSuite.html new file mode 100755 index 00000000..677d9857 --- /dev/null +++ b/trunk/web2d/src/test/javascript/jsUnit/WorkspaceTestSuite.html @@ -0,0 +1,135 @@ + + + + + + JsUnit Test Suite + + + + + + + + +

JsUnit Test Suite

+ +

This page contains a suite of tests for testing JsUnit. Click here to + start running the test

+ +
+
+ + + + + + + + diff --git a/trunk/web2d/src/test/javascript/render/events.html b/trunk/web2d/src/test/javascript/render/events.html new file mode 100755 index 00000000..f5e62fa3 --- /dev/null +++ b/trunk/web2d/src/test/javascript/render/events.html @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + +

Elements Event Handling

+ + ++ + + + + + + + + + + + + + + + +
+ This examples shows the ability to attach listeners to handle several events. + In this example, you can attach different events to three elements: workspace, small elipse and the big elipse. + Events will follow the event bubbling behaviour. + +
+ +
+
+
+ Workspace Events +
+
+
+
+ +
+
+ +
+
+ Small Elipse Events +
+
+
+
+ +
+
+ +
+
+ Big Elipse Events +
+
+
+
+ +
+
+ +
+
Multiple listeners can be attached to an element to handle an event type. + In this example, multiple listeners can be registered to the elipse element to handle the click event type. + +
+ +
+
+
+ Elipse Click Events Listeners + +
+ + +
+ +
+ +
+ +
+ + diff --git a/trunk/web2d/src/test/javascript/render/group.html b/trunk/web2d/src/test/javascript/render/group.html new file mode 100755 index 00000000..5a8791bc --- /dev/null +++ b/trunk/web2d/src/test/javascript/render/group.html @@ -0,0 +1,480 @@ + + + + + + + + + + +

Group Render Tests.

+ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ A group object can be used to collect shapes. In this example, + There is a group that contains an elipse and two lines as children. + Changing the group position also change the position of all contained + elements. + +
+
+ Following the bubbling event pattern, all the events over a shape are propageted to its + parent. In this example, both elipse objects are child of a group element and click event listeners + have been added to the elipse and the group. + +
+
+ Groups can be nested as a regular shape. An important property of the groups is the ability + to define their own coordSize, coorOrigin and size. In this example, both shapes have been + created with the same properties. The red one has been added as a child element of a group with the + following properties:
+
+ Size(50,50);
+ Position(25,25);
+ CoordSize(100,100);
+ CoordOrigin(0,0)
+ + The blue one has been added as a child of another group with the following properties::
+
+ Size(50,50);
+ Position(25,25);
+ CoordSize(100,100);
+ CoordOrigin(0,0);
+
+ Finally, the second group has been added as a child of the first declared group. +
+
+
+ Group coordsize defines how many units there are along the width of the containing block. + In all the examples, the coordsize of the workspaces have been set to (100,100) and the circles have been + positioned + at (0,0),(0,100),(100,0),(100,100)(50,50).
+
+ 1) Group with CoordSize(100,100)
+ 2) Group with CoordSize(100,200)
+ 3) Group with CoordSize(200,100)
+
+
+
+ (1) +
+ +
+ (2) +
+ +
+ (3) +
+
+
+ Group coordorigin defines the coordinate at the top left corner of the containing block. + In all the examples,the coordsize of the groups have been set to (100,100) and the circles have been positioned + at (0,0),(0,100),(100,0),(100,100)(50,50).
+
+ 1) Group with CoordOrigin(0,0)
+ 2) Group with CoordOrigin(0,50)
+ 3) Group with CoordOrigin(50,0)
+
+
+
+ (1) +
+ +
+ (2) +
+ +
+ (3) +
+
+
+ Visibility can be used to hide an element and disable all the element events. + In the case of a group, this property is applied to all the children elements. + +
+
+ Scale. + +
+
+ + diff --git a/trunk/web2d/src/test/javascript/render/line.html b/trunk/web2d/src/test/javascript/render/line.html new file mode 100755 index 00000000..2095bbdd --- /dev/null +++ b/trunk/web2d/src/test/javascript/render/line.html @@ -0,0 +1,129 @@ + + + + + + + + + + +

Lines Render Tests

+ + ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Lines. + +
+
+ Lines Opacity. + +
+
+ Line Styles. + +
+
+ Line Arrows. + +
+
+ + diff --git a/trunk/web2d/src/test/javascript/render/mootools.js b/trunk/web2d/src/test/javascript/render/mootools.js new file mode 100644 index 00000000..38369cea --- /dev/null +++ b/trunk/web2d/src/test/javascript/render/mootools.js @@ -0,0 +1,2171 @@ +/* +* 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 $ +*/ + +//MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006 Valerio Proietti, , MIT Style License. + +var MooTools = {version:'1.11'}; +function $defined(obj) { + return(obj != undefined); +} +; +function $type(obj) { + if (!$defined(obj))return false; + if (obj.htmlElement)return'element'; + var type = typeof obj; + if (type == 'object' && obj.nodeName) { + switch (obj.nodeType) {case 1:return'element';case 3:return(/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';} + } + if (type == 'object' || type == 'function') { + switch (obj.constructor) {case Array:return'array';case RegExp:return'regexp';case Class:return'class';} + if (typeof obj.length == 'number') { + if (obj.item)return'collection'; + if (obj.callee)return'arguments'; + } + } + return type; +} +; +function $merge() { + var mix = {}; + for (var i = 0; i < arguments.length; i++) { + for (var property in arguments[i]) { + var ap = arguments[i][property]; + var mp = mix[property]; + if (mp && $type(ap) == 'object' && $type(mp) == 'object')mix[property] = $merge(mp, ap); else mix[property] = ap; + } + } + return mix; +} +; +var $extend = function() { + var args = arguments; + if (!args[1])args = [this,args[0]]; + for (var property in args[1])args[0][property] = args[1][property]; + return args[0]; +}; +var $native = function() { + for (var i = 0,l = arguments.length; i < l; i++) { + arguments[i].extend = function(props) { + for (var prop in props) { + if (!this.prototype[prop])this.prototype[prop] = props[prop]; + if (!this[prop])this[prop] = $native.generic(prop); + } + }; + } +}; +$native.generic = function(prop) { + return function(bind) { + return this.prototype[prop].apply(bind, Array.prototype.slice.call(arguments, 1)); + }; +}; +$native(Function, Array, String, Number); +function $chk(obj) { + return!!(obj || obj === 0); +} +; +function $pick(obj, picked) { + return $defined(obj) ? obj : picked; +} +; +function $random(min, max) { + return Math.floor(Math.random() * (max - min + 1) + min); +} +; +function $time() { + return new Date().getTime(); +} +; +function $clear(timer) { + clearTimeout(timer); + clearInterval(timer); + return null; +} +; +var Abstract = function(obj) { + obj = obj || {}; + obj.extend = $extend; + return obj; +}; +var Window = new Abstract(window); +var Document = new Abstract(document); +document.head = document.getElementsByTagName('head')[0]; +window.xpath = !!(document.evaluate); +if (window.ActiveXObject)window.ie = window[window.XMLHttpRequest ? 'ie7' : 'ie6'] = true; else if (document.childNodes && !document.all && !navigator.taintEnabled)window.webkit = window[window.xpath ? 'webkit420' : 'webkit419'] = true; else if (document.getBoxObjectFor != null)window.gecko = true; +window.khtml = window.webkit; +Object.extend = $extend; +if (typeof HTMLElement == 'undefined') { + var HTMLElement = function() { + }; + if (window.webkit)document.createElement("iframe"); + HTMLElement.prototype = (window.webkit) ? window["[[DOMElement.prototype]]"] : {}; +} +HTMLElement.prototype.htmlElement = function() { +}; +if (window.ie6)try { + document.execCommand("BackgroundImageCache", false, true); +} catch(e) { +} +; +var Class = function(properties) { + var klass = function() { + return(arguments[0] !== null && this.initialize && $type(this.initialize) == 'function') ? this.initialize.apply(this, arguments) : this; + }; + $extend(klass, this); + klass.prototype = properties; + klass.constructor = Class; + return klass; +}; +Class.empty = function() { +}; +Class.prototype = {extend:function(properties) { + var proto = new this(null); + for (var property in properties) { + var pp = proto[property]; + proto[property] = Class.Merge(pp, properties[property]); + } + return new Class(proto); +},implement:function() { + for (var i = 0,l = arguments.length; i < l; i++)$extend(this.prototype, arguments[i]); +}}; +Class.Merge = function(previous, current) { + if (previous && previous != current) { + var type = $type(current); + if (type != $type(previous))return current; + switch (type) {case'function':var merged = function() { + this.parent = arguments.callee.parent; + return current.apply(this, arguments); + };merged.parent = previous;return merged;case'object':return $merge(previous, current);} + } + return current; +}; +var Chain = new Class({chain:function(fn) { + this.chains = this.chains || []; + this.chains.push(fn); + return this; +},callChain:function() { + if (this.chains && this.chains.length)this.chains.shift().delay(10, this); +},clearChain:function() { + this.chains = []; +}}); +var Events = new Class({addEvent:function(type, fn) { + if (fn != Class.empty) { + this.$events = this.$events || {}; + this.$events[type] = this.$events[type] || []; + this.$events[type].include(fn); + } + return this; +},fireEvent:function(type, args, delay) { + if (this.$events && this.$events[type]) { + this.$events[type].each(function(fn) { + fn.create({'bind':this,'delay':delay,'arguments':args})(); + }, this); + } + return this; +},removeEvent:function(type, fn) { + if (this.$events && this.$events[type])this.$events[type].remove(fn); + return this; +}}); +var Options = new Class({setOptions:function() { + this.options = $merge.apply(null, [this.options].extend(arguments)); + if (this.addEvent) { + for (var option in this.options) { + if ($type(this.options[option] == 'function') && (/^on[A-Z]/).test(option))this.addEvent(option, this.options[option]); + } + } + return this; +}}); +Array.extend({forEach:function(fn, bind) { + for (var i = 0,j = this.length; i < j; i++)fn.call(bind, this[i], i, this); +},filter:function(fn, bind) { + var results = []; + for (var i = 0,j = this.length; i < j; i++) { + if (fn.call(bind, this[i], i, this))results.push(this[i]); + } + return results; +},map:function(fn, bind) { + var results = []; + for (var i = 0,j = this.length; i < j; i++)results[i] = fn.call(bind, this[i], i, this); + return results; +},every:function(fn, bind) { + for (var i = 0,j = this.length; i < j; i++) { + if (!fn.call(bind, this[i], i, this))return false; + } + return true; +},some:function(fn, bind) { + for (var i = 0,j = this.length; i < j; i++) { + if (fn.call(bind, this[i], i, this))return true; + } + return false; +},indexOf:function(item, from) { + var len = this.length; + for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++) { + if (this[i] === item)return i; + } + return-1; +},copy:function(start, length) { + start = start || 0; + if (start < 0)start = this.length + start; + length = length || (this.length - start); + var newArray = []; + for (var i = 0; i < length; i++)newArray[i] = this[start++]; + return newArray; +},remove:function(item) { + var i = 0; + var len = this.length; + while (i < len) { + if (this[i] === item) { + this.splice(i, 1); + len--; + } else { + i++; + } + } + return this; +},contains:function(item, from) { + return this.indexOf(item, from) != -1; +},associate:function(keys) { + var obj = {},length = Math.min(this.length, keys.length); + for (var i = 0; i < length; i++)obj[keys[i]] = this[i]; + return obj; +},extend:function(array) { + for (var i = 0,j = array.length; i < j; i++)this.push(array[i]); + return this; +},merge:function(array) { + for (var i = 0,l = array.length; i < l; i++)this.include(array[i]); + return this; +},include:function(item) { + if (!this.contains(item))this.push(item); + return this; +},getRandom:function() { + return this[$random(0, this.length - 1)] || null; +},getLast:function() { + return this[this.length - 1] || null; +}}); +Array.prototype.each = Array.prototype.forEach; +Array.each = Array.forEach; +function $A(array) { + return Array.copy(array); +} +; +function $each(iterable, fn, bind) { + if (iterable && typeof iterable.length == 'number' && $type(iterable) != 'object') { + Array.forEach(iterable, fn, bind); + } else { + for (var name in iterable)fn.call(bind || iterable, iterable[name], name); + } +} +; +Array.prototype.test = Array.prototype.contains; +String.extend({test:function(regex, params) { + return(($type(regex) == 'string') ? new RegExp(regex, params) : regex).test(this); +},toInt:function() { + return parseInt(this, 10); +},toFloat:function() { + return parseFloat(this); +},camelCase:function() { + return this.replace(/-\D/g, function(match) { + return match.charAt(1).toUpperCase(); + }); +},hyphenate:function() { + return this.replace(/\w[A-Z]/g, function(match) { + return(match.charAt(0) + '-' + match.charAt(1).toLowerCase()); + }); +},capitalize:function() { + return this.replace(/\b[a-z]/g, function(match) { + return match.toUpperCase(); + }); +},trim:function() { + return this.replace(/^\s+|\s+$/g, ''); +},clean:function() { + return this.replace(/\s{2,}/g, ' ').trim(); +},rgbToHex:function(array) { + var rgb = this.match(/\d{1,3}/g); + return(rgb) ? rgb.rgbToHex(array) : false; +},hexToRgb:function(array) { + var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); + return(hex) ? hex.slice(1).hexToRgb(array) : false; +},contains:function(string, s) { + return(s) ? (s + this + s).indexOf(s + string + s) > -1 : this.indexOf(string) > -1; +},escapeRegExp:function() { + return this.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1'); +}}); +Array.extend({rgbToHex:function(array) { + if (this.length < 3)return false; + if (this.length == 4 && this[3] == 0 && !array)return'transparent'; + var hex = []; + for (var i = 0; i < 3; i++) { + var bit = (this[i] - 0).toString(16); + hex.push((bit.length == 1) ? '0' + bit : bit); + } + return array ? hex : '#' + hex.join(''); +},hexToRgb:function(array) { + if (this.length != 3)return false; + var rgb = []; + for (var i = 0; i < 3; i++) { + rgb.push(parseInt((this[i].length == 1) ? this[i] + this[i] : this[i], 16)); + } + return array ? rgb : 'rgb(' + rgb.join(',') + ')'; +}}); +Function.extend({create:function(options) { + var fn = this; + options = $merge({'bind':fn,'event':false,'arguments':null,'delay':false,'periodical':false,'attempt':false}, options); + if ($chk(options.arguments) && $type(options.arguments) != 'array')options.arguments = [options.arguments]; + return function(event) { + var args; + if (options.event) { + event = event || window.event; + args = [(options.event === true) ? event : new options.event(event)]; + if (options.arguments)args.extend(options.arguments); + } + else args = options.arguments || arguments; + var returns = function() { + return fn.apply($pick(options.bind, fn), args); + }; + if (options.delay)return setTimeout(returns, options.delay); + if (options.periodical)return setInterval(returns, options.periodical); + if (options.attempt)try { + return returns(); + } catch(err) { + return false; + } + ; + return returns(); + }; +},pass:function(args, bind) { + return this.create({'arguments':args,'bind':bind}); +},attempt:function(args, bind) { + return this.create({'arguments':args,'bind':bind,'attempt':true})(); +},bind:function(bind, args) { + return this.create({'bind':bind,'arguments':args}); +},bindAsEventListener:function(bind, args) { + return this.create({'bind':bind,'event':true,'arguments':args}); +},delay:function(delay, bind, args) { + return this.create({'delay':delay,'bind':bind,'arguments':args})(); +},periodical:function(interval, bind, args) { + return this.create({'periodical':interval,'bind':bind,'arguments':args})(); +}}); +Number.extend({toInt:function() { + return parseInt(this); +},toFloat:function() { + return parseFloat(this); +},limit:function(min, max) { + return Math.min(max, Math.max(min, this)); +},round:function(precision) { + precision = Math.pow(10, precision || 0); + return Math.round(this * precision) / precision; +},times:function(fn) { + for (var i = 0; i < this; i++)fn(i); +}}); +var Element = new Class({initialize:function(el, props) { + if ($type(el) == 'string') { + if (window.ie && props && (props.name || props.type)) { + var name = (props.name) ? ' name="' + props.name + '"' : ''; + var type = (props.type) ? ' type="' + props.type + '"' : ''; + delete props.name; + delete props.type; + el = '<' + el + name + type + '>'; + } + el = document.createElement(el); + } + el = $(el); + return(!props || !el) ? el : el.set(props); +}}); +var Elements = new Class({initialize:function(elements) { + return(elements) ? $extend(elements, this) : this; +}}); +Elements.extend = function(props) { + for (var prop in props) { + this.prototype[prop] = props[prop]; + this[prop] = $native.generic(prop); + } +}; +function $(el) { + if (!el)return null; + if (el.htmlElement)return Garbage.collect(el); + if ([window,document].contains(el))return el; + var type = $type(el); + if (type == 'string') { + el = document.getElementById(el); + type = (el) ? 'element' : false; + } + if (type != 'element')return null; + if (el.htmlElement)return Garbage.collect(el); + if (['object','embed'].contains(el.tagName.toLowerCase()))return el; + $extend(el, Element.prototype); + el.htmlElement = function() { + }; + return Garbage.collect(el); +} +; +document.getElementsBySelector = document.getElementsByTagName; +function $$() { + var elements = []; + for (var i = 0,j = arguments.length; i < j; i++) { + var selector = arguments[i]; + switch ($type(selector)) {case'element':elements.push(selector);case'boolean':break;case false:break;case'string':selector = document.getElementsBySelector(selector, true);default:elements.extend(selector);} + } + return $$.unique(elements); +} +; +$$.unique = function(array) { + var elements = []; + for (var i = 0,l = array.length; i < l; i++) { + if (array[i].$included)continue; + var element = $(array[i]); + if (element && !element.$included) { + element.$included = true; + elements.push(element); + } + } + for (var n = 0,d = elements.length; n < d; n++)elements[n].$included = null; + return new Elements(elements); +}; +Elements.Multi = function(property) { + return function() { + var args = arguments; + var items = []; + var elements = true; + for (var i = 0,j = this.length,returns; i < j; i++) { + returns = this[i][property].apply(this[i], args); + if ($type(returns) != 'element')elements = false; + items.push(returns); + } + ; + return(elements) ? $$.unique(items) : items; + }; +}; +Element.extend = function(properties) { + for (var property in properties) { + HTMLElement.prototype[property] = properties[property]; + Element.prototype[property] = properties[property]; + Element[property] = $native.generic(property); + var elementsProperty = (Array.prototype[property]) ? property + 'Elements' : property; + Elements.prototype[elementsProperty] = Elements.Multi(property); + } +}; +Element.extend({set:function(props) { + for (var prop in props) { + var val = props[prop]; + switch (prop) {case'styles':this.setStyles(val);break;case'events':if (this.addEvents)this.addEvents(val);break;case'properties':this.setProperties(val);break;default:this.setProperty(prop, val);} + } + return this; +},inject:function(el, where) { + el = $(el); + switch (where) {case'before':el.parentNode.insertBefore(this, el);break;case'after':var next = el.getNext();if (!next)el.parentNode.appendChild(this); else el.parentNode.insertBefore(this, next);break;case'top':var first = el.firstChild;if (first) { + el.insertBefore(this, first); + break; + } + default:el.appendChild(this);} + return this; +},injectBefore:function(el) { + return this.inject(el, 'before'); +},injectAfter:function(el) { + return this.inject(el, 'after'); +},injectInside:function(el) { + return this.inject(el, 'bottom'); +},injectTop:function(el) { + return this.inject(el, 'top'); +},adopt:function() { + var elements = []; + $each(arguments, function(argument) { + elements = elements.concat(argument); + }); + $$(elements).inject(this); + return this; +},remove:function() { + return this.parentNode.removeChild(this); +},clone:function(contents) { + var el = $(this.cloneNode(contents !== false)); + if (!el.$events)return el; + el.$events = {}; + for (var type in this.$events)el.$events[type] = {'keys':$A(this.$events[type].keys),'values':$A(this.$events[type].values)}; + return el.removeEvents(); +},replaceWith:function(el) { + el = $(el); + this.parentNode.replaceChild(el, this); + return el; +},appendText:function(text) { + this.appendChild(document.createTextNode(text)); + return this; +},hasClass:function(className) { + return this.className.contains(className, ' '); +},addClass:function(className) { + if (!this.hasClass(className))this.className = (this.className + ' ' + className).clean(); + return this; +},removeClass:function(className) { + this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1').clean(); + return this; +},toggleClass:function(className) { + return this.hasClass(className) ? this.removeClass(className) : this.addClass(className); +},setStyle:function(property, value) { + switch (property) {case'opacity':return this.setOpacity(parseFloat(value));case'float':property = (window.ie) ? 'styleFloat' : 'cssFloat';} + property = property.camelCase(); + switch ($type(value)) {case'number':if (!['zIndex','zoom'].contains(property))value += 'px';break;case'array':value = 'rgb(' + value.join(',') + ')';} + this.style[property] = value; + return this; +},setStyles:function(source) { + switch ($type(source)) {case'object':Element.setMany(this, 'setStyle', source);break;case'string':this.style.cssText = source;} + return this; +},setOpacity:function(opacity) { + if (opacity == 0) { + if (this.style.visibility != "hidden")this.style.visibility = "hidden"; + } else { + if (this.style.visibility != "visible")this.style.visibility = "visible"; + } + if (!this.currentStyle || !this.currentStyle.hasLayout)this.style.zoom = 1; + if (window.ie)this.style.filter = (opacity == 1) ? '' : "alpha(opacity=" + opacity * 100 + ")"; + this.style.opacity = this.$tmp.opacity = opacity; + return this; +},getStyle:function(property) { + property = property.camelCase(); + var result = this.style[property]; + if (!$chk(result)) { + if (property == 'opacity')return this.$tmp.opacity; + result = []; + for (var style in Element.Styles) { + if (property == style) { + Element.Styles[style].each(function(s) { + var style = this.getStyle(s); + result.push(parseInt(style) ? style : '0px'); + }, this); + if (property == 'border') { + var every = result.every(function(bit) { + return(bit == result[0]); + }); + return(every) ? result[0] : false; + } + return result.join(' '); + } + } + if (property.contains('border')) { + if (Element.Styles.border.contains(property)) { + return['Width','Style','Color'].map(function(p) { + return this.getStyle(property + p); + }, this).join(' '); + } else if (Element.borderShort.contains(property)) { + return['Top','Right','Bottom','Left'].map(function(p) { + return this.getStyle('border' + p + property.replace('border', '')); + }, this).join(' '); + } + } + if (document.defaultView)result = document.defaultView.getComputedStyle(this, null).getPropertyValue(property.hyphenate()); else if (this.currentStyle)result = this.currentStyle[property]; + } + if (window.ie)result = Element.fixStyle(property, result, this); + if (result && property.test(/color/i) && result.contains('rgb')) { + return result.split('rgb').splice(1, 4).map(function(color) { + return color.rgbToHex(); + }).join(' '); + } + return result; +},getStyles:function() { + return Element.getMany(this, 'getStyle', arguments); +},walk:function(brother, start) { + brother += 'Sibling'; + var el = (start) ? this[start] : this[brother]; + while (el && $type(el) != 'element')el = el[brother]; + return $(el); +},getPrevious:function() { + return this.walk('previous'); +},getNext:function() { + return this.walk('next'); +},getFirst:function() { + return this.walk('next', 'firstChild'); +},getLast:function() { + return this.walk('previous', 'lastChild'); +},getParent:function() { + return $(this.parentNode); +},getChildren:function() { + return $$(this.childNodes); +},hasChild:function(el) { + return!!$A(this.getElementsByTagName('*')).contains(el); +},getProperty:function(property) { + var index = Element.Properties[property]; + if (index)return this[index]; + var flag = Element.PropertiesIFlag[property] || 0; + if (!window.ie || flag)return this.getAttribute(property, flag); + var node = this.attributes[property]; + return(node) ? node.nodeValue : null; +},removeProperty:function(property) { + var index = Element.Properties[property]; + if (index)this[index] = ''; else this.removeAttribute(property); + return this; +},getProperties:function() { + return Element.getMany(this, 'getProperty', arguments); +},setProperty:function(property, value) { + var index = Element.Properties[property]; + if (index)this[index] = value; else this.setAttribute(property, value); + return this; +},setProperties:function(source) { + return Element.setMany(this, 'setProperty', source); +},setHTML:function() { + this.innerHTML = $A(arguments).join(''); + return this; +},setText:function(text) { + var tag = this.getTag(); + if (['style','script'].contains(tag)) { + if (window.ie) { + if (tag == 'style')this.styleSheet.cssText = text; else if (tag == 'script')this.setProperty('text', text); + return this; + } else { + this.removeChild(this.firstChild); + return this.appendText(text); + } + } + this[$defined(this.innerText) ? 'innerText' : 'textContent'] = text; + return this; +},getText:function() { + var tag = this.getTag(); + if (['style','script'].contains(tag)) { + if (window.ie) { + if (tag == 'style')return this.styleSheet.cssText; else if (tag == 'script')return this.getProperty('text'); + } else { + return this.innerHTML; + } + } + return($pick(this.innerText, this.textContent)); +},getTag:function() { + return this.tagName.toLowerCase(); +},empty:function() { + Garbage.trash(this.getElementsByTagName('*')); + return this.setHTML(''); +}}); +Element.fixStyle = function(property, result, element) { + if ($chk(parseInt(result)))return result; + if (['height','width'].contains(property)) { + var values = (property == 'width') ? ['left','right'] : ['top','bottom']; + var size = 0; + values.each(function(value) { + size += element.getStyle('border-' + value + '-width').toInt() + element.getStyle('padding-' + value).toInt(); + }); + return element['offset' + property.capitalize()] - size + 'px'; + } else if (property.test(/border(.+)Width|margin|padding/)) { + return'0px'; + } + return result; +}; +Element.Styles = {'border':[],'padding':[],'margin':[]}; +['Top','Right','Bottom','Left'].each(function(direction) { + for (var style in Element.Styles)Element.Styles[style].push(style + direction); +}); +Element.borderShort = ['borderWidth','borderStyle','borderColor']; +Element.getMany = function(el, method, keys) { + var result = {}; + $each(keys, function(key) { + result[key] = el[method](key); + }); + return result; +}; +Element.setMany = function(el, method, pairs) { + for (var key in pairs)el[method](key, pairs[key]); + return el; +}; +Element.Properties = new Abstract({'class':'className','for':'htmlFor','colspan':'colSpan','rowspan':'rowSpan','accesskey':'accessKey','tabindex':'tabIndex','maxlength':'maxLength','readonly':'readOnly','frameborder':'frameBorder','value':'value','disabled':'disabled','checked':'checked','multiple':'multiple','selected':'selected'}); +Element.PropertiesIFlag = {'href':2,'src':2}; +Element.Methods = {Listeners:{addListener:function(type, fn) { + if (this.addEventListener)this.addEventListener(type, fn, false); else this.attachEvent('on' + type, fn); + return this; +},removeListener:function(type, fn) { + if (this.removeEventListener)this.removeEventListener(type, fn, false); else this.detachEvent('on' + type, fn); + return this; +}}}; +window.extend(Element.Methods.Listeners); +document.extend(Element.Methods.Listeners); +Element.extend(Element.Methods.Listeners); +var Garbage = {elements:[],collect:function(el) { + if (!el.$tmp) { + Garbage.elements.push(el); + el.$tmp = {'opacity':1}; + } + return el; +},trash:function(elements) { + for (var i = 0,j = elements.length,el; i < j; i++) { + if (!(el = elements[i]) || !el.$tmp)continue; + if (el.$events)el.fireEvent('trash').removeEvents(); + for (var p in el.$tmp)el.$tmp[p] = null; + for (var d in Element.prototype)el[d] = null; + Garbage.elements[Garbage.elements.indexOf(el)] = null; + el.htmlElement = el.$tmp = el = null; + } + Garbage.elements.remove(null); +},empty:function() { + Garbage.collect(window); + Garbage.collect(document); + Garbage.trash(Garbage.elements); +}}; +window.addListener('beforeunload', function() { + window.addListener('unload', Garbage.empty); + if (window.ie)window.addListener('unload', CollectGarbage); +}); +var Event = new Class({initialize:function(event) { + if (event && event.$extended)return event; + this.$extended = true; + event = event || window.event; + this.event = event; + this.type = event.type; + this.target = event.target || event.srcElement; + if (this.target.nodeType == 3)this.target = this.target.parentNode; + this.shift = event.shiftKey; + this.control = event.ctrlKey; + this.alt = event.altKey; + this.meta = event.metaKey; + if (['DOMMouseScroll','mousewheel'].contains(this.type)) { + this.wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3; + } else if (this.type.contains('key')) { + this.code = event.which || event.keyCode; + for (var name in Event.keys) { + if (Event.keys[name] == this.code) { + this.key = name; + break; + } + } + if (this.type == 'keydown') { + var fKey = this.code - 111; + if (fKey > 0 && fKey < 13)this.key = 'f' + fKey; + } + this.key = this.key || String.fromCharCode(this.code).toLowerCase(); + } else if (this.type.test(/(click|mouse|menu)/)) { + this.page = {'x':event.pageX || event.clientX + document.documentElement.scrollLeft,'y':event.pageY || event.clientY + document.documentElement.scrollTop}; + this.client = {'x':event.pageX ? event.pageX - window.pageXOffset : event.clientX,'y':event.pageY ? event.pageY - window.pageYOffset : event.clientY}; + this.rightClick = (event.which == 3) || (event.button == 2); + switch (this.type) {case'mouseover':this.relatedTarget = event.relatedTarget || event.fromElement;break;case'mouseout':this.relatedTarget = event.relatedTarget || event.toElement;} + this.fixRelatedTarget(); + } + return this; +},stop:function() { + return this.stopPropagation().preventDefault(); +},stopPropagation:function() { + if (this.event.stopPropagation)this.event.stopPropagation(); else this.event.cancelBubble = true; + return this; +},preventDefault:function() { + if (this.event.preventDefault)this.event.preventDefault(); else this.event.returnValue = false; + return this; +}}); +Event.fix = {relatedTarget:function() { + if (this.relatedTarget && this.relatedTarget.nodeType == 3)this.relatedTarget = this.relatedTarget.parentNode; +},relatedTargetGecko:function() { + try { + Event.fix.relatedTarget.call(this); + } catch(e) { + this.relatedTarget = this.target; + } +}}; +Event.prototype.fixRelatedTarget = (window.gecko) ? Event.fix.relatedTargetGecko : Event.fix.relatedTarget; +Event.keys = new Abstract({'enter':13,'up':38,'down':40,'left':37,'right':39,'esc':27,'space':32,'backspace':8,'tab':9,'delete':46}); +Element.Methods.Events = {addEvent:function(type, fn) { + this.$events = this.$events || {}; + this.$events[type] = this.$events[type] || {'keys':[],'values':[]}; + if (this.$events[type].keys.contains(fn))return this; + this.$events[type].keys.push(fn); + var realType = type; + var custom = Element.Events[type]; + if (custom) { + if (custom.add)custom.add.call(this, fn); + if (custom.map)fn = custom.map; + if (custom.type)realType = custom.type; + } + if (!this.addEventListener)fn = fn.create({'bind':this,'event':true}); + this.$events[type].values.push(fn); + return(Element.NativeEvents.contains(realType)) ? this.addListener(realType, fn) : this; +},removeEvent:function(type, fn) { + if (!this.$events || !this.$events[type])return this; + var pos = this.$events[type].keys.indexOf(fn); + if (pos == -1)return this; + var key = this.$events[type].keys.splice(pos, 1)[0]; + var value = this.$events[type].values.splice(pos, 1)[0]; + var custom = Element.Events[type]; + if (custom) { + if (custom.remove)custom.remove.call(this, fn); + if (custom.type)type = custom.type; + } + return(Element.NativeEvents.contains(type)) ? this.removeListener(type, value) : this; +},addEvents:function(source) { + return Element.setMany(this, 'addEvent', source); +},removeEvents:function(type) { + if (!this.$events)return this; + if (!type) { + for (var evType in this.$events)this.removeEvents(evType); + this.$events = null; + } else if (this.$events[type]) { + this.$events[type].keys.each(function(fn) { + this.removeEvent(type, fn); + }, this); + this.$events[type] = null; + } + return this; +},fireEvent:function(type, args, delay) { + if (this.$events && this.$events[type]) { + this.$events[type].keys.each(function(fn) { + fn.create({'bind':this,'delay':delay,'arguments':args})(); + }, this); + } + return this; +},cloneEvents:function(from, type) { + if (!from.$events)return this; + if (!type) { + for (var evType in from.$events)this.cloneEvents(from, evType); + } else if (from.$events[type]) { + from.$events[type].keys.each(function(fn) { + this.addEvent(type, fn); + }, this); + } + return this; +}}; +window.extend(Element.Methods.Events); +document.extend(Element.Methods.Events); +Element.extend(Element.Methods.Events); +Element.Events = new Abstract({'mouseenter':{type:'mouseover',map:function(event) { + event = new Event(event); + if (event.relatedTarget != this && !this.hasChild(event.relatedTarget))this.fireEvent('mouseenter', event); +}},'mouseleave':{type:'mouseout',map:function(event) { + event = new Event(event); + if (event.relatedTarget != this && !this.hasChild(event.relatedTarget))this.fireEvent('mouseleave', event); +}},'mousewheel':{type:(window.gecko) ? 'DOMMouseScroll' : 'mousewheel'}}); +Element.NativeEvents = ['click','dblclick','mouseup','mousedown','mousewheel','DOMMouseScroll','mouseover','mouseout','mousemove','keydown','keypress','keyup','load','unload','beforeunload','resize','move','focus','blur','change','submit','reset','select','error','abort','contextmenu','scroll']; +Function.extend({bindWithEvent:function(bind, args) { + return this.create({'bind':bind,'arguments':args,'event':Event}); +}}); +Elements.extend({filterByTag:function(tag) { + return new Elements(this.filter(function(el) { + return(Element.getTag(el) == tag); + })); +},filterByClass:function(className, nocash) { + var elements = this.filter(function(el) { + return(el.className && el.className.contains(className, ' ')); + }); + return(nocash) ? elements : new Elements(elements); +},filterById:function(id, nocash) { + var elements = this.filter(function(el) { + return(el.id == id); + }); + return(nocash) ? elements : new Elements(elements); +},filterByAttribute:function(name, operator, value, nocash) { + var elements = this.filter(function(el) { + var current = Element.getProperty(el, name); + if (!current)return false; + if (!operator)return true; + switch (operator) {case'=':return(current == value);case'*=':return(current.contains(value));case'^=':return(current.substr(0, value.length) == value);case'$=':return(current.substr(current.length - value.length) == value);case'!=':return(current != value);case'~=':return current.contains(value, ' ');} + return false; + }); + return(nocash) ? elements : new Elements(elements); +}}); +function $E(selector, filter) { + return($(filter) || document).getElement(selector); +} +; +function $ES(selector, filter) { + return($(filter) || document).getElementsBySelector(selector); +} +; +$$.shared = {'regexp':/^(\w*|\*)(?:#([\w-]+)|\.([\w-]+))?(?:\[(\w+)(?:([!*^$]?=)["']?([^"'\]]*)["']?)?])?$/,'xpath':{getParam:function(items, context, param, i) { + var temp = [context.namespaceURI ? 'xhtml:' : '',param[1]]; + if (param[2])temp.push('[@id="', param[2], '"]'); + if (param[3])temp.push('[contains(concat(" ", @class, " "), " ', param[3], ' ")]'); + if (param[4]) { + if (param[5] && param[6]) { + switch (param[5]) {case'*=':temp.push('[contains(@', param[4], ', "', param[6], '")]');break;case'^=':temp.push('[starts-with(@', param[4], ', "', param[6], '")]');break;case'$=':temp.push('[substring(@', param[4], ', string-length(@', param[4], ') - ', param[6].length, ' + 1) = "', param[6], '"]');break;case'=':temp.push('[@', param[4], '="', param[6], '"]');break;case'!=':temp.push('[@', param[4], '!="', param[6], '"]');} + } else { + temp.push('[@', param[4], ']'); + } + } + items.push(temp.join('')); + return items; +},getItems:function(items, context, nocash) { + var elements = []; + var xpath = document.evaluate('.//' + items.join('//'), context, $$.shared.resolver, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); + for (var i = 0,j = xpath.snapshotLength; i < j; i++)elements.push(xpath.snapshotItem(i)); + return(nocash) ? elements : new Elements(elements.map($)); +}},'normal':{getParam:function(items, context, param, i) { + if (i == 0) { + if (param[2]) { + var el = context.getElementById(param[2]); + if (!el || ((param[1] != '*') && (Element.getTag(el) != param[1])))return false; + items = [el]; + } else { + items = $A(context.getElementsByTagName(param[1])); + } + } else { + items = $$.shared.getElementsByTagName(items, param[1]); + if (param[2])items = Elements.filterById(items, param[2], true); + } + if (param[3])items = Elements.filterByClass(items, param[3], true); + if (param[4])items = Elements.filterByAttribute(items, param[4], param[5], param[6], true); + return items; +},getItems:function(items, context, nocash) { + return(nocash) ? items : $$.unique(items); +}},resolver:function(prefix) { + return(prefix == 'xhtml') ? 'http://www.w3.org/1999/xhtml' : false; +},getElementsByTagName:function(context, tagName) { + var found = []; + for (var i = 0,j = context.length; i < j; i++)found.extend(context[i].getElementsByTagName(tagName)); + return found; +}}; +$$.shared.method = (window.xpath) ? 'xpath' : 'normal'; +Element.Methods.Dom = {getElements:function(selector, nocash) { + var items = []; + selector = selector.trim().split(' '); + for (var i = 0,j = selector.length; i < j; i++) { + var sel = selector[i]; + var param = sel.match($$.shared.regexp); + if (!param)break; + param[1] = param[1] || '*'; + var temp = $$.shared[$$.shared.method].getParam(items, this, param, i); + if (!temp)break; + items = temp; + } + return $$.shared[$$.shared.method].getItems(items, this, nocash); +},getElement:function(selector) { + return $(this.getElements(selector, true)[0] || false); +},getElementsBySelector:function(selector, nocash) { + var elements = []; + selector = selector.split(','); + for (var i = 0,j = selector.length; i < j; i++)elements = elements.concat(this.getElements(selector[i], true)); + return(nocash) ? elements : $$.unique(elements); +}}; +Element.extend({getElementById:function(id) { + var el = document.getElementById(id); + if (!el)return false; + for (var parent = el.parentNode; parent != this; parent = parent.parentNode) { + if (!parent)return false; + } + return el; +},getElementsByClassName:function(className) { + return this.getElements('.' + className); +}}); +document.extend(Element.Methods.Dom); +Element.extend(Element.Methods.Dom); +Element.extend({getValue:function() { + switch (this.getTag()) {case'select':var values = [];$each(this.options, function(option) { + if (option.selected)values.push($pick(option.value, option.text)); + });return(this.multiple) ? values : values[0];case'input':if (!(this.checked && ['checkbox','radio'].contains(this.type)) && !['hidden','text','password'].contains(this.type))break;case'textarea':return this.value;} + return false; +},getFormElements:function() { + return $$(this.getElementsByTagName('input'), this.getElementsByTagName('select'), this.getElementsByTagName('textarea')); +},toQueryString:function() { + var queryString = []; + this.getFormElements().each(function(el) { + var name = el.name; + var value = el.getValue(); + if (value === false || !name || el.disabled)return; + var qs = function(val) { + queryString.push(name + '=' + encodeURIComponent(val)); + }; + if ($type(value) == 'array')value.each(qs); else qs(value); + }); + return queryString.join('&'); +}}); +Element.extend({scrollTo:function(x, y) { + this.scrollLeft = x; + this.scrollTop = y; +},getSize:function() { + return{'scroll':{'x':this.scrollLeft,'y':this.scrollTop},'size':{'x':this.offsetWidth,'y':this.offsetHeight},'scrollSize':{'x':this.scrollWidth,'y':this.scrollHeight}}; +},getPosition:function(overflown) { + overflown = overflown || []; + var el = this,left = 0,top = 0; + do{ + left += el.offsetLeft || 0; + top += el.offsetTop || 0; + el = el.offsetParent; + } while (el); + overflown.each(function(element) { + left -= element.scrollLeft || 0; + top -= element.scrollTop || 0; + }); + return{'x':left,'y':top}; +},getTop:function(overflown) { + return this.getPosition(overflown).y; +},getLeft:function(overflown) { + return this.getPosition(overflown).x; +},getCoordinates:function(overflown) { + var position = this.getPosition(overflown); + var obj = {'width':this.offsetWidth,'height':this.offsetHeight,'left':position.x,'top':position.y}; + obj.right = obj.left + obj.width; + obj.bottom = obj.top + obj.height; + return obj; +}}); +Element.Events.domready = {add:function(fn) { + if (window.loaded) { + fn.call(this); + return; + } + var domReady = function() { + if (window.loaded)return; + window.loaded = true; + window.timer = $clear(window.timer); + this.fireEvent('domready'); + }.bind(this); + if (document.readyState && window.webkit) { + window.timer = function() { + if (['loaded','complete'].contains(document.readyState))domReady(); + }.periodical(50); + } else if (document.readyState && window.ie) { + if (!$('ie_ready')) { + var src = (window.location.protocol == 'https:') ? '://0' : 'javascript:void(0)'; + document.write(' + + + + +

PolyLines Render Tests

+ + ++ + + + + + + + + + + + + + + + +
+ Different types of PolyLines that can be used. + +
+
+ This is how multiple childs will look in each style line + +
+
+ + diff --git a/trunk/web2d/src/test/javascript/render/prototype.html b/trunk/web2d/src/test/javascript/render/prototype.html new file mode 100755 index 00000000..f7f735c0 --- /dev/null +++ b/trunk/web2d/src/test/javascript/render/prototype.html @@ -0,0 +1,168 @@ + + + + + + + + + + +

Chart prototype Tests

+ + + + + + +
+
+ + + + +Notas: +
  • El evento de mousemove se debe agregar al workspace. +
  • Cuando se esta drageando un elemento se deberia deshabilitar los eventos del resto de los elementos. +
  • Definir comportamiento del area. + + + diff --git a/trunk/web2d/src/test/javascript/render/rect.html b/trunk/web2d/src/test/javascript/render/rect.html new file mode 100755 index 00000000..6b93acd8 --- /dev/null +++ b/trunk/web2d/src/test/javascript/render/rect.html @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Rect Render Tests

    + + + + + + + + + + + + + + + + + + + + + + +
    + Straight Lines. + +
    +
    + Straight Lines. + +
    +
    + + diff --git a/trunk/web2d/src/test/javascript/render/shapes.html b/trunk/web2d/src/test/javascript/render/shapes.html new file mode 100755 index 00000000..0f7bf7ae --- /dev/null +++ b/trunk/web2d/src/test/javascript/render/shapes.html @@ -0,0 +1,386 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Element properties Tests

    + + ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Stroke Styles. + +
    +
    +
    +
    +
    +
    + Stroke Width. + +
    +
    + Stroke Opacity. + +
    +
    + Fill Opacity. + +
    +
    + Opacity. + +
    +
    + Visibility. + +
    +
    + + diff --git a/trunk/web2d/src/test/javascript/render/text.html b/trunk/web2d/src/test/javascript/render/text.html new file mode 100755 index 00000000..f2124eac --- /dev/null +++ b/trunk/web2d/src/test/javascript/render/text.html @@ -0,0 +1,104 @@ + + + + + + + + + + + +

    Text Render Tests

    + + + + + + + + + + + + + + +
    + Simple text + +
    +
    +
    +
    +
    +
    +Text to Inspect: + + + + diff --git a/trunk/web2d/src/test/javascript/render/utils.js b/trunk/web2d/src/test/javascript/render/utils.js new file mode 100755 index 00000000..6c0d008e --- /dev/null +++ b/trunk/web2d/src/test/javascript/render/utils.js @@ -0,0 +1,64 @@ +/* +* 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 $ +*/ + +Grid = function(parent, colums, rows) +{ + var cellSize = "10px"; + this._parent = parent; + this._container = this._createContainer(); + var tbody = this._container.firstChild.firstChild; + for (var i = 0; i < rows; i++) + { + var trElement = document.createElement("tr"); + for (var j = 0; j < colums; j++) + { + var tdElement = document.createElement("td"); + tdElement.style.width = cellSize; + tdElement.style.height = cellSize; + tdElement.style.borderWidth = "1px"; + tdElement.style.borderStyle = "dashed"; + tdElement.style.borderColor = "lightsteelblue"; + trElement.appendChild(tdElement); + } + tbody.appendChild(trElement); + } +}; + +Grid.prototype.setPosition = function(x, y) +{ + this._container.style.left = x; + this._container.style.top = y; +}; + +Grid.prototype.render = function() +{ + this._parent.appendChild(this._container); +}; + +Grid.prototype._createContainer = function() +{ + var result = window.document.createElement("div"); + result.style.tableLayout = "fixed"; + result.style.borderCollapse = "collapse"; + result.style.emptyCells = "show"; + result.style.position = "absolute"; + result.innerHTML = '
    '; + return result; +}; + diff --git a/trunk/web2d/src/test/javascript/render/web2dLibraryLoader.js b/trunk/web2d/src/test/javascript/render/web2dLibraryLoader.js new file mode 100644 index 00000000..31da5f34 --- /dev/null +++ b/trunk/web2d/src/test/javascript/render/web2dLibraryLoader.js @@ -0,0 +1,150 @@ +/* +* 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 $ +*/ + +// Modulue initializer. +web2d = { + peer: {} +}; + +web2d.peer = +{ + svg: {}, + vml: {} +}; + +web2d.peer.utils = {}; +web2d.Loader = +{ + load: function(scriptPath, stylePath, jsFileName) + { + var headElement = document.getElementsByTagName('head'); + var htmlDoc = headElement.item(0); + var baseUrl = this.baseUrl(jsFileName); + + if (scriptPath && scriptPath.length > 0) + { + for (var i = 0; i < scriptPath.length; i++) + { + + this.includeScriptNode(baseUrl + scriptPath[i]); + } + } + }, + baseUrl: function(jsFileName) + { + var headElement = document.getElementsByTagName('head'); + var htmlDoc = headElement.item(0); + var headChildren = htmlDoc.childNodes; + var result = null; + for (var i = 0; i < headChildren.length; i++) + { + var node = headChildren.item(i); + if (node.nodeName && node.nodeName.toLowerCase() == "script") + { + var libraryUrl = node.src; + if (libraryUrl.indexOf(jsFileName) != -1) + { + var index = libraryUrl.lastIndexOf("/"); + index = libraryUrl.lastIndexOf("/", index - 1); + result = libraryUrl.substring(0, index); + } + } + } + + if (result == null) + { + throw "Could not obtain the base url directory."; + } + return result; + }, + includeScriptNode: function(filename) { + var html_doc = document.getElementsByTagName('head').item(0); + var js = document.createElement('script'); + js.setAttribute('language', 'javascript'); + js.setAttribute('type', 'text/javascript'); + js.setAttribute('src', filename); + html_doc.appendChild(js); + return false; + }, + includeStyleNode: function(filename) { + var html_doc = document.getElementsByTagName('head').item(0); + var js = document.createElement('link'); + js.setAttribute('rel', 'stylesheet'); + js.setAttribute('type', 'text/css'); + js.setAttribute('href', filename); + html_doc.appendChild(js); + return false; + } +}; + + +web2d.JsLoader = +{ + scriptPath: [ + "/render/mootools.js", + "/../../../../core-js/target/classes/core.js", + "/../../../src/main/javascript/EventDispatcher.js", + "/../../../src/main/javascript/peer/vml/ElementPeer.js", + "/../../../src/main/javascript/peer/svg/ElementPeer.js","" + + "/../../../src/main/javascript/Element.js", + "/../../../src/main/javascript/Workspace.js", + "/../../../src/main/javascript/peer/svg/WorkspacePeer.js", + "/../../../src/main/javascript/peer/vml/WorkspacePeer.js", + "/../../../src/main/javascript/Toolkit.js", + "/../../../src/main/javascript/Elipse.js", + "/../../../src/main/javascript/peer/svg/ElipsePeer.js", + "/../../../src/main/javascript/peer/vml/ElipsePeer.js", + "/../../../src/main/javascript/Line.js", + "/../../../src/main/javascript/peer/svg/LinePeer.js", + "/../../../src/main/javascript/peer/vml/LinePeer.js", + "/../../../src/main/javascript/PolyLine.js", + "/../../../src/main/javascript/peer/svg/PolyLinePeer.js", + "/../../../src/main/javascript/peer/vml/PolyLinePeer.js", + "/../../../src/main/javascript/Group.js", + "/../../../src/main/javascript/peer/svg/GroupPeer.js", + "/../../../src/main/javascript/peer/vml/GroupPeer.js", + "/../../../src/main/javascript/Rect.js", + "/../../../src/main/javascript/peer/svg/RectPeer.js", + "/../../../src/main/javascript/peer/vml/RectPeer.js", + "/../../../src/main/javascript/Text.js", + "/../../../src/main/javascript/peer/svg/TextPeer.js", + "/../../../src/main/javascript/peer/vml/TextPeer.js", + "/../../../src/main/javascript/peer/vml/TextBoxPeer.js", + "/../../../src/main/javascript/peer/utils/TransformUtils.js", + "/../../../src/main/javascript/peer/utils/EventUtils.js", + "/../../../src/main/javascript/Font.js", + "/../../../src/main/javascript/peer/svg/Font.js", + "/../../../src/main/javascript/peer/vml/Font.js", + "/../../../src/main/javascript/peer/svg/TahomaFont.js", + "/../../../src/main/javascript/peer/svg/TimesFont.js", + "/../../../src/main/javascript/peer/svg/ArialFont.js", + "/../../../src/main/javascript/peer/svg/VerdanaFont.js", + "/../../../src/main/javascript/peer/vml/TahomaFont.js", + "/../../../src/main/javascript/peer/vml/TimesFont.js", + "/../../../src/main/javascript/peer/vml/ArialFont.js", + "/../../../src/main/javascript/peer/vml/VerdanaFont.js"], + + stylePath: [], + load: function() + { + web2d.Loader.load(this.scriptPath, this.stylePath, "web2dLibraryLoader.js"); + } +}; + +web2d.JsLoader.load(); diff --git a/trunk/web2d/src/test/javascript/render/workspace.html b/trunk/web2d/src/test/javascript/render/workspace.html new file mode 100755 index 00000000..a0a24277 --- /dev/null +++ b/trunk/web2d/src/test/javascript/render/workspace.html @@ -0,0 +1,374 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Workspace Render Tests

    + + ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + The Workspace's size defines the visible work area. If an element is outside the workspace, it must not be + visible. + In this example, The back circle is bigger than the workspace area. A big portion of the circle will not be + displayed. + +
    +
    + Workspace will be added as child of a div element. That's why, Its parent will define this position. + +
    +
    + Workspaces size can be defined using standard CSS measures. + In this example, the first workspace is defined using pixes and the second one + using inchs. + +
    +
    + +
    +
    +
    + Workspace coordsize defines how many units there are along the width of the containing block. + In all the examples,the coordsize of the workspaces have been set to (100,100) and the circles have been + positioned + at (0,0),(0,100),(100,0),(100,100)(50,50).
    +
    + 1) Workspace with CoordSize(100,100)
    + 2) Workspace with CoordSize(100,200)
    + 3) Workspace with CoordSize(200,100)
    + 4) Workspace animation changing the coordsize from (30,30) to (100,100)
    +
    +
    +
    + (1) +
    + +
    + (2) +
    + +
    + (3) +
    + +
    + (4) +
    +
    +
    + Workspace coordorigin defines the coordinate at the top left corner of the containing block. + In all the examples,the coordsize of the workspaces have been set to (100,100) and the circles have been + positioned + at (0,0),(0,100),(100,0),(100,100)(50,50).
    +
    + 1) Workspace with CoordOrigin(0,0)
    + 2) Workspace with CoordOrigin(0,50)
    + 3) Workspace with CoordOrigin(50,0)
    + 4) Workspace animation changing the coordorigin from (0,0) to (50,50)
    +
    +
    +
    + (1) +
    + +
    + (2) +
    + +
    + (3) +
    + +
    + (4) +
    +
    +
    + + diff --git a/trunk/wise-webapp/pom.xml b/trunk/wise-webapp/pom.xml new file mode 100644 index 00000000..f4255b72 --- /dev/null +++ b/trunk/wise-webapp/pom.xml @@ -0,0 +1,445 @@ + + 4.0.0 + wise-webapp + war + WiseMapping Webapp + http://www.wisemapping.org + + org.wisemapping + wisemapping + ../pom.xml + 1.0-SNAPSHOT + + + + + org.wisemapping + core-js + 1.0-SNAPSHOT + provided + + + org.wisemapping + mindplot + 1.0-SNAPSHOT + provided + + + org.apache.velocity + velocity + 1.5 + compile + + + org.testng + testng + 5.8 + test + jdk15 + + + org.springframework + spring-webmvc + 2.5.6 + compile + + + org.springframework + spring-webmvc-struts + 2.5.6 + runtime + + + org.apache.struts + struts-tiles + 1.3.8 + runtime + + + org.springframework + spring-aop + 2.5.6 + runtime + + + org.springframework + spring-orm + 2.5.6 + compile + + + org.springframework + spring-jdbc + 2.5.6 + compile + + + org.springframework.ws + spring-ws-support + 1.5.6 + compile + + + org.springframework.ws + spring-ws-core-tiger + 1.5.6 + compile + + + org.springframework.ws + spring-ws-core-tiger + 1.5.6 + compile + + + org.hibernate + hibernate + 3.1.3 + compile + + + org.apache.xmlgraphics + batik-codec + 1.7 + runtime + + + org.directwebremoting + dwr + 2.0.3 + compile + + + org.apache.xmlgraphics + batik-svg-dom + 1.7 + compile + + + xalan + xalan + + + + + org.apache.xmlgraphics + batik-transcoder + 1.7 + compile + + + xalan + xalan + + + + + com.octo.captcha + jcaptcha + 1.0 + compile + + + org.acegisecurity + acegi-security + 1.0.7 + compile + + + org.springframework + spring-core + + + org.springframework + spring-aop + + + org.springframework + spring-beans + + + org.springframework + spring-context + + + org.springframework + spring-dao + + + org.springframework + spring-jdbc + + + org.springframework + spring-support + + + org.springframework + spring-remoting + + + + + javax.servlet + servlet-api + 2.4 + provided + + + javax.servlet + jstl + 1.2 + runtime + + + javax.mail + mail + 1.4 + compile + + + mysql + mysql-connector-java + 5.1.5 + runtime + + + commons-dbcp + commons-dbcp + 1.2.2 + runtime + + + commons-fileupload + commons-fileupload + 1.2.1 + runtime + + + log4j + log4j + 1.2.9 + compile + + + + hsqldb + hsqldb + 1.8.0.7 + runtime + + + + + + + org.codehaus.mojo + sql-maven-plugin + 1.2 + + + org.hsqldb.jdbcDriver + jdbc:hsqldb:file:${basedir}/target/db/wisemapping + sa + + ${maven.test.skipDB} + + + + + mysql + mysql-connector-java + 5.1.5 + + + hsqldb + hsqldb + 1.8.0.1 + + + + + + drop-schemas + test + + execute + + + continue + ascending + + ${basedir} + + src/test/sql/hsql/drop-schemas.sql + + + + + + create-schema + test + + execute + + + ascending + + ${basedir} + + src/test/sql/hsql/create-schemas.sql + + + + + + create-data + test + + execute + + + ascending + + ${basedir} + + src/test/sql/hsql/test-data.sql + + + + + + + + + maven-war-plugin + + wisemapping + + + org.wisemapping + core-js + jar + js + + *.js + + + + org.wisemapping + mindplot + jar + js + + *.js + + + + true + + + src/main/resources + WEB-INF + + *.wsdl + *.xsd + + + + + + + + net.sf.alchim + yuicompressor-maven-plugin + + + generate-resources + + compress + + + + + + ${project.build.directory}/${project.build.finalName}/js/wiseLibrary.js + + + mootools.js + common.js + shadedborder.js + transcorners.js + windoo.js + menu.js + slideShow.js + mooRainbow.js + help.js + helpPanel.js + IconPanel.js + + + + true + true + false + false + + + + + + org.codehaus.mojo + jaxws-maven-plugin + + + generate-sources + + wsimport + + + + + ${project.build.directory}/generated-sources/jaxws + ${project.build.directory}/generated-sources/jaxws + 2.1 + com.wisemapping.ws + ${basedir}/src/main/resources/ + + wiseservices.wsdl + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + testng.xml + + WiseWebServicesGroup + + + + + + org.mortbay.jetty + maven-jetty-plugin + + false + + + 8080 + 60000 + + + ${project.build.directory}/wisemapping.war + + + + + diff --git a/trunk/wise-webapp/src/license.txt b/trunk/wise-webapp/src/license.txt new file mode 100644 index 00000000..9f45ba26 --- /dev/null +++ b/trunk/wise-webapp/src/license.txt @@ -0,0 +1,19 @@ +/* +* 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 $ +*/ + diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ActivationController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ActivationController.java new file mode 100755 index 00000000..3daee656 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ActivationController.java @@ -0,0 +1,73 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.service.UserService; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.Controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +public class ActivationController + implements Controller, InitializingBean +{ + + //~ Instance fields ...................................................................................... + private UserService userService; + + //~ Methods .............................................................................................. + + public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) + throws Exception + { + ModelAndView modelAndView; + try + { + final String code = request.getParameter("code"); + userService.activateAcount(Long.parseLong(code)); + modelAndView = new ModelAndView("activationAccountConfirmation"); + } + catch (Throwable exc) + { + // TODO Fix it ! + exc.printStackTrace(); + // Any type of error + modelAndView = new ModelAndView("activationAccountConfirmationFail"); + } + return modelAndView; + } + + public void setUserService(UserService userService) { + this.userService = userService; + } + + /** + * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() + */ + public void afterPropertiesSet() + throws Exception { + if (userService == null) { + throw new RuntimeException("userService was not set!"); + } + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/BaseMultiActionController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/BaseMultiActionController.java new file mode 100644 index 00000000..97bf7fb6 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/BaseMultiActionController.java @@ -0,0 +1,159 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.model.MindMap; +import com.wisemapping.model.MindMapCriteria; +import com.wisemapping.model.MindmapUser; +import com.wisemapping.model.User; +import com.wisemapping.security.Utils; +import com.wisemapping.service.MindmapService; +import com.wisemapping.service.UserService; +import com.wisemapping.view.MindMapBean; +import org.springframework.web.servlet.mvc.multiaction.MultiActionController; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; + +public abstract class BaseMultiActionController + extends MultiActionController { + + private MindmapService mindmapService; + private UserService userService; + + protected List getMindmapUsersFromRequest(HttpServletRequest request) { + List result = new ArrayList(); + final String mindmapIds = request.getParameter("mindmapIds"); + + final String ids[] = mindmapIds.split(","); + for (String id : ids) + if (mindmapIds.length()!=0){ + result.add(getMindmapUser(Integer.parseInt(id), request)); + } + return result; + } + + protected List getMindmapsFromRequest(HttpServletRequest request) { + List result = new ArrayList(); + final String mindmapIds = request.getParameter("mindmapIds"); + + final String ids[] = mindmapIds.split(","); + for (String id : ids) { + MindMap map = mindmapService.getMindmapById(Integer.parseInt(id)); + result.add(map); + } + return result; + } + + protected List getMindMapBeanList(User user) { + final List userMindmaps = getMindmapService().getMindmapUserByUser(user); + + final List mindMapBeans = new ArrayList(userMindmaps.size()); + for (MindmapUser mindmap : userMindmaps) { + mindMapBeans.add(new MindMapBean(mindmap.getMindMap())); + } + return mindMapBeans; + } + + protected MindMapCriteria getMindMapCriteriaFromRequest(HttpServletRequest request) { + final MindMapCriteria criteria = new MindMapCriteria(); + + final String titleOrTags = request.getParameter("titleOrTags"); + if (titleOrTags != null && titleOrTags.length() != 0) { + criteria.orCriteria(); + criteria.setTitle(titleOrTags); + final String tag[] = titleOrTags.split(MindmapService.TAG_SEPARATOR); + // Add new Tags to User + for (String searchTag : tag) { + criteria.getTags().add(searchTag); + } + } + + final String title = request.getParameter("name"); + if (title != null && title.length() != 0) { + criteria.setTitle(title); + } + final String description = request.getParameter("description"); + if (description != null && description.length() != 0) { + criteria.setDescription(description); + } + + final String tags = request.getParameter("tags"); + if (tags != null && tags.length() != 0) { + final String tag[] = tags.split(MindmapService.TAG_SEPARATOR); + // Add new Tags to User + for (String searchTag : tag) { + criteria.getTags().add(searchTag); + } + } + + return criteria; + } + + protected MindMap getMindmapFromRequest(HttpServletRequest request) { + final String mapIdStr = request.getParameter(MAP_ID_PARAMNAME); + assert mapIdStr != null : "mapId parameter can not be null"; + logger.info("MapIdStr:" + mapIdStr); + MindMap map = null; + int mapId; + try + { + mapId = Integer.parseInt(mapIdStr); + map = mindmapService.getMindmapById(mapId); + } + catch (Exception e) + { + logger.debug("An error ocurred trying to get mapId "+ mapIdStr + "'",e); + } + + if (map == null) { + throw new IllegalStateException("Map with id '" + mapIdStr + "' can not be found"); + } + return map; + } + + private MindmapUser getMindmapUser(Integer mapId, HttpServletRequest request) { + assert mapId != null : "EDIT action: mindmapId is required!"; + assert request != null : "EDIT action: request is required!"; + final User user = Utils.getUser(request); + return mindmapService.getMindmapUserBy(mapId, user); + } + + public MindmapService getMindmapService() { + return mindmapService; + } + + public void setMindmapService(MindmapService mindmapService) { + this.mindmapService = mindmapService; + } + + public UserService getUserService() { + return userService; + } + + public void setUserService(UserService userService) { + this.userService = userService; + } + + public static final String MAP_ID_PARAMNAME = "mapId"; + public static final String MINDMAP_EMAILS_PARAMNAME = "userEmails"; + public static final String MINDMAP_EMAIL_PARAMNAME = "userEmail"; +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/BaseSimpleFormController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/BaseSimpleFormController.java new file mode 100644 index 00000000..86805ed0 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/BaseSimpleFormController.java @@ -0,0 +1,84 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.model.MindMap; +import com.wisemapping.service.MindmapService; +import com.wisemapping.service.UserService; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.SimpleFormController; + +import javax.servlet.http.HttpServletRequest; + + +public class BaseSimpleFormController extends SimpleFormController +{ + + private MindmapService mindmapService; + private UserService userService; + private String errorView; + + public UserService getUserService() { + return userService; + } + + public void setUserService(UserService userService) { + this.userService = userService; + } + + public MindmapService getMindmapService() { + return mindmapService; + } + + public void setMindmapService(MindmapService mindmapService) { + this.mindmapService = mindmapService; + } + + public String getErrorView() { + return errorView; + } + + public void setErrorView(String errorView) { + this.errorView = errorView; + } + + @Override protected org.springframework.web.servlet.ModelAndView showForm(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, org.springframework.validation.BindException bindException) throws java.lang.Exception + { + final ModelAndView view = super.showForm(httpServletRequest, httpServletResponse,bindException); + final String viewName = getErrorView(); + if(viewName !=null && bindException.getAllErrors().size()>0) + { + view.setViewName(viewName); + view.addObject("errorView",true); + } + return view; + } + + /* TODO codigo repetido en BaseMultiActionController */ + protected MindMap getMindmapFromRequest(HttpServletRequest request) { + final String mapIdStr = request.getParameter(BaseMultiActionController.MAP_ID_PARAMNAME); + assert mapIdStr != null : "mapId parameter can not be null"; + logger.info("MapIdStr:" + mapIdStr); + int mapId = Integer.parseInt(mapIdStr); + return mindmapService.getMindmapById(mapId); + } +} + + diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/CaptchaController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/CaptchaController.java new file mode 100644 index 00000000..347f4399 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/CaptchaController.java @@ -0,0 +1,94 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; + +import javax.servlet.ServletOutputStream; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.InitializingBean; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.Controller; + +import com.octo.captcha.service.image.ImageCaptchaService; + +import com.sun.image.codec.jpeg.JPEGCodec; +import com.sun.image.codec.jpeg.JPEGImageEncoder; + +public class CaptchaController + implements Controller, InitializingBean +{ + private ImageCaptchaService captchaService; + + public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) + throws Exception + { + + byte[] captchaChallengeAsJpeg; + // the output stream to render the captcha image as jpeg into + final ByteArrayOutputStream jpegOutputStream = new ByteArrayOutputStream(); + + // get the session id that will identify the generated captcha. + //the same id must be used to validate the response, the session id is a good candidate! + final String captchaId = request.getSession().getId(); + + // call the ImageCaptchaService getChallenge method + final BufferedImage challenge = captchaService.getImageChallengeForID(captchaId,request.getLocale()); + + // a jpeg encoder + final JPEGImageEncoder jpegEncoder = JPEGCodec.createJPEGEncoder(jpegOutputStream); + jpegEncoder.encode(challenge); + + captchaChallengeAsJpeg = jpegOutputStream.toByteArray(); + + // flush it in the response + response.setHeader("Cache-Control", "no-store"); + response.setHeader("Pragma", "no-cache"); + response.setDateHeader("Expires", 0); + response.setContentType("image/jpeg"); + final ServletOutputStream responseOutputStream = response.getOutputStream(); + responseOutputStream.write(captchaChallengeAsJpeg); + responseOutputStream.flush(); + responseOutputStream.close(); + return null; + } + + /** Set captcha service + * @param captchaService The captchaService to set. + */ + public void setCaptchaService(ImageCaptchaService captchaService) { + this.captchaService = captchaService; + } + + /** + * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() + */ + public void afterPropertiesSet() + throws Exception + { + if(captchaService == null){ + throw new RuntimeException("captcha service wasn`t set!"); + } + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/CaptchaFormController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/CaptchaFormController.java new file mode 100644 index 00000000..61ce78e3 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/CaptchaFormController.java @@ -0,0 +1,110 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.octo.captcha.service.CaptchaServiceException; +import com.octo.captcha.service.image.ImageCaptchaService; +import org.springframework.validation.BindException; +import org.springframework.web.servlet.mvc.SimpleFormController; + +import javax.servlet.http.HttpServletRequest; + +/** + * Convenient superclass for form controller implementations which need + * CAPTCHA support. + */ +public class CaptchaFormController extends SimpleFormController { + /** + * Default paramter name for CAPTCHA response in {@link HttpServletRequest} + */ + private static final String DEFAULT_CAPTCHA_RESPONSE_PARAMETER_NAME = "j_captcha_response"; + + protected ImageCaptchaService captchaService; + protected String captchaResponseParameterName = DEFAULT_CAPTCHA_RESPONSE_PARAMETER_NAME; + + /** + * Delegates request to CAPTCHA validation, subclasses which overrides this + * method must manually call {@link #validateCaptcha(HttpServletRequest,BindException)} + * or explicitly call super method. + * + * @see #validateCaptcha(HttpServletRequest,BindException) + * @see org.springframework.web.servlet.mvc.BaseCommandController#onBindAndValidate(javax.servlet.http.HttpServletRequest,java.lang.Object,org.springframework.validation.BindException) + */ + @Override + protected void onBindAndValidate(HttpServletRequest request, Object command, BindException errors) throws Exception { + validateCaptcha(request, errors); + } + + /** + * Validate CAPTCHA response, if response isn`t valid creates new error object + * and put him to errors holder. + * + * @param request current servlet request + * @param errors errors holder + */ + protected void validateCaptcha(HttpServletRequest request, BindException errors) { + boolean isResponseCorrect = false; + + //remenber that we need an id to validate! + String captchaId = request.getSession().getId(); + //retrieve the response + String response = request.getParameter(captchaResponseParameterName); + //validate response + try { + if (response != null) { + isResponseCorrect = + captchaService.validateResponseForID(captchaId, response); + } + } catch (CaptchaServiceException e) { + //should not happen, may be thrown if the id is not valid + } + + if (!isResponseCorrect) { + //prepare object error, captcha response isn`t valid +// String objectName = "Captcha"; +// String[] codes = {"invalid"}; +// Object[] arguments = {}; +// String defaultMessage = "Wrong control text!"; +// ObjectError oe = new ObjectError(objectName, codes, arguments, defaultMessage); +// +// errors.addError(oe); + errors.rejectValue("captcha", Messages.CAPTCHA_ERROR); + } + } + + /** + * Set captcha service + * + * @param captchaService the captchaService to set. + */ + public void setCaptchaService(ImageCaptchaService captchaService) { + this.captchaService = captchaService; + } + + /** + * Set paramter name for CAPTCHA response in {@link HttpServletRequest} + * + * @param captchaResponseParameterName the captchaResponseParameterName to set. + */ + public void setCaptchaResponseParameterName(String captchaResponseParameterName) { + this.captchaResponseParameterName = captchaResponseParameterName; + } +} + diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ChangePasswordController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ChangePasswordController.java new file mode 100644 index 00000000..832a356f --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ChangePasswordController.java @@ -0,0 +1,63 @@ +/* +* 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 $ +*/ + +// ........................................................................................................... +// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved +// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc. +// The copyright notice above does not evidence any actual or intended +// publication of such source code. +// +// Last changed on 2007-04-03 09:29:20 (-0300), by: nachomanz. $Revision$ +// ........................................................................................................... + +package com.wisemapping.controller; + +import com.wisemapping.model.User; +import com.wisemapping.security.Utils; +import com.wisemapping.service.UserService; +import com.wisemapping.view.ChangePasswordBean; +import org.springframework.validation.BindException; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ChangePasswordController + extends BaseSimpleFormController { + + //~ Methods .............................................................................................. + + public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, + BindException errors) + throws ServletException { + final ChangePasswordBean bean = (ChangePasswordBean) command; + // Reload user only in case of beeing necessary... + final User model = Utils.getUser(request); + + final UserService userService = this.getUserService(); + final User user = userService.reloadUser(model); + + user.setPassword(bean.getPassword()); + userService.changePassword(user); + + return new ModelAndView(getSuccessView()); + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/EditProfileController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/EditProfileController.java new file mode 100755 index 00000000..823978be --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/EditProfileController.java @@ -0,0 +1,66 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.model.User; +import com.wisemapping.security.Utils; +import com.wisemapping.service.UserService; +import com.wisemapping.view.UserBean; +import org.springframework.validation.BindException; +import org.springframework.web.servlet.ModelAndView; + + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class EditProfileController extends BaseSimpleFormController { + + + protected Object formBackingObject(HttpServletRequest httpServletRequest) throws Exception { + final User model = Utils.getUser(httpServletRequest); + return new UserBean(model); + } + + //~ Methods .............................................................................................. + + public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, + BindException errors) + throws ServletException { + final UserBean bean = (UserBean) command; + final UserService userService = this.getUserService(); + + // Reload user only in case of beeing necessary... + final User model = Utils.getUser(request); + final User user = userService.reloadUser(model); + + user.setFirstname(bean.getFirstname()); + user.setLastname(bean.getLastname()); + // trim() the email email in order to remove spaces + user.setEmail(bean.getEmail().trim()); + user.setAllowSendEmail(bean.isAllowSendEmail()); + + // Sync Acegi user and DB user + model.setAllowSendEmail(bean.isAllowSendEmail()); + userService.updateUser(user); + + return new ModelAndView(getSuccessView()); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/EmbeddedViewController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/EmbeddedViewController.java new file mode 100644 index 00000000..7a2c323c --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/EmbeddedViewController.java @@ -0,0 +1,80 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.wisemapping.model.MindMap; +import com.wisemapping.filter.UserAgent; + +import java.lang.reflect.UndeclaredThrowableException; + +public class EmbeddedViewController extends BaseMultiActionController { + + protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + + ModelAndView view; + try { + final MindMap mindmap = this.getMindmapFromRequest(httpServletRequest); + if (mindmap == null) { + throw new IllegalStateException("Map could not be found"); + } + + final String fullViewStr = httpServletRequest.getParameter("fullView"); + final boolean fullView = Boolean.parseBoolean(fullViewStr); + + final UserAgent userAgent = UserAgent.create(httpServletRequest); + + if (userAgent.isBrowserSupported()) { + view = new ModelAndView("embeddedView"); + view.addObject("mindmap", mindmap); + final String xmlMap = mindmap.getNativeXmlAsJsLiteral(); + view.addObject("mapXml", xmlMap); + + final String zoomStr = httpServletRequest.getParameter("zoom"); + float zoom = 1; + if(zoomStr!=null) + { + try { + zoom = Float.parseFloat(zoomStr); + } catch (NumberFormatException e) { + } + } + view.addObject("zoom",zoom); + + } else { + + view = new ModelAndView("embeddedViewImg"); + view.addObject("mindmap", mindmap); + } + view.addObject("fullView", fullView); + + } catch (UndeclaredThrowableException e) { + // Security exception .... + view = new ModelAndView("embeddedViewError"); + } + + return view; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java new file mode 100644 index 00000000..d02dd641 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java @@ -0,0 +1,166 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.exporter.ExportFormat; +import com.wisemapping.model.MindMap; +import com.wisemapping.service.MindmapService; +import com.wisemapping.view.MindMapBean; +import com.wisemapping.exporter.ExportProperties; +import com.wisemapping.filter.UserAgent; +import org.apache.batik.transcoder.TranscoderException; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; + +import javax.servlet.ServletOutputStream; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.xml.bind.JAXBException; +import java.io.IOException; + +public class ExportController extends BaseMultiActionController { + private static final String IMG_EXPORT_FORMAT = "IMG_EXPORT_FORMAT"; + private static final String MAP_ID_PARAMETER = "mapId"; + private static final String EXPORT_FORMAT_PARAMETER = "exportFormat"; + private static final String IMG_SIZE_PARAMETER = "imgSize"; + + + public ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + logger.info("Mindmap Controller: EXPORT action"); + final MindMap mindmap = getMindmapFromRequest(httpServletRequest); + return new ModelAndView("mindmapExport", "mindmap", new MindMapBean(mindmap)); + } + + public ModelAndView export(HttpServletRequest request, HttpServletResponse response) throws TranscoderException, IOException, JAXBException { + logger.info("Export Controller: exporting WiseMap action"); + + final String mapIdStr = request.getParameter(MAP_ID_PARAMETER); + if (mapIdStr != null) { + try { + + int mindmapId = Integer.parseInt(mapIdStr); + + String formatStr = request.getParameter(EXPORT_FORMAT_PARAMETER); + if (IMG_EXPORT_FORMAT.endsWith(formatStr)) { + formatStr = request.getParameter("imgFormat"); + } + + final MindmapService service = getMindmapService(); + final MindMap mindMap = service.getMindmapById(mindmapId); + + // Build format properties ... + final ExportFormat format = ExportFormat.valueOf(formatStr); + final ExportProperties properties = ExportProperties.create(format); + if (properties instanceof ExportProperties.ImageProperties) { + final String sizeStr = request.getParameter(IMG_SIZE_PARAMETER); + final ExportProperties.ImageProperties imageProperties = (ExportProperties.ImageProperties) properties; + if (sizeStr != null) { + final ExportProperties.ImageProperties.Size size = ExportProperties.ImageProperties.Size.valueOf(sizeStr); + imageProperties.setSize(size); + } else { + imageProperties.setSize(ExportProperties.ImageProperties.Size.LARGE); + } + } + + // Change image link URL. + setBaseBaseImgUrl(format, properties); + + // Set format content type... + final String contentType = format.getContentType(); + response.setContentType(contentType); + + // Set file name... + final String fileName = mindMap.getTitle() + "." + format.getFileExtension(); + response.setHeader("Content-Disposition", "attachment;filename=" + fileName); + + // Write content ... + final ServletOutputStream outputStream = response.getOutputStream(); + mindMap.export(properties, outputStream); + + + } catch (Throwable e) { + logger.error("Unexpexted error during export process", e); + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + } + } else { + logger.warn("mapIdStr is null.Image could not be imported. UserAgent:" + request.getHeaders(UserAgent.USER_AGENT_HEADER)); + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + } + return null; + } + + private void setBaseBaseImgUrl(ExportFormat format, ExportProperties properties) { + + final String baseUrl; + if (format == ExportFormat.SVG) { + baseUrl = "http://www.wisemapping.com/images"; + } else { + final ServletContext servletContext = this.getServletContext(); + baseUrl = "file://" + servletContext.getRealPath("/images/"); + } + properties.setBaseImagePath(baseUrl); + } + + public ModelAndView print(HttpServletRequest request, HttpServletResponse response) throws TranscoderException, IOException, JAXBException { + logger.info("Export Controller: printing WiseMap action"); + + final String mapIdStr = request.getParameter(MAP_ID_PARAMETER); + int mindmapId = Integer.parseInt(mapIdStr); + final MindmapService service = getMindmapService(); + final MindMap mindMap = service.getMindmapById(mindmapId); + + return new ModelAndView("mindmapPrint", "mindmap", mindMap); + + } + + public ModelAndView image(HttpServletRequest request, HttpServletResponse response) throws TranscoderException, IOException, JAXBException { + try { + logger.info("Export Controller: generating image WiseMap action"); + + final String mapIdStr = request.getParameter(MAP_ID_PARAMETER); + int mindmapId = Integer.parseInt(mapIdStr); + final MindmapService service = getMindmapService(); + final MindMap mindMap = service.getMindmapById(mindmapId); + + //Image Format + ExportFormat imageFormat = ExportFormat.PNG; + + // Build format properties ... + final ExportProperties.ImageProperties imageProperties = new ExportProperties.ImageProperties(imageFormat); + imageProperties.setSize(ExportProperties.ImageProperties.Size.XMEDIUM); + + // Change image link URL. + setBaseBaseImgUrl(imageFormat, imageProperties); + + // Set format content type... + response.setContentType(imageFormat.getContentType()); + + // Write content ... + final ServletOutputStream outputStream = response.getOutputStream(); + mindMap.export(imageProperties, outputStream); + + + } catch (Throwable e) { + logger.error("Unexpexted error generating the image", e); + } + return null; + } +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ForgotPasswordController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ForgotPasswordController.java new file mode 100755 index 00000000..5148fc27 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ForgotPasswordController.java @@ -0,0 +1,67 @@ +/* +* 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 $ +*/ + + +// ........................................................................................................... +// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved +// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc. +// The copyright notice above does not evidence any actual or intended +// publication of such source code. +// +// Last changed on 2007-04-03 09:29:20 (-0300), by: nachomanz. $Revision$ +// ........................................................................................................... + +package com.wisemapping.controller; + +import com.wisemapping.exceptions.EmailNotExistsException; +import com.wisemapping.service.InvalidUserEmailException; +import com.wisemapping.service.UserService; +import com.wisemapping.view.ForgotPasswordBean; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.RedirectView; + +import javax.servlet.ServletException; + +public class ForgotPasswordController + extends BaseSimpleFormController +{ + + //~ Instance fields ...................................................................................... + + private UserService userService; + + //~ Methods .............................................................................................. + + public ModelAndView onSubmit(Object command) + throws ServletException, EmailNotExistsException { + + final ForgotPasswordBean bean = (ForgotPasswordBean) command; + try { + userService.sendEmailPassword(bean.getEmail()); + } catch (InvalidUserEmailException e) { + throw new EmailNotExistsException(e); + } + return new ModelAndView(new RedirectView(getSuccessView())); + } + + public void setUserService(UserService userService) + { + this.userService = userService; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/HistoryController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/HistoryController.java new file mode 100755 index 00000000..0b9b90f8 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/HistoryController.java @@ -0,0 +1,83 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.model.MindMap; +import com.wisemapping.model.MindMapHistory; +import com.wisemapping.view.HistoryBean; +import com.wisemapping.view.MindMapBean; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class HistoryController + extends BaseMultiActionController +{ + private static final String HISTORY_ID = "historyId"; + + public ModelAndView list(HttpServletRequest request, HttpServletResponse response) + throws java.lang.Exception { + + final MindMap map = getMindmapFromRequest(request); + final List historyBeanList = createHistoryBeanList(map); + + final Map attr = new HashMap(); + attr.put("minmap",new MindMapBean(map)); + attr.put("goToMindmapList",request.getParameter("goToMindmapList")); + attr.put("historyBeanList",historyBeanList); + return new ModelAndView("mindmapHistory",attr); + } + + public ModelAndView revert(HttpServletRequest request, HttpServletResponse response) + throws java.lang.Exception { + + final MindMap map = getMindmapFromRequest(request); + final int revertId = Integer.parseInt(request.getParameter(HISTORY_ID)); + getMindmapService().revertMapToHistory(map, revertId); + final StringBuilder redirectionTo = new StringBuilder("redirect:"); + + String goToMindmapList = request.getParameter("goToMindmapList"); + if (goToMindmapList != null) + { + redirectionTo.append("mymaps.htm"); + } + else + { + redirectionTo.append("editor.htm?mapId="); + redirectionTo.append(map.getId()); + redirectionTo.append("&action=open"); + } + return new ModelAndView(redirectionTo.toString()); + } + + private List createHistoryBeanList(MindMap map) { + final List list = getMindmapService().getMindMapHistory(map.getId()); + final List historyBeanList = new ArrayList(list.size()); + for (MindMapHistory mindMapHistory : list) { + historyBeanList.add(new HistoryBean(mindMapHistory.getMindmapId(),mindMapHistory.getId(),mindMapHistory.getCreator(),mindMapHistory.getCreationTime())); + } + return historyBeanList; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ImportController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ImportController.java new file mode 100644 index 00000000..0d3802ee --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/ImportController.java @@ -0,0 +1,74 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.exceptions.WiseMappingException; +import com.wisemapping.importer.ImporterException; +import com.wisemapping.model.MindMap; +import com.wisemapping.model.User; +import com.wisemapping.security.Utils; +import com.wisemapping.service.MindmapService; +import com.wisemapping.service.UserService; +import com.wisemapping.view.ImportMapBean; +import org.springframework.validation.BindException; +import org.springframework.web.bind.ServletRequestDataBinder; +import org.springframework.web.multipart.support.StringMultipartFileEditor; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ImportController + extends BaseSimpleFormController { + + //~ Methods .............................................................................................. + protected Object formBackingObject(HttpServletRequest httpServletRequest) throws Exception { + return new ImportMapBean(); + } + + public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) + throws ServletException, WiseMappingException, ImporterException { + final ImportMapBean bean = (ImportMapBean) command; + + User user = Utils.getUser(); + final UserService userService = this.getUserService(); + + user = userService.getUserBy(user.getId()); + final MindMap mindMap = bean.getImportedMap(); + mindMap.setOwner(user); + + final MindmapService mindmapService = this.getMindmapService(); + mindmapService.addMindmap(mindMap,user); + + final StringBuilder redirectionTo = new StringBuilder("redirect:editor.htm?mapId="); + redirectionTo.append(mindMap.getId()); + redirectionTo.append("&action=open"); + return new ModelAndView(redirectionTo.toString()); + } + + protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) + throws ServletException { + // to actually be able to convert Multipart instance to a String + // we have to register a custom editor + binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); + // now Spring knows how to handle multipart object and convert them + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/KeyboardController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/KeyboardController.java new file mode 100644 index 00000000..06de0435 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/KeyboardController.java @@ -0,0 +1,37 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class KeyboardController extends BaseMultiActionController { + public ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return newsPage(httpServletRequest, httpServletResponse); + } + + public ModelAndView newsPage(HttpServletRequest request, HttpServletResponse response) { + logger.info("Keyboard"); + return new ModelAndView("keyboard"); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/LoginController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/LoginController.java new file mode 100755 index 00000000..f0cdb243 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/LoginController.java @@ -0,0 +1,63 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.model.UserLogin; +import com.wisemapping.model.User; +import com.wisemapping.security.Utils; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Calendar; + +public class LoginController + extends BaseMultiActionController { + + protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest request, HttpServletResponse httpServletResponse) throws Exception { + // Reload user only in case of beeing necessary... + final User user = Utils.getUser(request); + + ModelAndView result; + if (user != null) { + result = new ModelAndView("forward:/c/mymaps.htm"); + + } else { + result = new ModelAndView("login"); + } + + return result; + } + + public ModelAndView auditLogin(HttpServletRequest request, HttpServletResponse response) { + logger.info("Login Controller: auditLogin"); + + final String username = request.getUserPrincipal().getName(); + + final UserLogin userLogin = new UserLogin(); + final Calendar now = Calendar.getInstance(); + userLogin.setLoginDate(now); + userLogin.setEmail(username); + //userManager.auditLogin(userLogin); + + return new ModelAndView("forward:/c/mymaps.htm"); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/Messages.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/Messages.java new file mode 100644 index 00000000..033219af --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/Messages.java @@ -0,0 +1,31 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +public interface Messages { + String EMAIL_ALREADY_EXIST = "EMAIL_ALREADY_EXIST"; + String NO_VALID_EMAIL_ADDRESS = "NO_VALID_EMAIL_ADDRESS"; + String USERNAME_ALREADY_EXIST = "USERNAME_ALREADY_EXIST"; + String FIELD_REQUIRED = "FIELD_REQUIRED"; + String IMPORT_MAP_ERROR = "IMPORT_MAP_ERROR"; + String MAP_TITLE_ALREADY_EXISTS = "MAP_TITLE_ALREADY_EXISTS"; + String PASSWORD_MISSMATCH = "PASSWORD_MISSMATCH"; + String CAPTCHA_ERROR = "CAPTCHA_ERROR"; +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapController.java new file mode 100644 index 00000000..5d8826e7 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapController.java @@ -0,0 +1,145 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.model.MindMap; +import com.wisemapping.model.MindmapUser; +import com.wisemapping.model.User; +import com.wisemapping.security.Utils; +import com.wisemapping.view.MindMapBean; +import com.wisemapping.filter.UserAgent; +import com.wisemapping.exceptions.WiseMappingException; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.util.List; + +public class MindmapController extends BaseMultiActionController { + protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return list(httpServletRequest, httpServletResponse); + } + + public ModelAndView list(HttpServletRequest request, HttpServletResponse response) { + logger.info("Mindmap Controller: myMindmap action"); + final HttpSession session = request.getSession(false); + + // Try to loaded from the request ... + UserAgent userAgent = null; + if (session != null) { + userAgent = (UserAgent) session.getAttribute(USER_AGENT); + } + + // I could not loaded. I will create a new one... + if (userAgent == null) { + userAgent = UserAgent.create(request); + if (session != null) { + session.setAttribute(USER_AGENT, userAgent); + } + } + + // It's a supported browser ?. + final UserAgent.OS os = userAgent.getOs(); + + final User user = Utils.getUser(request); + final ModelAndView view = new ModelAndView("mindmapList", "wisemapsList", getMindMapBeanList(user)); + view.addObject("isMAC", os == UserAgent.OS.MAC); + view.addObject("user", user); + return view; + } + + public ModelAndView edit(HttpServletRequest request, HttpServletResponse response) { + logger.info("Mindmap Controller: EDIT action"); + final MindMap mindmap = getMindmapFromRequest(request); + return new ModelAndView("mindmapEditor", "wisemapsList", new MindMapBean(mindmap)); + } + + public ModelAndView collaborator(HttpServletRequest request, HttpServletResponse response) { + logger.info("Mindmap Controller: COLLABORATE action"); + final MindMap mindmap = getMindmapFromRequest(request); + return new ModelAndView("mindmapCollaborator", "mindmap", new MindMapBean(mindmap)); + } + + public ModelAndView viewer(HttpServletRequest request, HttpServletResponse response) { + logger.info("Mindmap Controller: VIEWER action"); + final MindMap mindmap = getMindmapFromRequest(request); + return new ModelAndView("mindmapViewer", "wisemapsList", new MindMapBean(mindmap)); + } + + public ModelAndView delete(HttpServletRequest request, HttpServletResponse response) throws WiseMappingException { + logger.info("Mindmap Controller: DELETE action"); + final User user = Utils.getUser(request); + + final MindMap mindmap = getMindmapFromRequest(request); + getMindmapService().removeColaboratorFromMindmap(mindmap, user.getId()); + + return list(request, response); + } + + public ModelAndView deleteAll(HttpServletRequest request, HttpServletResponse response) throws WiseMappingException { + logger.info("Mindmap Controller: DELETE ALL action"); + + final List mindmaps = getMindmapUsersFromRequest(request); + final User user = Utils.getUser(request); + for (MindmapUser mindmap : mindmaps) + getMindmapService().removeMindmap(mindmap.getMindMap(), user); + return list(request, response); + } + + public ModelAndView detail(HttpServletRequest request, HttpServletResponse response) { + logger.info("Mindmap Controller: DETAIL action"); + final MindMap mindMap = getMindmapFromRequest(request); + final ModelAndView view = new ModelAndView("mindmapDetail", "wisemapDetail", new MindMapBean(mindMap)); + view.addObject("user", Utils.getUser()); + return view; + } + + public ModelAndView changeStatus(HttpServletRequest request, HttpServletResponse response) throws WiseMappingException { + final MindMap mindmap = getMindmapFromRequest(request); + boolean isPublic = !mindmap.isPublic(); + mindmap.setPublic(isPublic); + getMindmapService().updateMindmap(mindmap, false); + return new ModelAndView("mindmapDetail", "wisemapDetail", new MindMapBean(mindmap)); + } + + public ModelAndView editMindmap(HttpServletRequest request, HttpServletResponse response) throws WiseMappingException { + final MindMap mindmap = getMindmapFromRequest(request); + final ModelAndView view = new ModelAndView("editMindmap", "mindmap", new MindMapBean(mindmap)); + view.addObject("user", Utils.getUser()); + return view; + } + + public ModelAndView updateMindmap(HttpServletRequest request, HttpServletResponse response) throws WiseMappingException { + final MindMap mindmap = getMindmapFromRequest(request); + + final String title = request.getParameter("title"); + final String description = request.getParameter("description"); + + mindmap.setTitle(title); + mindmap.setDescription(description); + + getMindmapService().updateMindmap(mindmap, false); + return list(request, response); + } + + private static final String USER_AGENT = "wisemapping.userAgent"; +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapCooker.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapCooker.java new file mode 100644 index 00000000..95883114 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapCooker.java @@ -0,0 +1,64 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.wisemapping.model.MindMap; + +/** + * Usage: http://localhost:8080/wisemapping/c/cooker.htm?action=edit&mapId=12 + */ +public class MindmapCooker extends BaseMultiActionController { + + public static final String MINDMAP_ID_PARAMETER = "mapId"; + public static final String MAP_XML_PARAM = "mapXml"; + + public ModelAndView edit(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + + final String mindmapId = httpServletRequest.getParameter(MINDMAP_ID_PARAMETER); + final int mapId = Integer.parseInt(mindmapId); + final MindMap mindmap = getMindmapService().getMindmapById(mapId); + + // Mark as try mode... + final ModelAndView view = new ModelAndView("mindmapCooker", "mindmap", mindmap); + return view; + } + + public ModelAndView save(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + + final String mindmapId = httpServletRequest.getParameter(MINDMAP_ID_PARAMETER); + final int mapId = Integer.parseInt(mindmapId); + final MindMap mindmap = getMindmapService().getMindmapById(mapId); + + String nativeXml = httpServletRequest.getParameter("nativeXml"); + mindmap.setNativeXml(nativeXml); + + getMindmapService().updateMindmap(mindmap, false); + + // Mark as try mode... + final ModelAndView view = new ModelAndView("mindmapCooker", "mindmap", mindmap); + return view; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapEditorController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapEditorController.java new file mode 100644 index 00000000..bbe4cf0c --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapEditorController.java @@ -0,0 +1,62 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.model.MindMap; +import com.wisemapping.security.Utils; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; +import org.springframework.web.servlet.view.RedirectView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class MindmapEditorController extends BaseMultiActionController { + + public static final String MINDMAP_ID_PARAMETER = "mapId"; + public static final String MAP_XML_PARAM = "mapXml"; + + public ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return new ModelAndView(new RedirectView("mymaps.htm")); + } + + public ModelAndView open(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + + final String mindmapId = httpServletRequest.getParameter(MINDMAP_ID_PARAMETER); + final int mapId = Integer.parseInt(mindmapId); + final MindMap mindmap = getMindmapService().getMindmapById(mapId); + + // Mark as try mode... + final ModelAndView view = new ModelAndView("mindmapEditor", "mindmap", mindmap); + view.addObject("editorTryMode", false); + final boolean showHelp = isWelcomeMap(mindmap); + view.addObject("showHelp", showHelp); + final String xmlMap = mindmap.getNativeXmlAsJsLiteral(); + view.addObject(MAP_XML_PARAM, xmlMap); + view.addObject("user", Utils.getUser()); + + return view; + } + + private boolean isWelcomeMap(MindMap map) { + return map.getTitle().startsWith("Welcome "); + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapPublishController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapPublishController.java new file mode 100644 index 00000000..7cc473e1 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapPublishController.java @@ -0,0 +1,70 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.exceptions.WiseMappingException; +import com.wisemapping.model.MindMap; +import com.wisemapping.model.User; +import com.wisemapping.security.Utils; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class MindmapPublishController extends BaseMultiActionController { + + protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + + final MindMap mindmap = this.getMindmapFromRequest(httpServletRequest); + if (mindmap == null) { + throw new IllegalStateException("Map could not be found"); + } + + return new ModelAndView("mindmapPublish", "mindmap", mindmap); + } + + public ModelAndView save(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws WiseMappingException { + + final MindMap mindmap = this.getMindmapFromRequest(httpServletRequest); + if (mindmap == null) { + throw new IllegalStateException("Map could not be found"); + } + + User user = Utils.getUser(); + if (!mindmap.getOwner().equals(user)) { + throw new IllegalStateException("No enought right to execute this operation"); + } + + + final String publicViewStr = httpServletRequest.getParameter("publicView"); + boolean publicView = Boolean.valueOf(publicViewStr); + + if (mindmap.isPublic() != publicView) { + mindmap.setPublic(publicView); + getMindmapService().updateMindmap(mindmap, false); + } + + + return new ModelAndView("closeDialog"); + } + + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapSharingController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapSharingController.java new file mode 100644 index 00000000..3997c63b --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/MindmapSharingController.java @@ -0,0 +1,93 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.model.ColaborationEmail; +import com.wisemapping.model.MindMap; +import com.wisemapping.model.User; +import com.wisemapping.model.UserRole; +import com.wisemapping.security.Utils; +import com.wisemapping.service.InvalidColaboratorException; +import com.wisemapping.view.MindMapBean; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class MindmapSharingController extends BaseMultiActionController { + private static final String COLABORATOR_ID = "colaboratorId"; + + public ModelAndView addCollaborator(HttpServletRequest request, HttpServletResponse response) + throws InvalidColaboratorException { + logger.info("Sharing Controller: add collaborators action"); + addColaborator(request, UserRole.COLLABORATOR); + return new ModelAndView("closeDialog"); + } + + public ModelAndView addViewer(HttpServletRequest request, HttpServletResponse response) + throws InvalidColaboratorException { + logger.info("Sharing Controller: add viewer action"); + addColaborator(request, UserRole.VIEWER); + return new ModelAndView("closeDialog"); + } + + public ModelAndView removeCollaborator(HttpServletRequest request, HttpServletResponse response) { + logger.info("Sharing Controller: remove collaborator action"); + final MindMap mindmap = removeColaborator(request); + return new ModelAndView("mindmapCollaborator", "mindmap", new MindMapBean(mindmap)); + } + + private MindMap removeColaborator(HttpServletRequest request) { + final MindMap mindmap = getMindmapFromRequest(request); + final String colaboratorId = request.getParameter(COLABORATOR_ID); + long colaborator = Long.parseLong(colaboratorId); + getMindmapService().removeColaboratorFromMindmap(mindmap, colaborator); + return mindmap; + } + + private String[] getEmailsToAdd(final HttpServletRequest request) { + final String[] result; + String collaboratorEmails = request.getParameter(MINDMAP_EMAILS_PARAMNAME); + if (collaboratorEmails != null && collaboratorEmails.trim().length() > 0) { + result = collaboratorEmails.split("\\s*[,|\\;|\\s]\\s*"); + } else { + result = null; + } + return result; + } + + private MindMapBean addColaborator(HttpServletRequest request, UserRole role) throws InvalidColaboratorException { + final MindMap mindMap = getMindmapFromRequest(request); + User user = Utils.getUser(); + if (!mindMap.getOwner().equals(user)) { + throw new IllegalStateException("No enought right to execute this operation"); + } + + + final String[] emails = getEmailsToAdd(request); + + final ColaborationEmail email = new ColaborationEmail(); + email.setSubject(request.getParameter("subject")); + email.setMessage(request.getParameter("message")); + getMindmapService().addColaborators(mindMap, emails, role, email); + + return new MindMapBean(mindMap); + } +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/NewMindmapController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/NewMindmapController.java new file mode 100644 index 00000000..de84f18c --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/NewMindmapController.java @@ -0,0 +1,79 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.exceptions.WiseMappingException; +import com.wisemapping.model.MindMap; +import com.wisemapping.model.MindMapNative; +import com.wisemapping.model.User; +import com.wisemapping.security.Utils; +import com.wisemapping.service.MindmapService; +import com.wisemapping.view.MindMapInfoBean; +import org.springframework.validation.BindException; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class NewMindmapController + extends BaseSimpleFormController { + + public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) + throws ServletException, WiseMappingException, IOException { + final MindMapInfoBean bean = (MindMapInfoBean) command; + + final String title = bean.getTitle(); + final String description = bean.getDescription(); + + final User user = Utils.getUser(); + final MindmapService service = getMindmapService(); + + // The map has not been created. Create a new one ... + MindMap mindmap = new MindMap(); + mindmap.setDescription(description); + mindmap.setTitle(title); + mindmap.setOwner(user); + + final String defaultNativeMap = getDefaultMindmapXml(title); + mindmap.setNativeXml(defaultNativeMap); + + final MindMapNative nativeBrowser = new MindMapNative(); + mindmap.setNativeBrowser(nativeBrowser); + final User dbUSer = getUserService().getUserBy(user.getId()); + + service.addMindmap(mindmap, dbUSer); + + return new ModelAndView("redirect:editor.htm?mapId=" + mindmap.getId() + "&action=open"); + } + + + private String getDefaultMindmapXml(final String title) { + + final StringBuffer map = new StringBuffer(); + map.append(""); + map.append(""); + return map.toString(); + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/PublicPagesController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/PublicPagesController.java new file mode 100644 index 00000000..cff78bc3 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/PublicPagesController.java @@ -0,0 +1,78 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.wisemapping.model.MindMap; + +public class PublicPagesController extends BaseMultiActionController { + + public ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return this.home(httpServletRequest, httpServletResponse); + } + + public ModelAndView faq(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return new ModelAndView("faq"); + } + + public ModelAndView aboutUs(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return new ModelAndView("aboutUs"); + } + + public ModelAndView video(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return new ModelAndView("video"); + } + + public ModelAndView crew(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return new ModelAndView("crew"); + } + + public ModelAndView privacyPolicy(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return new ModelAndView("privacyPolicy"); + } + + public ModelAndView home(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return new ModelAndView("homepage"); + } + + public ModelAndView tryEditor(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + + final MindMap mindmap = getMindmapService().getMindmapById(TRY_EXAMPLE_MINDMAP_ID); + + ModelAndView view = new ModelAndView("mindmapEditor", "mindmap", mindmap); + final String xmlMap = mindmap.getNativeXmlAsJsLiteral(); + view.addObject(MindmapEditorController.MAP_XML_PARAM, xmlMap); + view.addObject("editorTryMode", true); + view.addObject("showHelp", true); + return view; + } + + public ModelAndView termsOfUse(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return new ModelAndView("termsOfUse"); + } + + public static final int TRY_EXAMPLE_MINDMAP_ID = 3; + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/PublicViewController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/PublicViewController.java new file mode 100644 index 00000000..464cfd43 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/PublicViewController.java @@ -0,0 +1,44 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.wisemapping.model.MindMap; + +public class PublicViewController extends BaseMultiActionController { + private static final String MAP_ID = "mapId"; + + protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) + throws Exception + { + + final MindMap mindmap = super.getMindmapFromRequest(httpServletRequest); + + final ModelAndView view = new ModelAndView("mindmapPublicView"); + view.addObject("mindmap", mindmap); + view.addObject("viewTitle","'"+mindmap.getTitle()+"' Map View"); + return view; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/RenameMindmapController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/RenameMindmapController.java new file mode 100755 index 00000000..baab7197 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/RenameMindmapController.java @@ -0,0 +1,59 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.exceptions.WiseMappingException; +import com.wisemapping.service.MindmapService; +import com.wisemapping.view.MindMapInfoBean; +import com.wisemapping.model.MindMap; +import com.wisemapping.model.User; +import com.wisemapping.security.Utils; +import org.springframework.validation.BindException; +import org.springframework.web.servlet.ModelAndView; + + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class RenameMindmapController + extends BaseSimpleFormController { + + //~ Methods .............................................................................................. + protected Object formBackingObject(HttpServletRequest httpServletRequest) throws Exception { + final MindMap mindMap = getMindmapFromRequest(httpServletRequest); + User user = Utils.getUser(); + if (!mindMap.getOwner().equals(user)) { + throw new IllegalStateException("No enought right to execute this operation"); + } + + + return new MindMapInfoBean(mindMap); + } + + public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) + throws ServletException, WiseMappingException { + final MindMapInfoBean bean = (MindMapInfoBean) command; + final MindmapService mindmapService = this.getMindmapService(); + mindmapService.updateMindmap(bean.getMindMap(), false); + + return new ModelAndView(getSuccessView()); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/SearchController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/SearchController.java new file mode 100755 index 00000000..f706e597 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/SearchController.java @@ -0,0 +1,99 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.model.MindMap; +import com.wisemapping.model.MindMapCriteria; +import com.wisemapping.security.Utils; +import com.wisemapping.view.MindMapBean; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SearchController extends BaseMultiActionController { + private static final int MAX_RESULT = 20; + + public ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + return searchPage(httpServletRequest, httpServletResponse); + } + + public ModelAndView searchPage(HttpServletRequest request, HttpServletResponse response) { + logger.info("Search"); + return new ModelAndView("search"); + } + + public ModelAndView showAll(HttpServletRequest request, HttpServletResponse response) + { + final Map viewAttrMap = getRequestAttributes(request); + + viewAttrMap.put("emptyCriteria", false); + com.wisemapping.model.User user = Utils.getUser(); + viewAttrMap.put("user",user); + + final List searchResult = getMindmapService().getPublicMaps(MAX_RESULT); + final List result = new ArrayList(); + for (MindMap mindMap : searchResult) { + result.add(new MindMapBean(mindMap)); + } + viewAttrMap.put("wisemapsList", result); + + + return new ModelAndView("searchResult", viewAttrMap); + } + + public ModelAndView search(HttpServletRequest request, HttpServletResponse response) { + + logger.info("Search Result"); + + final Map viewAttrMap = getRequestAttributes(request); + + final MindMapCriteria criteria = getMindMapCriteriaFromRequest(request); + viewAttrMap.put("emptyCriteria", criteria.isEmpty()); + com.wisemapping.model.User user = Utils.getUser(); + viewAttrMap.put("user",user); + if (!criteria.isEmpty()) { + final List searchResult = getMindmapService().search(criteria); + final List result = new ArrayList(); + for (MindMap mindMap : searchResult) { + result.add(new MindMapBean(mindMap)); + } + viewAttrMap.put("wisemapsList", result); + } + + return new ModelAndView("searchResult", viewAttrMap); + } + + private Map getRequestAttributes(HttpServletRequest request) { + final Map viewAttrMap = new HashMap(); + viewAttrMap.put("titleOrTags", request.getParameter("titleOrTags")); + final String name = request.getParameter("name"); + viewAttrMap.put("name", name); + viewAttrMap.put("description", request.getParameter("description")); + viewAttrMap.put("tags", request.getParameter("tags")); + viewAttrMap.put("advanceSearch", request.getParameter("advanceSearch")); + return viewAttrMap; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/SettingsController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/SettingsController.java new file mode 100755 index 00000000..d4a9bf5a --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/SettingsController.java @@ -0,0 +1,34 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class SettingsController extends BaseMultiActionController { + + public ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) + throws Exception { + return new ModelAndView("setting"); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/TagsController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/TagsController.java new file mode 100644 index 00000000..890701b3 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/TagsController.java @@ -0,0 +1,61 @@ +/* +* 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 $ +*/ + +package com.wisemapping.controller; + +import com.wisemapping.exceptions.WiseMappingException; +import com.wisemapping.importer.ImporterException; +import com.wisemapping.model.MindMap; +import com.wisemapping.model.User; +import com.wisemapping.security.Utils; +import com.wisemapping.view.TagBean; +import org.springframework.validation.BindException; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class TagsController + extends BaseSimpleFormController { + + //~ Methods .............................................................................................. + protected Object formBackingObject(HttpServletRequest httpServletRequest) throws Exception { + + final MindMap mindmap = getMindmapFromRequest(httpServletRequest); + final User user = Utils.getUser(httpServletRequest); + final User dbUser = getUserService().getUserBy(user.getId()); + + final TagBean tagBean = new TagBean(); + tagBean.setUserTags(dbUser.getTags()); + tagBean.setMindmapId(mindmap.getId()); + tagBean.setMindmapTags(mindmap.getTags()); + tagBean.setMindmapTitle(mindmap.getTitle()); + return tagBean; + } + + public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) + throws ServletException, WiseMappingException, ImporterException + { + final TagBean bean = (TagBean) command; + final MindMap mindmap = getMindmapService().getMindmapById(bean.getMindmapId()); + getMindmapService().addTags(mindmap, bean.getMindmapTags()); + return new ModelAndView(getSuccessView()); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/controller/UserController.java b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/UserController.java new file mode 100644 index 00000000..8740e85f --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/controller/UserController.java @@ -0,0 +1,66 @@ +/* +* 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 $ +*/ + +// ........................................................................................................... +// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved +// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc. +// The copyright notice above does not evidence any actual or intended +// publication of such source code. +// +// Last changed on 2007-04-03 09:29:20 (-0300), by: nachomanz. $Revision$ +// ........................................................................................................... + +package com.wisemapping.controller; + +import com.wisemapping.model.User; +import com.wisemapping.service.UserService; +import com.wisemapping.view.UserBean; +import com.wisemapping.exceptions.WiseMappingException; +import org.springframework.web.servlet.ModelAndView; + +public class UserController + extends CaptchaFormController { + + //~ Instance fields ...................................................................................... + + private UserService userService; + + //~ Methods .............................................................................................. + + public ModelAndView onSubmit(Object command) throws WiseMappingException { + final UserBean userBean = ((UserBean) command); + + if (userBean != null) { + final User user = new User(); + // trim() the email email in order to remove spaces + user.setEmail(userBean.getEmail().trim()); + user.setUsername(userBean.getUsername()); + user.setFirstname(userBean.getFirstname()); + user.setLastname(userBean.getLastname()); + user.setPassword(userBean.getPassword()); + userService.createUser(user); + } + + return new ModelAndView(getSuccessView()); + } + + public void setUserService(UserService userService) { + this.userService = userService; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManager.java b/trunk/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManager.java new file mode 100644 index 00000000..adc7d5a9 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManager.java @@ -0,0 +1,67 @@ +/* +* 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 $ +*/ + +package com.wisemapping.dao; + +import com.wisemapping.model.*; + +import java.util.List; + +public interface MindmapManager { + + Colaborator getColaboratorBy(String email); + + Colaborator getColaboratorBy(long id); + + List getMindmapUserByColaborator(final long colaboratorId); + + List getMindmapUserByRole(final UserRole userRole); + + MindmapUser getMindmapUserBy(final int mindmapId, final User user); + + List getAllMindmaps(); + + MindMap getMindmapById(int mindmapId); + + MindMap getMindmapByTitle(final String name, final User user); + + void addColaborator (Colaborator colaborator); + + void addMindmap(User user, MindMap mindMap); + + public void addView(int mapId); + + void saveMindmap(MindMap mindMap); + + void updateMindmap(MindMap mindMap, boolean saveHistory); + + void removeColaborator(Colaborator colaborator); + + void removeMindmap(MindMap mindap); + + void removeMindmapUser(MindmapUser mindmapUser); + + public List search(MindMapCriteria criteria); + + public List search(MindMapCriteria criteria, int maxResult); + + public List getHistoryFrom(int mindmapId); + + public MindMapHistory getHistory(int historyId); +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java b/trunk/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java new file mode 100644 index 00000000..aee57185 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java @@ -0,0 +1,203 @@ +/* +* 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 $ +*/ + +package com.wisemapping.dao; + +import com.wisemapping.model.*; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; +import org.hibernate.criterion.Restrictions; +import org.hibernate.criterion.SimpleExpression; +import org.hibernate.criterion.Junction; +import org.hibernate.criterion.Order; +import org.hibernate.Criteria; + +import java.util.List; +import java.util.Calendar; + +public class MindmapManagerImpl + extends HibernateDaoSupport + implements MindmapManager { + + public Colaborator getColaboratorBy(final String email) { + final Colaborator colaborator; + final List colaborators = getHibernateTemplate().find("from com.wisemapping.model.Colaborator colaborator where email=?", email); + if (colaborators != null && !colaborators.isEmpty()) { + assert colaborators.size() == 1 : "More than one user with the same username!"; + colaborator = (Colaborator) colaborators.get(0); + } else { + colaborator = null; + } + return colaborator; + } + + public List search(MindMapCriteria criteria) { + return search(criteria,-1); + } + + public List getHistoryFrom(int mindmapId) + { + final Criteria hibernateCriteria = getSession().createCriteria(MindMapHistory.class); + hibernateCriteria.add(Restrictions.eq("mindmapId",mindmapId)); + hibernateCriteria.addOrder( Order.desc("creationTime")); + // Mientras no haya paginacion solo los 10 primeros + hibernateCriteria.setMaxResults(10); + return hibernateCriteria.list(); + } + + public MindMapHistory getHistory(int historyId) + { + return (MindMapHistory) getHibernateTemplate().get(MindMapHistory.class, historyId); + } + + public List search(MindMapCriteria criteria, int maxResult) { + final Criteria hibernateCriteria = getSession().createCriteria(MindMap.class); + //always search public maps + hibernateCriteria.add(Restrictions.like("public", Boolean.TRUE)); + + if (criteria != null) { + final Junction junction; + if (criteria.isOrCriteria()) { + junction = Restrictions.disjunction(); + } else { + junction = Restrictions.conjunction(); + } + + if (criteria.getTitle() != null && criteria.getTitle().length() > 0) { + final SimpleExpression titleRestriction = Restrictions.like("title", "%" + criteria.getTitle() + "%"); + junction.add(titleRestriction); + } + + if (criteria.getDescription() != null && criteria.getDescription().length() > 0) { + final SimpleExpression descriptionRestriction = Restrictions.like("description", "%" + criteria.getDescription() + "%"); + junction.add(descriptionRestriction); + } + if (criteria.getTags().size() > 0) { + for (String tag : criteria.getTags()) { + final SimpleExpression tagRestriction = Restrictions.like("tags", "%" + tag + "%"); + junction.add(tagRestriction); + } + } + + hibernateCriteria.add(junction); + } +// if (maxResult>0) +// { +// hibernateCriteria.setMaxResults(maxResult); +// } + return hibernateCriteria.list(); + } + + public Colaborator getColaboratorBy(long id) { + return (Colaborator) getHibernateTemplate().get(Colaborator.class, id); + } + + public List getMindmapUserByColaborator(final long colaboratorId) { + return getHibernateTemplate().find("from com.wisemapping.model.MindmapUser mindmapUser where colaborator_id=?", colaboratorId); + } + + public List getMindmapUserByRole(final UserRole userRole) { + return getHibernateTemplate().find("from com.wisemapping.model.MindmapUser mindmapUser where roleId=?", userRole.ordinal()); + } + + public MindmapUser getMindmapUserBy(final int mindmapId, final User user) { + final MindmapUser result; + + final List mindMaps = getHibernateTemplate().find("from com.wisemapping.model.MindmapUser mindmapUser where mindMap.id=? and colaborator_id=?", new Object[]{mindmapId, user.getId()}); + if (mindMaps != null && !mindMaps.isEmpty()) { + result = mindMaps.get(0); + } else { + result = null; + } + + return result; + } + + public void addColaborator(Colaborator colaborator) { + assert colaborator != null : "ADD MINDMAP COLABORATOR: Colaborator is required!"; + getHibernateTemplate().save(colaborator); + } + + public void removeMindmapUser(MindmapUser mindmapUser) { + getHibernateTemplate().delete(mindmapUser); + } + + public void removeColaborator(Colaborator colaborator) { + getHibernateTemplate().delete(colaborator); + } + + public List getAllMindmaps() { + return getHibernateTemplate().find("from com.wisemapping.model.MindMap wisemapping"); + } + + public MindMap getMindmapById(int mindmapId) { + return (MindMap) getHibernateTemplate().get(MindMap.class, mindmapId); + } + + public MindMap getMindmapByTitle(final String title, final User user) { + final MindMap result; + List mindMaps = getHibernateTemplate().find("from com.wisemapping.model.MindMap wisemapping where title=? and creator=?", new Object[]{title, user.getUsername()}); + if (mindMaps != null && !mindMaps.isEmpty()) { + result = mindMaps.get(0); + } else { + result = null; + } + return result; + } + + public void addView(int mapId) + { + + } + + public void addMindmap(User user, MindMap mindMap) { + saveMindmap(mindMap); + } + + public void saveMindmap(MindMap mindMap) { + assert mindMap != null : "Save Mindmap: Mindmap is required!"; + getSession().saveOrUpdate(mindMap.getNativeBrowser()); + getSession().save(mindMap); + } + + public void updateMindmap(MindMap mindMap, boolean saveHistory) { + assert mindMap != null : "Save Mindmap: Mindmap is required!"; + getHibernateTemplate().saveOrUpdate(mindMap.getNativeBrowser()); + getHibernateTemplate().saveOrUpdate(mindMap); + if (saveHistory) + { + saveHistory(mindMap); + } + } + + public void removeMindmap(MindMap mindMap) { + getHibernateTemplate().delete(mindMap); + } + + public void saveHistory(MindMap mindMap) + { + final MindMapHistory history = new MindMapHistory(); + + history.setXml(mindMap.getXml()); + history.setCreationTime(Calendar.getInstance()); + history.setCreator(mindMap.getLastModifierUser()); + history.setMindmapId(mindMap.getId()); + getHibernateTemplate().saveOrUpdate(history); + } +} + diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/dao/UserManager.java b/trunk/wise-webapp/src/main/java/com/wisemapping/dao/UserManager.java new file mode 100644 index 00000000..c6bfd3d4 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/dao/UserManager.java @@ -0,0 +1,51 @@ +/* +* 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 $ +*/ + +package com.wisemapping.dao; + +import com.wisemapping.model.User; +import com.wisemapping.model.UserLogin; +import com.wisemapping.model.Colaborator; + +import java.util.List; + +public interface UserManager { + + List getAllUsers(); + + User getUserBy(String email); + + public User getUserBy(long id); + + User getUserByUsername(String username); + + boolean authenticate(String email, String password); + + void createUser(User user); + + void auditLogin(UserLogin userLogin); + + void updateUser(User user); + + User getUserByActivationCode(long code); + + public Colaborator getColaboratorBy(String email); + + public User createUser(User user, Colaborator col); +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java b/trunk/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java new file mode 100644 index 00000000..61d1a157 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java @@ -0,0 +1,143 @@ +/* +* 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 $ +*/ + +package com.wisemapping.dao; + +import com.wisemapping.model.Colaborator; +import com.wisemapping.model.MindmapUser; +import com.wisemapping.model.User; +import com.wisemapping.model.UserLogin; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; +import org.acegisecurity.providers.encoding.PasswordEncoder; + +import java.util.List; +import java.util.Set; + +public class UserManagerImpl + extends HibernateDaoSupport + implements UserManager { + + private PasswordEncoder passwordEncoder; + + public void setPasswordEncoder(PasswordEncoder passwordEncoder) + { + this.passwordEncoder = passwordEncoder; + } + + public List getAllUsers() { + return getHibernateTemplate().find("from com.wisemapping.model.User user"); + } + + public User getUserBy(final String email) { + final User user; + final List users = getHibernateTemplate().find("from com.wisemapping.model.User colaborator where email=?", email); + if (users != null && !users.isEmpty()) { + assert users.size() == 1 : "More than one user with the same email!"; + user = (User) users.get(0); + } else { + user = null; + } + return user; + } + + public Colaborator getColaboratorBy(final String email) { + final Colaborator cola; + final List cols = getHibernateTemplate().find("from com.wisemapping.model.Colaborator colaborator where email=?", email); + if (cols != null && !cols.isEmpty()) { + assert cols.size() == 1 : "More than one colaborator with the same email!"; + cola = (Colaborator) cols.get(0); + } else { + cola = null; + } + return cola; + } + + public User getUserBy(long id) + { + return (User)getHibernateTemplate().get(User.class,id); + } + + public User getUserByUsername(String username) { + final User user; + final List users = getHibernateTemplate().find("from com.wisemapping.model.User colaborator where username=?", username); + if (users != null && !users.isEmpty()) { + assert users.size() == 1 : "More than one user with the same username!"; + user = (User) users.get(0); + } else { + user = null; + } + return user; + } + + public boolean authenticate(final String email, final String password) { + final boolean result; + final User user = getUserBy(email); + result = user != null && user.getPassword().equals(password); + return result; + } + + public void createUser(User user) { + assert user != null : "Trying to store a null user"; + user.setPassword(passwordEncoder.encodePassword(user.getPassword(),null)); + getHibernateTemplate().saveOrUpdate(user); + } + + public User createUser(User user, Colaborator col) + { + user.setPassword(passwordEncoder.encodePassword(user.getPassword(),null)); + assert user != null : "Trying to store a null user"; + + final Set set = col.getMindmapUsers(); + for (MindmapUser mindmapUser : set) { + MindmapUser newMapUser = new MindmapUser(); + newMapUser.setRoleId(mindmapUser.getRole().ordinal()); + newMapUser.setMindMap(mindmapUser.getMindMap()); + newMapUser.setColaborator(user); + user.addMindmapUser(newMapUser); + } + + getHibernateTemplate().delete(col); + getHibernateTemplate().flush(); + getHibernateTemplate().saveOrUpdate(user); + return user; + } + + public void auditLogin(UserLogin userLogin) { + assert userLogin != null : "userLogin is null"; + getHibernateTemplate().save(userLogin); + } + + public void updateUser(User user) { + assert user != null : "user is null"; + user.setPassword(passwordEncoder.encodePassword(user.getPassword(),null)); + getHibernateTemplate().update(user); + } + + public User getUserByActivationCode(long code) { + final User user; + final List users = getHibernateTemplate().find("from com.wisemapping.model.User user where activationCode=?", code); + if (users != null && !users.isEmpty()) { + assert users.size() == 1 : "More than one user with the same username!"; + user = (User) users.get(0); + } else { + user = null; + } + return user; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/BaseDwrService.java b/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/BaseDwrService.java new file mode 100644 index 00000000..5bedaba4 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/BaseDwrService.java @@ -0,0 +1,59 @@ +/* +* 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 $ +*/ + +package com.wisemapping.dwr; + +import com.wisemapping.service.MindmapService; +import com.wisemapping.service.UserService; +import com.wisemapping.model.User; +import com.wisemapping.security.Utils; +import org.directwebremoting.WebContextFactory; +import org.directwebremoting.WebContext; + +import javax.servlet.http.HttpServletRequest; + +abstract public class BaseDwrService { + private MindmapService mindmapService; + private UserService userService; + + public MindmapService getMindmapService() { + return mindmapService; + } + + public void setMindmapService(MindmapService mindmapService) { + this.mindmapService = mindmapService; + } + + public UserService getUserService() { + return userService; + } + + public void setUserService(UserService userService) { + this.userService = userService; + } + + public User getUser() { + + WebContext ctx = WebContextFactory.get(); + final HttpServletRequest request = ctx.getHttpServletRequest(); + + return Utils.getUser(request); + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/JavaScriptErrorLoggerService.java b/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/JavaScriptErrorLoggerService.java new file mode 100644 index 00000000..34dbdf25 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/JavaScriptErrorLoggerService.java @@ -0,0 +1,91 @@ +/* +* 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 $ +*/ + +// ........................................................................................................... +// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved +// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc. +// The copyright notice above does not evidence any actual or intended +// publication of such source code. +// +// Last changed on 2007-08-01 19:08:20 (-0300), by: imanzano. $Revision$ +// ........................................................................................................... + +package com.wisemapping.dwr; + +import java.io.IOException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.directwebremoting.WebContext; +import org.directwebremoting.WebContextFactory; +import com.wisemapping.model.User; + +import javax.servlet.http.HttpServletRequest; + +public class JavaScriptErrorLoggerService + extends BaseDwrService { + + final Log logger = LogFactory.getLog(JavaScriptErrorLoggerService.class); + private static final int ERROR_MESSAGE = 3; + private static final int FATAL_MESSAGE = 4; + private static final String USER_AGENT = "User-Agent"; + + JavaScriptErrorLoggerService() { + LogFactory.getLog(JavaScriptErrorLoggerService.class); + } + //~ Methods .............................................................................................. + + public void logError(final int severity, final String logMsg) + throws IOException { + + final User user = getUser(); + + final WebContext ctx = WebContextFactory.get(); + final HttpServletRequest request = ctx.getHttpServletRequest(); + + + final String userAgent = request.getHeader(USER_AGENT); + synchronized (logger) { + // Log user info ... + if (user != null) { + log(severity, "UserId:" + user.getId() + ", UserEmail:" + user.getEmail()); + } else { + log(severity, "Anonymous user"); + } + + // Log browser details ... + log(severity, "Browser:" + userAgent); + + // Log error message ... + log(severity, logMsg); + } + } + + void log(final int severity, final String msg) { + // Log error message ... + if (severity == ERROR_MESSAGE && logger.isErrorEnabled()) { + logger.error(msg); + } else if (severity == FATAL_MESSAGE && logger.isFatalEnabled()) { + logger.fatal(msg); + } else if (logger.isInfoEnabled()) { + logger.info(msg); + } + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/MapEditorService.java b/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/MapEditorService.java new file mode 100644 index 00000000..f952110a --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/MapEditorService.java @@ -0,0 +1,95 @@ +/* +* 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 $ +*/ + +// ........................................................................................................... +// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved +// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc. +// The copyright notice above does not evidence any actual or intended +// publication of such source code. +// +// Last changed on 2007-08-01 19:08:21 (-0300), by: imanzano. $Revision$ +// ........................................................................................................... + +package com.wisemapping.dwr; + +import java.io.IOException; +import java.util.Calendar; +import java.util.Date; + +import com.wisemapping.model.MindMap; +import com.wisemapping.model.MindMapNative; +import com.wisemapping.model.User; +import com.wisemapping.service.MindmapService; +import com.wisemapping.exceptions.WiseMappingException; + +public class MapEditorService + extends BaseDwrService { + + //~ Methods .............................................................................................. + + public ResponseMessage draftMap(final int mapId, final String nativeXml) { + final ResponseMessage response = new ResponseMessage(); + response.setMsgCode(ResponseMessage.Code.OK.name()); + response.setMsgDetails("Map Saved Successfully"); + return response; + } + + public ResponseMessage saveMap(final int mapId, final String nativeXml, final String chartType, + String chartXml, final String editorProperties,boolean saveHistory) + throws IOException, WiseMappingException { + final MindmapService serservice = getMindmapService(); + final MindMap mindMap = serservice.getMindmapById(mapId); + final User user = this.getUser(); + + + MindMapNative nativeBrowser = mindMap.getNativeBrowser(); + + if (nativeBrowser == null) { + nativeBrowser = new MindMapNative(); + } + + if ("SVG".equals(chartType)) { + nativeBrowser.setSvgXml(chartXml); + nativeBrowser.setVmlXml((byte[]) null); + } else { + nativeBrowser.setVmlXml(chartXml); + nativeBrowser.setSvgXml((byte[]) null); + } + + mindMap.setNativeBrowser(nativeBrowser); + mindMap.setProperties(editorProperties); + + final Calendar now = Calendar.getInstance(); + mindMap.setLastModificationTime(now); + mindMap.setLastModifierUser(user.getUsername()); + + final Calendar lastModification = Calendar.getInstance(); + lastModification.setTime(new Date()); + mindMap.setLastModificationTime(lastModification); + + mindMap.setNativeXml(nativeXml); + serservice.updateMindmap(mindMap,saveHistory); + + final ResponseMessage response = new ResponseMessage(); + response.setMsgCode(ResponseMessage.Code.OK.name()); + response.setMsgDetails("Map Saved Successfully"); + + return response; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/ResponseMessage.java b/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/ResponseMessage.java new file mode 100644 index 00000000..652099b5 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/dwr/ResponseMessage.java @@ -0,0 +1,67 @@ +/* +* 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 $ +*/ + +package com.wisemapping.dwr; + +public class ResponseMessage { + private ResponseMessage.Code msgCode; + private String msgDetails; + private String content; + private String contentType; + + public ResponseMessage() { + this.contentType = "text/xml;charset=UTF-8"; + } + + public String getMsgCode() { + return msgCode.name(); + } + + public void setMsgCode(String msgCode) { + this.msgCode = Code.valueOf(msgCode); + } + + public String getMsgDetails() { + return msgDetails; + } + + public void setMsgDetails(String msgDetails) { + this.msgDetails = msgDetails; + } + + public enum Code { + OK, ERROR + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getContentType() { + return contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/AccessDeniedSecurityException.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/AccessDeniedSecurityException.java new file mode 100755 index 00000000..3f25ea30 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/AccessDeniedSecurityException.java @@ -0,0 +1,29 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exceptions; + +public class AccessDeniedSecurityException + extends Exception +{ + public AccessDeniedSecurityException(String msg) + { + super(msg); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/EmailNotExistsException.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/EmailNotExistsException.java new file mode 100755 index 00000000..a7f704b4 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/EmailNotExistsException.java @@ -0,0 +1,29 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exceptions; + +public class EmailNotExistsException + extends Exception +{ + public EmailNotExistsException(Exception e) + { + super(e); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/NoMapFoundException.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/NoMapFoundException.java new file mode 100644 index 00000000..20bc2d93 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/NoMapFoundException.java @@ -0,0 +1,27 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exceptions; + +public class NoMapFoundException extends WiseMappingException +{ + public NoMapFoundException(final long mapId) { + super("Could not find a mindmap with id '" + mapId + "'"); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/UnexpectedArgumentException.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/UnexpectedArgumentException.java new file mode 100755 index 00000000..65a4e6df --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/UnexpectedArgumentException.java @@ -0,0 +1,30 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exceptions; + + +public class UnexpectedArgumentException + extends Exception +{ + public UnexpectedArgumentException(String msg) + { + super(msg); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/UnsupportedBrowserException.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/UnsupportedBrowserException.java new file mode 100644 index 00000000..2fb680dd --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/UnsupportedBrowserException.java @@ -0,0 +1,24 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exceptions; + +public class UnsupportedBrowserException extends Exception { + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/WiseMappingException.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/WiseMappingException.java new file mode 100755 index 00000000..a098048a --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exceptions/WiseMappingException.java @@ -0,0 +1,29 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exceptions; + +public class WiseMappingException + extends Exception +{ + public WiseMappingException(String str) + { + super(str); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/ExportException.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/ExportException.java new file mode 100755 index 00000000..63f95c75 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/ExportException.java @@ -0,0 +1,29 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exporter; + +public class ExportException + extends Exception +{ + public ExportException(Throwable e) + { + super(e); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/ExportFormat.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/ExportFormat.java new file mode 100644 index 00000000..57c53475 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/ExportFormat.java @@ -0,0 +1,45 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exporter; + +public enum ExportFormat { + SVG("image/svg+xml", "xml"), + JPEG("image/jpeg", "jpg"), + PNG("image/png", "png"), + MINDJET("text/xml", "xml"), + PDF("application/pdf", "pdf"), + FREEMIND("text/xml", "mm"); + + private String contentType; + private String fileExtension; + + ExportFormat(String contentType, String fileExtension) { + this.contentType = contentType; + this.fileExtension = fileExtension; + } + + public String getFileExtension() { + return fileExtension; + } + + public String getContentType() { + return contentType; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java new file mode 100644 index 00000000..1e0dd0ee --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java @@ -0,0 +1,87 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exporter; + +public class ExportProperties { + private ExportFormat format; + private String baseImgPath; + + public ExportFormat getFormat() { + return format; + } + + private ExportProperties(final ExportFormat format) { + this.format = format; + } + + public static ExportProperties create(final ExportFormat format) { + ExportProperties result; + if (format == ExportFormat.JPEG || format == ExportFormat.PNG) { + result = new ImageProperties(format); + } else { + result = new GenericProperties(format); + } + return result; + } + + public void setBaseImagePath(String baseUrl) { + this.baseImgPath = baseUrl; + } + + public String getBaseImgPath() { + return baseImgPath; + } + + static public class GenericProperties extends ExportProperties { + private GenericProperties(ExportFormat format) { + super(format); + } + } + + static public class ImageProperties extends ExportProperties { + private Size size; + + public Size getSize() { + return size; + } + + public void setSize(Size size) { + this.size = size; + } + + public ImageProperties(ExportFormat format) { + super(format); + } + + public enum Size { + SMALL(100), MEDIUM(800), XMEDIUM(1024), LARGE(2048); + private int width; + + Size(int width) { + this.width = width; + } + + public Float getWidth() { + return (float) width; + } + } + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/Exporter.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/Exporter.java new file mode 100755 index 00000000..0c1eb09e --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/Exporter.java @@ -0,0 +1,29 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exporter; + +import com.wisemapping.model.MindMap; + +import java.io.OutputStream; + +public interface Exporter { + public void export(byte[] xml, OutputStream outputStream) throws ExportException; + public void export(MindMap map, OutputStream outputStream) throws ExportException; +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/SvgExporter.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/SvgExporter.java new file mode 100644 index 00000000..9c69f8e5 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/SvgExporter.java @@ -0,0 +1,276 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exporter; + +import com.wisemapping.exporter.freemind.FreemindExporter; +import com.wisemapping.model.MindMap; +import org.apache.batik.transcoder.Transcoder; +import org.apache.batik.transcoder.TranscoderException; +import org.apache.batik.transcoder.TranscoderInput; +import org.apache.batik.transcoder.TranscoderOutput; +import org.apache.batik.transcoder.image.ImageTranscoder; +import org.apache.batik.transcoder.image.JPEGTranscoder; +import org.apache.batik.transcoder.image.PNGTranscoder; +import org.apache.fop.svg.PDFTranscoder; +import org.w3c.dom.*; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import javax.xml.bind.JAXBException; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.stream.XMLStreamException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import java.io.*; + +public class SvgExporter { + private static final String GROUP_NODE_NAME = "g"; + private static final String RECT_NODE_NAME = "rect"; + private static final String IMAGE_NODE_NAME = "image"; + + private SvgExporter() { + } + + public static void export(ExportProperties properties, MindMap map, OutputStream output) throws TranscoderException, IOException, ParserConfigurationException, SAXException, XMLStreamException, TransformerException, JAXBException, ExportException { + final ExportFormat format = properties.getFormat(); + + final String imgPath = properties.getBaseImgPath(); + switch (format) { + case PNG: { + // Create a JPEG transcoder + final Transcoder transcoder = new PNGTranscoder(); + final ExportProperties.ImageProperties imageProperties = + (ExportProperties.ImageProperties) properties; + final ExportProperties.ImageProperties.Size size = imageProperties.getSize(); + transcoder.addTranscodingHint(ImageTranscoder.KEY_WIDTH, size.getWidth()); + + // Create the transcoder input. + char[] xml = map.generateSvgXml(); + xml = normalizeSvg(xml, imgPath); + final CharArrayReader is = new CharArrayReader(xml); + TranscoderInput input = new TranscoderInput(is); + TranscoderOutput trascoderOutput = new TranscoderOutput(output); + + // Save the image. + transcoder.transcode(input, trascoderOutput); + break; + } + case JPEG: { + // Create a JPEG transcoder + final Transcoder transcoder = new JPEGTranscoder(); + transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.99)); + + final ExportProperties.ImageProperties imageProperties = + (ExportProperties.ImageProperties) properties; + final ExportProperties.ImageProperties.Size size = imageProperties.getSize(); + transcoder.addTranscodingHint(ImageTranscoder.KEY_WIDTH, size.getWidth()); + + // Create the transcoder input. + final char[] xml = map.generateSvgXml(); + char[] svgXml = normalizeSvg(xml, imgPath); + final CharArrayReader is = new CharArrayReader(svgXml); + TranscoderInput input = new TranscoderInput(is); + TranscoderOutput trascoderOutput = new TranscoderOutput(output); + + // Save the image. + transcoder.transcode(input, trascoderOutput); + break; + } + case PDF: { + // Create a JPEG transcoder + final Transcoder transcoder = new PDFTranscoder(); + + // Create the transcoder input. + final char[] xml = map.generateSvgXml(); + char[] svgXml = normalizeSvg(xml, imgPath); + final CharArrayReader is = new CharArrayReader(svgXml); + TranscoderInput input = new TranscoderInput(is); + TranscoderOutput trascoderOutput = new TranscoderOutput(output); + + // Save the image. + transcoder.transcode(input, trascoderOutput); + break; + } + case SVG: { + final char[] xml = map.generateSvgXml(); + char[] svgXml = normalizeSvg(xml, imgPath); + output.write(new String(svgXml).getBytes("UTF-8")); + break; + } + case FREEMIND: { + final FreemindExporter exporter = new FreemindExporter(); + exporter.export(map.getUnzippedXml().getBytes(), output); + break; + } + default: + throw new UnsupportedOperationException("Export method not supported."); + } + } + + private static char[] normalizeSvg(final char[] svgXml, final String imgBaseUrl) throws XMLStreamException, ParserConfigurationException, IOException, SAXException, TransformerException { + final Reader in = new CharArrayReader(svgXml); + + // Load document ... + final InputSource is = new InputSource(in); + + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = factory.newDocumentBuilder(); + + final Document svgDocument = documentBuilder.parse(is); + + fitSvg(svgDocument); + + fixImageTagHref(svgDocument, imgBaseUrl); + + DOMSource domSource = new DOMSource(svgDocument); + + // Save document ... + + // Create a string writer + final CharArrayWriter outDocument = new CharArrayWriter(); + + // Create the result stream for the transform + StreamResult result = new StreamResult(outDocument); + + // Create a Transformer to serialize the document + TransformerFactory tFactory = TransformerFactory.newInstance(); + + Transformer transformer = tFactory.newTransformer(); + transformer.setOutputProperty("indent", "yes"); + + // Transform the document to the result stream + transformer.transform(domSource, result); + + return outDocument.toCharArray(); + + } + + private static void fixImageTagHref(Document svgDocument, String imgBaseUrl) { + final Node child = svgDocument.getFirstChild(); + fixImageTagHref((Element) child, imgBaseUrl); + } + + private static void fixImageTagHref(Element element, String imgBaseUrl) { + + final NodeList list = element.getChildNodes(); + + for (int i = 0; i < list.getLength(); i++) { + final Node node = list.item(i); + // find all groups + if (GROUP_NODE_NAME.equals(node.getNodeName())) { + // Must continue looking .... + fixImageTagHref((Element) node, imgBaseUrl); + + } else if (IMAGE_NODE_NAME.equals(node.getNodeName())) { + + Element elem = (Element) node; + + // Cook image href ... + String imgName = elem.getAttribute("href"); + int index = imgName.lastIndexOf("/"); + elem.removeAttribute("href"); + if (index != -1) + { + imgName = imgName.substring(index); + final String imgPath = imgBaseUrl + imgName; + elem.setAttribute("xlink:href", imgPath); + } + } + } + } + + private static void fitSvg(Document document) { + // viewBox size + int mapWidth = 1024; + int mapHeight = 768; + // some browser return width and heigth with precision + float currentMaxWidth = 0; + float currentMaxHeight = 0; + + final Element svgNode = (Element) document.getFirstChild(); + final NodeList list = svgNode.getChildNodes(); + + for (int i = 0; i < list.getLength(); i++) { + final Node node = list.item(i); + // find all groups + if (GROUP_NODE_NAME.equals(node.getNodeName())) { + final NamedNodeMap groupAttributes = node.getAttributes(); + + final String[] transformUnit = getTransformUnit(groupAttributes); + + int groupPositionX = Integer.parseInt(transformUnit[0].trim()); + int groupPositionY = 0; + if (transformUnit.length > 1) { + groupPositionY = Integer.parseInt(transformUnit[1].trim()); + } + + int signumX = Integer.signum(groupPositionX); + int signumY = Integer.signum(groupPositionY); + + final NodeList groupChildren = node.getChildNodes(); + for (int idx = 0; idx < groupChildren.getLength(); idx++) { + final Node rectNode = groupChildren.item(idx); + float curentHeight = 0 ; + float curentWidth = 0; + + // If has a rect use the rect to calcular the real width of the topic + if (RECT_NODE_NAME.equals(rectNode.getNodeName())) { + final NamedNodeMap rectAttributes = rectNode.getAttributes(); + + final Node attributeHeight = rectAttributes.getNamedItem("height"); + final Node attributeWidth = rectAttributes.getNamedItem("width"); + + curentHeight = Float.valueOf(attributeHeight.getNodeValue()); + curentWidth = Float.valueOf(attributeWidth.getNodeValue()); + } + + float newMaxWidth = groupPositionX + (curentWidth * signumX); + if (Math.abs(currentMaxWidth) < Math.abs(newMaxWidth)) { + currentMaxWidth = newMaxWidth; + } + + float newMaxHeight = groupPositionY + curentHeight * signumY; + if (Math.abs(currentMaxHeight) < Math.abs(newMaxHeight)) { + currentMaxHeight = newMaxHeight; + } + } + } + } + + svgNode.setAttribute("viewBox", -Math.abs(currentMaxWidth) + " " + -Math.abs(currentMaxHeight) + " " + Math.abs(currentMaxWidth * 2) + " " + Math.abs(currentMaxHeight * 2)); + svgNode.setAttribute("width", Float.toString(mapWidth / 2)); + svgNode.setAttribute("height", Float.toString(mapHeight / 2)); + svgNode.setAttribute("preserveAspectRatio", "xMinYMin"); + } + + private static String[] getTransformUnit(NamedNodeMap groupAttributes) { + final String value = groupAttributes.getNamedItem("transform").getNodeValue(); + final int pos = value.indexOf("translate"); + final int initTranslate = value.indexOf("(", pos); + final int endTranslate = value.indexOf(")", pos); + final String transate = value.substring(initTranslate + 1, endTranslate); + return transate.split(","); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/freemind/FreemindExporter.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/freemind/FreemindExporter.java new file mode 100755 index 00000000..725413ed --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/freemind/FreemindExporter.java @@ -0,0 +1,223 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exporter.freemind; + +import com.wisemapping.exporter.ExportException; +import com.wisemapping.exporter.Exporter; +import com.wisemapping.model.MindMap; +import com.wisemapping.util.JAXBUtils; +import com.wisemapping.xml.freemind.Font; +import com.wisemapping.xml.freemind.Node; +import com.wisemapping.xml.freemind.Edge; +import com.wisemapping.xml.freemind.Hook; +import com.wisemapping.xml.mindmap.TopicType; +import com.wisemapping.xml.mindmap.Icon; + +import javax.xml.bind.JAXBException; +import java.io.IOException; +import java.io.OutputStream; +import java.io.ByteArrayInputStream; +import java.math.BigInteger; +import java.util.List; + +public class FreemindExporter + implements Exporter +{ + + private com.wisemapping.xml.freemind.ObjectFactory freemindObjectFactory; + + public void export(MindMap map, OutputStream outputStream) throws ExportException { + try { + export(map.getUnzippedXml().getBytes(),outputStream); + } catch (IOException e) { + throw new ExportException(e); + } + } + + public void export(byte[] xml, OutputStream outputStream) throws ExportException { + + freemindObjectFactory = new com.wisemapping.xml.freemind.ObjectFactory(); + final com.wisemapping.xml.mindmap.Map mindmapMap; + + try { + final ByteArrayInputStream stream = new ByteArrayInputStream(xml); + mindmapMap = (com.wisemapping.xml.mindmap.Map) JAXBUtils.getMapObject(stream,"com.wisemapping.xml.mindmap"); + + final com.wisemapping.xml.freemind.Map freemindMap = freemindObjectFactory.createMap(); + + final List topics = mindmapMap.getTopic(); + + // Insolated Topic doesn´t exists in Freemind only take the center topic + TopicType centerTopic = null; + if (topics.size() >1) + { + for (TopicType topic : topics) { + if (topic.isCentral()) + { + centerTopic = topic; + break; + } + } + } + else + { + centerTopic = topics.get(0); + } + + final Node main = freemindObjectFactory.createNode(); + freemindMap.setNode(main); + if (centerTopic != null) + { + setTopicPropertiesToNode(main,centerTopic); + addNodeFromTopic(centerTopic,main); + } + + JAXBUtils.saveMap(freemindMap,outputStream,"com.wisemapping.xml.freemind"); + } catch (JAXBException e) { + throw new ExportException(e); + } + } + + private void addNodeFromTopic(TopicType mainTopic, Node destNode) + { + final List currentTopic = mainTopic.getTopic(); + + for (TopicType topicType : currentTopic) { + final Node newNode = freemindObjectFactory.createNode(); + setTopicPropertiesToNode(newNode,topicType); + destNode.getArrowlinkOrCloudOrEdge().add(newNode); + addNodeFromTopic(topicType,newNode); + } + } + + private void setTopicPropertiesToNode(com.wisemapping.xml.freemind.Node freemindNode, com.wisemapping.xml.mindmap.TopicType mindmapTopic) + { + freemindNode.setTEXT(mindmapTopic.getText()); + freemindNode.setBACKGROUNDCOLOR(mindmapTopic.getBgColor()); + String style = "line"; // default style for freemind + if ("rounded rectagle".equals(mindmapTopic.getShape())) + { + style = "bubble"; + } + freemindNode.setSTYLE(style); + addIconNode(freemindNode,mindmapTopic); + addLinkNode(freemindNode,mindmapTopic); + addFontNode(freemindNode,mindmapTopic); + addEdgeNode(freemindNode,mindmapTopic); + addNote(freemindNode,mindmapTopic); + + } + + private void addNote(com.wisemapping.xml.freemind.Node freemindNode,com.wisemapping.xml.mindmap.TopicType mindmapTopic) + { + if (mindmapTopic.getNote() != null) + { + final Hook note = new Hook(); + String textNote = mindmapTopic.getNote().getText(); + textNote = textNote.replaceAll("%0A","\n"); + note.setNAME("accessories/plugins/NodeNote.properties"); + note.setText(textNote); + freemindNode.getArrowlinkOrCloudOrEdge().add(note); + } + } + + private void addLinkNode(com.wisemapping.xml.freemind.Node freemindNode,com.wisemapping.xml.mindmap.TopicType mindmapTopic) + { + if (mindmapTopic.getLink() != null) + { + final String url = mindmapTopic.getLink().getUrl(); + freemindNode.setLINK(url); + } + } + + private void addIconNode(com.wisemapping.xml.freemind.Node freemindNode,com.wisemapping.xml.mindmap.TopicType mindmapTopic) + { + if (mindmapTopic.getIcon() != null) + { + final List iconsList = mindmapTopic.getIcon(); + for (Icon icon : iconsList) { + final String id = icon.getId(); + com.wisemapping.xml.freemind.Icon freemindIcon = new com.wisemapping.xml.freemind.Icon(); + final String freemindIconId = FreemindIconMapper.getFreemindIcon(id); + freemindIcon.setBUILTIN(freemindIconId); + freemindNode.getArrowlinkOrCloudOrEdge().add(freemindIcon); + } + } + } + + private void addEdgeNode(com.wisemapping.xml.freemind.Node freemindNode,com.wisemapping.xml.mindmap.TopicType mindmapTopic) + { + if (mindmapTopic.getBrColor() != null) + { + final Edge edgeNode = freemindObjectFactory.createEdge(); + edgeNode.setCOLOR(mindmapTopic.getBrColor()); + freemindNode.getArrowlinkOrCloudOrEdge().add(edgeNode); + } + } + + /* + * MindmapFont format : fontName ; size ; color ; bold; italic; + * eg: Verdana;10;#ffffff;bold;italic; + * + */ + private void addFontNode(com.wisemapping.xml.freemind.Node freemindNode,com.wisemapping.xml.mindmap.TopicType mindmapTopic) + { + final String fontStyle = mindmapTopic.getFontStyle(); + if (fontStyle!= null && fontStyle.length()!=0) + { + final Font font = freemindObjectFactory.createFont(); + final String[] part = fontStyle.split(";",6); + int countParts = part.length; + int idx=0; + // Font name + if (idx < countParts && part[idx].length()!=0) + { + font.setNAME(part[idx]); + } + idx++; + // Font size + String size = "10"; // default value + if (idx < countParts && part[idx].length()!=0) + { + size = part[idx]; + } + + font.setSIZE(new BigInteger(size)); + idx++; + + // Font Color + if (idx < countParts && part[idx].length()!=0) + { + freemindNode.setCOLOR(part[idx]); + } + idx++; + if (idx < countParts && part[idx].length()!=0) + { + font.setBOLD(Boolean.TRUE.toString()); + } + idx++; + if (idx < countParts && part[idx].length()!=0) + { + font.setITALIC(Boolean.TRUE.toString()); + } + freemindNode.getArrowlinkOrCloudOrEdge().add(font); + } + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/freemind/FreemindIconMapper.java b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/freemind/FreemindIconMapper.java new file mode 100755 index 00000000..69826313 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/exporter/freemind/FreemindIconMapper.java @@ -0,0 +1,87 @@ +/* +* 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 $ +*/ + +package com.wisemapping.exporter.freemind; + +import com.wisemapping.model.MindmapImagesFactory; +import com.wisemapping.model.ImageFamily; +import com.wisemapping.model.MindmapImage; + +import java.util.Map; +import java.util.HashMap; +import java.util.List; + +public class FreemindIconMapper { + + + private static Map mindmapImageToFreemind = new HashMap(); + private static final String DEFAULT_ICON = "button_ok"; + + public FreemindIconMapper() + { + + } + + public static String getFreemindIcon(String mindmapImageId) + { + + String freemindIconId = mindmapImageToFreemind.get(mindmapImageId); + + // The image doesn´t exists in freemind select he default image + if (freemindIconId == null) + { + freemindIconId = DEFAULT_ICON; + } + return freemindIconId; + } + + static { + + List images = MindmapImagesFactory.getImagesByFamily(ImageFamily.BULLET); + + for (int idx=0; idx < images.size() ; idx++) + { + mindmapImageToFreemind.put(images.get(idx).getId(), "full-"+(idx+1)); + } + + images = MindmapImagesFactory.getImagesByFamily(ImageFamily.FLAG); + for (MindmapImage mindmapImage : images) { + mindmapImageToFreemind.put(mindmapImage.getId(), "flag"); + } + + images = MindmapImagesFactory.getImagesByFamily(ImageFamily.BULB); + mindmapImageToFreemind.put(images.get(0).getId(), "idea"); + + images = MindmapImagesFactory.getImagesByFamily(ImageFamily.TICK); + mindmapImageToFreemind.put(images.get(0).getId(), "button_ok"); + mindmapImageToFreemind.put(images.get(1).getId(), "button_cancel"); + + images = MindmapImagesFactory.getImagesByFamily(ImageFamily.ARROW); + mindmapImageToFreemind.put(images.get(2).getId(), "back"); + mindmapImageToFreemind.put(images.get(3).getId(), "forward"); + + images = MindmapImagesFactory.getImagesByFamily(ImageFamily.FACE); + mindmapImageToFreemind.put(images.get(3).getId(), "ksmiletris"); + + images = MindmapImagesFactory.getImagesByFamily(ImageFamily.FLAG); + for (MindmapImage mindmapImage : images) { + mindmapImageToFreemind.put(mindmapImage.getId(), "flag"); + } + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/filter/BrowserSupportInterceptor.java b/trunk/wise-webapp/src/main/java/com/wisemapping/filter/BrowserSupportInterceptor.java new file mode 100644 index 00000000..5813c298 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/filter/BrowserSupportInterceptor.java @@ -0,0 +1,72 @@ +/* +* 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 $ +*/ + +package com.wisemapping.filter; + +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import com.wisemapping.exceptions.UnsupportedBrowserException; + +import java.util.List; + +public class BrowserSupportInterceptor extends HandlerInterceptorAdapter { + private List exclude; + public static final String USER_AGENT = "wisemapping.userAgent"; + + public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object object) throws Exception { + + final String servletPath = httpServletRequest.getServletPath(); + if (exclude != null && !exclude.contains(servletPath)) { + final HttpSession session = httpServletRequest.getSession(false); + + // Try to loaded from the request ... + UserAgent userAgent = null; + if (session != null) { + userAgent = (UserAgent) session.getAttribute(USER_AGENT); + } + + // I could not loaded. I will create a new one... + if (userAgent == null) { + userAgent = UserAgent.create(httpServletRequest); + if (session != null) { + session.setAttribute(USER_AGENT, userAgent); + } + } + + // It's a supported browser ?. + if (!userAgent.isBrowserSupported()) { + throw new UnsupportedBrowserException(); + } + } + return true; + } + + + public List getExclude() { + return exclude; + } + + public void setExclude(List exclude) { + this.exclude = exclude; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/filter/UserAgent.java b/trunk/wise-webapp/src/main/java/com/wisemapping/filter/UserAgent.java new file mode 100644 index 00000000..915eb7c6 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/filter/UserAgent.java @@ -0,0 +1,321 @@ +/* +* 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 $ +*/ + +package com.wisemapping.filter; + +import org.apache.commons.logging.LogFactory; + +import javax.servlet.http.HttpServletRequest; +import java.io.Serializable; + +public class UserAgent implements Serializable { + public static final String USER_AGENT_HEADER = "User-Agent"; + private int versionMajor = -1; + private int versionVariation = -1; + private Product product; + private OS os; + private final org.apache.commons.logging.Log logger = LogFactory.getLog(UserAgent.class.getName()); + + public static void main(final String argv[]) { + // UserAgent explorer = UserAgent.create("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); + // UserAgent firefox = UserAgent.create("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20050302 Firefox/0.9.6"); + //UserAgent safari = UserAgent.create("iCab/2.9.5 (Macintosh; U; PPC; Mac OS X)"); + //UserAgent opera = UserAgent.create("Opera/9.21 (Windows NT 5.1; U; en)"); + + + + UserAgent firefox = UserAgent.create("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20050302 Firefox/1.9.6"); + assert firefox.isBrowserSupported(); + + + firefox = UserAgent.create("Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7 Creative ZENcast v1.02.08 FirePHP/0.0.5.13"); + assert firefox.isBrowserSupported(); + + firefox = UserAgent.create("Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.8.0.12) Gecko/20070731 Ubuntu/dapper-security Firefox/1.5.0.12"); + assert firefox.isBrowserSupported(); + + firefox = UserAgent.create("'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 firefox 2.0'"); + assert firefox.isBrowserSupported(); + + firefox = UserAgent.create("Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20080129 Iceweasel/2.0.0.12 (Debian-2.0.0.12-0etch1)"); + assert firefox.isBrowserSupported(); + + + + + } + + + public boolean isVersionGreatedOrEqualThan(final int mayor, final int variation) { + return this.versionMajor > mayor || (mayor == this.versionMajor && this.versionVariation >= variation); + } + + public int getVersionMajor() { + return versionMajor; + } + + public int getVersionVariation() { + return versionVariation; + } + + public Product getProduct() { + return product; + } + + public OS getOs() { + return os; + } + + public enum Product { + EXPLORER, FIREFOX, CAMINO, NETSCAPE, OPERA, SAFARI, KONQUEOR, KMELEON, MOZILLA, LYNX, ROBOT; + } + + public enum OS { + WINDOWS, LINUX, MAC, KNOWN + } + + + private UserAgent(final String header) { + parse(header); + } + + private void parse(String userAgentHeader) { + // Format ApplicationName/ApplicationVersion (); + + try { + int detailStart = userAgentHeader.indexOf('('); + int detailEnd = userAgentHeader.indexOf(')'); + + // Parse base format = application (productDetails) productAddition + String application = userAgentHeader.substring(0, detailStart); + application = application.trim(); + + String productDetails = userAgentHeader.substring(detailStart + 1, detailEnd); + productDetails = productDetails.trim(); + + String productAddition = userAgentHeader.substring(detailEnd + 1, userAgentHeader.length()); + productAddition = productAddition.trim(); + + this.os = parseOS(productDetails); + + if (userAgentHeader.indexOf("MSIE") != -1) { + // Explorer Browser : http://msdn2.microsoft.com/en-us/library/ms537503.aspx + // Format: Mozilla/MozVer (compatible; MSIE IEVer[; Provider]; Platform[; Extension]*) [Addition] + // SampleTest: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Google Wireless Transcoder;) + + // Parse version ... + int index = productDetails.indexOf("MSIE") + 4; + int lastIndex = productDetails.indexOf(';', index); + + final String versionStr = productDetails.substring(index + 1, lastIndex); + parseVersion(versionStr); + + // Explorer Parse ... + this.product = Product.EXPLORER; + } else if (userAgentHeader.indexOf("iCab") != -1 || userAgentHeader.indexOf("Safari") != -1) { + // Safari: + //Formats: Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1 + this.product = Product.SAFARI; + + } else if (userAgentHeader.indexOf("Konqueror") != -1) { + this.product = Product.KONQUEOR; + } else if (userAgentHeader.indexOf("KMeleon") != -1) { + this.product = Product.KMELEON; + } else if (userAgentHeader.indexOf("Gecko") != -1) { + // Firefox/Mozilla/Camino: + // Mozilla/MozVer (Platform; Security; SubPlatform; Language; rv:Revision[; Extension]*) Gecko/GeckVer [Product/ProdVer] + // SampleTest: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20050302 Firefox/0.9.6 + // Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7 Creative ZENcast v1.02.08 FirePHP/0.0.5.13 + // 'Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.7.12) Gecko/20050915' + // 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 firefox 2.0' + // 'Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.6) Gecko/20060601 Firefox/2.0.0.6 (Ubuntu-edgy)' + // 'Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.8.0.12) Gecko/20070731 Ubuntu/dapper-security Firefox/1.5.0.12' + // "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20080129 Iceweasel/2.0.0.12 (Debian-2.0.0.12-0etch1) + + // Remove gecko string + // Debian Firefox is remamed to iceweasel. + productAddition = productAddition.replace("Iceweasel","firefox"); + + + productAddition = productAddition.substring(productAddition.indexOf(' ') + 1); + productAddition = productAddition.toLowerCase(); + String prodDesc = null; + if (productAddition.contains("firefox")) { + this.product = Product.FIREFOX; + prodDesc = "firefox"; + } else if (productAddition.contains("netscape")) { + this.product = Product.NETSCAPE; + prodDesc = "netscape"; + } else if (productAddition.contains("camino")) { + this.product = Product.CAMINO; + prodDesc = "camino"; + } else { + this.product = Product.MOZILLA; + // @todo: How it can get the mozilla vesion? + } + + // Now, parse product version ... + if(prodDesc!=null) + { + int sI = productAddition.indexOf(prodDesc) + prodDesc.length() + 1; + int eI = productAddition.indexOf(' ',sI); + if(eI==-1) + { + eI = productAddition.length(); + } + + final String productVersion = productAddition.substring(sI,eI); + parseVersion(productVersion); + + } + + } else if (userAgentHeader.indexOf("Opera") != -1) { + // Opera: + // Samples: Opera/9.0 (Windows NT 5.1; U; en) + // Opera/8.5 (Macintosh; PPC Mac OS X; U; en) + // Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en) Opera 8.5 + // Mozilla/4.0 (compatible; MSIE 6.0; Mac_PowerPC Mac OS X; en) Opera 8.5 + // Opera/9.21 (Windows NT 5.1; U; en) + this.product = Product.OPERA; + String productVersion; + if (application.startsWith("Opera")) { + productVersion = application.substring(application.indexOf('/') + 1, application.length()); + + } else { + productVersion = productAddition.substring(application.lastIndexOf(' ') + 1, application.length()); + } + parseVersion(productVersion); + + } else if (userAgentHeader.indexOf("4.7") != -1) { + this.product = Product.NETSCAPE; + } else if (userAgentHeader.indexOf("Lynx") != -1) { + this.product = Product.LYNX; + } else { + // It's a robot .. + for (String botAgent : botAgents) { + if (userAgentHeader.indexOf(botAgent) != -1) { + // set a key in the session, so the next time we don't have to manually + // detect the robot again + this.product = Product.ROBOT; + break; + } + } + logger.info("UserAgent could not be detected: '" + userAgentHeader + "'"); + } + } catch (Throwable e) { + logger.error("Could not detect the browser based on the user agent: '" + userAgentHeader + "'"); + // Mark as an unsupported browser... + this.product = Product.ROBOT; + } + } + + private OS parseOS(String details) { + OS result; + if (details.contains("Windows")) + result = OS.WINDOWS; + else if (details.contains("Mac") || details.contains("Macintosh")) + result = OS.MAC; + else if (details.contains("X11")) + result = OS.LINUX; + else + result = OS.KNOWN; + return result; + } + + public static UserAgent create(final HttpServletRequest request) { + final String userAgent = request.getHeader(USER_AGENT_HEADER); + return new UserAgent(userAgent); + } + + + public static UserAgent create(final String userAgent) { + return new UserAgent(userAgent); + } + + private void parseVersion(final String version) { + final int index = version.indexOf('.'); + final String vm = version.substring(0, index); + final String vv = version.substring(index + 1, version.length()); + this.versionMajor = Integer.parseInt(vm); + char c = vv.charAt(0); + this.versionVariation = Integer.valueOf(String.valueOf(c)); + } + + /** + * All known robot user-agent headers (list can be found + * here). + *

    + *

    NOTE: To avoid bad detection:

    + *

    + *

      + *
    • Robots with ID of 2 letters only were removed
    • + *
    • Robot called "webs" were removed
    • + *
    • directhit was changed in direct_hit (its real id)
    • + *
    + */ + private static final String[] botAgents = { + "acme.spider", "ahoythehomepagefinder", "alkaline", "appie", "arachnophilia", + "architext", "aretha", "ariadne", "aspider", "atn.txt", "atomz", "auresys", + "backrub", "bigbrother", "bjaaland", "blackwidow", "blindekuh", "bloodhound", + "brightnet", "bspider", "cactvschemistryspider", "calif", "cassandra", + "cgireader", "checkbot", "churl", "cmc", "collective", "combine", "conceptbot", + "core", "cshkust", "cusco", "cyberspyder", "deweb", "dienstspider", "diibot", + "direct_hit", "dnabot", "download_express", "dragonbot", "dwcp", "ebiness", + "eit", "emacs", "emcspider", "esther", "evliyacelebi", "fdse", "felix", + "ferret", "fetchrover", "fido", "finnish", "fireball", "fish", "fouineur", + "francoroute", "freecrawl", "funnelweb", "gazz", "gcreep", "getbot", "geturl", + "golem", "googlebot", "grapnel", "griffon", "gromit", "gulliver", "hambot", + "harvest", "havindex", "hometown", "wired-digital", "htdig", "htmlgobble", + "hyperdecontextualizer", "ibm", "iconoclast", "ilse", "imagelock", "incywincy", + "informant", "infoseek", "infoseeksidewinder", "infospider", "inspectorwww", + "intelliagent", "iron33", "israelisearch", "javabee", "jcrawler", "jeeves", + "jobot", "joebot", "jubii", "jumpstation", "katipo", "kdd", "kilroy", + "ko_yappo_robot", "labelgrabber.txt", "larbin", "legs", "linkscan", + "linkwalker", "lockon", "logo_gif", "lycos", "macworm", "magpie", "mediafox", + "merzscope", "meshexplorer", "mindcrawler", "moget", "momspider", "monster", + "motor", "muscatferret", "mwdsearch", "myweb", "netcarta", "netmechanic", + "netscoop", "newscan-online", "nhse", "nomad", "northstar", "nzexplorer", + "occam", "octopus", "orb_search", "packrat", "pageboy", "parasite", "patric", + "perignator", "perlcrawler", "phantom", "piltdownman", "pioneer", "pitkow", + "pjspider", "pka", "plumtreewebaccessor", "poppi", "portalb", "puu", "python", + "raven", "rbse", "resumerobot", "rhcs", "roadrunner", "robbie", "robi", + "roverbot", "safetynetrobot", "scooter", "search_au", "searchprocess", + "senrigan", "sgscout", "shaggy", "shaihulud", "sift", "simbot", "site-valet", + "sitegrabber", "sitetech", "slurp", "smartspider", "snooper", "solbot", + "spanner", "speedy", "spider_monkey", "spiderbot", "spiderman", "spry", + "ssearcher", "suke", "sven", "tach_bw", "tarantula", "tarspider", "tcl", + "techbot", "templeton", "titin", "titan", "tkwww", "tlspider", "ucsd", + "udmsearch", "urlck", "valkyrie", "victoria", "visionsearch", "voyager", + "vwbot", "w3index", "w3m2", "wanderer", "webbandit", "webcatcher", "webcopy", + "webfetcher", "webfoot", "weblayers", "weblinker", "webmirror", "webmoose", + "webquest", "webreader", "webreaper", "websnarf", "webspider", "webvac", + "webwalk", "webwalker", "webwatch", "wget", "whowhere", "wmir", "wolp", + "wombat", "worm", "wwwc", "wz101", "xget", "nederland.zoek" + }; + + public boolean isBrowserSupported() { + // Is it a supported browser ?. + final UserAgent.Product product = this.getProduct(); + boolean result = product == UserAgent.Product.FIREFOX && this.isVersionGreatedOrEqualThan(1, 5); + result = result || product == UserAgent.Product.EXPLORER && this.isVersionGreatedOrEqualThan(6, 0) && this.getOs() == UserAgent.OS.WINDOWS; + result = result || product == UserAgent.Product.OPERA && this.isVersionGreatedOrEqualThan(9, 2); + return result; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/importer/ImportFormat.java b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/ImportFormat.java new file mode 100755 index 00000000..63c3031d --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/ImportFormat.java @@ -0,0 +1,24 @@ +/* +* 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 $ +*/ + +package com.wisemapping.importer; + +public enum ImportFormat { + FREEMIND() +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/importer/Importer.java b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/Importer.java new file mode 100755 index 00000000..4fb13df2 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/Importer.java @@ -0,0 +1,29 @@ +/* +* 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 $ +*/ + +package com.wisemapping.importer; + +import com.wisemapping.model.MindMap; + +import java.io.InputStream; + +public interface Importer +{ + public MindMap importMap(String mapName,String description,InputStream input) throws ImporterException; +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/importer/ImporterException.java b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/ImporterException.java new file mode 100755 index 00000000..8bbd6e6f --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/ImporterException.java @@ -0,0 +1,33 @@ +/* +* 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 $ +*/ + +package com.wisemapping.importer; + +public class ImporterException + extends Exception +{ + public ImporterException(String str) + { + super(str); + } + public ImporterException(Throwable exc) + { + super(exc); + } +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/importer/ImporterFactory.java b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/ImporterFactory.java new file mode 100755 index 00000000..bfe7fccc --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/ImporterFactory.java @@ -0,0 +1,55 @@ +/* +* 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 $ +*/ + +package com.wisemapping.importer; + +import com.wisemapping.importer.freemind.FreemindImporter; + +public class ImporterFactory +{ + + private static ImporterFactory instance = null; + + private ImporterFactory() {} + + public static ImporterFactory getInstance() + { + if (instance == null) + { + instance = new ImporterFactory(); + } + return instance; + } + + public Importer getImporter(ImportFormat format) + throws ImporterException + { + Importer importer; + switch (format) + { + case FREEMIND: + importer = new FreemindImporter(); + break; + default: + throw new ImporterException("Invalid format type:" + format); + } + + return importer; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindIconMapper.java b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindIconMapper.java new file mode 100755 index 00000000..303accb2 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindIconMapper.java @@ -0,0 +1,85 @@ +/* +* 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 $ +*/ + +package com.wisemapping.importer.freemind; + +import com.wisemapping.model.MindmapImage; +import com.wisemapping.model.MindmapImagesFactory; +import com.wisemapping.model.ImageFamily; + +import java.util.Map; +import java.util.HashMap; +import java.util.List; + +public class FreemindIconMapper { + + + private static Map freemindToMindmapIcon = new HashMap(); + private static final MindmapImage DEFAULT_ICON = MindmapImagesFactory.getImagesByFamily(ImageFamily.BULLET).get(3); + + public FreemindIconMapper() + { + + } + + public static String getMindmapIcon(String freemindIconId) + { + + String iconId = freemindToMindmapIcon.get(freemindIconId); + + // The image doesn´t exists in freemind select he default image + if (iconId == null) + { + iconId = DEFAULT_ICON.getId(); + } + return iconId; + } + + static { + + List images = MindmapImagesFactory.getImagesByFamily(ImageFamily.BULLET); + + freemindToMindmapIcon.put( "full-1",images.get(0).getId()); + freemindToMindmapIcon.put( "full-2",images.get(1).getId()); + freemindToMindmapIcon.put( "full-3",images.get(2).getId()); + freemindToMindmapIcon.put( "full-4",images.get(3).getId()); + freemindToMindmapIcon.put( "full-5",images.get(4).getId()); + freemindToMindmapIcon.put( "full-6",images.get(5).getId()); + freemindToMindmapIcon.put( "full-7",images.get(6).getId()); + + images = MindmapImagesFactory.getImagesByFamily(ImageFamily.BULB); + freemindToMindmapIcon.put( "idea",images.get(0).getId()); + + images = MindmapImagesFactory.getImagesByFamily(ImageFamily.TICK); + freemindToMindmapIcon.put( "button_ok",images.get(0).getId()); + freemindToMindmapIcon.put( "button_cancel",images.get(1).getId()); + + images = MindmapImagesFactory.getImagesByFamily(ImageFamily.ARROW); + freemindToMindmapIcon.put( "back",images.get(2).getId()); + freemindToMindmapIcon.put( "forward",images.get(3).getId()); + + images = MindmapImagesFactory.getImagesByFamily(ImageFamily.FACE); + freemindToMindmapIcon.put( "ksmiletris",images.get(3).getId()); + + images = MindmapImagesFactory.getImagesByFamily(ImageFamily.FLAG); + + final MindmapImage orangeFlag = images.get(2); + freemindToMindmapIcon.put("flag", orangeFlag.getId()); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java new file mode 100755 index 00000000..0300addc --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java @@ -0,0 +1,231 @@ +/* +* 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 $ +*/ + +package com.wisemapping.importer.freemind; + +import com.wisemapping.importer.Importer; +import com.wisemapping.importer.ImporterException; +import com.wisemapping.model.MindMap; +import com.wisemapping.model.ShapeStyle; +import com.wisemapping.model.MindMapNative; +import com.wisemapping.util.JAXBUtils; +import com.wisemapping.xml.freemind.*; +import com.wisemapping.xml.mindmap.TopicType; +import com.wisemapping.xml.mindmap.Link; + +import javax.xml.bind.JAXBException; +import java.io.InputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.List; +import java.math.BigInteger; + +public class FreemindImporter + implements Importer +{ + + private com.wisemapping.xml.mindmap.ObjectFactory mindmapObjectFactory; + private static final String POSITION_LEFT = "left"; + private static final String BOLD = "bold"; + private static final String ITALIC = "italic"; + private static final String EMPTY_NOTE = ""; + + public MindMap importMap(String mapName,String description,InputStream input) throws ImporterException { + + final MindMap map; + mindmapObjectFactory = new com.wisemapping.xml.mindmap.ObjectFactory(); + try { + final Map freemindMap = (Map) JAXBUtils.getMapObject(input,"com.wisemapping.xml.freemind"); + + final com.wisemapping.xml.mindmap.Map mindmapMap = mindmapObjectFactory.createMap(); + + final Node centralNode = freemindMap.getNode(); + final TopicType centralTopic = mindmapObjectFactory.createTopicType(); + centralTopic.setCentral(true); + + setNodePropertiesToTopic(centralTopic,centralNode); + centralTopic.setShape(ShapeStyle.ROUNDED_RETAGLE.getStyle()); + mindmapMap.getTopic().add(centralTopic); + mindmapMap.setName(mapName); + + addTopicFromNode(centralNode,centralTopic); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + JAXBUtils.saveMap(mindmapMap,out,"com.wisemapping.xml.mindmap"); + + map = new MindMap(); + map.setNativeXml(out.toString()); + map.setTitle(mapName); + map.setDescription(description); + map.setNativeBrowser(new MindMapNative()); + + } catch (JAXBException e) { + throw new ImporterException(e); + } catch (IOException e) { + throw new ImporterException(e); + } + + return map; + } + + private void addTopicFromNode(Node mainNode, TopicType topic) + { + final List freemindNodes = mainNode.getArrowlinkOrCloudOrEdge(); + TopicType currentTopic = topic; + int order = 0; + for (Object freemindNode : freemindNodes) { + + if (freemindNode instanceof Node) + { + final Node node = (Node) freemindNode; + TopicType newTopic = mindmapObjectFactory.createTopicType(); + newTopic.setOrder(order++); + String url = node.getLINK(); + if (url != null) + { + final Link link = new Link(); + link.setUrl(url); + newTopic.setLink(link); + } + setNodePropertiesToTopic(newTopic, node); + addTopicFromNode(node,newTopic); + if (!newTopic.equals(topic)) + { + topic.getTopic().add(newTopic); + } + currentTopic = newTopic; + } + else if (freemindNode instanceof Font) + { + final Font font = (Font)freemindNode; + final String fontStyle = generateFontStyle(mainNode, font); + currentTopic.setFontStyle(fontStyle); + } + else if (freemindNode instanceof Edge) + { + final Edge edge = (Edge)freemindNode; + currentTopic.setBrColor(edge.getCOLOR()); + } + else if (freemindNode instanceof Icon) + { + final Icon freemindIcon = (Icon)freemindNode; + final com.wisemapping.xml.mindmap.Icon mindmapIcon = new com.wisemapping.xml.mindmap.Icon(); + final String mindmapIconId = FreemindIconMapper.getMindmapIcon(freemindIcon.getBUILTIN()); + mindmapIcon.setId(mindmapIconId); + currentTopic.getIcon().add(mindmapIcon); + } + else if (freemindNode instanceof Hook) + { + final Hook hook = (Hook)freemindNode; + final com.wisemapping.xml.mindmap.Note mindmapNote = new com.wisemapping.xml.mindmap.Note(); + String textNote = hook.getText(); + if (textNote == null) // It is not a note is a BlinkingNodeHook or AutomaticLayout Hook + { + textNote = textNote != null ? textNote.replaceAll("\n","%0A") : EMPTY_NOTE; + mindmapNote.setText(textNote); + currentTopic.setNote(mindmapNote); + } + } + } + } + + private void setNodePropertiesToTopic( com.wisemapping.xml.mindmap.TopicType mindmapTopic,com.wisemapping.xml.freemind.Node freemindNode) + { + mindmapTopic.setText(freemindNode.getTEXT()); + mindmapTopic.setBgColor(freemindNode.getBACKGROUNDCOLOR()); + + final String shape = getShapeFormFromNode(freemindNode); + mindmapTopic.setShape(shape); + int pos = 1; + if (POSITION_LEFT.equals(freemindNode.getPOSITION())) + { + pos = -1; + } + Integer orderPosition = mindmapTopic.getOrder() != null ? mindmapTopic.getOrder() : 0; + int position = pos * 200 + (orderPosition +1)*10; + + mindmapTopic.setPosition( position+","+200 * orderPosition); + generateFontStyle(freemindNode,null); + } + + private String generateFontStyle(Node node,Font font) + { + /* + * MindmapFont format : fontName ; size ; color ; bold; italic; + * eg: Verdana;10;#ffffff;bold;italic; + * + */ + StringBuilder fontStyle = new StringBuilder(); + if (font != null) + { + fontStyle.append(fixFontName(font)); + fontStyle.append(";"); + BigInteger bigInteger = font.getSIZE().intValue() < 8 ? BigInteger.valueOf(8) : font.getSIZE(); + fontStyle.append(bigInteger); + fontStyle.append(";"); + fontStyle.append(node.getCOLOR()); + fontStyle.append(";"); + + boolean hasBold = Boolean.parseBoolean(font.getBOLD()); + + fontStyle.append(hasBold ? BOLD : null); + fontStyle.append(";"); + + boolean hasItalic = Boolean.parseBoolean(font.getITALIC()); + fontStyle.append(hasItalic ? ITALIC : null); + fontStyle.append(";"); + } + else + { + fontStyle.append(";"); + fontStyle.append(";"); + fontStyle.append(node.getCOLOR()); + fontStyle.append(";"); + fontStyle.append(";"); + fontStyle.append(";"); + } + + return fontStyle.toString(); + } + + private String fixFontName(Font font) + { + String fontName = com.wisemapping.model.Font.ARIAL.getFontName(); // Default Font + if (com.wisemapping.model.Font.isValidFont(font.getNAME())) + { + fontName = font.getNAME(); + } + return fontName; + } + + private String getShapeFormFromNode(Node node) + { + String shape = node.getSTYLE(); + // In freemind a node without style is a line + if ("bubble".equals(shape)) + { + shape= ShapeStyle.ROUNDED_RETAGLE.getStyle(); + } + else + { + shape=ShapeStyle.LINE.getStyle(); + } + return shape; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java b/trunk/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java new file mode 100644 index 00000000..a17f2322 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java @@ -0,0 +1,96 @@ +/* +* 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 $ +*/ + +// ........................................................................................................... +// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved +// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc. +// The copyright notice above does not evidence any actual or intended +// publication of such source code. +// +// Last changed on 2007-04-03 09:29:20 (-0300), by: nachomanz. $Revision$ +// ........................................................................................................... + +package com.wisemapping.mail; + +import org.apache.velocity.app.VelocityEngine; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.mail.javamail.MimeMessagePreparator; +import org.springframework.ui.velocity.VelocityEngineUtils; + +import javax.mail.internet.MimeMessage; +import java.util.Map; + +public final class Mailer { + + //~ Instance fields ...................................................................................... + + private JavaMailSender mailSender; + private VelocityEngine velocityEngine; + private String registrationEmail; + private String siteEmail; + + //~ Methods .............................................................................................. + + public Mailer(String registrationEmail, String siteEmail) + { + this.registrationEmail = registrationEmail; + this.siteEmail = siteEmail; + } + + public String getRegistrationEmail() + { + return registrationEmail; + } + + public String getSiteEmail() + { + return siteEmail; + } + + public void sendEmail(final String from, final String to, final String subject, final Map model, + final String templateMail) { + final MimeMessagePreparator preparator = + new MimeMessagePreparator() { + public void prepare(MimeMessage mimeMessage) + throws Exception { + final MimeMessageHelper message = new MimeMessageHelper(mimeMessage); + message.setTo(to); + message.setFrom(from); + message.setSubject(subject); + + final String text = + VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/mail/" + templateMail, + model); + + message.setText(text, true); + } + }; + + this.mailSender.send(preparator); + } + + public void setMailSender(JavaMailSender mailer) { + this.mailSender = mailer; + } + + public void setVelocityEngine(VelocityEngine engine) { + this.velocityEngine = engine; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/mail/SmtpAuthenticator.java b/trunk/wise-webapp/src/main/java/com/wisemapping/mail/SmtpAuthenticator.java new file mode 100755 index 00000000..f2080c11 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/mail/SmtpAuthenticator.java @@ -0,0 +1,42 @@ +/* +* 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 $ +*/ + +package com.wisemapping.mail; + +import javax.mail.Authenticator; +import javax.mail.PasswordAuthentication; + +public class SmtpAuthenticator + extends Authenticator +{ + private String username; + private String password; + + public SmtpAuthenticator(String username, String password) + { + super(); + this.username = username; + this.password = password; + } + + public PasswordAuthentication getPasswordAuthentication() + { + return new PasswordAuthentication(username, password); + } +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/ColaborationEmail.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/ColaborationEmail.java new file mode 100755 index 00000000..d353879d --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/ColaborationEmail.java @@ -0,0 +1,44 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +public class ColaborationEmail +{ + private String subject; + private String message; + + public ColaborationEmail(){} + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/Colaborator.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/Colaborator.java new file mode 100755 index 00000000..745282df --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/Colaborator.java @@ -0,0 +1,77 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +import java.util.Calendar; +import java.util.Set; +import java.util.HashSet; + + +public class Colaborator { + private long id; + private String email; + private Calendar creationDate; + private Set mindmapUsers = new HashSet(); + + public Colaborator() {} + + public Colaborator(Set mindmapUsers) { + this.mindmapUsers = mindmapUsers; + } + + public void setMindmapUsers(Set mindmapUsers) + { + this.mindmapUsers = mindmapUsers; + } + + public void addMindmapUser(MindmapUser mindmaUser) + { + mindmapUsers.add(mindmaUser); + } + + public Set getMindmapUsers() + { + return mindmapUsers; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Calendar getCreationDate() { + return creationDate; + } + + public void setCreationDate(Calendar creationDate) { + this.creationDate = creationDate; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/Constants.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/Constants.java new file mode 100755 index 00000000..d83c0c9a --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/Constants.java @@ -0,0 +1,34 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +public class Constants { + + public static int WELCOME_MAP_ID =49 ; + public static final int MAX_MAP_NAME_LENGTH = 512; + public static final int MAX_MAP_DESCRIPTION_LENGTH = 512; + public static final int MAX_USER_USERNAME_LENGTH = 255; + public static final int MAX_USER_LASTNAME_LENGTH = 255; + public static final int MAX_USER_FIRSTNAME_LENGTH = 255; + public static final int MAX_USER_PASSWORD_LENGTH = 255; + public static final int MAX_COMMENT_LENGTH = 512; + public static final int MAX_SUBJECT_LENGTH = 100; + public static final int MAX_TAGS_LENGTH=1014; +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/Font.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/Font.java new file mode 100755 index 00000000..9a1612f0 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/Font.java @@ -0,0 +1,53 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +public enum Font { + + VERDANA("Verdana"), + TIMES("Times"), + TAHOMA("Tahoma"), + ARIAL("Arial"); + + private String fontName; + + Font (String name) + { + this.fontName = name; + } + + public String getFontName() + { + return fontName; + } + + public static boolean isValidFont(String font) { + boolean isValid = false; + try { + if (font != null) { + isValid = Font.valueOf(font.toUpperCase()) != null; + } + } + catch (IllegalArgumentException ignote) { + } + + return isValid; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/ImageFamily.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/ImageFamily.java new file mode 100755 index 00000000..9b29e6a4 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/ImageFamily.java @@ -0,0 +1,55 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +public enum ImageFamily { + FLAG("FLAG","flag_"), + BULLET("BULLET","bullet_"), + TAG("TAG","tag_"), + NUMBER("NUMBER","number_"), + FACE("FACE","face_"), + FACE_FUNY("FACEFUNY","facefuny_"), + ARROW("ARROW","arrow_"), + ARROWC("ARROWC","arrowc_"), + CONN("CONN","conn_"), + BULB("BULB","bulb_"), + THUMB("THUMB","thumb_"), + TICK("TICK","tick_"), + ONOFF("ONOFF","onoff_"), + MONEY("MONEY","money_"), + CHART("CHART","chart_"), + TASK("TASK","task_"); + + private String prefix; + private String name; + + ImageFamily(String name, String prefix) { + this.name = name; + this.prefix = prefix; + } + + public String getPrefix() { + return prefix; + } + + public String getName() { + return name; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMap.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMap.java new file mode 100644 index 00000000..85bb5f64 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMap.java @@ -0,0 +1,288 @@ +/* +* 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 $ +*/ + +// ........................................................................................................... +// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved +// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc. +// The copyright notice above does not evidence any actual or intended +// publication of such source code. +// +// Last changed on 2007-08-01 19:08:21 (-0300), by: imanzano. $Revision$ +// ........................................................................................................... + +package com.wisemapping.model; + +import com.wisemapping.exporter.ExportProperties; +import com.wisemapping.exporter.SvgExporter; +import com.wisemapping.util.ZipUtils; +import com.wisemapping.xml.VmlToSvgConverter; +import com.wisemapping.exporter.ExportException; +import org.apache.batik.transcoder.TranscoderException; +import org.apache.log4j.Logger; +import org.xml.sax.SAXException; + +import javax.xml.bind.JAXBException; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.stream.XMLStreamException; +import javax.xml.transform.TransformerException; +import java.io.CharArrayReader; +import java.io.CharArrayWriter; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; + +public class MindMap { + + //~ Instance fields ...................................................................................... + + final Logger logger = Logger.getLogger(MindMap.class.getName()); + private Calendar creationTime; + private String creator; + private String description; + + private int id; + private boolean isPublic; + private Calendar lastModificationTime; + private String lastModifierUser; + + private Set mindmapUsers = new HashSet(); + private MindMapNative nativeBrowser; + private User owner; + private String properties; + private String tags; + private String title; + private byte[] xml; + + public static void main(String argv[]) { + + String xml = "pepe\n hole"; + xml = xml.replace("'", "\\'"); + xml = xml.replace("\n", ""); + xml = xml.trim(); + + System.out.println("xml:" + xml); + + } + + //~ Constructors ......................................................................................... + + public MindMap() { + } + + public MindMap(Set mindmapUsers) { + this.mindmapUsers = mindmapUsers; + } + + //~ Methods .............................................................................................. + + public void setXml(byte[] xml) { + this.xml = xml; + } + + public byte[] getXml() { + return xml; + } + + public String getUnzippedXml() + throws IOException { + return ZipUtils.zipToString(xml); + } + + public void setProperties(String properties) { + this.properties = properties; + } + + public String getProperties() { + String ret; + if (properties == null) { + ret = "{zoom:0.7,saveOnLoad:true}"; + } else { + ret = properties; + } + + return ret; + } + + public Set getMindmapUsers() { + return mindmapUsers; + } + + public void setMindmapUsers(Set mindmapUsers) { + this.mindmapUsers = mindmapUsers; + } + + public void addMindmapUser(MindmapUser mindmaUser) { + mindmapUsers.add(mindmaUser); + } + + public boolean isPublic() { + return isPublic; + } + + public void setPublic(boolean isPublic) { + this.isPublic = isPublic; + } + + public Calendar getLastModificationTime() { + return lastModificationTime; + } + + public Date getLastModificationDate() { + return new Date(); + } + + public void setLastModificationTime(Calendar lastModificationTime) { + this.lastModificationTime = lastModificationTime; + } + + public String getLastModifierUser() { + return lastModifierUser; + } + + public void setLastModifierUser(String lastModifierUser) { + this.lastModifierUser = lastModifierUser; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creatorUser) { + this.creator = creatorUser; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getNativeXml() + throws IOException { + return getUnzippedXml(); + } + + + public String getNativeXmlAsJsLiteral() + throws IOException { + String xml = getNativeXml(); + if (xml != null) { + xml = xml.replace("'", "\\'"); + xml = xml.replace("\n", ""); + xml = xml.trim(); + } + return xml; + } + + public void setNativeXml(String nativeXml) + throws IOException { + this.xml = ZipUtils.stringToZip(nativeXml); + } + + public void setTags(String tags) { + this.tags = tags; + } + + public String getTags() { + return tags; + } + + public char[] generateSvgXml() + throws IOException, JAXBException { + final MindMapNative mindmapNativeBrowser = this.getNativeBrowser(); + String svgText = mindmapNativeBrowser.getUnzippedSvgXml(); + + if (svgText == null || svgText.length() == 0) { + // The map must be saved using IE. Convert VML to SVG. + + // Add namespace to the converter ... + String vmlXml = mindmapNativeBrowser.getUnzippedVmlXml(); + vmlXml = vmlXml.replaceFirst("]+)>", ""); + + return result.toCharArray(); + } + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Calendar getCreationTime() { + return creationTime; + } + + public void setCreationTime(Calendar creationTime) { + this.creationTime = creationTime; + } + + public void export(final ExportProperties properties, OutputStream output) throws JAXBException, TranscoderException, TransformerException, IOException, ParserConfigurationException, ExportException, SAXException, XMLStreamException { + SvgExporter.export(properties, this, output); + } + + public void setOwner(User owner) { + this.owner = owner; + } + + public User getOwner() { + return owner; + } + + public MindMapNative getNativeBrowser() { + return nativeBrowser; + } + + public void setNativeBrowser(MindMapNative nativeBrowser) { + this.nativeBrowser = nativeBrowser; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMapCriteria.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMapCriteria.java new file mode 100644 index 00000000..6ce01a6b --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMapCriteria.java @@ -0,0 +1,86 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +import java.util.List; +import java.util.ArrayList; + +public class MindMapCriteria { + private String title; + private String description; + private List tags = new ArrayList(); + private boolean orConnector = false; + private int pageNro = 0; + + public MindMapCriteria() { + } + + public int getPageNro() + { + return pageNro; + } + + public void setPageNro(int page) + { + this.pageNro = page; + } + + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public void orCriteria() { + this.orConnector = true; + } + + public void andCriteria() { + this.orConnector = false; + } + + public boolean isOrCriteria() { + return this.orConnector; + } + + public boolean isEmpty() { + return !(getTags() != null && !getTags().isEmpty() || getTitle() != null || getDescription() != null); + } + + public static MindMapCriteria EMPTY_CRITERIA = new MindMapCriteria(); +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMapHistory.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMapHistory.java new file mode 100755 index 00000000..cee13fd6 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMapHistory.java @@ -0,0 +1,85 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +import com.wisemapping.util.ZipUtils; + +import java.util.Calendar; +import java.io.IOException; + +public class MindMapHistory { + + private int id; + private Calendar creationTime; + private String creator; + private byte[] xml; + private int mindmapId; + + public MindMapHistory() + { + + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getMindmapId() { + return mindmapId; + } + + public void setMindmapId(int id) { + this.mindmapId = id; + } + + public Calendar getCreationTime() { + return creationTime; + } + + public void setCreationTime(Calendar creationTime) { + this.creationTime = creationTime; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public byte[] getXml() { + return xml; + } + + public void setXml(byte[] xml) { + this.xml = xml; + } + + public String getNativeXml() + throws IOException + { + return ZipUtils.zipToString(xml); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMapNative.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMapNative.java new file mode 100755 index 00000000..d44d6029 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindMapNative.java @@ -0,0 +1,80 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +import com.wisemapping.util.ZipUtils; + +import java.io.IOException; + +/** + * This class contains the SVG and VML representation of the MindMap + */ +public class MindMapNative { + private int id; + + private byte[] svgXml; + private byte[] vmlXml; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public byte[] getSvgXml() { + return svgXml; + } + + public void setSvgXml(byte[] svgXml) { + this.svgXml = svgXml; + } + + public byte[] getVmlXml() { + return vmlXml; + } + + public void setVmlXml(byte[] vmlXml) { + this.vmlXml = vmlXml; + } + + public String getUnzippedVmlXml() + throws IOException + { + return ZipUtils.zipToString(vmlXml); + } + + public String getUnzippedSvgXml() + throws IOException + { + return ZipUtils.zipToString(svgXml); + } + + public void setVmlXml(String xml) throws IOException { + // compress and set + vmlXml = ZipUtils.stringToZip(xml); + } + + public void setSvgXml(String xml) throws IOException { + // compress and set + svgXml = ZipUtils.stringToZip(xml); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindmapImage.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindmapImage.java new file mode 100755 index 00000000..10d8fa56 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindmapImage.java @@ -0,0 +1,47 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +public class MindmapImage +{ + private String name; + private ImageFamily family; + + public MindmapImage(String name, ImageFamily family) + { + this.name = name; + this.family = family; + } + + public String getName() + { + return name; + } + + public ImageFamily getFamily() + { + return family; + } + + public String getId() + { + return family.getPrefix() + name; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindmapImagesFactory.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindmapImagesFactory.java new file mode 100755 index 00000000..b72756c0 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindmapImagesFactory.java @@ -0,0 +1,217 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +import java.util.*; + +public class MindmapImagesFactory { + + private static Map> images = new HashMap>(); + + static { + images.put(ImageFamily.BULLET, getImagesBullet()); + images.put(ImageFamily.FLAG,getImagesFlag()); + images.put(ImageFamily.NUMBER,getImagesNumber()); + images.put(ImageFamily.TAG,getImagesTag()); + images.put(ImageFamily.TASK,getImagesTask()); + images.put(ImageFamily.FACE,getImagesFaces()); + images.put(ImageFamily.BULB,getImagesBulb()); + images.put(ImageFamily.ARROW,getImagesArrow()); + images.put(ImageFamily.ARROWC,getImagesArrowC()); + images.put(ImageFamily.CONN,getImagesConn()); + images.put(ImageFamily.THUMB,getImagesThumbs()); + images.put(ImageFamily.TICK,getImagesTick()); + images.put(ImageFamily.ONOFF,getImagesOnOff()); + images.put(ImageFamily.MONEY,getImagesMoney()); + images.put(ImageFamily.CHART,getImagesChart()); + } + + private static List getImagesFaces() + { + final List images = new ArrayList(); + images.add(new MindmapImage("plain",ImageFamily.FACE)); + images.add(new MindmapImage("sad",ImageFamily.FACE)); + images.add(new MindmapImage("crying",ImageFamily.FACE)); + images.add(new MindmapImage("smile",ImageFamily.FACE)); + images.add(new MindmapImage("surprise",ImageFamily.FACE)); + images.add(new MindmapImage("wink",ImageFamily.FACE)); + return images; + } + + private static List getImagesArrow() + { + final List images = new ArrayList(); + images.add(new MindmapImage("up",ImageFamily.ARROW)); + images.add(new MindmapImage("down",ImageFamily.ARROW)); + images.add(new MindmapImage("left",ImageFamily.ARROW)); + images.add(new MindmapImage("right",ImageFamily.ARROW)); + return images; + } + + private static List getImagesArrowC() + { + final List images = new ArrayList(); + images.add(new MindmapImage("undo",ImageFamily.ARROWC)); + images.add(new MindmapImage("rotate_anticlockwise",ImageFamily.ARROWC)); + images.add(new MindmapImage("rotate_clockwise",ImageFamily.ARROWC)); + images.add(new MindmapImage("turn_left",ImageFamily.ARROWC)); + images.add(new MindmapImage("turn_right",ImageFamily.ARROWC)); + return images; + } + + private static List getImagesBulb() + { + final List images = new ArrayList(); + images.add(new MindmapImage("light_on",ImageFamily.BULB)); + images.add(new MindmapImage("light_off",ImageFamily.BULB)); + return images; + } + + private static List getImagesTick() + { + final List images = new ArrayList(); + images.add(new MindmapImage("tick",ImageFamily.TICK)); + images.add(new MindmapImage("cross",ImageFamily.TICK)); + return images; + } + + private static List getImagesChart() + { + final List images = new ArrayList(); + images.add(new MindmapImage("bar",ImageFamily.CHART)); + images.add(new MindmapImage("line",ImageFamily.CHART)); + images.add(new MindmapImage("curve",ImageFamily.CHART)); + images.add(new MindmapImage("pie",ImageFamily.CHART)); + images.add(new MindmapImage("organisation",ImageFamily.CHART)); + return images; + } + + private static List getImagesOnOff() + { + final List images = new ArrayList(); + images.add(new MindmapImage("clock",ImageFamily.ONOFF)); + images.add(new MindmapImage("clock_red",ImageFamily.ONOFF)); + images.add(new MindmapImage("add",ImageFamily.ONOFF)); + images.add(new MindmapImage("delete",ImageFamily.ONOFF)); + return images; + } + + private static List getImagesMoney() + { + final List images = new ArrayList(); + images.add(new MindmapImage("money",ImageFamily.MONEY)); + images.add(new MindmapImage("dollar",ImageFamily.MONEY)); + images.add(new MindmapImage("euro",ImageFamily.MONEY)); + images.add(new MindmapImage("pound",ImageFamily.MONEY)); + images.add(new MindmapImage("yen",ImageFamily.MONEY)); + images.add(new MindmapImage("coins",ImageFamily.MONEY)); + images.add(new MindmapImage("ruby",ImageFamily.MONEY)); + return images; + } + + private static List getImagesThumbs() + { + final List images = new ArrayList(); + images.add(new MindmapImage("thumb_up",ImageFamily.THUMB)); + images.add(new MindmapImage("thumb_down",ImageFamily.THUMB)); + return images; + } + + private static List getImagesConn() + { + final List images = new ArrayList(); + images.add(new MindmapImage("connect",ImageFamily.CONN)); + images.add(new MindmapImage("disconnect",ImageFamily.CONN)); + return images; + } + + private static List getImagesBullet() + { + final List images = new ArrayList(); + images.add(new MindmapImage("black",ImageFamily.BULLET)); + images.add(new MindmapImage("blue",ImageFamily.BULLET)); + images.add(new MindmapImage("green",ImageFamily.BULLET)); + images.add(new MindmapImage("orange",ImageFamily.BULLET)); + images.add(new MindmapImage("red",ImageFamily.BULLET)); + images.add(new MindmapImage("pink",ImageFamily.BULLET)); + images.add(new MindmapImage("purple",ImageFamily.BULLET)); + return images; + } + + private static List getImagesFlag() + { + final List images = new ArrayList(); + images.add(new MindmapImage("blue",ImageFamily.FLAG)); + images.add(new MindmapImage("green",ImageFamily.FLAG)); + images.add(new MindmapImage("orange",ImageFamily.FLAG)); + images.add(new MindmapImage("pink",ImageFamily.FLAG)); + images.add(new MindmapImage("purple",ImageFamily.FLAG)); + images.add(new MindmapImage("yellow",ImageFamily.FLAG)); + return images; + } + + private static List getImagesNumber() + { + final List images = new ArrayList(); + images.add(new MindmapImage("one",ImageFamily.NUMBER)); + images.add(new MindmapImage("two",ImageFamily.NUMBER)); + images.add(new MindmapImage("three",ImageFamily.NUMBER)); + images.add(new MindmapImage("four",ImageFamily.NUMBER)); + images.add(new MindmapImage("five",ImageFamily.NUMBER)); + images.add(new MindmapImage("six",ImageFamily.NUMBER)); + images.add(new MindmapImage("seven",ImageFamily.NUMBER)); + images.add(new MindmapImage("eight",ImageFamily.NUMBER)); + images.add(new MindmapImage("nine",ImageFamily.NUMBER)); + return images; + } + + private static List getImagesTag() + { + final List images = new ArrayList(); + images.add(new MindmapImage("blue",ImageFamily.TAG)); + images.add(new MindmapImage("green",ImageFamily.TAG)); + images.add(new MindmapImage("orange",ImageFamily.TAG)); + images.add(new MindmapImage("red",ImageFamily.TAG)); + images.add(new MindmapImage("pink",ImageFamily.TAG)); + images.add(new MindmapImage("yellow",ImageFamily.TAG)); + return images; + } + + private static List getImagesTask() + { + final List images = new ArrayList(); + images.add(new MindmapImage("one",ImageFamily.TASK)); + images.add(new MindmapImage("two",ImageFamily.TASK)); + images.add(new MindmapImage("three",ImageFamily.TASK)); + images.add(new MindmapImage("four",ImageFamily.TASK)); + images.add(new MindmapImage("five",ImageFamily.TASK)); + return images; + } + + public static Collection> getAllImages() + { + return images.values(); + } + + public static List getImagesByFamily(ImageFamily family) + { + return images.get(family); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindmapUser.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindmapUser.java new file mode 100644 index 00000000..4549159e --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/MindmapUser.java @@ -0,0 +1,89 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +public class MindmapUser { + + private int id; + private int roleId; + private MindMap mindMap; + private Colaborator colaborator; + + public MindmapUser(){ } + + public MindmapUser(int role, Colaborator colaborator , MindMap mindmap) + { + this.roleId = role; + this.mindMap =mindmap; + this.colaborator = colaborator; + + // Guarantee referential integrity + mindmap.addMindmapUser(this); + colaborator.addMindmapUser(this); + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getRoleId() { + return roleId; + } + + public void setRoleId(int roleId) { + this.roleId = roleId; + } + + public UserRole getRole() { + return UserRole.values()[roleId]; + } + + public boolean isOwner() { + return getRole() == UserRole.OWNER; + } + + public boolean isCollaborator() { + return getRole() == UserRole.COLLABORATOR; + } + + public boolean isViewer() { + return getRole() == UserRole.VIEWER; + } + + public MindMap getMindMap() { + return mindMap; + } + + public void setMindMap(MindMap mindMap) { + this.mindMap = mindMap; + } + + public Colaborator getColaborator() { + return colaborator; + } + + public void setColaborator(Colaborator colaborator) { + this.colaborator = colaborator; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/ShapeStyle.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/ShapeStyle.java new file mode 100755 index 00000000..5ab943de --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/ShapeStyle.java @@ -0,0 +1,40 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +public enum ShapeStyle +{ + LINE("line"), + ROUNDED_RETAGLE("rounded rectagle"), + RECTAGLE("rectagle"), + ELIPSE("elipse"); + + private String style; + + ShapeStyle(String style) + { + this.style = style; + } + + public String getStyle() + { + return style; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/User.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/User.java new file mode 100644 index 00000000..e046dc8c --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/User.java @@ -0,0 +1,141 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +import java.io.Serializable; +import java.util.*; + +public class User + extends Colaborator + implements Serializable +{ + + private String firstname; + private String lastname; + private String password; + private long activationCode; + private Calendar activationDate; + private String username; + private Set tags = new HashSet(); + private boolean allowSendEmail = false; + + public User() { + } + + public void setTags(Set tags) + { + this.tags = tags; + } + + public Set getTags() + { + return tags; + } + + public String getFirstname() { + return firstname; + } + + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + public String getLastname() { + return lastname; + } + + public void setLastname(String lastname) { + this.lastname = lastname; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public boolean isActive() { + return activationDate != null; + } + + public void setActivationCode(long code) { + this.activationCode = code; + } + + public long getActivationCode() { + return activationCode; + } + + public void setActivationDate(Calendar date) { + this.activationDate = date; + } + + public Calendar getActivationDate() { + return activationDate; + } + + public boolean isAllowSendEmail() + { + return allowSendEmail; + } + + public void setAllowSendEmail(boolean allowSendEmail) + { + this.allowSendEmail = allowSendEmail; + } + + public boolean getAllowSendEmail() + { + return allowSendEmail; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + final User user = (User) o; + + if (!getEmail().equals(user.getEmail())) return false; + if (firstname != null ? !firstname.equals(user.firstname) : user.firstname != null) return false; + if (lastname != null ? !lastname.equals(user.lastname) : user.lastname != null) return false; + if (password != null ? !password.equals(user.password) : user.password != null) return false; + + return true; + } + + public int hashCode() { + int result; + result = (firstname != null ? firstname.hashCode() : 0); + result = 29 * result + (lastname != null ? lastname.hashCode() : 0); + result = 29 * result + (password != null ? password.hashCode() : 0); + result = 29 * result + getEmail().hashCode(); + return result; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/UserLogin.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/UserLogin.java new file mode 100755 index 00000000..07781347 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/UserLogin.java @@ -0,0 +1,84 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +import java.io.Serializable; +import java.util.Calendar; + +public class UserLogin + implements Serializable +{ + + private int id; + private Calendar loginDate = null; + private String email = null; + + public UserLogin() + { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public void setLoginDate(Calendar loginDate) + { + this.loginDate = loginDate; + } + + public Calendar getLoginDate() + { + return loginDate; + } + + public void setEmail(String email) + { + this.email = email; + } + + public String getEmail() + { + return email; + } +/* + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + final UserLogin userLogin = (UserLogin) o; + + if (loginDate.equals(userLogin.loginDate)) return false; + if (email.equals(userLogin.email)) return false; + + return true; + } + + public int hashCode() { + int result; + result = (loginDate!= null ? loginDate.hashCode() : 0); + result = 29 * result + (email != null ? email.hashCode() : 0); + return result; + } + */ +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/model/UserRole.java b/trunk/wise-webapp/src/main/java/com/wisemapping/model/UserRole.java new file mode 100644 index 00000000..01d6e89c --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/model/UserRole.java @@ -0,0 +1,46 @@ +/* +* 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 $ +*/ + +package com.wisemapping.model; + +public enum UserRole { + OWNER(true, true, true), COLLABORATOR(true, true, false), VIEWER(false, true, false); + + private final boolean hasEditPermission; + private final boolean hasViewPermission; + private final boolean hasDeletePermission; + + private UserRole(boolean hasEditPermission, boolean hasViewPermission, boolean hasDeletePermission) { + this.hasEditPermission = hasEditPermission; + this.hasViewPermission = hasViewPermission; + this.hasDeletePermission = hasDeletePermission; + } + + public boolean hasEditPermission() { + return hasEditPermission; + } + + public boolean hasViewPermission() { + return hasViewPermission; + } + + public boolean hasDeletePermission() { + return hasDeletePermission; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/SVGWiseMap.xsd b/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/SVGWiseMap.xsd new file mode 100644 index 00000000..21f14e08 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/SVGWiseMap.xsd @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/VMLWiseMap.xsd b/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/VMLWiseMap.xsd new file mode 100644 index 00000000..94dd6a0b --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/VMLWiseMap.xsd @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/sampleSVG.xml b/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/sampleSVG.xml new file mode 100644 index 00000000..aa0e5292 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/sampleSVG.xml @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Node 0 + + + + + + + Node 1 + + + + + + + Node 2 + + + + + + + Node 3 + + + + + + Main Topic + + + + + + + + Sub Topic + + + + + + + Sub Topic + + + + + + + Sub Topic + + + + + + + Sub Topic + + + + + + Main Topic + + + + + + + Main Topic + + + + + + + Central Topic + + + + + + + Sub Topic + + + + + + + Sub Topic + + + + + + + Sub Topic + + + + + + + Sub Topic + + + + + + Isolated Topic + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/sampleVML.html b/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/sampleVML.html new file mode 100644 index 00000000..5b2dc44f --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/sampleVML.html @@ -0,0 +1,577 @@ + + + + VML Sample + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Node 0 + + + + + + + + + + + + + + + + Node 1 + + + + + + + + + + + + + + + + Node 2 + + + + + + + + + + + + + + + + Node 3 + + + + + + + + + + + + + Main Topic + + + + + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + Main Topic + + + + + + + + + + + + + + + + + + Main Topic + + + + + + + + + + + + + + + + + + Central Topic + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + Isolated Topic + + + + + + + + +
    + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/sampleVML.xml b/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/sampleVML.xml new file mode 100644 index 00000000..f6a0fcac --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/schemas/sampleVML.xml @@ -0,0 +1,612 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Node 0 + + + + + + + + + + + + + + + + + + + + Node 1 + + + + + + + + + + + + + + + + + + + + Node 2 + + + + + + + + + + + + + + + + + + + + Node 3 + + + + + + + + + + + + + + + + + Main Topic + + + + + + + + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + Main Topic + + + + + + + + + + + + + + + + + + + + + Main Topic + + + + + + + + + + + + + + + + + + + + + Central Topic + + + + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + + + + Sub Topic + + + + + + + + + + + + + + + + + Isolated Topic + + + + + + + + + + + + + + + + + Main Topic + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/AuthenticationHandler.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/AuthenticationHandler.java new file mode 100755 index 00000000..7a2589a8 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/AuthenticationHandler.java @@ -0,0 +1,31 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security; + +import org.acegisecurity.AuthenticationException; + +import javax.servlet.http.HttpServletRequest; + +public interface AuthenticationHandler +{ + + AuthenticationToken getAuthenticationToken(HttpServletRequest request) throws AuthenticationException; + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/AuthenticationToken.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/AuthenticationToken.java new file mode 100755 index 00000000..f9c4973d --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/AuthenticationToken.java @@ -0,0 +1,42 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security; + +public class AuthenticationToken +{ + private String username; + private String password; + + public AuthenticationToken(String username,String password) + { + this.username = username; + this.password = password; + } + + public String getUsername() + { + return username; + } + + public String getPassword() + { + return password; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/CustomPasswordEncoder.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/CustomPasswordEncoder.java new file mode 100755 index 00000000..436982db --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/CustomPasswordEncoder.java @@ -0,0 +1,60 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security; + +import org.acegisecurity.providers.encoding.PasswordEncoder; +import org.springframework.dao.DataAccessException; + +public class CustomPasswordEncoder + implements PasswordEncoder +{ + private PasswordEncoder delegateEncoder; + private static final String ENC_PREFIX = "ENC:"; + + public void setDelegatedEncoder(PasswordEncoder delegateEncoder) + { + this.delegateEncoder = delegateEncoder; + } + + public String encodePassword(String rawPass, Object salt) throws DataAccessException { + + String password = rawPass; + if (!rawPass.startsWith(ENC_PREFIX)) + { + password = ENC_PREFIX + delegateEncoder.encodePassword(rawPass,salt); + } + + return password; + } + + public boolean isPasswordValid(String encPass, String rawPass, Object salt) throws DataAccessException { + + String pass1 = "" + encPass; + String pass2 = rawPass; + + if (pass1.startsWith(ENC_PREFIX)) + { + + pass2 = encodePassword(rawPass, salt); + } + + return pass1.equals(pass2); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/CustomTokenBasedRememberMeServices.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/CustomTokenBasedRememberMeServices.java new file mode 100644 index 00000000..b5602aa9 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/CustomTokenBasedRememberMeServices.java @@ -0,0 +1,41 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security; + +import org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices; +import org.acegisecurity.Authentication; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class CustomTokenBasedRememberMeServices extends + TokenBasedRememberMeServices { + public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) + { + if(authentication!=null) + super.logout(request, response, authentication); + else + { + logger.debug("Session Already Expired. Authentication is null"); + response.addCookie(makeCancelCookie(request)); + } + } + +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/DatabaseUserDetailService.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/DatabaseUserDetailService.java new file mode 100644 index 00000000..16b9f8fe --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/DatabaseUserDetailService.java @@ -0,0 +1,53 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security; + +import com.wisemapping.dao.UserManager; +import org.acegisecurity.userdetails.UserDetailsService; +import org.acegisecurity.userdetails.UsernameNotFoundException; +import org.acegisecurity.userdetails.UserDetails; +import org.acegisecurity.providers.encoding.PasswordEncoder; +import org.acegisecurity.providers.encoding.Md5PasswordEncoder; +import org.acegisecurity.providers.dao.SaltSource; +import org.springframework.dao.DataAccessException; + +public class DatabaseUserDetailService + implements UserDetailsService { + private UserManager userManager; + + public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException, DataAccessException { + final com.wisemapping.model.User model = userManager.getUserBy(email); + + if (model != null) { + return new User(model); + } else { + throw new UsernameNotFoundException(email); + } + } + + public UserManager getUserManager() { + return userManager; + } + + public void setUserManager(UserManager userManager) { + this.userManager = userManager; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/DefaultAuthenticationHandler.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/DefaultAuthenticationHandler.java new file mode 100755 index 00000000..dcab594f --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/DefaultAuthenticationHandler.java @@ -0,0 +1,44 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security; + +import org.acegisecurity.AuthenticationException; +import org.acegisecurity.ui.webapp.AuthenticationProcessingFilter; + +import javax.servlet.http.HttpServletRequest; + +public class DefaultAuthenticationHandler + implements AuthenticationHandler +{ + public AuthenticationToken getAuthenticationToken(HttpServletRequest request) + throws AuthenticationException + { + String username = request.getParameter(AuthenticationProcessingFilter.ACEGI_SECURITY_FORM_USERNAME_KEY); + String password = request.getParameter(AuthenticationProcessingFilter.ACEGI_SECURITY_FORM_PASSWORD_KEY); + if (username == null) { + username = ""; + } + + if (password == null) { + password = ""; + } + return new AuthenticationToken(username,password); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/User.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/User.java new file mode 100644 index 00000000..78a6ae32 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/User.java @@ -0,0 +1,68 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security; + +import org.acegisecurity.userdetails.UserDetails; +import org.acegisecurity.GrantedAuthority; +import org.acegisecurity.GrantedAuthorityImpl; + +public class User implements UserDetails { + private com.wisemapping.model.User model; + + public User(com.wisemapping.model.User model) { + this.model = model; + } + + public GrantedAuthority[] getAuthorities() { + return new GrantedAuthority[]{new GrantedAuthorityImpl("ROLE_USER")}; + } + + public String getPassword() { + return model.getPassword(); + } + + public String getUsername() { + return model.getEmail(); + } + + public boolean isAccountNonExpired() { + return true; + } + + public boolean isAccountNonLocked() { + return this.model.isActive(); + } + + public boolean isCredentialsNonExpired() { + return true; + } + + public boolean isEnabled() { + return this.model.isActive(); + } + + public com.wisemapping.model.User getModel() { + return model; + } + + public String getDisplayName() { + return model.getFirstname(); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/Utils.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/Utils.java new file mode 100644 index 00000000..39d98e6d --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/Utils.java @@ -0,0 +1,59 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security; + +import com.wisemapping.model.User; + +import javax.servlet.http.HttpServletRequest; + +import org.acegisecurity.providers.AbstractAuthenticationToken; +import org.acegisecurity.context.SecurityContextHolder; +import org.acegisecurity.Authentication; + + +public class Utils { + private Utils() { + } + + public static User getUser(final HttpServletRequest request) { + + final AbstractAuthenticationToken token = (AbstractAuthenticationToken) request.getUserPrincipal(); + User result = null; + if (token != null) { + final com.wisemapping.security.User user = (com.wisemapping.security.User) token.getPrincipal(); + result = user.getModel(); + } + return result; + } + + public static User getUser() + { + User user = null; + final Authentication auth = SecurityContextHolder.getContext().getAuthentication(); + if (auth != null && auth.getDetails() != null) + { + final Object principal = auth.getPrincipal(); + if (principal != null && principal instanceof com.wisemapping.security.User) { + user = ((com.wisemapping.security.User)principal).getModel(); + } + } + return user; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/WiseAuthenticationProcessingFilter.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/WiseAuthenticationProcessingFilter.java new file mode 100755 index 00000000..16ada5aa --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/WiseAuthenticationProcessingFilter.java @@ -0,0 +1,67 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security; + +import org.acegisecurity.Authentication; +import org.acegisecurity.AuthenticationException; +import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; +import org.acegisecurity.ui.webapp.AuthenticationProcessingFilter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class WiseAuthenticationProcessingFilter + extends AuthenticationProcessingFilter +{ + public static final String ACEGI_SECURITY_FORM_SSO_ID_KEY = "j_sso_id"; + + private AuthenticationHandler authenticationHandler; + + public void setAuthenticationHandler(AuthenticationHandler ssoAuthenticationHandler) + { + this.authenticationHandler = ssoAuthenticationHandler; + } + + @Override + public Authentication attemptAuthentication(HttpServletRequest request) + throws AuthenticationException + { + + final AuthenticationToken ssoToken = authenticationHandler.getAuthenticationToken(request); + + final UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(ssoToken.getUsername(), ssoToken.getPassword()); + + // Place the last username attempted into HttpSession for views + request.getSession().setAttribute(ACEGI_SECURITY_LAST_USERNAME_KEY, ssoToken.getUsername()); + + // Allow subclasses to set the "details" property + setDetails(request, authRequest); + + return this.getAuthenticationManager().authenticate(authRequest); + } + + @Override + protected void onPreAuthentication(HttpServletRequest request, HttpServletResponse response) + throws AuthenticationException, IOException + { + assert request != null; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/aop/BaseSecurityAdvice.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/aop/BaseSecurityAdvice.java new file mode 100755 index 00000000..f602b4e5 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/aop/BaseSecurityAdvice.java @@ -0,0 +1,72 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security.aop; + +import com.wisemapping.model.MindMap; +import com.wisemapping.model.User; +import com.wisemapping.exceptions.AccessDeniedSecurityException; +import com.wisemapping.exceptions.UnexpectedArgumentException; +import com.wisemapping.security.Utils; +import com.wisemapping.service.MindmapService; +import org.aopalliance.intercept.MethodInvocation; + +public abstract class BaseSecurityAdvice { + private MindmapService mindmapService = null; + + public void checkRole(MethodInvocation methodInvocation) throws UnexpectedArgumentException,AccessDeniedSecurityException + { + final User user = Utils.getUser(); + + final Object argument = methodInvocation.getArguments()[0]; + + boolean isAllowed; + + if (argument instanceof MindMap) + { + isAllowed = isAllowed(user,(MindMap) argument); + } + else if (argument instanceof Integer) + { + isAllowed = isAllowed(user, ((Integer)argument)); + } + else + { + throw new UnexpectedArgumentException("Argument " +argument); + } + + if (!isAllowed) + { + throw new AccessDeniedSecurityException("User not allowed to invoke:" + methodInvocation); + } + } + + protected abstract boolean isAllowed(User user, MindMap map); + protected abstract boolean isAllowed(User user, int mapId); + + protected MindmapService getMindmapService() + { + return mindmapService; + } + + public void setMindmapService(MindmapService service) + { + this.mindmapService = service; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/aop/UpdateSecurityAdvise.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/aop/UpdateSecurityAdvise.java new file mode 100755 index 00000000..d714d929 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/aop/UpdateSecurityAdvise.java @@ -0,0 +1,50 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security.aop; + +import com.wisemapping.model.UserRole; +import com.wisemapping.model.User; +import com.wisemapping.model.MindMap; + +import org.aopalliance.intercept.MethodInterceptor; +import org.aopalliance.intercept.MethodInvocation; + +public class UpdateSecurityAdvise + extends BaseSecurityAdvice + implements MethodInterceptor +{ + + private UserRole grantedRole = UserRole.COLLABORATOR; + + public Object invoke(MethodInvocation methodInvocation) throws Throwable { + checkRole(methodInvocation); + return methodInvocation.proceed(); + } + + protected boolean isAllowed(User user, MindMap map) + { + return getMindmapService().isAllowedToView(user,map,grantedRole); + } + + protected boolean isAllowed(User user, int mapId) + { + return getMindmapService().isAllowedToView(user,mapId,grantedRole); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/security/aop/ViewBaseSecurityAdvise.java b/trunk/wise-webapp/src/main/java/com/wisemapping/security/aop/ViewBaseSecurityAdvise.java new file mode 100755 index 00000000..e3af461d --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/security/aop/ViewBaseSecurityAdvise.java @@ -0,0 +1,48 @@ +/* +* 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 $ +*/ + +package com.wisemapping.security.aop; + +import org.aopalliance.intercept.MethodInterceptor; +import org.aopalliance.intercept.MethodInvocation; +import com.wisemapping.model.UserRole; +import com.wisemapping.model.User; +import com.wisemapping.model.MindMap; + +public class ViewBaseSecurityAdvise + extends BaseSecurityAdvice + implements MethodInterceptor +{ + private UserRole grantedRole = UserRole.VIEWER; + + public Object invoke(MethodInvocation methodInvocation) throws Throwable { + checkRole(methodInvocation); + return methodInvocation.proceed(); + } + + protected boolean isAllowed(User user, MindMap map) + { + return getMindmapService().isAllowedToView(user,map,grantedRole); + } + + protected boolean isAllowed(User user, int mapId) + { + return getMindmapService().isAllowedToView(user,mapId,grantedRole); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/service/HibernateAppListener.java b/trunk/wise-webapp/src/main/java/com/wisemapping/service/HibernateAppListener.java new file mode 100755 index 00000000..f0b47784 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/service/HibernateAppListener.java @@ -0,0 +1,40 @@ +/* +* 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 $ +*/ + +package com.wisemapping.service; + +import javax.servlet.ServletContextListener; +import javax.servlet.ServletContextEvent; + +public class HibernateAppListener implements ServletContextListener { + + /* Application Startup Event */ + public void contextInitialized(ServletContextEvent ce) { + + try { + + Class.forName("tomcatJndi.HibernateUtil").newInstance(); + + } catch (Exception e) {} + } + + /* Application Shutdown Event */ + public void contextDestroyed(ServletContextEvent ce) + { } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/service/HibernateUtil.java b/trunk/wise-webapp/src/main/java/com/wisemapping/service/HibernateUtil.java new file mode 100755 index 00000000..f09f5b3d --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/service/HibernateUtil.java @@ -0,0 +1,43 @@ +/* +* 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 $ +*/ + +package com.wisemapping.service; + +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; + +public class HibernateUtil { + + private static final SessionFactory sessionFactory; + + static { + try { + + sessionFactory = new Configuration().configure().buildSessionFactory(); + } catch (Throwable ex) { + // Make sure you log the exception, as it might be swallowed + System.err.println("Initial SessionFactory creation failed." + ex); + throw new ExceptionInInitializerError(ex); + } + } + + public static SessionFactory getSessionFactory() { + return sessionFactory; + } +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/service/InvalidActivationCodeException.java b/trunk/wise-webapp/src/main/java/com/wisemapping/service/InvalidActivationCodeException.java new file mode 100755 index 00000000..6ec7e2c5 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/service/InvalidActivationCodeException.java @@ -0,0 +1,29 @@ +/* +* 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 $ +*/ + +package com.wisemapping.service; + +public class InvalidActivationCodeException + extends Exception +{ + public InvalidActivationCodeException(String msg) + { + super(msg); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/service/InvalidColaboratorException.java b/trunk/wise-webapp/src/main/java/com/wisemapping/service/InvalidColaboratorException.java new file mode 100755 index 00000000..228bbf52 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/service/InvalidColaboratorException.java @@ -0,0 +1,29 @@ +/* +* 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 $ +*/ + +package com.wisemapping.service; + +public class InvalidColaboratorException + extends Exception +{ + public InvalidColaboratorException(String msg) + { + super(msg); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/service/InvalidUserEmailException.java b/trunk/wise-webapp/src/main/java/com/wisemapping/service/InvalidUserEmailException.java new file mode 100755 index 00000000..86143f8b --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/service/InvalidUserEmailException.java @@ -0,0 +1,28 @@ +/* +* 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 $ +*/ + +package com.wisemapping.service; + +public class InvalidUserEmailException extends Exception +{ + public InvalidUserEmailException(String msg) + { + super(msg); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/service/MindmapService.java b/trunk/wise-webapp/src/main/java/com/wisemapping/service/MindmapService.java new file mode 100755 index 00000000..538c390e --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/service/MindmapService.java @@ -0,0 +1,72 @@ +/* +* 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 $ +*/ + +package com.wisemapping.service; + +import com.wisemapping.model.*; +import com.wisemapping.exceptions.WiseMappingException; + +import java.util.List; +import java.io.IOException; + +public interface MindmapService { + + public static final String TAG_SEPARATOR = " "; + + public MindmapUser getMindmapUserBy(int mindmapId, User user); + + public MindMap getMindmapById(int mindmapId); + + public MindMap getMindmapByTitle(String title, User user); + + public List getMindmapUserByUser(User user); + + public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException; + + public void addMindmap(MindMap map, User user) throws WiseMappingException; + + public void addColaborators(MindMap mindmap, String[] colaboratorEmails, UserRole role, ColaborationEmail email) + throws InvalidColaboratorException; + + public void addTags(MindMap mindmap, String tags); + + public void removeColaboratorFromMindmap(MindMap mindmap, long colaboratorId); + + public void removeMindmap(MindMap mindmap, User user) throws WiseMappingException; + + public List search(MindMapCriteria criteria); + + public List getPublicMaps(int cant); + + public List getMindMapHistory(int mindmapId); + + public boolean isAllowedToView(User user, MindMap map, UserRole allowedRole); + + public boolean isAllowedToView(User user, int mapId, UserRole allowedRole); + + public boolean isAllowedToColaborate(User user, int mapId, UserRole grantedRole); + + public boolean isAllowedToColaborate(User user, MindMap map, UserRole grantedRole); + + public void addWelcomeMindmap(User user) throws WiseMappingException; + + public void addView(int mapId); + + public void revertMapToHistory(MindMap map, int historyId) throws IOException, WiseMappingException; +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java b/trunk/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java new file mode 100755 index 00000000..2d6feda6 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java @@ -0,0 +1,303 @@ +/* +* 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 $ +*/ + +package com.wisemapping.service; + +import com.wisemapping.dao.MindmapManager; +import com.wisemapping.exceptions.WiseMappingException; +import com.wisemapping.mail.Mailer; +import com.wisemapping.model.*; + +import java.io.IOException; +import java.util.*; + + +public class MindmapServiceImpl + implements MindmapService { + + private MindmapManager mindmapManager; + private UserService userService; + private Mailer mailer; + + public boolean isAllowedToColaborate(User user, int mapId, UserRole grantedRole) { + final MindMap map = mindmapManager.getMindmapById(mapId); + return isAllowedToColaborate(user, map, grantedRole); + } + + public boolean isAllowedToView(User user, int mapId, UserRole grantedRole) { + final MindMap map = mindmapManager.getMindmapById(mapId); + return isAllowedToView(user, map, grantedRole); + } + + public boolean isAllowedToView(User user, MindMap map, UserRole grantedRole) { + boolean isAllowed = false; + if (map != null) { + + if (map.isPublic()) { + isAllowed = true; + } else if (user != null) { + isAllowed = isAllowedToColaborate(user, map, grantedRole); + } + } + return isAllowed; + } + + public boolean isAllowedToColaborate(User user, MindMap map, UserRole grantedRole) { + boolean isAllowed = false; + if (map != null) { + if (map.getOwner().getId() == user.getId()) { + isAllowed = true; + } else { + final Set users = map.getMindmapUsers(); + UserRole rol = null; + for (MindmapUser mindmapUser : users) { + if (mindmapUser.getColaborator().getId() == user.getId()) { + rol = mindmapUser.getRole(); + break; + } + } + // only if the user has a role for the current map + isAllowed = rol != null && + (grantedRole.equals(rol) || rol.ordinal() < grantedRole.ordinal()); + } + } + return isAllowed; + } + + public MindmapUser getMindmapUserBy(int mindmapId, User user) { + return mindmapManager.getMindmapUserBy(mindmapId, user); + } + + public MindMap getMindmapByTitle(String title, User user) { + return mindmapManager.getMindmapByTitle(title, user); + } + + public MindMap getMindmapById(int mindmapId) { + return mindmapManager.getMindmapById(mindmapId); + } + + public List getMindmapUserByUser(User user) { + return mindmapManager.getMindmapUserByColaborator(user.getId()); + } + + public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException { + if (mindMap.getTitle() == null || mindMap.getTitle().length() == 0) { + throw new WiseMappingException("The tile can not be empty"); + } + mindmapManager.updateMindmap(mindMap, saveHistory); + } + + public List getPublicMaps(int cant) { + return mindmapManager.search(null, cant); + } + + public List search(MindMapCriteria criteria) { + return mindmapManager.search(criteria); + } + + public void removeColaboratorFromMindmap(MindMap mindmap, long colaboratorId) { + // remove colaborator association + Set mindmapusers = mindmap.getMindmapUsers(); + MindmapUser mindmapuserToDelete = null; + for (MindmapUser mindmapuser : mindmapusers) { + if (mindmapuser.getColaborator().getId() == colaboratorId) { + mindmapuserToDelete = mindmapuser; + //@TODO evaluar si el colaborador no tiene mas asociaciones si hay que eliminarlo, por ahora NO +// final List otherAsociations = mindmapManager.getMindmapUserByColaborator(colaboratorId); +// if (otherAsociations != null) +// { +// +// final User user = userService.getUserBy(colaboratorId); +// // Is not a User +// if (user == null) +// { +// final Colaborator col = mindmapManager.getColaboratorBy(colaboratorId); +// mindmapManager.removeColaborator(col); +// } +// } + break; + } + } + if (mindmapuserToDelete != null) { + // When you delete an object from hibernate you have to delete it from *all* collections it exists in... + mindmapusers.remove(mindmapuserToDelete); + mindmapManager.removeMindmapUser(mindmapuserToDelete); + } + } + + public void removeMindmap(MindMap mindmap, User user) throws WiseMappingException { + if (mindmap.getOwner().equals(user)) { + + mindmapManager.removeMindmap(mindmap); + } else { + this.removeColaboratorFromMindmap(mindmap, user.getId()); + } + } + + public void addMindmap(MindMap map, User user) throws WiseMappingException { + + final String title = map.getTitle(); + + if (title == null || title.length() == 0) { + throw new IllegalArgumentException("The tile can not be empty"); + } + + if (user==null) { + throw new IllegalArgumentException("User can not be null"); + } + + final Calendar creationTime = Calendar.getInstance(); + final String username = user.getUsername(); + map.setCreator(username); + map.setLastModifierUser(username); + map.setCreationTime(creationTime); + map.setLastModificationTime(creationTime); + map.setOwner(user); + + final MindmapUser mindmapUser = new MindmapUser(UserRole.OWNER.ordinal(), user, map); + map.getMindmapUsers().add(mindmapUser); + + mindmapManager.addMindmap(user, map); + } + + public void addColaborators(MindMap mindmap, String[] colaboratorEmails, UserRole role, ColaborationEmail email) + throws InvalidColaboratorException { + if (colaboratorEmails != null && colaboratorEmails.length > 0) { + final Colaborator owner = mindmap.getOwner(); + final Set mindmapUsers = mindmap.getMindmapUsers(); + + for (String colaboratorEmail : colaboratorEmails) { + if (owner.getEmail().equals(colaboratorEmail)) { + throw new InvalidColaboratorException("The user " + owner.getEmail() + " is the owner"); + } + MindmapUser mindmapUser = getMindmapUserBy(colaboratorEmail, mindmapUsers); + if (mindmapUser == null) { + addColaborator(colaboratorEmail, role, mindmap, email); + } else if (mindmapUser.getRole() != role) { + // If the relationship already exists and the role changed then only update the role + mindmapUser.setRoleId(role.ordinal()); + mindmapManager.updateMindmap(mindmap, false); + } + } + } + } + + public void addTags(MindMap mindmap, String tags) { + mindmap.setTags(tags); + mindmapManager.updateMindmap(mindmap, false); + if (tags != null && tags.length() > 0) { + final String tag[] = tags.split(TAG_SEPARATOR); + final User user = mindmap.getOwner(); + // Add new Tags to User + boolean updateUser = false; + for (String userTag : tag) { + if (!user.getTags().contains(userTag)) { + user.getTags().add(userTag); + updateUser = true; + } + } + if (updateUser) { + //update user + userService.updateUser(user); + } + } + } + + public void addWelcomeMindmap(User user) throws WiseMappingException { + final MindMap savedWelcome = getMindmapById(Constants.WELCOME_MAP_ID); + + // Is there a welcomed map configured ? + if(savedWelcome!=null) + { + final MindMap welcomeMap = new MindMap(); + welcomeMap.setTitle(savedWelcome.getTitle() + " " + user.getFirstname()); + welcomeMap.setDescription(savedWelcome.getDescription()); + welcomeMap.setXml(savedWelcome.getXml()); + + final MindMapNative mindmapNative = new MindMapNative(); + mindmapNative.setSvgXml(savedWelcome.getNativeBrowser().getSvgXml()); + mindmapNative.setVmlXml(savedWelcome.getNativeBrowser().getVmlXml()); + + welcomeMap.setNativeBrowser(mindmapNative); + + addMindmap(welcomeMap, user); + } + } + + public void addView(int mapId) { + mindmapManager.addView(mapId); + } + + public List getMindMapHistory(int mindmapId) { + return mindmapManager.getHistoryFrom(mindmapId); + } + + public void revertMapToHistory(MindMap map, int historyId) + throws IOException, WiseMappingException { + final MindMapHistory history = mindmapManager.getHistory(historyId); + map.setNativeXml(history.getNativeXml()); + updateMindmap(map, false); + } + + private MindmapUser getMindmapUserBy(String email, Set mindmapUsers) { + MindmapUser mindmapUser = null; + + for (MindmapUser user : mindmapUsers) { + if (user.getColaborator().getEmail().equals(email)) { + mindmapUser = user; + break; + } + } + return mindmapUser; + } + + private void addColaborator(String colaboratorEmail, UserRole role, MindMap mindmap, ColaborationEmail email) { + + Colaborator colaborator = mindmapManager.getColaboratorBy(colaboratorEmail); + if (colaborator == null) { + colaborator = new Colaborator(); + colaborator.setEmail(colaboratorEmail); + colaborator.setCreationDate(Calendar.getInstance()); + mindmapManager.addColaborator(colaborator); + } + + final MindmapUser newMindmapUser = new MindmapUser(role.ordinal(), colaborator, mindmap); + mindmap.getMindmapUsers().add(newMindmapUser); + + mindmapManager.saveMindmap(mindmap); + + final Map model = new HashMap(); + model.put("role", role); + model.put("map", mindmap); + model.put("message", email.getMessage()); + mailer.sendEmail(mailer.getSiteEmail(), colaboratorEmail, email.getSubject(), model, "newColaborator.vm"); + } + + public void setMindmapManager(MindmapManager mindmapManager) { + this.mindmapManager = mindmapManager; + } + + public void setUserService(UserService userService) { + this.userService = userService; + } + + public void setMailer(Mailer mailer) { + this.mailer = mailer; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/service/UserService.java b/trunk/wise-webapp/src/main/java/com/wisemapping/service/UserService.java new file mode 100755 index 00000000..44fa4614 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/service/UserService.java @@ -0,0 +1,44 @@ +/* +* 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 $ +*/ + +package com.wisemapping.service; + +import com.wisemapping.model.User; +import com.wisemapping.exceptions.WiseMappingException; + +public interface UserService { + + public void activateAcount(long code) throws InvalidActivationCodeException; + + public void createUser(User user) throws WiseMappingException; + + public void changePassword(User user); + + public User getUserBy(String email); + + public User getUserBy(long id); + + public User getUserByUsername(String username); + + public void updateUser(User user); + + public void sendEmailPassword(String email) throws InvalidUserEmailException; + + public User reloadUser(final User user); +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/service/UserServiceImpl.java b/trunk/wise-webapp/src/main/java/com/wisemapping/service/UserServiceImpl.java new file mode 100755 index 00000000..87d6ee0b --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/service/UserServiceImpl.java @@ -0,0 +1,154 @@ +/* +* 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 $ +*/ + +package com.wisemapping.service; + +import com.wisemapping.dao.UserManager; +import com.wisemapping.exceptions.WiseMappingException; +import com.wisemapping.mail.Mailer; +import com.wisemapping.model.User; +import com.wisemapping.model.Colaborator; + +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class UserServiceImpl + implements UserService { + private UserManager userManager; + private MindmapService mindmapService; + private Mailer mailer; + + public void activateAcount(long code) + throws InvalidActivationCodeException + { + final User user = userManager.getUserByActivationCode(code); + if (user == null || user.isActive()) { + throw new InvalidActivationCodeException("Invalid Activation Code"); + } else { + final Calendar now = Calendar.getInstance(); + user.setActivationDate(now); + userManager.updateUser(user); + final Map model = new HashMap(); + model.put("user", user); + mailer.sendEmail(mailer.getRegistrationEmail(), user.getEmail(), "WiseMapping : Active account", model, "activationAccountMail.vm"); + } + } + + public User reloadUser(final User user) { + return this.getUserBy(user.getId()); + } + + public void sendEmailPassword(String email) + throws InvalidUserEmailException { + final User user = userManager.getUserBy(email); + if (user != null) { + final Map model = new HashMap(); + final String password = randomstring(8, 10); + user.setPassword(password); + changePassword(user); + model.put("user", user); + model.put("password", password); + + mailer.sendEmail(mailer.getRegistrationEmail(), user.getEmail(), "WiseMapping : Recovery Password", model, "recoveryMail.vm"); + } else { + throw new InvalidUserEmailException("The email '" + email + "' does not exists."); + } + } + + private String randomstring(int lo, int hi) { + int n = rand(lo, hi); + byte b[] = new byte[n]; + for (int i = 0; i < n; i++) + b[i] = (byte) rand('@', 'Z'); + return new String(b); + } + + private int rand(int lo, int hi) { + java.util.Random rn = new java.util.Random(); + int n = hi - lo + 1; + int i = rn.nextInt() % n; + if (i < 0) + i = -i; + return lo + i; + } + + public void createUser(User user) throws WiseMappingException { + final UUID uuid = UUID.randomUUID(); + user.setCreationDate(Calendar.getInstance()); + user.setActivationDate(null); + user.setActivationCode(uuid.getLeastSignificantBits()); + + Colaborator col = userManager.getColaboratorBy(user.getEmail()); + if (col != null) + { + userManager.createUser(user,col); + } + else + { + userManager.createUser(user); + } + + //create welcome map + mindmapService.addWelcomeMindmap(user); + + final Map model = new HashMap(); + model.put("user", user); + // TODO: ver como no hacer hardcode el url + final String activationUrl = "http://wisemapping.com/c/activation.htm?code=" + user.getActivationCode(); + model.put("emailcheck", activationUrl); + mailer.sendEmail(mailer.getRegistrationEmail(), user.getEmail(), "Welcome to Wisemapping!", model, + "confirmationMail.vm"); + mailer.sendEmail(mailer.getRegistrationEmail(), mailer.getRegistrationEmail(), "Wisemapping : New User", model, + "activeUserAccountMail.vm"); + } + + public void changePassword(User user) { + userManager.updateUser(user); + } + + public User getUserBy(String email) { + return userManager.getUserBy(email); + } + + public User getUserByUsername(String username) { + return userManager.getUserByUsername(username); + } + + public User getUserBy(long id) { + return userManager.getUserBy(id); + } + + public void updateUser(User user) { + userManager.updateUser(user); + } + + public void setUserManager(UserManager userManager) { + this.userManager = userManager; + } + + public void setMailer(Mailer mailer) { + this.mailer = mailer; + } + + public void setMindmapService(MindmapService mindmapService) { + this.mindmapService = mindmapService; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/util/JAXBUtils.java b/trunk/wise-webapp/src/main/java/com/wisemapping/util/JAXBUtils.java new file mode 100755 index 00000000..026e65eb --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/util/JAXBUtils.java @@ -0,0 +1,46 @@ +/* +* 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 $ +*/ + +package com.wisemapping.util; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import java.io.InputStream; +import java.io.OutputStream; + +public class JAXBUtils { + + public static Object getMapObject(InputStream stream,String pakage) throws JAXBException { + + final JAXBContext context = JAXBContext.newInstance(pakage); + final Unmarshaller unmarshaller = context.createUnmarshaller() ; + + return unmarshaller.unmarshal (stream) ; + } + + public static void saveMap(Object obj, OutputStream out,String pakage) throws JAXBException { + + final JAXBContext context = JAXBContext.newInstance(pakage); + final Marshaller marshaller = context.createMarshaller(); + + marshaller.marshal(obj, out) ; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/util/ZipUtils.java b/trunk/wise-webapp/src/main/java/com/wisemapping/util/ZipUtils.java new file mode 100755 index 00000000..520a90c6 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/util/ZipUtils.java @@ -0,0 +1,84 @@ +/* +* 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 $ +*/ + +package com.wisemapping.util; + +import java.io.IOException; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; +import java.util.zip.ZipEntry; + +public class ZipUtils { + + public static String zipToString(byte[] zip) throws IOException { + + String result = null; + if (zip != null) + { + final ByteArrayInputStream in = new ByteArrayInputStream(zip); + final ZipInputStream zipIn = new ZipInputStream(in); + zipIn.getNextEntry(); + + byte[] buffer = new byte[512]; + + int len; + StringBuffer sb_result = new StringBuffer(); + + while ((len = zipIn.read(buffer)) > 0) { + sb_result.append(new String(buffer, 0, len)); + } + + zipIn.closeEntry(); + zipIn.close(); + result = sb_result.toString(); + } + + return result; + } + + public static byte[] stringToZip(String content) throws IOException { + ZipOutputStream zip = null; + ByteArrayOutputStream byteArray = new ByteArrayOutputStream(); + ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes()); + try { + zip = new ZipOutputStream(byteArray); + + ZipEntry zEntry = new ZipEntry("content"); + zip.putNextEntry(zEntry); + int bytesRead; + byte[] buffer = new byte[8192]; + while ((bytesRead = in.read(buffer, 0, 8192)) != -1) { + zip.write(buffer, 0, bytesRead); + } + zip.closeEntry(); + } + finally + { + if (zip != null) + { + zip.flush(); + zip.close(); + } + } + + return byteArray.toByteArray(); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ChangePasswordValidator.java b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ChangePasswordValidator.java new file mode 100644 index 00000000..0cbb9485 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ChangePasswordValidator.java @@ -0,0 +1,60 @@ +/* +* 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 $ +*/ + +package com.wisemapping.validator; + +import org.springframework.validation.Validator; +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import com.wisemapping.view.ChangePasswordBean; +import com.wisemapping.model.Constants; + +public class ChangePasswordValidator + implements Validator { + + public boolean supports(final Class clazz) { + return clazz.equals(ChangePasswordBean.class); + } + + public void validate(Object obj, Errors errors) { + ChangePasswordBean bean = (ChangePasswordBean) obj; + + if (bean == null) { + errors.rejectValue("changePassword", "error.not-specified", null, "Value required."); + } else { + + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "required", "Field is required."); + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "retryPassword", "required", "Field is required."); + ValidatorUtils.rejectIfExceeded(errors, + "password", + "The password must have less than "+ Constants.MAX_USER_PASSWORD_LENGTH + " characters.", + bean.getPassword(), + Constants.MAX_USER_PASSWORD_LENGTH); + ValidatorUtils.rejectIfExceeded(errors, + "retryPassword", + "The retryPassword must have less than "+ Constants.MAX_USER_PASSWORD_LENGTH + " characters.", + bean.getRetryPassword(), + Constants.MAX_USER_PASSWORD_LENGTH); + final String password = bean.getPassword(); + if (password != null && !password.equals(bean.getRetryPassword())) { + errors.rejectValue("password", "Password mismatch", "Your password entries did not match"); + } + } + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/validator/EditProfileValidator.java b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/EditProfileValidator.java new file mode 100755 index 00000000..d6f05e28 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/EditProfileValidator.java @@ -0,0 +1,73 @@ +/* +* 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 $ +*/ + +package com.wisemapping.validator; + +import com.wisemapping.view.UserBean; +import com.wisemapping.controller.Messages; +import com.wisemapping.service.UserService; +import com.wisemapping.model.User; +import com.wisemapping.model.Constants; +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import org.springframework.validation.Validator; + +public class EditProfileValidator implements Validator { + + private UserService userService; + + public boolean supports(final Class clazz) { + return clazz.equals(UserBean.class); + } + + public void validate(Object obj, Errors errors) { + UserBean user = (UserBean) obj; + if (user == null) { + errors.rejectValue("user", "error.not-specified", null, "Value required."); + } else { + + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstname", "required", "Field is required."); + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lastname", "required", "Field is required."); + ValidatorUtils.rejectIfExceeded(errors, + "firstname", + "The firstname must have less than "+ Constants.MAX_USER_FIRSTNAME_LENGTH + " characters.", + user.getFirstname(), + Constants.MAX_USER_FIRSTNAME_LENGTH); + ValidatorUtils.rejectIfExceeded(errors, + "lastname", + "The lastname must have less than "+ Constants.MAX_USER_LASTNAME_LENGTH + " characters.", + user.getLastname(), + Constants.MAX_USER_LASTNAME_LENGTH); + final String email = user.getEmail(); + boolean isValid = Utils.isValidateEmailAddress(email); + if (isValid) { + final User oldUser = userService.getUserBy(email); + if (oldUser != null && user.getId() != oldUser.getId()) { + errors.rejectValue("email", Messages.EMAIL_ALREADY_EXIST); + } + } else { + Utils.validateEmailAddress(email, errors); + } + } + } + + public void setUserService(UserService userService) { + this.userService = userService; + } +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ForgotPasswordValidator.java b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ForgotPasswordValidator.java new file mode 100755 index 00000000..5fa23b5d --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ForgotPasswordValidator.java @@ -0,0 +1,48 @@ +/* +* 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 $ +*/ + +package com.wisemapping.validator; + +import org.springframework.validation.Validator; +import org.springframework.validation.Errors; +import com.wisemapping.view.ForgotPasswordBean; +import com.wisemapping.controller.Messages; + +public class ForgotPasswordValidator + implements Validator { + + + public boolean supports(final Class clazz) { + return clazz.equals(ForgotPasswordBean.class); + } + + public void validate(Object obj, Errors errors) { + ForgotPasswordBean bean = (ForgotPasswordBean) obj; + if (bean == null) { + errors.rejectValue("forgotPassword", "error.not-specified", null, "Value required."); + } else { + + final String email = bean.getEmail(); + boolean isValid = Utils.isValidateEmailAddress(email); + if (!isValid) { + errors.rejectValue("email", Messages.NO_VALID_EMAIL_ADDRESS); + } + } + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ImportMapValidator.java b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ImportMapValidator.java new file mode 100644 index 00000000..6d7d2621 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ImportMapValidator.java @@ -0,0 +1,57 @@ +/* +* 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 $ +*/ + +package com.wisemapping.validator; + +import com.wisemapping.controller.Messages; +import com.wisemapping.importer.ImportFormat; +import com.wisemapping.importer.Importer; +import com.wisemapping.importer.ImporterException; +import com.wisemapping.importer.ImporterFactory; +import com.wisemapping.model.MindMap; +import com.wisemapping.view.ImportMapBean; +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; + +import java.io.ByteArrayInputStream; + +public class ImportMapValidator extends MapInfoValidator { + + public boolean supports(final Class clazz) { + return clazz.equals(ImportMapBean.class); + } + + public void validate(Object obj, Errors errors) { + ImportMapBean bean = (ImportMapBean) obj; + + super.validate(obj,errors); + + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "mapFile", Messages.FIELD_REQUIRED); + try { + final Importer importer = ImporterFactory.getInstance().getImporter(ImportFormat.FREEMIND); + final ByteArrayInputStream stream = new ByteArrayInputStream(bean.getMapFile().getBytes()); + final MindMap map = importer.importMap(bean.getTitle(),bean.getDescription(),stream); + + bean.setImportedMap(map); + + } catch (ImporterException e) { + errors.rejectValue("mapFile",Messages.IMPORT_MAP_ERROR); + } + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/validator/MapInfoValidator.java b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/MapInfoValidator.java new file mode 100755 index 00000000..3ce2a5cd --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/MapInfoValidator.java @@ -0,0 +1,83 @@ +/* +* 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 $ +*/ + +package com.wisemapping.validator; + +import com.wisemapping.controller.Messages; +import com.wisemapping.model.MindMap; +import com.wisemapping.model.User; +import com.wisemapping.model.Constants; +import com.wisemapping.service.MindmapService; +import com.wisemapping.view.MindMapInfoBean; +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import org.springframework.validation.Validator; + +public class MapInfoValidator implements Validator { + + + private MindmapService mindmapService; + + public boolean supports(final Class clazz) { + return clazz.equals(MindMapInfoBean.class); + } + + public void validate(Object obj, Errors errors) { + final MindMapInfoBean map = (MindMapInfoBean) obj; + if (map == null) { + errors.rejectValue("map", "error.not-specified", null, "Value required."); + } else { + + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", Messages.FIELD_REQUIRED); + + final String title = map.getTitle(); + final String desc = map.getDescription(); + if (title != null && title.length() > 0) { + if (title.length() > Constants.MAX_MAP_NAME_LENGTH) { + errors.rejectValue("title", "field.max.length", + new Object[]{Constants.MAX_MAP_NAME_LENGTH}, + "The title must have less than " + Constants.MAX_MAP_NAME_LENGTH + " characters."); + } else { + // Map alredy exists ? + final MindmapService service = this.getMindmapService(); + + final User user = com.wisemapping.security.Utils.getUser(); + final MindMap mindMap = service.getMindmapByTitle(title, user); + if (mindMap != null) { + errors.rejectValue("title", Messages.MAP_TITLE_ALREADY_EXISTS); + } + } + } + ValidatorUtils.rejectIfExceeded(errors, + "description", + "The description must have less than "+Constants.MAX_MAP_DESCRIPTION_LENGTH + " characters.", + desc, + Constants.MAX_MAP_DESCRIPTION_LENGTH); + } + + } + + public MindmapService getMindmapService() { + return mindmapService; + } + + public void setMindmapService(MindmapService mindmapService) { + this.mindmapService = mindmapService; + } +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/validator/RenameMapValidator.java b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/RenameMapValidator.java new file mode 100755 index 00000000..7e1991a4 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/RenameMapValidator.java @@ -0,0 +1,83 @@ +/* +* 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 $ +*/ + +package com.wisemapping.validator; + +import org.springframework.validation.Validator; +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import com.wisemapping.service.MindmapService; +import com.wisemapping.view.MindMapInfoBean; +import com.wisemapping.controller.Messages; +import com.wisemapping.model.Constants; +import com.wisemapping.model.User; +import com.wisemapping.model.MindMap; + +public class RenameMapValidator + implements Validator { + + private MindmapService mindmapService; + + public boolean supports(final Class clazz) { + return clazz.equals(MindMapInfoBean.class); + } + + public void validate(Object obj, Errors errors) { + final MindMapInfoBean map = (MindMapInfoBean) obj; + if (map == null) { + errors.rejectValue("map", "error.not-specified", null, "Value required."); + } else { + + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", Messages.FIELD_REQUIRED); + + final String title = map.getTitle(); + final String desc = map.getDescription(); + if (title != null && title.length() > 0) { + if (title.length() > Constants.MAX_MAP_NAME_LENGTH) { + errors.rejectValue("title", "field.max.length", + new Object[]{Constants.MAX_MAP_NAME_LENGTH}, + "The title must have less than " + Constants.MAX_MAP_NAME_LENGTH + " characters."); + } else { + // Map alredy exists ? + final MindmapService service = this.getMindmapService(); + + final User user = com.wisemapping.security.Utils.getUser(); + final MindMap mindMap = service.getMindmapByTitle(title, user); + if (mindMap != null && map.getMindMap().getId() != mindMap.getId() ) { + errors.rejectValue("title", Messages.MAP_TITLE_ALREADY_EXISTS); + } + } + } + ValidatorUtils.rejectIfExceeded(errors, + "description", + "The description must have less than "+Constants.MAX_MAP_DESCRIPTION_LENGTH + " characters.", + desc, + Constants.MAX_MAP_DESCRIPTION_LENGTH); + } + + } + + public MindmapService getMindmapService() { + return mindmapService; + } + + public void setMindmapService(MindmapService mindmapService) { + this.mindmapService = mindmapService; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/validator/TagValidator.java b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/TagValidator.java new file mode 100755 index 00000000..0c0f58ed --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/TagValidator.java @@ -0,0 +1,48 @@ +/* +* 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 $ +*/ + +package com.wisemapping.validator; + +import com.wisemapping.model.Constants; +import com.wisemapping.view.TagBean; +import org.springframework.validation.Errors; +import org.springframework.validation.Validator; + +public class TagValidator implements Validator { + + public boolean supports(final Class clazz) { + return clazz.equals(TagBean.class); + } + + public void validate(Object obj, Errors errors) { + TagBean tag = (TagBean) obj; + if (tag == null) { + errors.rejectValue("user", "error.not-specified"); + } else { + + // Validate email address ... + final String tags = tag.getMindmapTags(); + ValidatorUtils.rejectIfExceeded(errors, + "mindmapTags", + "The tags must have less than "+ Constants.MAX_TAGS_LENGTH + " characters.", + tags, + Constants.MAX_TAGS_LENGTH); + } + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/validator/UserValidator.java b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/UserValidator.java new file mode 100644 index 00000000..c7ec6a5e --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/UserValidator.java @@ -0,0 +1,104 @@ +/* +* 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 $ +*/ + +package com.wisemapping.validator; + +import com.wisemapping.controller.Messages; +import com.wisemapping.service.UserService; +import com.wisemapping.view.UserBean; +import com.wisemapping.model.Constants; +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import org.springframework.validation.Validator; + +public class UserValidator + implements Validator { + + private UserService userService; + + public boolean supports(final Class clazz) { + return clazz.equals(UserBean.class); + } + + public void validate(Object obj, Errors errors) { + UserBean user = (UserBean) obj; + if (user == null) { + errors.rejectValue("user", "error.not-specified"); + } else { + + // Validate email address ... + final String email = user.getEmail(); + boolean isValid = Utils.isValidateEmailAddress(email); + if (isValid) { + if (userService.getUserBy(email) != null) { + errors.rejectValue("email", Messages.EMAIL_ALREADY_EXIST); + } + } else { + Utils.validateEmailAddress(email, errors); + } + + // Validate username ... + final String username = user.getUsername(); + if (username != null && userService.getUserByUsername(username) != null) { + errors.rejectValue("username", Messages.USERNAME_ALREADY_EXIST); + } else { + ValidationUtils.rejectIfEmpty(errors, "username", Messages.FIELD_REQUIRED); + } + + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstname", Messages.FIELD_REQUIRED); + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lastname", Messages.FIELD_REQUIRED); + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", Messages.FIELD_REQUIRED); + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "retypePassword", Messages.FIELD_REQUIRED); + ValidatorUtils.rejectIfExceeded(errors, + "firstname", + "The firstname must have less than "+ Constants.MAX_USER_FIRSTNAME_LENGTH + " characters.", + user.getFirstname(), + Constants.MAX_USER_FIRSTNAME_LENGTH); + ValidatorUtils.rejectIfExceeded(errors, + "lastname", + "The lastname must have less than "+ Constants.MAX_USER_LASTNAME_LENGTH + " characters.", + user.getLastname(), + Constants.MAX_USER_LASTNAME_LENGTH); + ValidatorUtils.rejectIfExceeded(errors, + "username", + "The username must have less than "+ Constants.MAX_USER_USERNAME_LENGTH + " characters.", + username, + Constants.MAX_USER_USERNAME_LENGTH); + ValidatorUtils.rejectIfExceeded(errors, + "password", + "The password must have less than "+ Constants.MAX_USER_PASSWORD_LENGTH + " characters.", + user.getPassword(), + Constants.MAX_USER_PASSWORD_LENGTH); + ValidatorUtils.rejectIfExceeded(errors, + "retypePassword", + "The retypePassword must have less than "+ Constants.MAX_USER_PASSWORD_LENGTH + " characters.", + user.getRetypePassword(), + Constants.MAX_USER_PASSWORD_LENGTH); + + final String password = user.getPassword(); + if (password != null && !password.equals(user.getRetypePassword())) { + errors.rejectValue("password", Messages.PASSWORD_MISSMATCH); + } + } + } + + public void setUserService(UserService userService) { + this.userService = userService; + } +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/validator/Utils.java b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/Utils.java new file mode 100644 index 00000000..5956a3e4 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/Utils.java @@ -0,0 +1,58 @@ +/* +* 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 $ +*/ + +package com.wisemapping.validator; + +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; + +import java.util.regex.Pattern; +import java.util.regex.Matcher; + +import com.wisemapping.controller.Messages; + +public class Utils { + //Set the email emailPattern string + + static private Pattern emailPattern = Pattern.compile(".+@.+\\.[a-z]+"); + + private Utils() { + + } + + static void validateEmailAddress(final String email, final Errors errors) { + if (email == null || email.trim().length() == 0) { + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email", Messages.FIELD_REQUIRED); + } else { + boolean isValid = Utils.isValidateEmailAddress(email); + if (!isValid) { + errors.rejectValue("email", Messages.NO_VALID_EMAIL_ADDRESS); + } + } + } + + static boolean isValidateEmailAddress(final String email) { + + //Match the given string with the emailPattern + final Matcher m = emailPattern.matcher(email); + + //check whether match is found + return m.matches(); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ValidatorUtils.java b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ValidatorUtils.java new file mode 100755 index 00000000..b88989d5 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/validator/ValidatorUtils.java @@ -0,0 +1,37 @@ +/* +* 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 $ +*/ + +package com.wisemapping.validator; + +import org.springframework.validation.ValidationUtils; + +public class ValidatorUtils + extends ValidationUtils +{ + public static void rejectIfExceeded(org.springframework.validation.Errors errors, + java.lang.String title, + java.lang.String message, + String value, + int limit) + { + if (value != null && value.length() > limit) { + errors.rejectValue(title, "field.max.length",message); + } + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/view/ChangePasswordBean.java b/trunk/wise-webapp/src/main/java/com/wisemapping/view/ChangePasswordBean.java new file mode 100644 index 00000000..bfb8c206 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/view/ChangePasswordBean.java @@ -0,0 +1,42 @@ +/* +* 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 $ +*/ + +package com.wisemapping.view; + +public class ChangePasswordBean { + + private String password; + private String retryPassword; + + public String getPassword() { + return password; + } + + public void setPassword(String e) { + this.password = e; + } + + public String getRetryPassword() { + return retryPassword; + } + + public void setRetryPassword(String e) { + this.retryPassword = e; + } +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/view/ColaboratorBean.java b/trunk/wise-webapp/src/main/java/com/wisemapping/view/ColaboratorBean.java new file mode 100755 index 00000000..5682cbfa --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/view/ColaboratorBean.java @@ -0,0 +1,70 @@ +/* +* 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 $ +*/ + +package com.wisemapping.view; + +import com.wisemapping.model.UserRole; +import com.wisemapping.model.Colaborator; +import com.wisemapping.model.User; + +public class ColaboratorBean +{ + private UserRole userRole; + private boolean isUser; + private Colaborator colaborator; + + public ColaboratorBean(Colaborator colaborator, UserRole role) + { + this.colaborator = colaborator; + this.userRole = role; + this.isUser = false; + } + + public ColaboratorBean(User user, UserRole role) + { + this.colaborator = user; + this.userRole = role; + this.isUser = true; + } + + public boolean isUser() + { + return isUser; + } + + public String getRole() + { + return userRole.name(); + } + + public String getUsername() + { + return isUser ? ((User)colaborator).getUsername() : colaborator.getEmail(); + } + + public String getEmail() + { + return colaborator.getEmail(); + } + + public long getId() + { + return colaborator.getId(); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/view/ForgotPasswordBean.java b/trunk/wise-webapp/src/main/java/com/wisemapping/view/ForgotPasswordBean.java new file mode 100755 index 00000000..892bc7fd --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/view/ForgotPasswordBean.java @@ -0,0 +1,33 @@ +/* +* 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 $ +*/ + +package com.wisemapping.view; + +public class ForgotPasswordBean { + + private String email; + + public String getEmail() { + return email; + } + + public void setEmail(String e) { + this.email = e; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/view/HistoryBean.java b/trunk/wise-webapp/src/main/java/com/wisemapping/view/HistoryBean.java new file mode 100755 index 00000000..81ec29e2 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/view/HistoryBean.java @@ -0,0 +1,73 @@ +/* +* 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 $ +*/ + +package com.wisemapping.view; + +import java.util.Calendar; +import java.util.Locale; +import java.text.DateFormat; + +public class HistoryBean +{ + private Calendar historyTime; + private String author; + private int mindmapId; + private int historyId; + + public HistoryBean() {} + + public HistoryBean(int mindmapId,int historyId,String author, Calendar time) + { + this.mindmapId = mindmapId; + this.author = author; + this.historyTime = time; + this.historyId = historyId; + } + + public Calendar getHistoryTime() { + return historyTime; + } + + public String getCreation(Locale locale) + { + return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.DEFAULT,locale).format(historyTime.getTime()); + } + + public void setHistoryTime(Calendar historyTime) { + this.historyTime = historyTime; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public int getMindMapId() + { + return mindmapId; + } + + public int getHistoryId() + { + return historyId; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/view/ImportMapBean.java b/trunk/wise-webapp/src/main/java/com/wisemapping/view/ImportMapBean.java new file mode 100644 index 00000000..78b56090 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/view/ImportMapBean.java @@ -0,0 +1,46 @@ +/* +* 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 $ +*/ + +package com.wisemapping.view; + +import com.wisemapping.model.MindMap; + +public class ImportMapBean extends MindMapInfoBean{ + + + private String mapFile; + private MindMap importedMap; + + + public MindMap getImportedMap() { + return importedMap; + } + + public void setMapFile(String mapFile) { + this.mapFile = mapFile; + } + + public String getMapFile() { + return mapFile; + } + + public void setImportedMap(MindMap map) { + this.importedMap = map; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/view/MindMapBean.java b/trunk/wise-webapp/src/main/java/com/wisemapping/view/MindMapBean.java new file mode 100644 index 00000000..4306742d --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/view/MindMapBean.java @@ -0,0 +1,168 @@ +/* +* 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 $ +*/ + +package com.wisemapping.view; + +import com.wisemapping.model.MindMap; +import com.wisemapping.model.MindmapUser; +import com.wisemapping.model.UserRole; +import com.wisemapping.model.User; + +import java.text.DateFormat; +import java.util.*; + +public class MindMapBean { + private MindMap mindMap; + private List viewers; + private List colaborators; + + public MindMapBean(final MindMap mindmap) { + this.mindMap = mindmap; + this.colaborators = getColaboratorBy(mindmap.getMindmapUsers(), UserRole.COLLABORATOR); + this.viewers = getColaboratorBy(mindmap.getMindmapUsers(), UserRole.VIEWER); + } + + public MindMap getMindMap() { + return mindMap; + } + + public boolean getPublic() { + return mindMap.isPublic(); + } + + public String getTitle() { + return mindMap.getTitle(); + } + + public String getDescription() { + return mindMap.getDescription(); + } + + public int getId() { + return mindMap.getId(); + } + + public List getViewers() { + return viewers; + } + + public List getCollaborators() { + return colaborators; + } + + public String getLastEditor() { + return mindMap.getLastModifierUser(); + } + + public String getLastEditDate() { + String result = ""; + Calendar lastEditTime = Calendar.getInstance(); + lastEditTime.setTime(mindMap.getLastModificationTime().getTime()); + Calendar now = Calendar.getInstance(); + int dayDiff = getDaysBetween(now, lastEditTime); + if (dayDiff > 0) { + result = dayDiff + " days ago"; + } else if (dayDiff == 0) { + result = "today"; + } + return result; + } + + public Calendar getLastEditTime() { + return mindMap.getLastModificationTime(); + } + + public String getCreationTime() { + return DateFormat.getInstance().format(mindMap.getCreationTime().getTime()); + } + + public String getCreationUser() { + return mindMap.getCreator(); + } + + public String getTags() { + return mindMap.getTags(); + } + + private List getColaboratorBy(Set source, UserRole role) { + List col = new ArrayList(); + if (source != null) { + for (MindmapUser mu : source) { + if (mu.getRole() == role) { + col.add(new ColaboratorBean(mu.getColaborator(), mu.getRole())); + } + } + } + return col; + } + + private static int getDaysBetween(java.util.Calendar d1, java.util.Calendar d2) { + if (d1.after(d2)) { // swap dates so that d1 is start and d2 is end + java.util.Calendar swap = d1; + d1 = d2; + d2 = swap; + } + int days = d2.get(java.util.Calendar.DAY_OF_YEAR) - + d1.get(java.util.Calendar.DAY_OF_YEAR); + int y2 = d2.get(java.util.Calendar.YEAR); + if (d1.get(java.util.Calendar.YEAR) != y2) { + d1 = (java.util.Calendar) d1.clone(); + do { + days += d1.getActualMaximum(java.util.Calendar.DAY_OF_YEAR); + d1.add(java.util.Calendar.YEAR, 1); + } while (d1.get(java.util.Calendar.YEAR) != y2); + } + return days; + } + + public static class MindMapBeanComparator implements Comparator { + + public int compare(MindMapBean o1, MindMapBean o2) { + return o1.getLastEditTime().compareTo(o2.getLastEditTime()); + } + } + + public int getCountColaborators() { + return colaborators != null ? colaborators.size() : 0; + } + + public int getCountViewers() { + return viewers != null ? viewers.size() : 0; + } + + public int getCountShared() { + return getCountColaborators() + getCountViewers(); + } + + public boolean isShared() { + return getCountShared() > 0; + } + + public void setTitle(String t) { + mindMap.setTitle(t); + } + + public void setDescription(String d) { + mindMap.setDescription(d); + } + + public User getOwner() { + return mindMap.getOwner(); + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/view/MindMapInfoBean.java b/trunk/wise-webapp/src/main/java/com/wisemapping/view/MindMapInfoBean.java new file mode 100644 index 00000000..29cd24fb --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/view/MindMapInfoBean.java @@ -0,0 +1,66 @@ +/* +* 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 $ +*/ + +package com.wisemapping.view; + +import com.wisemapping.model.MindMap; + + +public class MindMapInfoBean { + private String title; + private String description; + private MindMap mindMap; + + public MindMapInfoBean(MindMap map) { + this.title = map.getTitle(); + this.description = map.getDescription(); + + this.mindMap = map; + } + + public MindMapInfoBean() { + this.title = ""; + this.description = ""; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public MindMap getMindMap() { + if (mindMap != null) { + mindMap.setTitle(title); + mindMap.setDescription(description); + } + return mindMap; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/view/TagBean.java b/trunk/wise-webapp/src/main/java/com/wisemapping/view/TagBean.java new file mode 100755 index 00000000..7d86b045 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/view/TagBean.java @@ -0,0 +1,68 @@ +/* +* 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 $ +*/ + +package com.wisemapping.view; + +import java.util.Set; + +public class TagBean +{ + private Set userTags; + private String mindmapTitle; + private int mindmapId; + private String mindmapTags; + + public TagBean(){} + + public Set getUserTags() { + return userTags; + } + + public void setUserTags(Set tags) { + this.userTags = tags; + } + + public String getMindmapTags() { + return mindmapTags; + } + + public void setMindmapTags(String tags) { + this.mindmapTags = tags; + } + + public String getMindmapTitle() + { + return mindmapTitle; + } + + public void setMindmapTitle(String title) + { + this.mindmapTitle = title; + } + + public int getMindmapId() + { + return mindmapId; + } + + public void setMindmapId(int id) + { + this.mindmapId = id; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/view/UserBean.java b/trunk/wise-webapp/src/main/java/com/wisemapping/view/UserBean.java new file mode 100644 index 00000000..a1c6e862 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/view/UserBean.java @@ -0,0 +1,56 @@ +/* +* 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 $ +*/ + +package com.wisemapping.view; + +import com.wisemapping.model.User; + +public class UserBean + extends User { + private String retypePassword; + private String captcha; + + public UserBean() { + + } + + public UserBean(User model) { + this.setFirstname(model.getFirstname()); + this.setLastname(model.getLastname()); + this.setEmail(model.getEmail()); + this.setId(model.getId()); + this.setAllowSendEmail(model.isAllowSendEmail()); + } + + public String getRetypePassword() { + return retypePassword; + } + + public void setRetypePassword(String retypePassword) { + this.retypePassword = retypePassword; + } + + public String getCaptcha() { + return captcha; + } + + public void setCaptcha(String captcha) { + this.captcha = captcha; + } +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/ws/WiseWsEndpoint.java b/trunk/wise-webapp/src/main/java/com/wisemapping/ws/WiseWsEndpoint.java new file mode 100644 index 00000000..174632a7 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/ws/WiseWsEndpoint.java @@ -0,0 +1,161 @@ +/* +* 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 $ +*/ + +package com.wisemapping.ws; + +import org.springframework.ws.server.endpoint.annotation.Endpoint; +import org.springframework.ws.server.endpoint.annotation.PayloadRoot; +import org.apache.log4j.Logger; +import com.sun.istack.internal.NotNull; +import com.wisemapping.service.MindmapService; +import com.wisemapping.service.UserService; +import com.wisemapping.model.MindMap; +import com.wisemapping.model.User; +import com.wisemapping.exceptions.NoMapFoundException; + +import javax.xml.bind.*; +import javax.xml.transform.stream.StreamSource; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.Calendar; + +/** + * WiseMapping Web Services API + */ +@Endpoint +public class WiseWsEndpoint { + + MindmapService mindmapService; + private UserService userService; + final static Logger logger = Logger.getLogger("org.wisemapping.ws"); + private JAXBContext jaxbContext; + + + public WiseWsEndpoint(MindmapService mindmapService, UserService userService) throws JAXBException { + this.mindmapService = mindmapService; + this.userService = userService; + jaxbContext = JAXBContext.newInstance("com.wisemapping.ws"); + } + + @PayloadRoot(localPart = "loadMindmapRequest", namespace = "http://www.wisemapping.org/ws") + public LoadMindmapResponse loadMindmap(final @NotNull LoadMindmapRequest request) throws Throwable { + + logger.debug("Invoking loadMindmap"); + final LoadMindmapResponse result = new LoadMindmapResponse(); + + try { + final MindMap mindmap = mindmapService.getMindmapById((int) request.getMapdId()); + if(mindmap==null) + { + throw new NoMapFoundException(request.getMapdId()); + } + + String xml = mindmap.getNativeXml(); + + // Hack, we need to unify to only one XSD schema definitions per map ... + xml = " mapElement = unmarshaller.unmarshal(streamSource,MapType.class); + + // Load map data ... + result.creator = mindmap.getCreator(); + result.setMap(mapElement.getValue()); + } catch (Throwable e) { + logger.fatal("Unexpexted Exception", e); + throw e; + } + + return result; + } + + @PayloadRoot(localPart = "addMindmapRequest", namespace = "http://www.wisemapping.org/ws") + public AddMindmapResponse createMindmap(final @NotNull AddMindmapRequest request) throws Throwable { + + logger.debug("Invoking createMindmap"); + final AddMindmapResponse response = new AddMindmapResponse(); + try { + + final String creator = request.getCreator(); + final User user = userService.getUserBy(creator); + if(user==null) + { + throw new IllegalArgumentException("Invalid addMindmapRequest.' " + creator+"' is not valid wisemapping user."); + } + + + final MindMap mindmap = new MindMap(); + mindmap.setCreationTime(Calendar.getInstance()); + + // Set title ... + final String title = request.getTitle(); + if(title==null) + { + throw new IllegalArgumentException("Invalid addMindmapRequest. Title element can not be null."); + } + mindmap.setTitle(title); + + // Set description ... + final String description = request.getDescription(); + if(description==null) + { + throw new IllegalArgumentException("Invalid addMindmapRequest. Description element can not be null."); + } + mindmap.setDescription(description); + + // Convert Map to XML + final MapType mapType = request.getMap(); + if(mapType==null) + { + throw new IllegalArgumentException("Invalid addMindmapRequest. Map element can not be null."); + } + + ObjectFactory factory = new ObjectFactory(); + final Marshaller marshaller = jaxbContext.createMarshaller(); + StringWriter stringWriter = new StringWriter(); + marshaller.marshal(factory.createMap(mapType),stringWriter); + + mindmap.setNativeXml(stringWriter.toString()); + mindmapService.addMindmap(mindmap,user); + + + // Prepare result ... + response.setMapId(mindmap.getId()); + + } catch (Throwable e) { + logger.fatal("Unexpexted Exception", e); + throw e; + + } + + return response; + } + + + public MindmapService getMindmapService() { + return mindmapService; + } + + public void setMindmapService(MindmapService mindmapService) { + this.mindmapService = mindmapService; + } +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/Style.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/Style.java new file mode 100644 index 00000000..8974135c --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/Style.java @@ -0,0 +1,162 @@ +/* +* 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 $ +*/ + +package com.wisemapping.xml; + +public class Style { + + private float width; + private float height; + private String left; + private String top; + private float fontSize; + private String fontFamily; + private String color; + private String fontWidth; + private boolean isVisible = true; + + public boolean isVisible() { + return isVisible; + } + + public void setVisible(boolean visible) { + isVisible = visible; + } + + public static Style parse(final String styleValue) { + Style result = new Style(); + String[] strings = styleValue.split(";"); + + for (String style : strings) { + final String key = style.substring(0, style.indexOf(":")); + String value = style.substring(style.indexOf(":") + 1, style.length()); + value = value.trim(); + + if (key.trim().equals("WIDTH")) { + result.setWidth(parseFloat(value)); + } else if (key.trim().equals("HEIGHT")) { + result.setHeight(parseFloat(value)); + } + if (key.trim().equals("TOP")) { + result.setTop(removeUnit(value)); + } else if (key.trim().equals("LEFT")) { + result.setLeft(removeUnit(value)); + } else if (key.trim().equals("FONT")) { + final String[] fontValues = value.split(" "); + if (fontValues.length == 3) { + result.setFontWidth(fontValues[0]); + result.setFontSize(parseFloat(fontValues[1])); + result.setFontFamily(fontValues[2]); + } else if (fontValues.length == 2) { + result.setFontSize(parseFloat(fontValues[0])); + result.setFontFamily(fontValues[1]); + } + } else if (key.trim().equals("COLOR")) { + result.setColor(value); + } else if (key.trim().equals("VISIBILITY")) { + result.setVisible(!"hidden".equals(value)); + } + + } + return result; + } + + private void setFontWidth(String v) { + this.fontWidth = v; + } + + private void setColor(String value) { + this.color = value; + } + + public float getHeight() { + return height; + } + + public void setHeight(float height) { + this.height = height; + } + + public float getWidth() { + return width; + } + + public void setWidth(float width) { + this.width = width; + } + + public static String removeUnit(String value) { + String number; + if (value.indexOf("px") != -1 || value.indexOf("pt") != -1) { + number = value.substring(0, value.length() - 2); + } else { + number = value; + } + return number; + } + + public static float parseFloat(String value) { + String number = removeUnit(value); + return Float.parseFloat(number); + } + + + public String getLeft() { + return left; + } + + public void setLeft(String left) { + this.left = left; + } + + public String getTop() { + return top; + } + + public void setTop(String top) { + this.top = top; + } + + + public float getFontSize() { + return fontSize; + } + + public void setFontSize(float fontSize) { + this.fontSize = fontSize; + } + + public String getFontFamily() { + return fontFamily; + } + + public void setFontFamily(String fontFamily) { + this.fontFamily = fontFamily; + } + + public String getColor() { + return this.color; + } + + public String getFontWidth() { + return fontWidth; + } +} + + diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/SvgToVMLConverter.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/SvgToVMLConverter.java new file mode 100644 index 00000000..e014f220 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/SvgToVMLConverter.java @@ -0,0 +1,443 @@ +/* +* 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 $ +*/ + +package com.wisemapping.xml; + +import com.wisemapping.xml.svgmap.*; +import com.wisemapping.xml.svgmap.ObjectFactory; +import com.wisemapping.xml.vmlmap.*; +import com.wisemapping.xml.vmlmap.Line; +import com.wisemapping.xml.vmlmap.Polyline; +import com.wisemapping.xml.vmlmap.Rect; + +import javax.xml.bind.JAXBException; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Unmarshaller; +import javax.xml.bind.Marshaller; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; + +public class SvgToVMLConverter { + private ObjectFactory svgObjectFactory; + private static final int CORRECTION_HANDCODE = 5; + private Object svgRootElem; + + public SvgToVMLConverter() { + this.svgObjectFactory = new ObjectFactory(); + + } + + public void convert(final InputStream vmlDocument) throws JAXBException { + + final JAXBContext vmlContext = JAXBContext.newInstance("com.wisemapping.xml.vmlmap"); + final Unmarshaller umarshaller = vmlContext.createUnmarshaller(); + final Group rootElem = (Group) umarshaller.unmarshal(vmlDocument); + + this.svgRootElem = convert(rootElem); + } + + private Svg convert(Group g) { + final Svg svgElement = svgObjectFactory.createSvg(); + svgElement.setPreserveAspectRatio("none"); + + /* + + + */ + + final String coordorigin = g.getCoordorigin(); + String coordSize = g.getCoordsize(); + svgElement.setViewBox(coordorigin + ", " + coordSize); + + final Style style = Style.parse(g.getStyle()); + float width = style.getWidth(); + svgElement.setWidth(String.valueOf(width)); + + float height = style.getHeight(); + svgElement.setHeight(String.valueOf(height)); + + // Convert connection lines ... + final List polylines = g.getPolyline(); + final List svgPolylines = svgElement.getPolyline(); + for (Polyline vmlPolyline : polylines) { + final com.wisemapping.xml.svgmap.Polyline svgPolyline = convert(vmlPolyline); + svgPolylines.add(svgPolyline); + } + + final List vmlLines = g.getLine(); + final List svgLines = svgElement.getLine(); + for (Line vmlLine : vmlLines) { + final com.wisemapping.xml.svgmap.Line svgPolyline = convert(vmlLine); + svgLines.add(svgPolyline); + } + + // Convert Topics ... + final List vmlTopics = g.getGroup(); + final List svgTopics = svgElement.getG(); + for (Group topic : vmlTopics) { + G svgTopic = convertTopicGroup(topic); + svgTopics.add(svgTopic); + } + + // Convert connectors ... + g.getOval(); + + return svgElement; + } + + private G convertTopicGroup(final Group vmlTopic) { + /** + * + * + */ + final G svgTopic = new G(); + + final String styleStr = vmlTopic.getStyle(); + final Style style = Style.parse(styleStr); + + String transform = "translate(" + style.getLeft() + ", " + style.getTop() + ") scale(1, 1)"; + svgTopic.setTransform(transform); + + float width = style.getWidth(); + svgTopic.setWidth(String.valueOf(width)); + + float height = style.getHeight(); + svgTopic.setHeight(String.valueOf(height)); + + svgTopic.setPreserveAspectRatio("none"); + + // Convert InnerShape ... + final List roundrects = vmlTopic.getRoundrect(); + float rectWidth = 0; + float rectHeight = 0; + for (Roundrect vmlRect : roundrects) { + + // Skip outerShape figure... + final Fill vmlFill = vmlRect.getFill(); + if (vmlFill == null || !"0".equals(vmlFill.getOpacity())) { + final com.wisemapping.xml.svgmap.Rect svgRect = convert(vmlRect); + svgTopic.setRect(svgRect); + final Style rectStyle = Style.parse(vmlRect.getStyle()); + + rectWidth = rectStyle.getWidth(); + rectHeight = rectStyle.getHeight(); + } + } + + final List vmlRects = vmlTopic.getRect(); + for (Rect vmlRect : vmlRects) { + + // Skip outerShape figure... + final Fill vmlFill = vmlRect.getFill(); + if (vmlFill == null || !"0".equals(vmlFill.getOpacity())) { + final com.wisemapping.xml.svgmap.Rect svgRect = convert(vmlRect); + svgTopic.setRect(svgRect); + final Style rectStyle = Style.parse(vmlRect.getStyle()); + + rectWidth = rectStyle.getWidth(); + rectHeight = rectStyle.getHeight(); + } + } + + final List vmlLines = vmlTopic.getLine(); + for (final Line vmlLine : vmlLines) { + + final String lineStyleStr = vmlLine.getStyle(); + final Style lineStyle = Style.parse(lineStyleStr); + if (lineStyle.isVisible()) { + com.wisemapping.xml.svgmap.Line line = convert(vmlLine); + svgTopic.setLine(line); + } else { + // Shape is line... + final String from = vmlLine.getFrom(); + String[] formPoints = from.split(","); + + final String to = vmlLine.getTo(); + String[] toPoints = to.split(","); + + rectWidth = Float.parseFloat(formPoints[0]) - Float.parseFloat(toPoints[0]); + rectWidth = Math.abs(rectWidth); + + rectHeight = Float.parseFloat(formPoints[1]); + } + } + + // Convert connection ovals.. + final List vmlOvals = vmlTopic.getOval(); + for (Oval vmlOval : vmlOvals) { + + // Skip outerShape figure... + final Ellipse svgElipse = convert(vmlOval); + if (svgElipse != null) { + svgTopic.setEllipse(svgElipse); + } + } + + // Convert Text ... + final List vmlTextShape = vmlTopic.getShape(); + final Text svgText = convertTextShape(vmlTextShape.get(0), rectWidth, rectHeight); + svgTopic.setText(svgText); + + return svgTopic; + } + + private com.wisemapping.xml.svgmap.Rect convert(Rect vmlRect) { + final com.wisemapping.xml.svgmap.Rect svgRect = new com.wisemapping.xml.svgmap.Rect(); + final Style style = Style.parse(vmlRect.getStyle()); + + float width = style.getWidth(); + svgRect.setWidth(String.valueOf(width)); + + float height = style.getHeight(); + svgRect.setHeight(height); + + String top = style.getTop(); + svgRect.setY(Float.parseFloat(top)); + + String left = style.getLeft(); + svgRect.setX(Float.parseFloat(left)); + + // Fill properties ... + final String fillColor = vmlRect.getFillcolor(); + svgRect.setFill(fillColor); + + // Stroke properties ... + final String strokeColor = vmlRect.getStrokecolor(); + svgRect.setStroke(strokeColor); + svgRect.setStrokeWidth("0.5px"); + return svgRect; + + } + + private Ellipse convert(final Oval vmlOval) { + + /** + * + * + * + * + * + * + * SVG: + * + */ + final Style style = Style.parse(vmlOval.getStyle()); + Ellipse svgElipse = null; + if (style.isVisible()) { + svgElipse = new Ellipse(); + + float width = style.getWidth(); + svgElipse.setWidth(width); + svgElipse.setRx(width / 2); + + float height = style.getHeight(); + svgElipse.setHeight(height); + svgElipse.setRy(height / 2); + + String top = style.getTop(); + svgElipse.setCy(Float.parseFloat(top) + (width / 2)); + + String left = style.getLeft(); + svgElipse.setCx(Float.parseFloat(left) + (height / 2)); + + // Fill properties ... + final String fillColor = vmlOval.getFillcolor(); + svgElipse.setFill(fillColor); + + // Stroke properties ... + final String strokeColor = vmlOval.getStrokecolor(); + svgElipse.setStroke(strokeColor); + svgElipse.setStrokeWidth("0.5px"); + } + return svgElipse; + } + + private com.wisemapping.xml.svgmap.Line convert(final Line vmlLine) { + /** + * VML: + * + * <:stroke dashstyle="solid"> + * + * + * SVG: + * + */ + + com.wisemapping.xml.svgmap.Line svgLine = new com.wisemapping.xml.svgmap.Line(); + final String from = vmlLine.getFrom(); + final String[] fromPoints = from.split(","); + + svgLine.setX1(Float.parseFloat(fromPoints[0])); + svgLine.setY1(Float.parseFloat(fromPoints[1])); + + final String to = vmlLine.getTo(); + final String[] toPoints = to.split(","); + + svgLine.setX2(Float.parseFloat(toPoints[0])); + svgLine.setY2(Float.parseFloat(toPoints[1])); + + String strokeweight = vmlLine.getStrokeweight(); + svgLine.setStrokeWidth(strokeweight); + + String stokeColor = vmlLine.getStrokecolor(); + svgLine.setStroke(stokeColor); + + return svgLine; + } + + private Text convertTextShape(Shape vmlTextShape, float boxWidth, float boxHeigth) { + /** + * + * + * + * Central Topic + * + * + * + * SVG: + * Central Topic + * + */ + final Text svgText = new Text(); + Textbox vmlTextBox = vmlTextShape.getTextbox(); + final String textBoxStyleStr = vmlTextBox.getStyle(); + final Style textBoxStyle = Style.parse(textBoxStyleStr); + + // @todo: Take this hardcode from javascript ... + float fontSize = textBoxStyle.getFontSize(); + float scale = vmlTextBox.getXFontScale(); + float svgFontSize = fontSize / scale; + + svgText.setFontSize(svgFontSize); + + // Set text properties... + final String textValue = vmlTextBox.getSPAN().getSPAN(); + svgText.setContent(textValue); + + final String color = textBoxStyle.getColor(); + svgText.setFill(color); + + final String fontWidth = textBoxStyle.getFontWidth(); + svgText.setFontWeight(fontWidth); + + // Positionate font... + final String textSize = vmlTextBox.getXTextSize(); + final String[] split = textSize.split(","); + float textWidth = Float.valueOf(split[0]); + float textHeight = Float.valueOf(split[1]); + + svgText.setX(boxWidth - textWidth); + svgText.setY(boxHeigth - textHeight + CORRECTION_HANDCODE); + + return svgText; + + } + + private com.wisemapping.xml.svgmap.Rect convert(Roundrect vmlRect) { + + /* + * VML: + * + * + * + * + * + * SVG: + * + * + */ + final com.wisemapping.xml.svgmap.Rect svgRect = new com.wisemapping.xml.svgmap.Rect(); + final Style style = Style.parse(vmlRect.getStyle()); + svgRect.setRy(2.7F); + svgRect.setRx(2.7F); + + float width = style.getWidth(); + svgRect.setWidth(String.valueOf(width)); + + float height = style.getHeight(); + svgRect.setHeight(height); + + String top = style.getTop(); + svgRect.setY(Float.parseFloat(top)); + + String left = style.getLeft(); + svgRect.setX(Float.parseFloat(left)); + + // Fill properties ... + final String fillColor = vmlRect.getFillcolor(); + svgRect.setFill(fillColor); + + // Stroke properties ... + final String strokeColor = vmlRect.getStrokecolor(); + svgRect.setStroke(strokeColor); + svgRect.setStrokeWidth("0.5px"); + + return svgRect; + + } + + private com.wisemapping.xml.svgmap.Polyline convert(Polyline vmlPolyline) { + + /* + * + * + * + * + * + */ + final com.wisemapping.xml.svgmap.Polyline svgPolyline = svgObjectFactory.createPolyline(); + + final String rPoints = vmlPolyline.getXPoints(); + svgPolyline.setPoints(rPoints); + + final String strokeColor = vmlPolyline.getStrokecolor(); + svgPolyline.setStroke(strokeColor); + + // @todo: Take from SVG. + svgPolyline.setFill("none"); + svgPolyline.setStrokeWidth("1px"); + svgPolyline.setStrokeOpacity("1"); + + return svgPolyline; + } + + + public void toXml(OutputStream os) throws JAXBException { + final JAXBContext svgContext = JAXBContext.newInstance("com.wisemapping.xml.svgmap"); + Marshaller m = svgContext.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + m.marshal(svgRootElem, os); + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/VmlToSvgConverter.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/VmlToSvgConverter.java new file mode 100644 index 00000000..93b3bd89 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/VmlToSvgConverter.java @@ -0,0 +1,451 @@ +/* +* 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 $ +*/ + +package com.wisemapping.xml; + +import com.wisemapping.xml.vmlmap.*; +import com.wisemapping.xml.vmlmap.Polyline; +import com.wisemapping.xml.vmlmap.Line; +import com.wisemapping.xml.vmlmap.Rect; +import com.wisemapping.xml.svgmap.*; +import com.wisemapping.xml.svgmap.ObjectFactory; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.bind.Marshaller; +import java.io.*; +import java.util.List; + +public class VmlToSvgConverter { + private ObjectFactory svgObjectFactory; + private static final int CORRECTION_HARDCODE = 5; + private Object svgRootElem; + + public VmlToSvgConverter() { + this.svgObjectFactory = new ObjectFactory(); + + } + + public void convert(final Reader vmlDocument) throws JAXBException, IOException { + + final JAXBContext vmlContext = JAXBContext.newInstance("com.wisemapping.xml.vmlmap"); + final Unmarshaller umarshaller = vmlContext.createUnmarshaller(); + final Group rootElem = (Group) umarshaller.unmarshal(vmlDocument); + this.svgRootElem = convert(rootElem); + } + + private Svg convert(Group g) { + final Svg svgElement = svgObjectFactory.createSvg(); + svgElement.setPreserveAspectRatio("none"); + + /* + + + */ + + final String coordorigin = g.getCoordorigin(); + String coordSize = g.getCoordsize(); + svgElement.setViewBox(coordorigin + ", " + coordSize); + + final Style style = Style.parse(g.getStyle()); + float width = style.getWidth(); + svgElement.setWidth(String.valueOf(width)); + + float height = style.getHeight(); + svgElement.setHeight(String.valueOf(height)); + + // Convert connection lines ... + final List polylines = g.getPolyline(); + final List svgPolylines = svgElement.getPolyline(); + for (Polyline vmlPolyline : polylines) { + final com.wisemapping.xml.svgmap.Polyline svgPolyline = convert(vmlPolyline); + svgPolylines.add(svgPolyline); + } + + final List vmlLines = g.getLine(); + final List svgLines = svgElement.getLine(); + for (Line vmlLine : vmlLines) { + final com.wisemapping.xml.svgmap.Line svgPolyline = convert(vmlLine); + svgLines.add(svgPolyline); + } + + // Convert Topics ... + final List vmlTopics = g.getGroup(); + final List svgTopics = svgElement.getG(); + for (Group topic : vmlTopics) { + G svgTopic = convertTopicGroup(topic); + svgTopics.add(svgTopic); + } + + // Convert connectors ... + g.getOval(); + + return svgElement; + } + + private G convertTopicGroup(final Group vmlTopic) { + /** + * + * + */ + final G svgTopic = new G(); + + final String styleStr = vmlTopic.getStyle(); + final Style style = Style.parse(styleStr); + + String transform = "translate(" + style.getLeft() + ", " + style.getTop() + ") scale(1, 1)"; + svgTopic.setTransform(transform); + + float width = style.getWidth(); + svgTopic.setWidth(String.valueOf(width)); + + float height = style.getHeight(); + svgTopic.setHeight(String.valueOf(height)); + + svgTopic.setPreserveAspectRatio("none"); + + // Convert InnerShape ... + final List roundrects = vmlTopic.getRoundrect(); + float rectWidth = 0; + float rectHeight = 0; + for (Roundrect vmlRect : roundrects) { + + // Skip outerShape figure... + final Fill vmlFill = vmlRect.getFill(); + if (vmlFill == null || !"0".equals(vmlFill.getOpacity())) { + final com.wisemapping.xml.svgmap.Rect svgRect = convert(vmlRect); + svgTopic.setRect(svgRect); + final Style rectStyle = Style.parse(vmlRect.getStyle()); + + rectWidth = rectStyle.getWidth(); + rectHeight = rectStyle.getHeight(); + } + } + + final List vmlRects = vmlTopic.getRect(); + for (com.wisemapping.xml.vmlmap.Rect vmlRect : vmlRects) { + + // Skip outerShape figure... + final Fill vmlFill = vmlRect.getFill(); + if (vmlFill == null || !"0".equals(vmlFill.getOpacity())) { + final com.wisemapping.xml.svgmap.Rect svgRect = convert(vmlRect); + svgTopic.setRect(svgRect); + final Style rectStyle = Style.parse(vmlRect.getStyle()); + + rectWidth = rectStyle.getWidth(); + rectHeight = rectStyle.getHeight(); + } + } + + final List vmlLines = vmlTopic.getLine(); + for (final Line vmlLine : vmlLines) { + + final String lineStyleStr = vmlLine.getStyle(); + final Style lineStyle = Style.parse(lineStyleStr); + if (lineStyle.isVisible()) { + com.wisemapping.xml.svgmap.Line line = convert(vmlLine); + svgTopic.setLine(line); + } else { + // Shape is line... + final String from = vmlLine.getFrom(); + String[] formPoints = from.split(","); + + final String to = vmlLine.getTo(); + String[] toPoints = to.split(","); + + rectWidth = Float.parseFloat(formPoints[0]) - Float.parseFloat(toPoints[0]); + rectWidth = Math.abs(rectWidth); + + rectHeight = Float.parseFloat(formPoints[1]); + } + } + + // Convert connection ovals.. + final List vmlOvals = vmlTopic.getOval(); + for (Oval vmlOval : vmlOvals) { + + // Skip outerShape figure... + final Ellipse svgElipse = convert(vmlOval); + if (svgElipse != null) { + svgTopic.setEllipse(svgElipse); + } + } + + // Convert Text ... + final List vmlTextShape = vmlTopic.getShape(); + final Text svgText = convertTextShape(vmlTextShape.get(0), rectWidth, rectHeight); + svgTopic.setText(svgText); + + return svgTopic; + } + + private com.wisemapping.xml.svgmap.Rect convert(Rect vmlRect) { + final com.wisemapping.xml.svgmap.Rect svgRect = new com.wisemapping.xml.svgmap.Rect(); + final Style style = Style.parse(vmlRect.getStyle()); + + float width = style.getWidth(); + svgRect.setWidth(String.valueOf(width)); + + float height = style.getHeight(); + svgRect.setHeight(height); + + String top = style.getTop(); + svgRect.setY(Float.parseFloat(top)); + + String left = style.getLeft(); + svgRect.setX(Float.parseFloat(left)); + + // Fill properties ... + final String fillColor = vmlRect.getFillcolor(); + svgRect.setFill(fillColor); + + // Stroke properties ... + final String strokeColor = vmlRect.getStrokecolor(); + svgRect.setStroke(strokeColor); + svgRect.setStrokeWidth("0.5px"); + return svgRect; + + } + + private Ellipse convert(final Oval vmlOval) { + + /** + * + * + * + * + * + * + * SVG: + * + */ + final Style style = Style.parse(vmlOval.getStyle()); + Ellipse svgElipse = null; + if (style.isVisible()) { + svgElipse = new Ellipse(); + + float width = style.getWidth(); + svgElipse.setWidth(width); + svgElipse.setRx(width / 2); + + float height = style.getHeight(); + svgElipse.setHeight(height); + svgElipse.setRy(height / 2); + + String top = style.getTop(); + svgElipse.setCy(Float.parseFloat(top) + (width / 2)); + + String left = style.getLeft(); + svgElipse.setCx(Float.parseFloat(left) + (height / 2)); + + // Fill properties ... + final String fillColor = vmlOval.getFillcolor(); + svgElipse.setFill(fillColor); + + // Stroke properties ... + final String strokeColor = vmlOval.getStrokecolor(); + svgElipse.setStroke(strokeColor); + svgElipse.setStrokeWidth("0.5px"); + } + return svgElipse; + } + + private com.wisemapping.xml.svgmap.Line convert(final Line vmlLine) { + /** + * VML: + * + * <:stroke dashstyle="solid"> + * + * + * SVG: + * + */ + + com.wisemapping.xml.svgmap.Line svgLine = new com.wisemapping.xml.svgmap.Line(); + final String from = vmlLine.getFrom(); + final String[] fromPoints = from.split(","); + + svgLine.setX1(Float.parseFloat(fromPoints[0])); + svgLine.setY1(Float.parseFloat(fromPoints[1])); + + final String to = vmlLine.getTo(); + final String[] toPoints = to.split(","); + + svgLine.setX2(Float.parseFloat(toPoints[0])); + svgLine.setY2(Float.parseFloat(toPoints[1])); + + String strokeweight = vmlLine.getStrokeweight(); + svgLine.setStrokeWidth(strokeweight); + + String stokeColor = vmlLine.getStrokecolor(); + svgLine.setStroke(stokeColor); + + return svgLine; + } + + private Text convertTextShape(Shape vmlTextShape, float boxWidth, float boxHeigth) { + /** + * + * + * + * Central Topic + * + * + * + * SVG: + * Central Topic + * + */ + final Text svgText = new Text(); + Textbox vmlTextBox = vmlTextShape.getTextbox(); + final String textBoxStyleStr = vmlTextBox.getStyle(); + final Style textBoxStyle = Style.parse(textBoxStyleStr); + + String fontStyle = svgText.getFontStyle(); + svgText.setFontStyle(fontStyle); + + // @todo: Take this hardcode from javascript ... + float fontSize = textBoxStyle.getFontSize(); + float scale = vmlTextBox.getXFontScale(); + float svgFontSize = fontSize / scale; + + svgText.setFontSize(svgFontSize); + + // Set text properties... + final String textValue = vmlTextBox.getSPAN().getSPAN(); + svgText.setContent(textValue); + + final String color = textBoxStyle.getColor(); + svgText.setFill(color); + + final String style = textBoxStyle.getFontWidth(); + svgText.setFontWeight(style); + + // Positionate font... + final String textSize = vmlTextBox.getXTextSize(); + final String[] split = textSize.split(","); + float textWidth = Float.valueOf(split[0]); + float textHeight = Float.valueOf(split[1]); + + svgText.setX(boxWidth - textWidth); + svgText.setY(boxHeigth - textHeight + CORRECTION_HARDCODE); + + return svgText; + + } + + private com.wisemapping.xml.svgmap.Rect convert(Roundrect vmlRect) { + + /* + * VML: + * + * + * + * + * + * SVG: + * + * + */ + final com.wisemapping.xml.svgmap.Rect svgRect = new com.wisemapping.xml.svgmap.Rect(); + final Style style = Style.parse(vmlRect.getStyle()); + svgRect.setRy(2.7F); + svgRect.setRx(2.7F); + + float width = style.getWidth(); + svgRect.setWidth(String.valueOf(width)); + + float height = style.getHeight(); + svgRect.setHeight(height); + + String top = style.getTop(); + svgRect.setY(Float.parseFloat(top)); + + String left = style.getLeft(); + svgRect.setX(Float.parseFloat(left)); + + // Fill properties ... + final String fillColor = vmlRect.getFillcolor(); + svgRect.setFill(fillColor); + + // Stroke properties ... + final String strokeColor = vmlRect.getStrokecolor(); + svgRect.setStroke(strokeColor); + svgRect.setStrokeWidth("0.5px"); + + return svgRect; + + } + + private com.wisemapping.xml.svgmap.Polyline convert(Polyline vmlPolyline) { + + /* + * + * + * + * + * + */ + final com.wisemapping.xml.svgmap.Polyline svgPolyline = svgObjectFactory.createPolyline(); + + final String rPoints = vmlPolyline.getXPoints(); + svgPolyline.setPoints(rPoints); + + final String strokeColor = vmlPolyline.getStrokecolor(); + svgPolyline.setStroke(strokeColor); + + // @todo: Take from SVG. + svgPolyline.setFill("none"); + svgPolyline.setStrokeWidth("1px"); + svgPolyline.setStrokeOpacity("1"); + + return svgPolyline; + } + + + public void toXml(OutputStream os) throws JAXBException { + final JAXBContext svgContext = JAXBContext.newInstance("com.wisemapping.xml.svgmap"); + Marshaller m = svgContext.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + m.marshal(svgRootElem, os); + } + + public void toXml(Writer os) throws JAXBException { + final JAXBContext svgContext = JAXBContext.newInstance("com.wisemapping.xml.svgmap"); + Marshaller m = svgContext.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + m.marshal(svgRootElem, os); + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Arrowlink.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Arrowlink.java new file mode 100755 index 00000000..3461781e --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Arrowlink.java @@ -0,0 +1,248 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.08.27 at 09:24:17 PM ART +// + + +package com.wisemapping.xml.freemind; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="COLOR" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="DESTINATION" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="ENDARROW" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="ENDINCLINATION" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="ID" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="STARTARROW" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="STARTINCLINATION" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "arrowlink") +public class Arrowlink { + + @XmlAttribute(name = "COLOR") + protected String color; + @XmlAttribute(name = "DESTINATION", required = true) + protected String destination; + @XmlAttribute(name = "ENDARROW") + protected String endarrow; + @XmlAttribute(name = "ENDINCLINATION") + protected String endinclination; + @XmlAttribute(name = "ID") + protected String id; + @XmlAttribute(name = "STARTARROW") + protected String startarrow; + @XmlAttribute(name = "STARTINCLINATION") + protected String startinclination; + + /** + * Gets the value of the color property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCOLOR() { + return color; + } + + /** + * Sets the value of the color property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCOLOR(String value) { + this.color = value; + } + + /** + * Gets the value of the destination property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDESTINATION() { + return destination; + } + + /** + * Sets the value of the destination property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDESTINATION(String value) { + this.destination = value; + } + + /** + * Gets the value of the endarrow property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getENDARROW() { + return endarrow; + } + + /** + * Sets the value of the endarrow property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setENDARROW(String value) { + this.endarrow = value; + } + + /** + * Gets the value of the endinclination property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getENDINCLINATION() { + return endinclination; + } + + /** + * Sets the value of the endinclination property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setENDINCLINATION(String value) { + this.endinclination = value; + } + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getID() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setID(String value) { + this.id = value; + } + + /** + * Gets the value of the startarrow property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSTARTARROW() { + return startarrow; + } + + /** + * Sets the value of the startarrow property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSTARTARROW(String value) { + this.startarrow = value; + } + + /** + * Gets the value of the startinclination property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSTARTINCLINATION() { + return startinclination; + } + + /** + * Sets the value of the startinclination property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSTARTINCLINATION(String value) { + this.startinclination = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Cloud.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Cloud.java new file mode 100755 index 00000000..4d8165dc --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Cloud.java @@ -0,0 +1,86 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.08.27 at 09:24:17 PM ART +// + + +package com.wisemapping.xml.freemind; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="COLOR" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "cloud") +public class Cloud { + + @XmlAttribute(name = "COLOR") + protected String color; + + /** + * Gets the value of the color property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCOLOR() { + return color; + } + + /** + * Sets the value of the color property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCOLOR(String value) { + this.color = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Edge.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Edge.java new file mode 100755 index 00000000..c33c3316 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Edge.java @@ -0,0 +1,140 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.08.27 at 09:24:17 PM ART +// + + +package com.wisemapping.xml.freemind; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="COLOR" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="STYLE" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="WIDTH" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "edge") +public class Edge { + + @XmlAttribute(name = "COLOR") + protected String color; + @XmlAttribute(name = "STYLE") + protected String style; + @XmlAttribute(name = "WIDTH") + protected String width; + + /** + * Gets the value of the color property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCOLOR() { + return color; + } + + /** + * Sets the value of the color property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCOLOR(String value) { + this.color = value; + } + + /** + * Gets the value of the style property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSTYLE() { + return style; + } + + /** + * Sets the value of the style property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSTYLE(String value) { + this.style = value; + } + + /** + * Gets the value of the width property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWIDTH() { + return width; + } + + /** + * Sets the value of the width property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWIDTH(String value) { + this.width = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Font.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Font.java new file mode 100755 index 00000000..67961952 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Font.java @@ -0,0 +1,181 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.08.27 at 09:24:17 PM ART +// + + +package com.wisemapping.xml.freemind; + +import java.math.BigInteger; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="BOLD">
    + *         <simpleType>
    + *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
    + *             <enumeration value="true"/>
    + *           </restriction>
    + *         </simpleType>
    + *       </attribute>
    + *       <attribute name="ITALIC">
    + *         <simpleType>
    + *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
    + *             <enumeration value="true"/>
    + *             <enumeration value="false"/>
    + *           </restriction>
    + *         </simpleType>
    + *       </attribute>
    + *       <attribute name="NAME" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="SIZE" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "font") +public class Font { + + @XmlAttribute(name = "BOLD") + protected String bold; + @XmlAttribute(name = "ITALIC") + protected String italic; + @XmlAttribute(name = "NAME", required = true) + protected String name; + @XmlAttribute(name = "SIZE", required = true) + protected BigInteger size; + + /** + * Gets the value of the bold property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBOLD() { + return bold; + } + + /** + * Sets the value of the bold property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBOLD(String value) { + this.bold = value; + } + + /** + * Gets the value of the italic property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getITALIC() { + return italic; + } + + /** + * Sets the value of the italic property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setITALIC(String value) { + this.italic = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNAME() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNAME(String value) { + this.name = value; + } + + /** + * Gets the value of the size property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getSIZE() { + return size; + } + + /** + * Sets the value of the size property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setSIZE(BigInteger value) { + this.size = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Hook.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Hook.java new file mode 100755 index 00000000..c37f71fd --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Hook.java @@ -0,0 +1,145 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.08.27 at 09:24:17 PM ART +// + + +package com.wisemapping.xml.freemind; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <sequence>
    + *         <element ref="{}Parameters" minOccurs="0"/>
    + *         <element ref="{}text" minOccurs="0"/>
    + *       </sequence>
    + *       <attribute name="NAME" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "parameters", + "text" +}) +@XmlRootElement(name = "hook") +public class Hook { + + @XmlElement(name = "Parameters") + protected Parameters parameters; + protected String text; + @XmlAttribute(name = "NAME", required = true) + protected String name; + + /** + * Gets the value of the parameters property. + * + * @return + * possible object is + * {@link Parameters } + * + */ + public Parameters getParameters() { + return parameters; + } + + /** + * Sets the value of the parameters property. + * + * @param value + * allowed object is + * {@link Parameters } + * + */ + public void setParameters(Parameters value) { + this.parameters = value; + } + + /** + * Gets the value of the text property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getText() { + return text; + } + + /** + * Sets the value of the text property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setText(String value) { + this.text = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNAME() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNAME(String value) { + this.name = value; + } + +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Icon.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Icon.java new file mode 100755 index 00000000..2480bc15 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Icon.java @@ -0,0 +1,86 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.08.27 at 09:24:17 PM ART +// + + +package com.wisemapping.xml.freemind; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="BUILTIN" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "icon") +public class Icon { + + @XmlAttribute(name = "BUILTIN", required = true) + protected String builtin; + + /** + * Gets the value of the builtin property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBUILTIN() { + return builtin; + } + + /** + * Sets the value of the builtin property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBUILTIN(String value) { + this.builtin = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Map.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Map.java new file mode 100755 index 00000000..9a76184b --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Map.java @@ -0,0 +1,118 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.08.27 at 09:24:17 PM ART +// + + +package com.wisemapping.xml.freemind; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <sequence>
    + *         <element ref="{}node"/>
    + *       </sequence>
    + *       <attribute name="version" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "node" +}) +@XmlRootElement(name = "map") +public class Map { + + @XmlElement(required = true) + protected Node node; + @XmlAttribute(required = true) + protected String version; + + /** + * Gets the value of the node property. + * + * @return + * possible object is + * {@link Node } + * + */ + public Node getNode() { + return node; + } + + /** + * Sets the value of the node property. + * + * @param value + * allowed object is + * {@link Node } + * + */ + public void setNode(Node value) { + this.node = value; + } + + /** + * Gets the value of the version property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersion() { + return version; + } + + /** + * Sets the value of the version property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersion(String value) { + this.version = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Node.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Node.java new file mode 100755 index 00000000..b1d5b9c8 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Node.java @@ -0,0 +1,517 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.08.27 at 09:24:17 PM ART +// + + +package com.wisemapping.xml.freemind; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElements; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <choice maxOccurs="unbounded" minOccurs="0">
    + *         <element ref="{}arrowlink"/>
    + *         <element ref="{}cloud"/>
    + *         <element ref="{}edge"/>
    + *         <element ref="{}font"/>
    + *         <element ref="{}hook"/>
    + *         <element ref="{}icon"/>
    + *         <element ref="{}node"/>
    + *       </choice>
    + *       <attribute name="BACKGROUND_COLOR" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="COLOR" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="CREATED" type="{http://www.w3.org/2001/XMLSchema}integer" />
    + *       <attribute name="ENCRYPTED_CONTENT" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="FOLDED">
    + *         <simpleType>
    + *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
    + *             <enumeration value="true"/>
    + *             <enumeration value="false"/>
    + *           </restriction>
    + *         </simpleType>
    + *       </attribute>
    + *       <attribute name="HGAP" type="{http://www.w3.org/2001/XMLSchema}integer" />
    + *       <attribute name="ID" type="{http://www.w3.org/2001/XMLSchema}ID" />
    + *       <attribute name="LINK" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="MODIFIED" type="{http://www.w3.org/2001/XMLSchema}integer" />
    + *       <attribute name="POSITION">
    + *         <simpleType>
    + *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
    + *             <enumeration value="left"/>
    + *             <enumeration value="right"/>
    + *           </restriction>
    + *         </simpleType>
    + *       </attribute>
    + *       <attribute name="STYLE" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="TEXT" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="VGAP" type="{http://www.w3.org/2001/XMLSchema}integer" />
    + *       <attribute name="VSHIFT" type="{http://www.w3.org/2001/XMLSchema}integer" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "arrowlinkOrCloudOrEdge" +}) +@XmlRootElement(name = "node") +public class Node { + + @XmlElements({ + @XmlElement(name = "cloud", type = Cloud.class), + @XmlElement(name = "icon", type = Icon.class), + @XmlElement(name = "arrowlink", type = Arrowlink.class), + @XmlElement(name = "edge", type = Edge.class), + @XmlElement(name = "font", type = Font.class), + @XmlElement(name = "node", type = Node.class), + @XmlElement(name = "hook", type = Hook.class) + }) + protected List arrowlinkOrCloudOrEdge; + @XmlAttribute(name = "BACKGROUND_COLOR") + protected String backgroundcolor; + @XmlAttribute(name = "COLOR") + protected String color; + @XmlAttribute(name = "CREATED") + protected BigInteger created; + @XmlAttribute(name = "ENCRYPTED_CONTENT") + protected String encryptedcontent; + @XmlAttribute(name = "FOLDED") + protected String folded; + @XmlAttribute(name = "HGAP") + protected BigInteger hgap; + @XmlAttribute(name = "ID") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + protected String id; + @XmlAttribute(name = "LINK") + protected String link; + @XmlAttribute(name = "MODIFIED") + protected BigInteger modified; + @XmlAttribute(name = "POSITION") + protected String position; + @XmlAttribute(name = "STYLE") + protected String style; + @XmlAttribute(name = "TEXT", required = true) + protected String text; + @XmlAttribute(name = "VGAP") + protected BigInteger vgap; + @XmlAttribute(name = "VSHIFT") + protected BigInteger vshift; + + /** + * Gets the value of the arrowlinkOrCloudOrEdge property. + * + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the arrowlinkOrCloudOrEdge property. + * + *

    + * For example, to add a new item, do as follows: + *

    +     *    getArrowlinkOrCloudOrEdge().add(newItem);
    +     * 
    + * + * + *

    + * Objects of the following type(s) are allowed in the list + * {@link Cloud } + * {@link Icon } + * {@link Arrowlink } + * {@link Edge } + * {@link Font } + * {@link Node } + * {@link Hook } + * + * + */ + public List getArrowlinkOrCloudOrEdge() { + if (arrowlinkOrCloudOrEdge == null) { + arrowlinkOrCloudOrEdge = new ArrayList(); + } + return this.arrowlinkOrCloudOrEdge; + } + + /** + * Gets the value of the backgroundcolor property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBACKGROUNDCOLOR() { + return backgroundcolor; + } + + /** + * Sets the value of the backgroundcolor property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBACKGROUNDCOLOR(String value) { + this.backgroundcolor = value; + } + + /** + * Gets the value of the color property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCOLOR() { + return color; + } + + /** + * Sets the value of the color property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCOLOR(String value) { + this.color = value; + } + + /** + * Gets the value of the created property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getCREATED() { + return created; + } + + /** + * Sets the value of the created property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setCREATED(BigInteger value) { + this.created = value; + } + + /** + * Gets the value of the encryptedcontent property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getENCRYPTEDCONTENT() { + return encryptedcontent; + } + + /** + * Sets the value of the encryptedcontent property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setENCRYPTEDCONTENT(String value) { + this.encryptedcontent = value; + } + + /** + * Gets the value of the folded property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFOLDED() { + return folded; + } + + /** + * Sets the value of the folded property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFOLDED(String value) { + this.folded = value; + } + + /** + * Gets the value of the hgap property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getHGAP() { + return hgap; + } + + /** + * Sets the value of the hgap property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setHGAP(BigInteger value) { + this.hgap = value; + } + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getID() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setID(String value) { + this.id = value; + } + + /** + * Gets the value of the link property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLINK() { + return link; + } + + /** + * Sets the value of the link property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLINK(String value) { + this.link = value; + } + + /** + * Gets the value of the modified property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getMODIFIED() { + return modified; + } + + /** + * Sets the value of the modified property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setMODIFIED(BigInteger value) { + this.modified = value; + } + + /** + * Gets the value of the position property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPOSITION() { + return position; + } + + /** + * Sets the value of the position property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPOSITION(String value) { + this.position = value; + } + + /** + * Gets the value of the style property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSTYLE() { + return style; + } + + /** + * Sets the value of the style property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSTYLE(String value) { + this.style = value; + } + + /** + * Gets the value of the text property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTEXT() { + return text; + } + + /** + * Sets the value of the text property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTEXT(String value) { + this.text = value; + } + + /** + * Gets the value of the vgap property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getVGAP() { + return vgap; + } + + /** + * Sets the value of the vgap property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setVGAP(BigInteger value) { + this.vgap = value; + } + + /** + * Gets the value of the vshift property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getVSHIFT() { + return vshift; + } + + /** + * Sets the value of the vshift property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setVSHIFT(BigInteger value) { + this.vshift = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/ObjectFactory.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/ObjectFactory.java new file mode 100755 index 00000000..3ba2d774 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/ObjectFactory.java @@ -0,0 +1,143 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2008.03.26 at 10:38:46 PM ART +// + + +package com.wisemapping.xml.freemind; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the generated package. + *

    An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _Text_QNAME = new QName("", "text"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: generated + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Arrowlink } + * + */ + public Arrowlink createArrowlink() { + return new Arrowlink(); + } + + /** + * Create an instance of {@link Map } + * + */ + public Map createMap() { + return new Map(); + } + + /** + * Create an instance of {@link Icon } + * + */ + public Icon createIcon() { + return new Icon(); + } + + /** + * Create an instance of {@link Cloud } + * + */ + public Cloud createCloud() { + return new Cloud(); + } + + /** + * Create an instance of {@link Font } + * + */ + public Font createFont() { + return new Font(); + } + + /** + * Create an instance of {@link Parameters } + * + */ + public Parameters createParameters() { + return new Parameters(); + } + + /** + * Create an instance of {@link Hook } + * + */ + public Hook createHook() { + return new Hook(); + } + + /** + * Create an instance of {@link Edge } + * + */ + public Edge createEdge() { + return new Edge(); + } + + /** + * Create an instance of {@link Node } + * + */ + public Node createNode() { + return new Node(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "", name = "text") + public JAXBElement createText(String value) { + return new JAXBElement(_Text_QNAME, String.class, null, value); + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Parameters.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Parameters.java new file mode 100755 index 00000000..c89f3b83 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind/Parameters.java @@ -0,0 +1,87 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.08.27 at 09:24:17 PM ART +// + + +package com.wisemapping.xml.freemind; + +import java.math.BigInteger; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="REMINDUSERAT" type="{http://www.w3.org/2001/XMLSchema}integer" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "Parameters") +public class Parameters { + + @XmlAttribute(name = "REMINDUSERAT") + protected BigInteger reminduserat; + + /** + * Gets the value of the reminduserat property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getREMINDUSERAT() { + return reminduserat; + } + + /** + * Sets the value of the reminduserat property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setREMINDUSERAT(BigInteger value) { + this.reminduserat = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind_0_9_0.xsd b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind_0_9_0.xsd new file mode 100755 index 00000000..8c5a2dad --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/freemind_0_9_0.xsd @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap.xsd b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap.xsd new file mode 100755 index 00000000..b2287f2d --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap.xsd @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Icon.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Icon.java new file mode 100755 index 00000000..cd4ee292 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Icon.java @@ -0,0 +1,111 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.11.01 at 09:40:11 PM ART +// + + +package com.wisemapping.xml.mindmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for icon complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType name="icon">
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="order" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "icon") +public class Icon { + + @XmlAttribute + protected String id; + @XmlAttribute + protected String order; + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + /** + * Gets the value of the order property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getOrder() { + return order; + } + + /** + * Sets the value of the order property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setOrder(String value) { + this.order = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Link.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Link.java new file mode 100755 index 00000000..61fd8082 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Link.java @@ -0,0 +1,111 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.11.01 at 09:40:11 PM ART +// + + +package com.wisemapping.xml.mindmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for link complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType name="link">
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="order" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="url" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "link") +public class Link { + + @XmlAttribute + protected String order; + @XmlAttribute + protected String url; + + /** + * Gets the value of the order property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getOrder() { + return order; + } + + /** + * Sets the value of the order property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setOrder(String value) { + this.order = value; + } + + /** + * Gets the value of the url property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUrl() { + return url; + } + + /** + * Sets the value of the url property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUrl(String value) { + this.url = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Map.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Map.java new file mode 100755 index 00000000..6686f744 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Map.java @@ -0,0 +1,125 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.11.01 at 09:40:11 PM ART +// + + +package com.wisemapping.xml.mindmap; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <sequence>
    + *         <element ref="{}topic" maxOccurs="unbounded"/>
    + *       </sequence>
    + *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "topic" +}) +@XmlRootElement(name = "map") +public class Map { + + @XmlElement(required = true) + protected List topic; + @XmlAttribute + protected String name; + + /** + * Gets the value of the topic property. + * + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the topic property. + * + *

    + * For example, to add a new item, do as follows: + *

    +     *    getTopic().add(newItem);
    +     * 
    + * + * + *

    + * Objects of the following type(s) are allowed in the list + * {@link TopicType } + * + * + */ + public List getTopic() { + if (topic == null) { + topic = new ArrayList(); + } + return this.topic; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Note.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Note.java new file mode 100755 index 00000000..a5c6a8b2 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/Note.java @@ -0,0 +1,84 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2008.03.26 at 10:28:06 PM ART +// + + +package com.wisemapping.xml.mindmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for note complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType name="note">
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="text" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "note") +public class Note { + + @XmlAttribute + protected String text; + + /** + * Gets the value of the text property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getText() { + return text; + } + + /** + * Sets the value of the text property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setText(String value) { + this.text = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/ObjectFactory.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/ObjectFactory.java new file mode 100755 index 00000000..28668b91 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/ObjectFactory.java @@ -0,0 +1,111 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2008.03.26 at 10:28:06 PM ART +// + + +package com.wisemapping.xml.mindmap; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the generated package. + *

    An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _Topic_QNAME = new QName("", "topic"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: generated + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Link } + * + */ + public Link createLink() { + return new Link(); + } + + /** + * Create an instance of {@link Icon } + * + */ + public Icon createIcon() { + return new Icon(); + } + + /** + * Create an instance of {@link Map } + * + */ + public Map createMap() { + return new Map(); + } + + /** + * Create an instance of {@link TopicType } + * + */ + public TopicType createTopicType() { + return new TopicType(); + } + + /** + * Create an instance of {@link Note } + * + */ + public Note createNote() { + return new Note(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TopicType }{@code >}} + * + */ + @XmlElementDecl(namespace = "", name = "topic") + public JAXBElement createTopic(TopicType value) { + return new JAXBElement(_Topic_QNAME, TopicType.class, null, value); + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/TopicType.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/TopicType.java new file mode 100755 index 00000000..b4b4d2d1 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/mindmap/TopicType.java @@ -0,0 +1,397 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.11.01 at 09:40:11 PM ART +// + + +package com.wisemapping.xml.mindmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; +import java.util.ArrayList; +import java.util.List; + + +/** + *

    Java class for topicType complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType name="topicType">
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <sequence>
    + *         <element name="icon" type="{}icon" maxOccurs="unbounded" minOccurs="0"/>
    + *         <element name="link" type="{}link" minOccurs="0"/>
    + *         <element name="note" type="{}note" minOccurs="0"/>
    + *         <element ref="{}topic" maxOccurs="unbounded" minOccurs="0"/>
    + *       </sequence>
    + *       <attribute name="bgColor" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="brColor" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="central" type="{http://www.w3.org/2001/XMLSchema}boolean" />
    + *       <attribute name="fontStyle" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="order" type="{http://www.w3.org/2001/XMLSchema}int" />
    + *       <attribute name="position" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="shape" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="text" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "topicType", propOrder = { + "icon", + "link", + "note", + "topic" +}) +public class TopicType { + + protected List icon; + protected Link link; + protected Note note; + protected List topic; + @XmlAttribute + protected String bgColor; + @XmlAttribute + protected String brColor; + @XmlAttribute + protected Boolean central; + @XmlAttribute + protected String fontStyle; + @XmlAttribute + protected Integer order; + @XmlAttribute + protected String position; + @XmlAttribute + protected String shape; + @XmlAttribute + protected String text; + + /** + * Gets the value of the icon property. + * + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the icon property. + * + *

    + * For example, to add a new item, do as follows: + *

    +     *    getIcon().add(newItem);
    +     * 
    + * + * + *

    + * Objects of the following type(s) are allowed in the list + * {@link Icon } + * + * + */ + public List getIcon() { + if (icon == null) { + icon = new ArrayList(); + } + return this.icon; + } + + /** + * Gets the value of the link property. + * + * @return + * possible object is + * {@link Link } + * + */ + public Link getLink() { + return link; + } + + /** + * Sets the value of the link property. + * + * @param value + * allowed object is + * {@link Link } + * + */ + public void setLink(Link value) { + this.link = value; + } + + /** + * Gets the value of the note property. + * + * @return + * possible object is + * {@link Note } + * + */ + public Note getNote() { + return note; + } + + /** + * Sets the value of the note property. + * + * @param value + * allowed object is + * {@link Note } + * + */ + public void setNote(Note value) { + this.note = value; + } + + /** + * Gets the value of the topic property. + * + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the topic property. + * + *

    + * For example, to add a new item, do as follows: + *

    +     *    getTopic().add(newItem);
    +     * 
    + * + * + *

    + * Objects of the following type(s) are allowed in the list + * {@link TopicType } + * + * + */ + public List getTopic() { + if (topic == null) { + topic = new ArrayList(); + } + return this.topic; + } + + /** + * Gets the value of the bgColor property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBgColor() { + return bgColor; + } + + /** + * Sets the value of the bgColor property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBgColor(String value) { + this.bgColor = value; + } + + /** + * Gets the value of the brColor property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBrColor() { + return brColor; + } + + /** + * Sets the value of the brColor property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBrColor(String value) { + this.brColor = value; + } + + /** + * Gets the value of the central property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isCentral() { + return central; + } + + /** + * Sets the value of the central property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setCentral(Boolean value) { + this.central = value; + } + + /** + * Gets the value of the fontStyle property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFontStyle() { + return fontStyle; + } + + /** + * Sets the value of the fontStyle property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFontStyle(String value) { + this.fontStyle = value; + } + + /** + * Gets the value of the order property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getOrder() { + return order; + } + + /** + * Sets the value of the order property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setOrder(Integer value) { + this.order = value; + } + + /** + * Gets the value of the position property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPosition() { + return position; + } + + /** + * Sets the value of the position property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPosition(String value) { + this.position = value; + } + + /** + * Gets the value of the shape property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getShape() { + return shape; + } + + /** + * Sets the value of the shape property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setShape(String value) { + this.shape = value; + } + + /** + * Gets the value of the text property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getText() { + return text; + } + + /** + * Sets the value of the text property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setText(String value) { + this.text = value; + } + +} + diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Ellipse.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Ellipse.java new file mode 100644 index 00000000..ccbc5d1e --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Ellipse.java @@ -0,0 +1,270 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:27:07 PM ART +// + + +package com.wisemapping.xml.svgmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="cx" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="cy" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="fill" use="required" type="{http://www.w3.org/2001/XMLSchema}string" fixed="#E0E5EF" />
    + *       <attribute name="height" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="rx" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="ry" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="stroke" use="required" type="{http://www.w3.org/2001/XMLSchema}string" fixed="#023BB9" />
    + *       <attribute name="stroke-width" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *       <attribute name="visibility" use="required">
    + *         <simpleType>
    + *           <restriction base="{http://www.w3.org/2001/XMLSchema}NMTOKEN">
    + *             <enumeration value="hidden"/>
    + *             <enumeration value="visible"/>
    + *           </restriction>
    + *         </simpleType>
    + *       </attribute>
    + *       <attribute name="width" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "ellipse") +public class Ellipse { + + @XmlAttribute(required = true) + protected float cx; + @XmlAttribute(required = true) + protected float cy; + @XmlAttribute(required = true) + protected String fill; + @XmlAttribute(required = true) + protected float height; + @XmlAttribute(required = true) + protected float rx; + @XmlAttribute(required = true) + protected float ry; + @XmlAttribute(required = true) + protected String stroke; + @XmlAttribute(name = "stroke-width", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String strokeWidth; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String visibility; + @XmlAttribute(required = true) + protected float width; + + /** + * Gets the value of the cx property. + */ + public float getCx() { + return cx; + } + + /** + * Sets the value of the cx property. + */ + public void setCx(float value) { + this.cx = value; + } + + /** + * Gets the value of the cy property. + */ + public float getCy() { + return cy; + } + + /** + * Sets the value of the cy property. + */ + public void setCy(float value) { + this.cy = value; + } + + /** + * Gets the value of the fill property. + * + * @return possible object is + * {@link String } + */ + public String getFill() { + if (fill == null) { + return "#E0E5EF"; + } else { + return fill; + } + } + + /** + * Sets the value of the fill property. + * + * @param value allowed object is + * {@link String } + */ + public void setFill(String value) { + this.fill = value; + } + + /** + * Gets the value of the height property. + */ + public float getHeight() { + return height; + } + + /** + * Sets the value of the height property. + */ + public void setHeight(float value) { + this.height = value; + } + + /** + * Gets the value of the rx property. + */ + public float getRx() { + return rx; + } + + /** + * Sets the value of the rx property. + */ + public void setRx(float value) { + this.rx = value; + } + + /** + * Gets the value of the ry property. + */ + public float getRy() { + return ry; + } + + /** + * Sets the value of the ry property. + */ + public void setRy(float value) { + this.ry = value; + } + + /** + * Gets the value of the stroke property. + * + * @return possible object is + * {@link String } + */ + public String getStroke() { + if (stroke == null) { + return "#023BB9"; + } else { + return stroke; + } + } + + /** + * Sets the value of the stroke property. + * + * @param value allowed object is + * {@link String } + */ + public void setStroke(String value) { + this.stroke = value; + } + + /** + * Gets the value of the strokeWidth property. + * + * @return possible object is + * {@link String } + */ + public String getStrokeWidth() { + return strokeWidth; + } + + /** + * Sets the value of the strokeWidth property. + * + * @param value allowed object is + * {@link String } + */ + public void setStrokeWidth(String value) { + this.strokeWidth = value; + } + + /** + * Gets the value of the visibility property. + * + * @return possible object is + * {@link String } + */ + public String getVisibility() { + return visibility; + } + + /** + * Sets the value of the visibility property. + * + * @param value allowed object is + * {@link String } + */ + public void setVisibility(String value) { + this.visibility = value; + } + + /** + * Gets the value of the width property. + */ + public float getWidth() { + return width; + } + + /** + * Sets the value of the width property. + */ + public void setWidth(float value) { + this.width = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/G.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/G.java new file mode 100644 index 00000000..7ce658f8 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/G.java @@ -0,0 +1,289 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:27:07 PM ART +// + + +package com.wisemapping.xml.svgmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <choice>
    + *         <element ref="{http://www.w3.org/2000/svg}ellipse"/>
    + *         <element ref="{http://www.w3.org/2000/svg}line"/>
    + *         <element ref="{http://www.w3.org/2000/svg}rect"/>
    + *         <element ref="{http://www.w3.org/2000/svg}text"/>
    + *       </choice>
    + *       <attribute name="focusable" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="true" />
    + *       <attribute name="height" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="100" />
    + *       <attribute name="preserveAspectRatio" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="none" />
    + *       <attribute name="transform" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="width" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="100" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "ellipse", + "line", + "rect", + "text" + }) +@XmlRootElement(name = "g") +public class G { + + protected Ellipse ellipse; + protected Line line; + protected Rect rect; + protected Text text; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String focusable; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String height; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String preserveAspectRatio; + @XmlAttribute(required = true) + protected String transform; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String width; + + /** + * Gets the value of the ellipse property. + * + * @return possible object is + * {@link Ellipse } + */ + public Ellipse getEllipse() { + return ellipse; + } + + /** + * Sets the value of the ellipse property. + * + * @param value allowed object is + * {@link Ellipse } + */ + public void setEllipse(Ellipse value) { + this.ellipse = value; + } + + /** + * Gets the value of the line property. + * + * @return possible object is + * {@link Line } + */ + public Line getLine() { + return line; + } + + /** + * Sets the value of the line property. + * + * @param value allowed object is + * {@link Line } + */ + public void setLine(Line value) { + this.line = value; + } + + /** + * Gets the value of the rect property. + * + * @return possible object is + * {@link Rect } + */ + public Rect getRect() { + return rect; + } + + /** + * Sets the value of the rect property. + * + * @param value allowed object is + * {@link Rect } + */ + public void setRect(Rect value) { + this.rect = value; + } + + /** + * Gets the value of the text property. + * + * @return possible object is + * {@link Text } + */ + public Text getText() { + return text; + } + + /** + * Sets the value of the text property. + * + * @param value allowed object is + * {@link Text } + */ + public void setText(Text value) { + this.text = value; + } + + /** + * Gets the value of the focusable property. + * + * @return possible object is + * {@link String } + */ + public String getFocusable() { + if (focusable == null) { + return "true"; + } else { + return focusable; + } + } + + /** + * Sets the value of the focusable property. + * + * @param value allowed object is + * {@link String } + */ + public void setFocusable(String value) { + this.focusable = value; + } + + /** + * Gets the value of the height property. + * + * @return possible object is + * {@link String } + */ + public String getHeight() { + if (height == null) { + return "100"; + } else { + return height; + } + } + + /** + * Sets the value of the height property. + * + * @param value allowed object is + * {@link String } + */ + public void setHeight(String value) { + this.height = value; + } + + /** + * Gets the value of the preserveAspectRatio property. + * + * @return possible object is + * {@link String } + */ + public String getPreserveAspectRatio() { + if (preserveAspectRatio == null) { + return "none"; + } else { + return preserveAspectRatio; + } + } + + /** + * Sets the value of the preserveAspectRatio property. + * + * @param value allowed object is + * {@link String } + */ + public void setPreserveAspectRatio(String value) { + this.preserveAspectRatio = value; + } + + /** + * Gets the value of the transform property. + * + * @return possible object is + * {@link String } + */ + public String getTransform() { + return transform; + } + + /** + * Sets the value of the transform property. + * + * @param value allowed object is + * {@link String } + */ + public void setTransform(String value) { + this.transform = value; + } + + /** + * Gets the value of the width property. + * + * @return possible object is + * {@link String } + */ + public String getWidth() { + if (width == null) { + return "100"; + } else { + return width; + } + } + + /** + * Sets the value of the width property. + * + * @param value allowed object is + * {@link String } + */ + public void setWidth(String value) { + this.width = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Line.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Line.java new file mode 100644 index 00000000..45c85af0 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Line.java @@ -0,0 +1,279 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:27:07 PM ART +// + + +package com.wisemapping.xml.svgmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="fill-opacity" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *       <attribute name="stroke" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="stroke-opacity" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *       <attribute name="stroke-width" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="1px" />
    + *       <attribute name="style" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="visibility">
    + *         <simpleType>
    + *           <restriction base="{http://www.w3.org/2001/XMLSchema}NMTOKEN">
    + *             <enumeration value="hidden"/>
    + *           </restriction>
    + *         </simpleType>
    + *       </attribute>
    + *       <attribute name="x1" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="x2" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="y1" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="y2" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "line") +public class Line { + + @XmlAttribute(name = "fill-opacity") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String fillOpacity; + @XmlAttribute(required = true) + protected String stroke; + @XmlAttribute(name = "stroke-opacity") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String strokeOpacity; + @XmlAttribute(name = "stroke-width", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String strokeWidth; + @XmlAttribute + protected String style; + @XmlAttribute + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String visibility; + @XmlAttribute(required = true) + protected float x1; + @XmlAttribute(required = true) + protected float x2; + @XmlAttribute(required = true) + protected float y1; + @XmlAttribute(required = true) + protected float y2; + + /** + * Gets the value of the fillOpacity property. + * + * @return possible object is + * {@link String } + */ + public String getFillOpacity() { + return fillOpacity; + } + + /** + * Sets the value of the fillOpacity property. + * + * @param value allowed object is + * {@link String } + */ + public void setFillOpacity(String value) { + this.fillOpacity = value; + } + + /** + * Gets the value of the stroke property. + * + * @return possible object is + * {@link String } + */ + public String getStroke() { + return stroke; + } + + /** + * Sets the value of the stroke property. + * + * @param value allowed object is + * {@link String } + */ + public void setStroke(String value) { + this.stroke = value; + } + + /** + * Gets the value of the strokeOpacity property. + * + * @return possible object is + * {@link String } + */ + public String getStrokeOpacity() { + return strokeOpacity; + } + + /** + * Sets the value of the strokeOpacity property. + * + * @param value allowed object is + * {@link String } + */ + public void setStrokeOpacity(String value) { + this.strokeOpacity = value; + } + + /** + * Gets the value of the strokeWidth property. + * + * @return possible object is + * {@link String } + */ + public String getStrokeWidth() { + if (strokeWidth == null) { + return "1px"; + } else { + return strokeWidth; + } + } + + /** + * Sets the value of the strokeWidth property. + * + * @param value allowed object is + * {@link String } + */ + public void setStrokeWidth(String value) { + this.strokeWidth = value; + } + + /** + * Gets the value of the style property. + * + * @return possible object is + * {@link String } + */ + public String getStyle() { + return style; + } + + /** + * Sets the value of the style property. + * + * @param value allowed object is + * {@link String } + */ + public void setStyle(String value) { + this.style = value; + } + + /** + * Gets the value of the visibility property. + * + * @return possible object is + * {@link String } + */ + public String getVisibility() { + return visibility; + } + + /** + * Sets the value of the visibility property. + * + * @param value allowed object is + * {@link String } + */ + public void setVisibility(String value) { + this.visibility = value; + } + + /** + * Gets the value of the x1 property. + */ + public float getX1() { + return x1; + } + + /** + * Sets the value of the x1 property. + */ + public void setX1(float value) { + this.x1 = value; + } + + /** + * Gets the value of the x2 property. + */ + public float getX2() { + return x2; + } + + /** + * Sets the value of the x2 property. + */ + public void setX2(float value) { + this.x2 = value; + } + + /** + * Gets the value of the y1 property. + */ + public float getY1() { + return y1; + } + + /** + * Sets the value of the y1 property. + */ + public void setY1(float value) { + this.y1 = value; + } + + /** + * Gets the value of the y2 property. + */ + public float getY2() { + return y2; + } + + /** + * Sets the value of the y2 property. + */ + public void setY2(float value) { + this.y2 = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/ObjectFactory.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/ObjectFactory.java new file mode 100644 index 00000000..82daa97a --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/ObjectFactory.java @@ -0,0 +1,105 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:27:07 PM ART +// + + +package com.wisemapping.xml.svgmap; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.mindmap.xml.svgmap package. + *

    An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.mindmap.xml.svgmap + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Rect } + */ + public Rect createRect() { + return new Rect(); + } + + /** + * Create an instance of {@link Svg } + */ + public Svg createSvg() { + return new Svg(); + } + + /** + * Create an instance of {@link Text } + */ + public Text createText() { + return new Text(); + } + + /** + * Create an instance of {@link Ellipse } + */ + public Ellipse createEllipse() { + return new Ellipse(); + } + + /** + * Create an instance of {@link Line } + */ + public Line createLine() { + return new Line(); + } + + /** + * Create an instance of {@link Polyline } + */ + public Polyline createPolyline() { + return new Polyline(); + } + + /** + * Create an instance of {@link G } + */ + public G createG() { + return new G(); + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Polyline.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Polyline.java new file mode 100644 index 00000000..c39b4ea1 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Polyline.java @@ -0,0 +1,240 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:27:07 PM ART +// + + +package com.wisemapping.xml.svgmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="fill" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="none" />
    + *       <attribute name="fill-opacity" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *       <attribute name="points" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="stroke" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="stroke-opacity" use="required">
    + *         <simpleType>
    + *           <restriction base="{http://www.w3.org/2001/XMLSchema}NMTOKEN">
    + *             <enumeration value="0.4"/>
    + *             <enumeration value="1"/>
    + *           </restriction>
    + *         </simpleType>
    + *       </attribute>
    + *       <attribute name="stroke-width" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="1px" />
    + *       <attribute name="visibility" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "polyline") +public class Polyline { + + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String fill; + @XmlAttribute(name = "fill-opacity") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String fillOpacity; + @XmlAttribute + protected String points; + @XmlAttribute(required = true) + protected String stroke; + @XmlAttribute(name = "stroke-opacity", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String strokeOpacity; + @XmlAttribute(name = "stroke-width", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String strokeWidth; + @XmlAttribute + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String visibility; + + /** + * Gets the value of the fill property. + * + * @return possible object is + * {@link String } + */ + public String getFill() { + if (fill == null) { + return "none"; + } else { + return fill; + } + } + + /** + * Sets the value of the fill property. + * + * @param value allowed object is + * {@link String } + */ + public void setFill(String value) { + this.fill = value; + } + + /** + * Gets the value of the fillOpacity property. + * + * @return possible object is + * {@link String } + */ + public String getFillOpacity() { + return fillOpacity; + } + + /** + * Sets the value of the fillOpacity property. + * + * @param value allowed object is + * {@link String } + */ + public void setFillOpacity(String value) { + this.fillOpacity = value; + } + + /** + * Gets the value of the points property. + * + * @return possible object is + * {@link String } + */ + public String getPoints() { + return points; + } + + /** + * Sets the value of the points property. + * + * @param value allowed object is + * {@link String } + */ + public void setPoints(String value) { + this.points = value; + } + + /** + * Gets the value of the stroke property. + * + * @return possible object is + * {@link String } + */ + public String getStroke() { + return stroke; + } + + /** + * Sets the value of the stroke property. + * + * @param value allowed object is + * {@link String } + */ + public void setStroke(String value) { + this.stroke = value; + } + + /** + * Gets the value of the strokeOpacity property. + * + * @return possible object is + * {@link String } + */ + public String getStrokeOpacity() { + return strokeOpacity; + } + + /** + * Sets the value of the strokeOpacity property. + * + * @param value allowed object is + * {@link String } + */ + public void setStrokeOpacity(String value) { + this.strokeOpacity = value; + } + + /** + * Gets the value of the strokeWidth property. + * + * @return possible object is + * {@link String } + */ + public String getStrokeWidth() { + if (strokeWidth == null) { + return "1px"; + } else { + return strokeWidth; + } + } + + /** + * Sets the value of the strokeWidth property. + * + * @param value allowed object is + * {@link String } + */ + public void setStrokeWidth(String value) { + this.strokeWidth = value; + } + + /** + * Gets the value of the visibility property. + * + * @return possible object is + * {@link String } + */ + public String getVisibility() { + return visibility; + } + + /** + * Sets the value of the visibility property. + * + * @param value allowed object is + * {@link String } + */ + public void setVisibility(String value) { + this.visibility = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Rect.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Rect.java new file mode 100644 index 00000000..1fd5d0df --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Rect.java @@ -0,0 +1,342 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:27:07 PM ART +// + + +package com.wisemapping.xml.svgmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="fill" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="fill-opacity" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="height" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="rx" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="ry" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="stroke" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="stroke-opacity" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="stroke-width" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="style" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="visibility" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *       <attribute name="width" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *       <attribute name="x" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="y" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "rect") +public class Rect { + + @XmlAttribute(required = true) + protected String fill; + @XmlAttribute(name = "fill-opacity") + protected Float fillOpacity; + @XmlAttribute(required = true) + protected float height; + @XmlAttribute + protected Float rx; + @XmlAttribute + protected Float ry; + @XmlAttribute(required = true) + protected String stroke; + @XmlAttribute(name = "stroke-opacity") + protected Float strokeOpacity; + @XmlAttribute(name = "stroke-width", required = true) + protected String strokeWidth; + @XmlAttribute + protected String style; + @XmlAttribute + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String visibility; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String width; + @XmlAttribute(required = true) + protected float x; + @XmlAttribute(required = true) + protected float y; + + /** + * Gets the value of the fill property. + * + * @return possible object is + * {@link String } + */ + public String getFill() { + return fill; + } + + /** + * Sets the value of the fill property. + * + * @param value allowed object is + * {@link String } + */ + public void setFill(String value) { + this.fill = value; + } + + /** + * Gets the value of the fillOpacity property. + * + * @return possible object is + * {@link Float } + */ + public Float getFillOpacity() { + return fillOpacity; + } + + /** + * Sets the value of the fillOpacity property. + * + * @param value allowed object is + * {@link Float } + */ + public void setFillOpacity(Float value) { + this.fillOpacity = value; + } + + /** + * Gets the value of the height property. + */ + public float getHeight() { + return height; + } + + /** + * Sets the value of the height property. + */ + public void setHeight(float value) { + this.height = value; + } + + /** + * Gets the value of the rx property. + * + * @return possible object is + * {@link Float } + */ + public Float getRx() { + return rx; + } + + /** + * Sets the value of the rx property. + * + * @param value allowed object is + * {@link Float } + */ + public void setRx(Float value) { + this.rx = value; + } + + /** + * Gets the value of the ry property. + * + * @return possible object is + * {@link Float } + */ + public Float getRy() { + return ry; + } + + /** + * Sets the value of the ry property. + * + * @param value allowed object is + * {@link Float } + */ + public void setRy(Float value) { + this.ry = value; + } + + /** + * Gets the value of the stroke property. + * + * @return possible object is + * {@link String } + */ + public String getStroke() { + return stroke; + } + + /** + * Sets the value of the stroke property. + * + * @param value allowed object is + * {@link String } + */ + public void setStroke(String value) { + this.stroke = value; + } + + /** + * Gets the value of the strokeOpacity property. + * + * @return possible object is + * {@link Float } + */ + public Float getStrokeOpacity() { + return strokeOpacity; + } + + /** + * Sets the value of the strokeOpacity property. + * + * @param value allowed object is + * {@link Float } + */ + public void setStrokeOpacity(Float value) { + this.strokeOpacity = value; + } + + /** + * Gets the value of the strokeWidth property. + * + * @return possible object is + * {@link String } + */ + public String getStrokeWidth() { + return strokeWidth; + } + + /** + * Sets the value of the strokeWidth property. + * + * @param value allowed object is + * {@link String } + */ + public void setStrokeWidth(String value) { + this.strokeWidth = value; + } + + /** + * Gets the value of the style property. + * + * @return possible object is + * {@link String } + */ + public String getStyle() { + return style; + } + + /** + * Sets the value of the style property. + * + * @param value allowed object is + * {@link String } + */ + public void setStyle(String value) { + this.style = value; + } + + /** + * Gets the value of the visibility property. + * + * @return possible object is + * {@link String } + */ + public String getVisibility() { + return visibility; + } + + /** + * Sets the value of the visibility property. + * + * @param value allowed object is + * {@link String } + */ + public void setVisibility(String value) { + this.visibility = value; + } + + /** + * Gets the value of the width property. + * + * @return possible object is + * {@link String } + */ + public String getWidth() { + return width; + } + + /** + * Sets the value of the width property. + * + * @param value allowed object is + * {@link String } + */ + public void setWidth(String value) { + this.width = value; + } + + /** + * Gets the value of the x property. + */ + public float getX() { + return x; + } + + /** + * Sets the value of the x property. + */ + public void setX(float value) { + this.x = value; + } + + /** + * Gets the value of the y property. + */ + public float getY() { + return y; + } + + /** + * Sets the value of the y property. + */ + public void setY(float value) { + this.y = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Svg.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Svg.java new file mode 100644 index 00000000..a2654724 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Svg.java @@ -0,0 +1,332 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:27:07 PM ART +// + + +package com.wisemapping.xml.svgmap; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <sequence>
    + *         <element ref="{http://www.w3.org/2000/svg}polyline" maxOccurs="unbounded"/>
    + *         <element ref="{http://www.w3.org/2000/svg}line" maxOccurs="unbounded"/>
    + *         <element ref="{http://www.w3.org/2000/svg}g" maxOccurs="unbounded"/>
    + *         <element ref="{http://www.w3.org/2000/svg}rect" maxOccurs="unbounded"/>
    + *       </sequence>
    + *       <attribute name="focusable" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *       <attribute name="height" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *       <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *       <attribute name="preserveAspectRatio" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *       <attribute name="viewBox" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="width" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "polyline", + "line", + "g", + "rect" + }) +@XmlRootElement(name = "svg") +public class Svg { + + @XmlElement(required = true) + protected List polyline; + @XmlElement(required = true) + protected List line; + @XmlElement(required = true) + protected List g; + @XmlElement(required = true) + protected List rect; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String focusable; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String height; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String id; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String preserveAspectRatio; + @XmlAttribute(required = true) + protected String viewBox; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String width; + + /** + * Gets the value of the polyline property. + *

    + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the polyline property. + *

    + *

    + * For example, to add a new item, do as follows: + *

    +     *    getPolyline().add(newItem);
    +     * 
    + *

    + *

    + *

    + * Objects of the following type(s) are allowed in the list + * {@link Polyline } + */ + public List getPolyline() { + if (polyline == null) { + polyline = new ArrayList(); + } + return this.polyline; + } + + /** + * Gets the value of the line property. + *

    + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the line property. + *

    + *

    + * For example, to add a new item, do as follows: + *

    +     *    getLine().add(newItem);
    +     * 
    + *

    + *

    + *

    + * Objects of the following type(s) are allowed in the list + * {@link Line } + */ + public List getLine() { + if (line == null) { + line = new ArrayList(); + } + return this.line; + } + + /** + * Gets the value of the g property. + *

    + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the g property. + *

    + *

    + * For example, to add a new item, do as follows: + *

    +     *    getG().add(newItem);
    +     * 
    + *

    + *

    + *

    + * Objects of the following type(s) are allowed in the list + * {@link G } + */ + public List getG() { + if (g == null) { + g = new ArrayList(); + } + return this.g; + } + + /** + * Gets the value of the rect property. + *

    + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the rect property. + *

    + *

    + * For example, to add a new item, do as follows: + *

    +     *    getRect().add(newItem);
    +     * 
    + *

    + *

    + *

    + * Objects of the following type(s) are allowed in the list + * {@link Rect } + */ + public List getRect() { + if (rect == null) { + rect = new ArrayList(); + } + return this.rect; + } + + /** + * Gets the value of the focusable property. + * + * @return possible object is + * {@link String } + */ + public String getFocusable() { + return focusable; + } + + /** + * Sets the value of the focusable property. + * + * @param value allowed object is + * {@link String } + */ + public void setFocusable(String value) { + this.focusable = value; + } + + /** + * Gets the value of the height property. + * + * @return possible object is + * {@link String } + */ + public String getHeight() { + return height; + } + + /** + * Sets the value of the height property. + * + * @param value allowed object is + * {@link String } + */ + public void setHeight(String value) { + this.height = value; + } + + /** + * Gets the value of the id property. + * + * @return possible object is + * {@link String } + */ + public String getId() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value allowed object is + * {@link String } + */ + public void setId(String value) { + this.id = value; + } + + /** + * Gets the value of the preserveAspectRatio property. + * + * @return possible object is + * {@link String } + */ + public String getPreserveAspectRatio() { + return preserveAspectRatio; + } + + /** + * Sets the value of the preserveAspectRatio property. + * + * @param value allowed object is + * {@link String } + */ + public void setPreserveAspectRatio(String value) { + this.preserveAspectRatio = value; + } + + /** + * Gets the value of the viewBox property. + * + * @return possible object is + * {@link String } + */ + public String getViewBox() { + return viewBox; + } + + /** + * Sets the value of the viewBox property. + * + * @param value allowed object is + * {@link String } + */ + public void setViewBox(String value) { + this.viewBox = value; + } + + /** + * Gets the value of the width property. + * + * @return possible object is + * {@link String } + */ + public String getWidth() { + return width; + } + + /** + * Sets the value of the width property. + * + * @param value allowed object is + * {@link String } + */ + public void setWidth(String value) { + this.width = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Text.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Text.java new file mode 100644 index 00000000..a1632889 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/Text.java @@ -0,0 +1,299 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:27:07 PM ART +// + + +package com.wisemapping.xml.svgmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="fill" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="focusable" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="true" />
    + *       <attribute name="font-family" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="verdana" />
    + *       <attribute name="font-size" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="font-style" use="required">
    + *         <simpleType>
    + *           <restriction base="{http://www.w3.org/2001/XMLSchema}NMTOKEN">
    + *             <enumeration value="italic"/>
    + *             <enumeration value="normal"/>
    + *           </restriction>
    + *         </simpleType>
    + *       </attribute>
    + *       <attribute name="font-weight" use="required">
    + *         <simpleType>
    + *           <restriction base="{http://www.w3.org/2001/XMLSchema}NMTOKEN">
    + *             <enumeration value="bold"/>
    + *             <enumeration value="normal"/>
    + *           </restriction>
    + *         </simpleType>
    + *       </attribute>
    + *       <attribute name="style" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="x" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="y" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "content" + }) +@XmlRootElement(name = "text") +public class Text { + + @XmlValue + protected String content; + @XmlAttribute(required = true) + protected String fill; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String focusable; + @XmlAttribute(name = "font-family", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String fontFamily; + @XmlAttribute(name = "font-size", required = true) + protected float fontSize; + @XmlAttribute(name = "font-style", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String fontStyle; + @XmlAttribute(name = "font-weight", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String fontWeight; + @XmlAttribute(required = true) + protected String style; + @XmlAttribute(required = true) + protected float x; + @XmlAttribute(required = true) + protected float y; + + /** + * Gets the value of the content property. + * + * @return possible object is + * {@link String } + */ + public String getContent() { + return content; + } + + /** + * Sets the value of the content property. + * + * @param value allowed object is + * {@link String } + */ + public void setContent(String value) { + this.content = value; + } + + /** + * Gets the value of the fill property. + * + * @return possible object is + * {@link String } + */ + public String getFill() { + return fill; + } + + /** + * Sets the value of the fill property. + * + * @param value allowed object is + * {@link String } + */ + public void setFill(String value) { + this.fill = value; + } + + /** + * Gets the value of the focusable property. + * + * @return possible object is + * {@link String } + */ + public String getFocusable() { + if (focusable == null) { + return "true"; + } else { + return focusable; + } + } + + /** + * Sets the value of the focusable property. + * + * @param value allowed object is + * {@link String } + */ + public void setFocusable(String value) { + this.focusable = value; + } + + /** + * Gets the value of the fontFamily property. + * + * @return possible object is + * {@link String } + */ + public String getFontFamily() { + if (fontFamily == null) { + return "verdana"; + } else { + return fontFamily; + } + } + + /** + * Sets the value of the fontFamily property. + * + * @param value allowed object is + * {@link String } + */ + public void setFontFamily(String value) { + this.fontFamily = value; + } + + /** + * Gets the value of the fontSize property. + */ + public float getFontSize() { + return fontSize; + } + + /** + * Sets the value of the fontSize property. + */ + public void setFontSize(float value) { + this.fontSize = value; + } + + /** + * Gets the value of the fontStyle property. + * + * @return possible object is + * {@link String } + */ + public String getFontStyle() { + return fontStyle; + } + + /** + * Sets the value of the fontStyle property. + * + * @param value allowed object is + * {@link String } + */ + public void setFontStyle(String value) { + this.fontStyle = value; + } + + /** + * Gets the value of the fontWeight property. + * + * @return possible object is + * {@link String } + */ + public String getFontWeight() { + return fontWeight; + } + + /** + * Sets the value of the fontWeight property. + * + * @param value allowed object is + * {@link String } + */ + public void setFontWeight(String value) { + this.fontWeight = value; + } + + /** + * Gets the value of the style property. + * + * @return possible object is + * {@link String } + */ + public String getStyle() { + return style; + } + + /** + * Sets the value of the style property. + * + * @param value allowed object is + * {@link String } + */ + public void setStyle(String value) { + this.style = value; + } + + /** + * Gets the value of the x property. + */ + public float getX() { + return x; + } + + /** + * Sets the value of the x property. + */ + public void setX(float value) { + this.x = value; + } + + /** + * Gets the value of the y property. + */ + public float getY() { + return y; + } + + /** + * Sets the value of the y property. + */ + public void setY(float value) { + this.y = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/package-info.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/package-info.java new file mode 100644 index 00000000..88496309 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/svgmap/package-info.java @@ -0,0 +1,27 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:27:07 PM ART +// + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.w3.org/2000/svg", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package com.wisemapping.xml.svgmap; diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Element.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Element.java new file mode 100644 index 00000000..dcee8e00 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Element.java @@ -0,0 +1,170 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for element complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType name="element">
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="fillcolor" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="opacity" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="strokecolor" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="strokeweight" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="style" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "element") +public class Element { + + @XmlAttribute + protected String fillcolor; + @XmlAttribute + protected String opacity; + @XmlAttribute(required = true) + protected String strokecolor; + @XmlAttribute + protected String strokeweight; + @XmlAttribute + protected String style; + + /** + * Gets the value of the fillcolor property. + * + * @return possible object is + * {@link String } + */ + public String getFillcolor() { + return fillcolor; + } + + /** + * Sets the value of the fillcolor property. + * + * @param value allowed object is + * {@link String } + */ + public void setFillcolor(String value) { + this.fillcolor = value; + } + + /** + * Gets the value of the opacity property. + * + * @return possible object is + * {@link String } + */ + public String getOpacity() { + return opacity; + } + + /** + * Sets the value of the opacity property. + * + * @param value allowed object is + * {@link String } + */ + public void setOpacity(String value) { + this.opacity = value; + } + + /** + * Gets the value of the strokecolor property. + * + * @return possible object is + * {@link String } + */ + public String getStrokecolor() { + return strokecolor; + } + + /** + * Sets the value of the strokecolor property. + * + * @param value allowed object is + * {@link String } + */ + public void setStrokecolor(String value) { + this.strokecolor = value; + } + + /** + * Gets the value of the strokeweight property. + * + * @return possible object is + * {@link String } + */ + public String getStrokeweight() { + return strokeweight; + } + + /** + * Sets the value of the strokeweight property. + * + * @param value allowed object is + * {@link String } + */ + public void setStrokeweight(String value) { + this.strokeweight = value; + } + + /** + * Gets the value of the style property. + * + * @return possible object is + * {@link String } + */ + public String getStyle() { + return style; + } + + /** + * Sets the value of the style property. + * + * @param value allowed object is + * {@link String } + */ + public void setStyle(String value) { + this.style = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Fill.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Fill.java new file mode 100644 index 00000000..a27bb8b6 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Fill.java @@ -0,0 +1,80 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="opacity" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "fill") +public class Fill { + + @XmlAttribute + protected String opacity; + + /** + * Gets the value of the opacity property. + * + * @return possible object is + * {@link String } + */ + public String getOpacity() { + return opacity; + } + + /** + * Sets the value of the opacity property. + * + * @param value allowed object is + * {@link String } + */ + public void setOpacity(String value) { + this.opacity = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Group.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Group.java new file mode 100644 index 00000000..6b073326 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Group.java @@ -0,0 +1,319 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <extension base="{http://mindmap.com/xml/vmlmap}element">
    + *       <choice>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}group" maxOccurs="unbounded"/>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}line" maxOccurs="unbounded"/>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}oval" maxOccurs="unbounded"/>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}polyline" maxOccurs="unbounded"/>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}rect" maxOccurs="unbounded"/>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}roundrect" maxOccurs="unbounded"/>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}shape" maxOccurs="unbounded"/>
    + *       </choice>
    + *       <attribute name="coordorigin" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="coordsize" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </extension>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "group", + "line", + "oval", + "polyline", + "rect", + "roundrect", + "shape" + }) +@XmlRootElement(name = "group") +public class Group + extends Element { + + protected List group; + protected List line; + protected List oval; + protected List polyline; + protected List rect; + protected List roundrect; + protected List shape; + @XmlAttribute + protected String coordorigin; + @XmlAttribute(required = true) + protected String coordsize; + + /** + * Gets the value of the group property. + *

    + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the group property. + *

    + *

    + * For example, to add a new item, do as follows: + *

    +     *    getGroup().add(newItem);
    +     * 
    + *

    + *

    + *

    + * Objects of the following type(s) are allowed in the list + * {@link Group } + */ + public List getGroup() { + if (group == null) { + group = new ArrayList(); + } + return this.group; + } + + /** + * Gets the value of the line property. + *

    + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the line property. + *

    + *

    + * For example, to add a new item, do as follows: + *

    +     *    getLine().add(newItem);
    +     * 
    + *

    + *

    + *

    + * Objects of the following type(s) are allowed in the list + * {@link Line } + */ + public List getLine() { + if (line == null) { + line = new ArrayList(); + } + return this.line; + } + + /** + * Gets the value of the oval property. + *

    + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the oval property. + *

    + *

    + * For example, to add a new item, do as follows: + *

    +     *    getOval().add(newItem);
    +     * 
    + *

    + *

    + *

    + * Objects of the following type(s) are allowed in the list + * {@link Oval } + */ + public List getOval() { + if (oval == null) { + oval = new ArrayList(); + } + return this.oval; + } + + /** + * Gets the value of the polyline property. + *

    + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the polyline property. + *

    + *

    + * For example, to add a new item, do as follows: + *

    +     *    getPolyline().add(newItem);
    +     * 
    + *

    + *

    + *

    + * Objects of the following type(s) are allowed in the list + * {@link Polyline } + */ + public List getPolyline() { + if (polyline == null) { + polyline = new ArrayList(); + } + return this.polyline; + } + + /** + * Gets the value of the rect property. + *

    + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the rect property. + *

    + *

    + * For example, to add a new item, do as follows: + *

    +     *    getRect().add(newItem);
    +     * 
    + *

    + *

    + *

    + * Objects of the following type(s) are allowed in the list + * {@link Rect } + */ + public List getRect() { + if (rect == null) { + rect = new ArrayList(); + } + return this.rect; + } + + /** + * Gets the value of the roundrect property. + *

    + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the roundrect property. + *

    + *

    + * For example, to add a new item, do as follows: + *

    +     *    getRoundrect().add(newItem);
    +     * 
    + *

    + *

    + *

    + * Objects of the following type(s) are allowed in the list + * {@link Roundrect } + */ + public List getRoundrect() { + if (roundrect == null) { + roundrect = new ArrayList(); + } + return this.roundrect; + } + + /** + * Gets the value of the shape property. + *

    + *

    + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the shape property. + *

    + *

    + * For example, to add a new item, do as follows: + *

    +     *    getShape().add(newItem);
    +     * 
    + *

    + *

    + *

    + * Objects of the following type(s) are allowed in the list + * {@link Shape } + */ + public List getShape() { + if (shape == null) { + shape = new ArrayList(); + } + return this.shape; + } + + /** + * Gets the value of the coordorigin property. + * + * @return possible object is + * {@link String } + */ + public String getCoordorigin() { + return coordorigin; + } + + /** + * Sets the value of the coordorigin property. + * + * @param value allowed object is + * {@link String } + */ + public void setCoordorigin(String value) { + this.coordorigin = value; + } + + /** + * Gets the value of the coordsize property. + * + * @return possible object is + * {@link String } + */ + public String getCoordsize() { + return coordsize; + } + + /** + * Sets the value of the coordsize property. + * + * @param value allowed object is + * {@link String } + */ + public void setCoordsize(String value) { + this.coordsize = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Line.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Line.java new file mode 100644 index 00000000..58daffcb --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Line.java @@ -0,0 +1,185 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <extension base="{http://mindmap.com/xml/vmlmap}element">
    + *       <sequence>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}stroke"/>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}fill" minOccurs="0"/>
    + *       </sequence>
    + *       <attribute name="from" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="stroked" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="t" />
    + *       <attribute name="to" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </extension>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "stroke", + "fill" + }) +@XmlRootElement(name = "line") +public class Line + extends Element { + + @XmlElement(required = true) + protected Stroke stroke; + protected Fill fill; + @XmlAttribute(required = true) + protected String from; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String stroked; + @XmlAttribute(required = true) + protected String to; + + /** + * Gets the value of the stroke property. + * + * @return possible object is + * {@link Stroke } + */ + public Stroke getStroke() { + return stroke; + } + + /** + * Sets the value of the stroke property. + * + * @param value allowed object is + * {@link Stroke } + */ + public void setStroke(Stroke value) { + this.stroke = value; + } + + /** + * Gets the value of the fill property. + * + * @return possible object is + * {@link Fill } + */ + public Fill getFill() { + return fill; + } + + /** + * Sets the value of the fill property. + * + * @param value allowed object is + * {@link Fill } + */ + public void setFill(Fill value) { + this.fill = value; + } + + /** + * Gets the value of the from property. + * + * @return possible object is + * {@link String } + */ + public String getFrom() { + return from; + } + + /** + * Sets the value of the from property. + * + * @param value allowed object is + * {@link String } + */ + public void setFrom(String value) { + this.from = value; + } + + /** + * Gets the value of the stroked property. + * + * @return possible object is + * {@link String } + */ + public String getStroked() { + if (stroked == null) { + return "t"; + } else { + return stroked; + } + } + + /** + * Sets the value of the stroked property. + * + * @param value allowed object is + * {@link String } + */ + public void setStroked(String value) { + this.stroked = value; + } + + /** + * Gets the value of the to property. + * + * @return possible object is + * {@link String } + */ + public String getTo() { + return to; + } + + /** + * Sets the value of the to property. + * + * @param value allowed object is + * {@link String } + */ + public void setTo(String value) { + this.to = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/ObjectFactory.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/ObjectFactory.java new file mode 100644 index 00000000..995b437c --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/ObjectFactory.java @@ -0,0 +1,140 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.mindmap.xml.vmlmap package. + *

    An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.mindmap.xml.vmlmap + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Textbox } + */ + public Textbox createTextbox() { + return new Textbox(); + } + + /** + * Create an instance of {@link Shape } + */ + public Shape createShape() { + return new Shape(); + } + + /** + * Create an instance of {@link Roundrect } + */ + public Roundrect createRoundrect() { + return new Roundrect(); + } + + /** + * Create an instance of {@link Oval } + */ + public Oval createOval() { + return new Oval(); + } + + /** + * Create an instance of {@link Textbox.SPAN } + */ + public Textbox.SPAN createTextboxSPAN() { + return new Textbox.SPAN(); + } + + /** + * Create an instance of {@link Rect } + */ + public Rect createRect() { + return new Rect(); + } + + /** + * Create an instance of {@link Element } + */ + public Element createElement() { + return new Element(); + } + + /** + * Create an instance of {@link Line } + */ + public Line createLine() { + return new Line(); + } + + /** + * Create an instance of {@link Group } + */ + public Group createGroup() { + return new Group(); + } + + /** + * Create an instance of {@link Stroke } + */ + public Stroke createStroke() { + return new Stroke(); + } + + /** + * Create an instance of {@link Polyline } + */ + public Polyline createPolyline() { + return new Polyline(); + } + + /** + * Create an instance of {@link Fill } + */ + public Fill createFill() { + return new Fill(); + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Oval.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Oval.java new file mode 100644 index 00000000..d9168404 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Oval.java @@ -0,0 +1,167 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <extension base="{http://mindmap.com/xml/vmlmap}element">
    + *       <sequence>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}stroke"/>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}fill"/>
    + *       </sequence>
    + *       <attribute name="coordsize" use="required" type="{http://www.w3.org/2001/XMLSchema}string" fixed="21600,21600" />
    + *       <attribute name="stroked" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="t" />
    + *     </extension>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "stroke", + "fill" + }) +@XmlRootElement(name = "oval") +public class Oval + extends Element { + + @XmlElement(required = true) + protected Stroke stroke; + @XmlElement(required = true) + protected Fill fill; + @XmlAttribute(required = true) + protected String coordsize; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String stroked; + + /** + * Gets the value of the stroke property. + * + * @return possible object is + * {@link Stroke } + */ + public Stroke getStroke() { + return stroke; + } + + /** + * Sets the value of the stroke property. + * + * @param value allowed object is + * {@link Stroke } + */ + public void setStroke(Stroke value) { + this.stroke = value; + } + + /** + * Gets the value of the fill property. + * + * @return possible object is + * {@link Fill } + */ + public Fill getFill() { + return fill; + } + + /** + * Sets the value of the fill property. + * + * @param value allowed object is + * {@link Fill } + */ + public void setFill(Fill value) { + this.fill = value; + } + + /** + * Gets the value of the coordsize property. + * + * @return possible object is + * {@link String } + */ + public String getCoordsize() { + if (coordsize == null) { + return "21600,21600"; + } else { + return coordsize; + } + } + + /** + * Sets the value of the coordsize property. + * + * @param value allowed object is + * {@link String } + */ + public void setCoordsize(String value) { + this.coordsize = value; + } + + /** + * Gets the value of the stroked property. + * + * @return possible object is + * {@link String } + */ + public String getStroked() { + if (stroked == null) { + return "t"; + } else { + return stroked; + } + } + + /** + * Sets the value of the stroked property. + * + * @param value allowed object is + * {@link String } + */ + public void setStroked(String value) { + this.stroked = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Polyline.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Polyline.java new file mode 100644 index 00000000..faa55dc5 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Polyline.java @@ -0,0 +1,185 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <extension base="{http://mindmap.com/xml/vmlmap}element">
    + *       <sequence>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}stroke"/>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}fill" minOccurs="0"/>
    + *       </sequence>
    + *       <attribute name="filled" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="f" />
    + *       <attribute name="points" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="xPoints" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </extension>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "stroke", + "fill" + }) +@XmlRootElement(name = "polyline") +public class Polyline + extends Element { + + @XmlElement(required = true) + protected Stroke stroke; + protected Fill fill; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String filled; + @XmlAttribute + protected String points; + @XmlAttribute + protected String xPoints; + + /** + * Gets the value of the stroke property. + * + * @return possible object is + * {@link Stroke } + */ + public Stroke getStroke() { + return stroke; + } + + /** + * Sets the value of the stroke property. + * + * @param value allowed object is + * {@link Stroke } + */ + public void setStroke(Stroke value) { + this.stroke = value; + } + + /** + * Gets the value of the fill property. + * + * @return possible object is + * {@link Fill } + */ + public Fill getFill() { + return fill; + } + + /** + * Sets the value of the fill property. + * + * @param value allowed object is + * {@link Fill } + */ + public void setFill(Fill value) { + this.fill = value; + } + + /** + * Gets the value of the filled property. + * + * @return possible object is + * {@link String } + */ + public String getFilled() { + if (filled == null) { + return "f"; + } else { + return filled; + } + } + + /** + * Sets the value of the filled property. + * + * @param value allowed object is + * {@link String } + */ + public void setFilled(String value) { + this.filled = value; + } + + /** + * Gets the value of the points property. + * + * @return possible object is + * {@link String } + */ + public String getPoints() { + return points; + } + + /** + * Sets the value of the points property. + * + * @param value allowed object is + * {@link String } + */ + public void setPoints(String value) { + this.points = value; + } + + /** + * Gets the value of the xPoints property. + * + * @return possible object is + * {@link String } + */ + public String getXPoints() { + return xPoints; + } + + /** + * Sets the value of the xPoints property. + * + * @param value allowed object is + * {@link String } + */ + public void setXPoints(String value) { + this.xPoints = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Rect.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Rect.java new file mode 100644 index 00000000..a086b763 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Rect.java @@ -0,0 +1,159 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <extension base="{http://mindmap.com/xml/vmlmap}element">
    + *       <sequence>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}stroke"/>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}fill"/>
    + *       </sequence>
    + *       <attribute name="coordsize" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *       <attribute name="stroked" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
    + *     </extension>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "stroke", + "fill" + }) +@XmlRootElement(name = "rect") +public class Rect + extends Element { + + @XmlElement(required = true) + protected Stroke stroke; + @XmlElement(required = true) + protected Fill fill; + @XmlAttribute(required = true) + protected String coordsize; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String stroked; + + /** + * Gets the value of the stroke property. + * + * @return possible object is + * {@link Stroke } + */ + public Stroke getStroke() { + return stroke; + } + + /** + * Sets the value of the stroke property. + * + * @param value allowed object is + * {@link Stroke } + */ + public void setStroke(Stroke value) { + this.stroke = value; + } + + /** + * Gets the value of the fill property. + * + * @return possible object is + * {@link Fill } + */ + public Fill getFill() { + return fill; + } + + /** + * Sets the value of the fill property. + * + * @param value allowed object is + * {@link Fill } + */ + public void setFill(Fill value) { + this.fill = value; + } + + /** + * Gets the value of the coordsize property. + * + * @return possible object is + * {@link String } + */ + public String getCoordsize() { + return coordsize; + } + + /** + * Sets the value of the coordsize property. + * + * @param value allowed object is + * {@link String } + */ + public void setCoordsize(String value) { + this.coordsize = value; + } + + /** + * Gets the value of the stroked property. + * + * @return possible object is + * {@link String } + */ + public String getStroked() { + return stroked; + } + + /** + * Sets the value of the stroked property. + * + * @param value allowed object is + * {@link String } + */ + public void setStroked(String value) { + this.stroked = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Roundrect.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Roundrect.java new file mode 100644 index 00000000..0a31f2fe --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Roundrect.java @@ -0,0 +1,167 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <extension base="{http://mindmap.com/xml/vmlmap}element">
    + *       <sequence>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}stroke"/>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}fill"/>
    + *       </sequence>
    + *       <attribute name="arcsize" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" fixed="9830f" />
    + *       <attribute name="coordsize" use="required" type="{http://www.w3.org/2001/XMLSchema}string" fixed="21600,21600" />
    + *     </extension>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "stroke", + "fill" + }) +@XmlRootElement(name = "roundrect") +public class Roundrect + extends Element { + + @XmlElement(required = true) + protected Stroke stroke; + @XmlElement(required = true) + protected Fill fill; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String arcsize; + @XmlAttribute(required = true) + protected String coordsize; + + /** + * Gets the value of the stroke property. + * + * @return possible object is + * {@link Stroke } + */ + public Stroke getStroke() { + return stroke; + } + + /** + * Sets the value of the stroke property. + * + * @param value allowed object is + * {@link Stroke } + */ + public void setStroke(Stroke value) { + this.stroke = value; + } + + /** + * Gets the value of the fill property. + * + * @return possible object is + * {@link Fill } + */ + public Fill getFill() { + return fill; + } + + /** + * Sets the value of the fill property. + * + * @param value allowed object is + * {@link Fill } + */ + public void setFill(Fill value) { + this.fill = value; + } + + /** + * Gets the value of the arcsize property. + * + * @return possible object is + * {@link String } + */ + public String getArcsize() { + if (arcsize == null) { + return "9830f"; + } else { + return arcsize; + } + } + + /** + * Sets the value of the arcsize property. + * + * @param value allowed object is + * {@link String } + */ + public void setArcsize(String value) { + this.arcsize = value; + } + + /** + * Gets the value of the coordsize property. + * + * @return possible object is + * {@link String } + */ + public String getCoordsize() { + if (coordsize == null) { + return "21600,21600"; + } else { + return coordsize; + } + } + + /** + * Sets the value of the coordsize property. + * + * @param value allowed object is + * {@link String } + */ + public void setCoordsize(String value) { + this.coordsize = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Shape.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Shape.java new file mode 100644 index 00000000..8631a1cd --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Shape.java @@ -0,0 +1,113 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <extension base="{http://mindmap.com/xml/vmlmap}element">
    + *       <sequence>
    + *         <element ref="{http://mindmap.com/xml/vmlmap}textbox"/>
    + *       </sequence>
    + *       <attribute name="coordsize" use="required" type="{http://www.w3.org/2001/XMLSchema}string" fixed="100,100" />
    + *     </extension>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "textbox" + }) +@XmlRootElement(name = "shape") +public class Shape + extends Element { + + @XmlElement(required = true) + protected Textbox textbox; + @XmlAttribute(required = true) + protected String coordsize; + + /** + * Gets the value of the textbox property. + * + * @return possible object is + * {@link Textbox } + */ + public Textbox getTextbox() { + return textbox; + } + + /** + * Sets the value of the textbox property. + * + * @param value allowed object is + * {@link Textbox } + */ + public void setTextbox(Textbox value) { + this.textbox = value; + } + + /** + * Gets the value of the coordsize property. + * + * @return possible object is + * {@link String } + */ + public String getCoordsize() { + if (coordsize == null) { + return "100,100"; + } else { + return coordsize; + } + } + + /** + * Sets the value of the coordsize property. + * + * @param value allowed object is + * {@link String } + */ + public void setCoordsize(String value) { + this.coordsize = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Stroke.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Stroke.java new file mode 100644 index 00000000..fc2acf0f --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Stroke.java @@ -0,0 +1,89 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <attribute name="dashstyle">
    + *         <simpleType>
    + *           <restriction base="{http://www.w3.org/2001/XMLSchema}NMTOKEN">
    + *             <enumeration value="solid"/>
    + *           </restriction>
    + *         </simpleType>
    + *       </attribute>
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "stroke") +public class Stroke { + + @XmlAttribute + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String dashstyle; + + /** + * Gets the value of the dashstyle property. + * + * @return possible object is + * {@link String } + */ + public String getDashstyle() { + return dashstyle; + } + + /** + * Sets the value of the dashstyle property. + * + * @param value allowed object is + * {@link String } + */ + public void setDashstyle(String value) { + this.dashstyle = value; + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Textbox.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Textbox.java new file mode 100644 index 00000000..dad67293 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/Textbox.java @@ -0,0 +1,212 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + + +package com.wisemapping.xml.vmlmap; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    + * <complexType>
    + *   <complexContent>
    + *     <extension base="{http://mindmap.com/xml/vmlmap}element">
    + *       <sequence>
    + *         <element name="SPAN">
    + *           <complexType>
    + *             <complexContent>
    + *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *                 <sequence>
    + *                   <element name="SPAN" type="{http://www.w3.org/2001/XMLSchema}string"/>
    + *                 </sequence>
    + *               </restriction>
    + *             </complexContent>
    + *           </complexType>
    + *         </element>
    + *       </sequence>
    + *       <attribute name="inset" use="required" type="{http://www.w3.org/2001/XMLSchema}string" fixed="0,0,0,0" />
    + *       <attribute name="xFontScale" use="required" type="{http://www.w3.org/2001/XMLSchema}float" />
    + *       <attribute name="xTextSize" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
    + *     </extension>
    + *   </complexContent>
    + * </complexType>
    + * 
    + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "span" + }) +@XmlRootElement(name = "textbox") +public class Textbox + extends Element { + + @XmlElement(name = "SPAN", namespace = "", required = true) + protected Textbox.SPAN span; + @XmlAttribute(required = true) + protected String inset; + @XmlAttribute(required = true) + protected float xFontScale; + @XmlAttribute(required = true) + protected String xTextSize; + + /** + * Gets the value of the span property. + * + * @return possible object is + * {@link Textbox.SPAN } + */ + public Textbox.SPAN getSPAN() { + return span; + } + + /** + * Sets the value of the span property. + * + * @param value allowed object is + * {@link Textbox.SPAN } + */ + public void setSPAN(Textbox.SPAN value) { + this.span = value; + } + + /** + * Gets the value of the inset property. + * + * @return possible object is + * {@link String } + */ + public String getInset() { + if (inset == null) { + return "0,0,0,0"; + } else { + return inset; + } + } + + /** + * Sets the value of the inset property. + * + * @param value allowed object is + * {@link String } + */ + public void setInset(String value) { + this.inset = value; + } + + /** + * Gets the value of the xFontScale property. + */ + public float getXFontScale() { + return xFontScale; + } + + /** + * Sets the value of the xFontScale property. + */ + public void setXFontScale(float value) { + this.xFontScale = value; + } + + /** + * Gets the value of the xTextSize property. + * + * @return possible object is + * {@link String } + */ + public String getXTextSize() { + return xTextSize; + } + + /** + * Sets the value of the xTextSize property. + * + * @param value allowed object is + * {@link String } + */ + public void setXTextSize(String value) { + this.xTextSize = value; + } + + + /** + *

    Java class for anonymous complex type. + *

    + *

    The following schema fragment specifies the expected content contained within this class. + *

    + *

    +     * <complexType>
    +     *   <complexContent>
    +     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    +     *       <sequence>
    +     *         <element name="SPAN" type="{http://www.w3.org/2001/XMLSchema}string"/>
    +     *       </sequence>
    +     *     </restriction>
    +     *   </complexContent>
    +     * </complexType>
    +     * 
    + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "span" + }) + public static class SPAN { + + @XmlElement(name = "SPAN", namespace = "", required = true) + protected String span; + + /** + * Gets the value of the span property. + * + * @return possible object is + * {@link String } + */ + public String getSPAN() { + return span; + } + + /** + * Sets the value of the span property. + * + * @param value allowed object is + * {@link String } + */ + public void setSPAN(String value) { + this.span = value; + } + + } + +} diff --git a/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/package-info.java b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/package-info.java new file mode 100644 index 00000000..6a9734e9 --- /dev/null +++ b/trunk/wise-webapp/src/main/java/com/wisemapping/xml/vmlmap/package-info.java @@ -0,0 +1,27 @@ +/* +* 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 $ +*/ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.0 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2007.04.14 at 05:18:25 PM ART +// + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://wisemapping.com/xml/vmlmap", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package com.wisemapping.xml.vmlmap; diff --git a/trunk/wise-webapp/src/main/resources/com/wisemapping/model/Colaborator.hbm.xml b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/Colaborator.hbm.xml new file mode 100755 index 00000000..dac1f836 --- /dev/null +++ b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/Colaborator.hbm.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindMap.hbm.xml b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindMap.hbm.xml new file mode 100644 index 00000000..1151e90f --- /dev/null +++ b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindMap.hbm.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindMapHistory.hbm.xml b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindMapHistory.hbm.xml new file mode 100755 index 00000000..04087332 --- /dev/null +++ b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindMapHistory.hbm.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindmapNative.hbm.xml b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindmapNative.hbm.xml new file mode 100644 index 00000000..c52bf366 --- /dev/null +++ b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindmapNative.hbm.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindmapUser.hbm.xml b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindmapUser.hbm.xml new file mode 100644 index 00000000..92ae5c75 --- /dev/null +++ b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/MindmapUser.hbm.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/resources/com/wisemapping/model/UserLogin.hbm.xml b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/UserLogin.hbm.xml new file mode 100755 index 00000000..16118c30 --- /dev/null +++ b/trunk/wise-webapp/src/main/resources/com/wisemapping/model/UserLogin.hbm.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/resources/mindmap.xsd b/trunk/wise-webapp/src/main/resources/mindmap.xsd new file mode 100755 index 00000000..de724c11 --- /dev/null +++ b/trunk/wise-webapp/src/main/resources/mindmap.xsd @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/resources/wiseservices.wsdl b/trunk/wise-webapp/src/main/resources/wiseservices.wsdl new file mode 100644 index 00000000..fc66cfec --- /dev/null +++ b/trunk/wise-webapp/src/main/resources/wiseservices.wsdl @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/META-INF/Context.xml b/trunk/wise-webapp/src/main/webapp/META-INF/Context.xml new file mode 100755 index 00000000..0af54be5 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/META-INF/Context.xml @@ -0,0 +1,16 @@ + + + + + + + diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/app.properties b/trunk/wise-webapp/src/main/webapp/WEB-INF/app.properties new file mode 100755 index 00000000..cce09215 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/app.properties @@ -0,0 +1,22 @@ +# MySQL 5.X configuration properties + +#database.url=jdbc:mysql://localhost/wisemapping +#database.driver=com.mysql.jdbc.Driver +#database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect +#database.username=root +#database.password= + +# HSQL Configuration properties +database.url=jdbc:hsqldb:file:target/db/wisemapping +database.driver=org.hsqldb.jdbcDriver +database.hibernate.dialect=org.hibernate.dialect.HSQLDialect +database.username=sa +database.password= + +# Mail configuration seccion. +mail.smtp.socketFactory.port=465 +mail.host=localhost +mail.user=user +mail.password=password +mail.registrationEmail=root@localhost +mail.siteEmail=root@localhost \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties new file mode 100644 index 00000000..32a2b197 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties @@ -0,0 +1,10 @@ +log4j.rootCategory=WARN, stdout +log4j.net.sf=FATAL,stdout +log4j.com.wisemapping=DEBUG,stdout +log4j.org.wisemapping.ws=DEBUG,stdout + +##log4j.category.net.sf.acegisecurity=DEBUG, + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d %p %c - %m%n \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail.properties b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail.properties new file mode 100644 index 00000000..8a8b0f11 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail.properties @@ -0,0 +1,9 @@ +# Configuration file for javax.mail + +# Host whose mail services will be used +# (Default value : localhost) +mail.host=mail.wisemapping.com + +# Return address to appear on emails +# (Default value : username@host) +mail.from=webmaster@wisemapping.com \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/activationAccountMail.vm b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/activationAccountMail.vm new file mode 100644 index 00000000..6c8b0d75 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/activationAccountMail.vm @@ -0,0 +1,22 @@ + + +

    Welcome to WiseMapping!

    +

    + Your account has been activated. + First Name: ${user.firstname} + Last Name: ${user.lastname} + Username: ${user.username} +

    +

    + Thank you for using WiseMapping. +

    +

    + For questions or concerns regarding your account, send us an email to support@wisemapping.com. +

    +

    +Best regards,
    +WiseMapping Team +WiseMapping Site +

    + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/activeUserAccountMail.vm b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/activeUserAccountMail.vm new file mode 100755 index 00000000..c253cc84 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/activeUserAccountMail.vm @@ -0,0 +1,12 @@ + + +

    We have a new User !!

    +

    + Id: ${user.id}
    + First Name: ${user.firstname}
    + Last Name: ${user.lastname}
    + Username: ${user.username}
    + Email: ${user.email}
    +

    + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/confirmationMail.vm b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/confirmationMail.vm new file mode 100644 index 00000000..be44896c --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/confirmationMail.vm @@ -0,0 +1,24 @@ + + +

    Welcome to WiseMapping!

    +

    + To active your account and verify your e-mail address, please click on the following link. +

    + ${emailcheck} +

    +

    + If you have received this mail by error, you do not need to take any action to cancel the account. The account will not be activated, and you will not receive any futher emails. +

    +

    + If clicking the link above does not work, copy and paste the URL in a new browser window instead. +

    +

    + For questions or concerns regarding your account, send us an email to support@wisemapping.com. +

    +

    +Cheers,
    +The WiseMapping Team. +WiseMapping Site +

    + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/newColaborator.vm b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/newColaborator.vm new file mode 100755 index 00000000..392106f0 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/newColaborator.vm @@ -0,0 +1,7 @@ + + +

    + ${message} +

    + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/recoveryMail.vm b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/recoveryMail.vm new file mode 100644 index 00000000..fa8c97a0 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/recoveryMail.vm @@ -0,0 +1,24 @@ + + +

    Your password was regenerated from WiseMapping!

    +

    + Your account information is: +

    + User Login: ${user.email} +

    +

    + New Password: ${password} +

    +

    + Thank you for using WiseMapping. +

    +

    + For questions or concerns regarding your account, send us an email to support@wisemapping.com. +

    +

    +Best Regards,
    +The WiseMapping Team. +WiseMapping Site +

    + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/welcome.vm b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/welcome.vm new file mode 100755 index 00000000..c051db6e --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/mail/welcome.vm @@ -0,0 +1,21 @@ + + +

    + Hi, +

    +

    +Thank you so much for your interest in WiseMapping. Your subscription was a success! If you have any questions or have any feedback, please don't hesitate to reply to this email, or use the on line form. We'd love to hear from you. +

    +

    +Since we are currently in "private beta" phase, we are inviting people from the list you just signed up for every day. So sit tight because you might be the next one. +

    +

    + For questions or concerns regarding your account, send us an email to support@wisemapping.com. +

    +

    +Cheers,
    +The WiseMapping Team. +WiseMapping Site +

    + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/messages.properties b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/messages.properties new file mode 100644 index 00000000..0edb1166 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/messages.properties @@ -0,0 +1,324 @@ +NEW_MINDMAP=Create a new map +NAME=Name +DESCRIPTION=Description +OK=Ok +WISEMAPPING=WiseMapping +ADD=Add +ACTIONS=Actions +ADD_COLLABORATORS=Add Collaborators +CURRENT_COLLABORATORS=Current collaborators +VIEWERS=Viewers +ADD_VIEWERS=Add Viewers +CURRENT_VIEWERS=Current Viewers +USER_REGISTRATION=User Registration +CANCEL=Cancel +SUBMIT=Submit +FIRSTNAME=Firstname +LASTNAME=Lastname +EMAIL=E-mail +HELP=Help +LOGOUT=Logout +PASSWORD=Password +MY_WISEMAPS=My Wisemaps +SAVE_AND_CLOSE=Save and Close +RETYPE_PASSWORD=Retype Password +REGISTER=Register +REMEMBER_ME=Remember me on this computer +SIGN_IN=Sign In +SIGN_UP=Sign Up +SETTINGS=Settings +USERNAME=Username +BACK=Back +CLOSE=Close +NOT_READY_A_USER=Not ready a wisemapper? +NOT_READY_A_USER_MESSAGE=Registration is free and takes just a moment. +JOIN_NOW=Join Now! +REMOVE=Remove +MINDMAP=Mindmap +ROLE=Role +CAPTCHA= Word Verification +FORGOT_PASSWORD=Forgot Password ? +CHANGE_PASSWORD=Change your Password +FAQ=Frequent Asked Questions +SHORT_FAQ=FAQ +LOGIN=Login +SUBJECT=Subject +SUBJECT_MESSAGE= has shared a mind map with you at WiseMapping +MSG=Message +PROBLEM_DETAIL=Description +EXPORT=Export +EXPORT_MSG=Export +EXPORT_FORMAT=Export Format: +EDIT_PROFILE= Edit your Profile +JPEG_EXPORT_FORMAT=JPEG +PNG_EXPORT_FORMAT=Portable Network Graphics (PNG) +SVG_EXPORT_FORMAT=Scalable Vector Graphics (SVG) +PDF_EXPORT_FORMAT=Portable Document Format (PDF) +IMG_EXPORT_FORMAT=Image File +FREEMIND_EXPORT_FORMAT = Freemind (version 0.8.0) + +FILE=File +FILE_URL=File URL +STATUS=Status +LAST_EDITOR=Last Edition + +DELETE_SELECTED_CONFIRMATION=All selected Maps will be deleted. Do you want to continue? +DELETE_CONFIRMATION=Are you sure that you want to delete this map? +DELETE_SELECTED=Delete selected +DELETE=Delete +YES=yes +NO=no + +EDITOR.LOADING=Loading ... +SITE.TITLE=WiseMapping +SITE.SLOGAN=Visual Thinking Evolution +SAVE=Save +DISCARD_CHANGES=Discard Changes +ABOUT=About +ABOUT_TITLE=What is WiseMapping? +BLOG=Blog +BLOG_TITLE=WiseMapping Blog +NEWS=News +KEYBOARD=Keyboard Shortcuts +KEYBOARD_MSG=These are the keyboard shortcuts you can use in the editor! +FIRST_STEPS=Editor First Steps +FIRST_STEPS_MSG=Make these first steps in 2 minutes, and start running in 5! +HOME=Home +LOGIN_ERROR=The email address or password you provided does not match our records. +USER_INACTIVE=Sorry, your account has not been activated yet. You'll receive a notification email when it becomes active. Stay tuned!. +CREW=The Crew +ALREADY_A_MEMBER=Already a member? +WORD_VERIFICATION=Word Verification +TERM_OF_THE_SERVICE=Terms of Service: +FORGOT_PASSWORD_MESSAGE=Please enter your email to start the password recovery process. +LOADING_MSG=Loading ... +SEARCH_TITLE=Search for WiseMaps +SEARCH_TEXT=Search for public mind maps using either its name or tags +SEARCH_FIELD=Map Title or Tag +SEARCH=Search +SEARCH_RESULTS=Search Results +NO_SEARCH_RESULTS=No results were found. Go ahead and be the first one to publish a mind map about it! +NO_SEARCH_TERM=You didn't enter any search terms. +ADVANCE_SEARCH=Advanced Search +SIMPLE_SEARCH=Simple Search +TRYNOW= Try Demo ! +VIDEO=WiseMapping in 2 minutes + +FIELD_REQUIRED=Required field cannot be left blank +EMAIL_ALREADY_EXIST=Email already exists +NO_VALID_EMAIL_ADDRESS=Invalid email address +USERNAME_ALREADY_EXIST=Username already exists +PASSWORD_MISSMATCH=Your password entries did not match +TYPE_CHARACTER_BELOW=Type the characters you see in the picture below. +WISEMAPPING_ACCOUNT_MESSAGE=Please check the WiseMapping Account information you've entered above, and review the Terms of Service +REGISTRATION_CLICK_ADVICE= By clicking on 'Register' below you are agreeing to the Terms of Service above and the Privacy Policy. +REGISTRATION_TITLE_MSG=Please, fill the fields and become a member of WiseMapping community.
    Registration is Free and takes just a moment. +CAPTCHA_ERROR=Enter the letters as they are shown in the image above. +DETAIL_INFORMATION=Detail Information +CREATOR=Creator +CREATION_TIME=Creation Time +VIEWS=Views +STATE=State +COLLABORATORS=Collaborators +ADD_COLLABORATOR=Add Collaborator +EDITORS=Editors +VIEWER=Viewer +PRIVATE=Private +PUBLIC=Public +SHARED=Shared +ONLY_VIEW_PRIVATE = This document can be viewed by you only. +ALL_VIEW_PUBLIC = This document can be viewed by any user. + +EMAILS_ADRESSES = E-mails Addresses +CURRENT_CONTACTS = Current Contacts +MESSAGE=Message +COLLABORATION= Collaboration +SHARE_DETAILS=Share your maps with your colleagues. Invite them to collaborate with you. +NEW_MAP_MSG=Fill all the fields to create a new map + +TAG=Tag +PUBLISH=Publish +PUBLISH_MSG = What about using your maps in sites and blogs? +PUBLISH_DETAILS=By publishing the map you make it visible to everyone on the Internet. Copy the code snippets below to integrate it into your website or blog. +DETAIL=Detail +RECENT_FILES=Recent Maps +MINDMAP_DETAIL = Mind Map Detail +EDIT=Edit +INSERT=Insert +WISE_IT=Wise It! +EDITOR.LAST_SAVED=last modification by {0} +SHARE_IT=Share It +SETTINGS_DETAIL=Do you want to change you user options?. Here is the place. +SETTINGS_MSG=Please, select what option want to change from you profile: +TAGS=Tags +AVAILABLE_TAGS = Available tags + +EMPTY_MINDMAP_TABLE=Mapping your ideas is very simple. Create a map and try it! +EMPTY_RECENT_MINDMAP_TABLE=No recent maps +TAGS_DETAILS=Add tags you maps is very simple. Try! +TAG_IT=Tag It +PUBLISH_IT=Publish It +USUPPORTED_BROWSER=Unsupported Browser +FIELD_REQUIRED_MSG=Fields marked with an asterisk * are required. +TAGS_MSG=Tagging is a simple way to keep your maps in order and help other people to find your public maps +COMMA_SEPARATED_EMAILS=Comma separated emails +INVITE_USERS=Invite Users +AS_COLLABORATOR=as Collaborators +AS_VIEWER=as Viewers +CUSTOMIZE_INVITATION=Customize Invitation +INVITATION=Invitation +INVITATION_MSG= I've just shared a mind map with you.\nLog in to www.wisemapping.com and you will see the shared map in your mind map list. +SVG_EXPORT_FORMAT_DETAILS=Scalable Vector Graphics (SVG) is an XML markup language for describing two-dimensional vector graphics. This format will enable you to print your maps without quality lost at any resolution. +PDF_EXPORT_FORMAT_DETAILS=Get your map as Portable Document Format(PDF) to share use in your presentations. +IMG_EXPORT_FORMAT_DETAILS=Get a graphic representation of your map including all colors and shapes to reuse in documents or for archiving +FREEMIND_EXPORT_FORMAT_DETAILS = FreeMind is a nice desktop mind mapping application that has the great benefit of being free. +DELETE_MAP=Delete Confirmation + +TERMSOFUSE=Terms of Use +PRIVACYPOLICY= Privacy Policy +EXPORT_DETAILS=Export this map in the format that you want and start using it in your presentations +PUBLIC_MAP_VIEW=Public Map Info +HERE=here +DETAILS=Details +PUBLIC_VIEW_TITLE={0} Map View +WHO_ARE_WE=Who are we? +MEMBERS=Members +WELCOME=Welcome + +RENAME=Rename +RENAME_DETAILS=Change map's name and description +MAX_CHARACTER_SIZE= Maximum allowed message length of 512 characters. +PUBLISH_MAP_TO_INTERNET=Publish map to the Internet +URL=URL +DIRECT_LINK=Direct Link +BLOG_INCLUSION=For inclusion in blogs and web pages +OPEN=Open +OPEN_MSG=Open map for edition + +ZOOM=Zoom +ZOOM_IN=Zoom In +ZOOM_OUT=Zoom Out +IN=In +OUT=Out +HISTORY=History +TOPIC=Topic +TOPIC_BACKGROUND_COLOR=Topic Background Color +BACKGROUND_COLOR=BgColor +TOPIC_BORDER_COLOR=Topic Border Color +BORDER_COLOR=Border Color +BORDER=Border +TOPIC_SHAPE=Topic Shape +SHAPE=Shape +TOPIC_ADD=Add Topic +TOPIC_DELETE=Delete Topic +TOPIC_ICON=Add Icon +ICON=Icon +TOPIC_LINK=Add Link +LINK=Link +TOPIC_NOTE=Add Note +NOTE=Note + +FONT=Font +FONT_TYPE=Font Type +TYPE=Type +FONT_SIZE=Font Size +SIZE=Size +FONT_BOLD=Bold +BOLD=Bold +FONT_ITALIC=Italic +ITALIC=Italic +FONT_COLOR=Font Color +COLOR=Color +SHARE=Share +UNEXPECTED_ERROR=Outch!!. An unexpected error has occurred. +UNEXPECTED_ERROR_DETAILS=We're sorry, an error has occurred and we can't process your request. Please try again, or go to the home page. +NO_ENOUGH_PERMISSIONS=Outch!!. This map is not available anymore. +NO_ENOUGH_PERMISSIONS_DETAILS=You do not have enough right access to see this map. This map has been changed to private or deleted. +SHARING=Sharing +IMPORT_MINDMAP=Import map +IMPORT_MINDMAP_DETAILS=Do you already have maps created with FreeMind?.No problem, Import them!. +IMPORT_MINDMAP_INFO=You can import FreeMind maps to WiseMapping. Please, select the FreeMind map that want to import.
    Fields marked with an asterisk * are required. +PRINT=Print +FREE_MIND_FILE=FreeMind File +IMPORT_MAP_ERROR=Imported file seems not to be a valid FreeMind file. +MAP_TITLE_ALREADY_EXISTS=Map name already exists. +EMBEDDED_VIEWER=Embed a map viewer in your own web site, blog or post! +EMBEDDED_VIEWER_MESSAGE=Once you make your map public, you will be able to embed a mind map viewer in your own web site, blog or post just as we did it here!
    Try it!!, you can drag nodes, pan the map, and zoom in and out. +FREEMIND_EXPORT_IMPORT=Import and Export maps from/to FreeMind +FREEMIND_EXPORT_IMPORT_MESSAGE=You can now easily import and export mind maps from/to FreeMind. +EDITOR_TOOLBAR_IMPROVED=Usability Improvement: The editor toolbar has been redesign +EDITOR_TOOLBAR_IMPROVED_MESSAGE= The toolbar has been redesign to improve its usability. +COLLABORATE=Collaborate +PRINT_FEATURE_IMPLEMENTED=You can print your maps now +PRINT_FEATURE_IMPLEMENTED_MESSAGE=You can now easily print your maps from the editor and the map list! +EMBEDDED_MAP_SIZE=* Note: You can change embedded map size modifying 'height' and 'width' style properties. You can also adjust the zoom factor modifying 'zoom' parameter from the URL. +NEWSLETTER_DESC = Get News delivered to
    your Inbox +USABILITY_EDITING_IMPROVED= Usability Improvement: Node text Editing +USABILITY_EDITING_IMPROVED_ESC= Usability Improvement: Cancelling Node text Editing with the ESC Key +USABILITY_EDITING_IMPROVED_TEXT=Now you have 3 different ways of editing a node text.
    • Typing: Start typing to replace the focused node text.
    • F2: Pressing F2 key, will let you edit the node text
    • Double click: Double click with the mouse on the node to start editing its text
    +USABILITY_EDITING_IMPROVED_TEXT_ESC=Now, You can also cancel the changes that you've made in the text of a node by pressing the ESC key while editing it's text. +IMPORT-EXPORT_ISSUES_FIXED=Usability Improvement: Import-Export issues have been solved. +GO_TO= Go to my Wisemaps + +NEWS_AND_ARTICLES=News & Articles +NEWS_TITLE_EMBEDDED_MAPS=Embed your maps in anyplace +NEWS_DESC_EMBEDDED_MAPS=With this new feature, you can embed your maps in blogs and web pages. +NEWS_TITLE_FREEMIND=FreeMind import and export +NEWS_DESC_FREEMIND=Now, you can import and export your FreeMind maps. +NEWS_TITLE_KEYBOARD_NAVIGATION=WiseMapping Makes Creation of mind maps More Easily and PowerFul +NEWS_DESC_KEYBOARD_NAVIGATION=WiseMapping let's you create the most powerfull mind maps using the keyboard + +MOST_POPULAR_MAPS=Most Popular Maps +JOIN_WISEMAPPING=Join WiseMapping +IT_IS_FREE=It's free! +CREATE_EDIT_ACCESS_FROM_ANYWHERE=Create, edit and access your mindmaps from anywhere over the Web + +USABILITY_EDITOR_IMPROVED= Usability Improvement: Help button in the Mind Map Editor +EDITOR_HELP=A Help button has been placed at the bottom-left corner of the editor. From there you can see all the editor keyboard shortcuts you can use while editing your maps, and a quick tutorial on how to use the editor. + +USABILITY_EDITOR_IMPROVED_SHRINK= Usability Improvement: Collapse/Expand nodes +SHRINK_TEXT=You can now collapse and expand nodes by clicking on the node's dot, or by pressing the space bar button. + +EDITOR_LINKS=Mind Map feature: Add links to the topics +EDITOR_LINKS_SHORT=Add links to the topics +EDITOR_LINKS_TEXT=You can add Links to the topics very easily using the link icon in the toolbar. + +IMPORT_EXPORT_IMPROVEMENTS=We have done some improvements in the import and export features + +USERS_1500=We already have 2100 users!!, Thanks to all of you that have trust us in this starting phase... +NO_PRIVATE_ANY_MORE= We are not private any more! More than 2100 users have tested and used the application, it's time to stop being private!.. Stay tune because we have a lot of new ideas for WiseMapping!! +NO_PRIVATE_ANY_MORE_SHORT= We are not private any more! +NO_PRIVATE_ANY_MORE_TEXT=More than 1500 real users have tested the application!, so it's time to stop being private! + +NEWS_ADD_ICON=Mind Map feature: Add icons to the topics +NEWS_ADD_ICON_SHORT=Add icons to the topics +NEWS_ADD_ICON_TEXT=You can now add Icons to the topics very easily using the link icon in the toolbar + +NEWS_TOOLBAR_SHORT =New Editor Toolbar +NEWS_TOOLBAR_TEXT = We have update our editor toolbar in order to be more intuitive. + +#####FOOTER +COPYRIGHT=All content Copyright 2007-2009, WiseMapping Corporation +TERMS_AND_CONDITIONS=Terms and Conditions +CONTACT=Contact + +ACCOUNT_ACTIVED= Your account has been activated +ACCOUNT_ACTIVED_FAIL = Account Activation failed +VIEW_ALL_RESULTS= Show All Results +BROWSE=Browse +SEARCH_MSG=Discover publich mind maps created by people like you. +SEARCH_PUBLIC=Search Public Mind Maps +UNDO_EDITION=Undo Edition +UNDO=Undo +REDO_EDITION=Redo Edition +REDO=Redo + +BY=By +MODIFIED=Modified +HISTORY_MSG=Looking for an old modification of you map?. Here is the place. +NO_HISTORY_RESULTS= No History Information was found. +HISTORY_INFO = Here is the list of the last revisions of you map. +REVERT=revert +SAMPLE_MAPS=Sample Maps + +INVALID_EMAIL_ERROR = The e-mail was not verified \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/messages_es.properties b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/messages_es.properties new file mode 100644 index 00000000..90263de8 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/classes/messages_es.properties @@ -0,0 +1,264 @@ +NEW_MINDMAP=Crear un nuevo mapa +NAME=Nombre +DESCRIPTION=Descripción +OK=Ok +WISEMAPPING=WiseMapping +ADD=Agregar +ACTIONS=Acciones +ADD_COLLABORATORS=Agregar Colaboradores +CURRENT_COLLABORATORS=Colaboradores Actuales +VIEWERS=Lectores +ADD_VIEWERS=Agregar Lector +CURRENT_VIEWERS=Lectores Actuales +USER_REGISTRATION=Registración de Usuarios +CANCEL=Cancelar +SUBMIT=Aceptar +FIRSTNAME=Nombre +LASTNAME=Apellido +EMAIL=E-mail +HELP=Ayuda +LOGOUT=Salida +PASSWORD=Contraseña +MY_WISEMAPS=Mis mapas +SAVE_AND_CLOSE=Grabar y Salir +RETYPE_PASSWORD=Reingresar contraseña +REGISTER=Registración +REMEMBER_ME=Recordar mi sesión +SIGN_IN=Entrar +SIGN_UP=Registrate +SETTINGS=Configuración +USERNAME=Nombre de usuario +BACK=Atrás +CLOSE=Cerrar +NOT_READY_A_USER=Todavía no usa WiseMapping? +NOT_READY_A_USER_MESSAGE=La registración es rápida y gratuita. +JOIN_NOW=Inscribite! +REMOVE=Remover +MINDMAP=Mindmap +ROLE=Rol +CAPTCHA=Verificación de palabra +FORGOT_PASSWORD=Se olvidó la contraseña? +CHANGE_PASSWORD=Cambiar la contraseña +FAQ=Preguntas Frecuentes +SHORT_FAQ=FAQ +LOGIN=Login +SUBJECT=Asunto +SUBJECT_MESSAGE= ha compartido un mapa mental con usted en WiseMapping.com +MSG=Mensaje +PROBLEM_DETAIL=Descripción +EXPORT=Exportar +EXPORT_MSG=Exportar +EXPORT_FORMAT=Exportar a formato: +EDIT_PROFILE= Editar perfil +JPEG_EXPORT_FORMAT=JPEG +PNG_EXPORT_FORMAT=Portable Network Graphics (PNG) +SVG_EXPORT_FORMAT=Scalable Vector Graphics (SVG) +PDF_EXPORT_FORMAT=Portable Document Format (PDF) +IMG_EXPORT_FORMAT=Imagen +FREEMIND_EXPORT_FORMAT = Freemind (version 0.8.0) + +FILE=Archivo +FILE_URL=URL del archivo +STATUS=Estado +LAST_EDITOR=Última Edicion + +DELETE_SELECTED_CONFIRMATION=Todos los mapas seleccionados serán borrados. Desea continuar? +DELETE_CONFIRMATION=Esta seguro de que quiere borrar este mapa? +DELETE_SELECTED=Borrado seleccionado +DELETE=Borrar +YES=Si +NO=No + +EDITOR.LOADING=Cargando... +SITE.TITLE=WiseMapping +SITE.SLOGAN=Visual Thinking Evolution +SAVE=Guardar +DISCARD_CHANGES=Descartar cambios +ABOUT=Acerca +ABOUT_TITLE=Que es WiseMapping? +BLOG=Blog +BLOG_TITLE=WiseMapping Blog +NEWS=Noticias +HOME=Inicio +LOGIN_ERROR=Usuario/contraseña no válido/a. +USER_INACTIVE=Disculpe, su cuenta aun no ha sido activada. Usted recibira una notificación por email tan pronto la activemos. +CREW=The Crew +ALREADY_A_MEMBER=Ya tenes una cuenta en WiseMapping? +WORD_VERIFICATION=Verificación de palabra +TERM_OF_THE_SERVICE=Términos de servicio: +FORGOT_PASSWORD_MESSAGE=Ingrese su e-mail para iniciar el proceso de recuperación de su contraseña. +LOADING_MSG=Cargando... +SEARCH_TITLE=Busqueda por WiseMaps +SEARCH_TEXT=Busqueda sobre mapas publicos utilizando el titulo o la etiqueta +SEARCH_FIELD=Título o etiqueta del mapa +SEARCH=Busqueda +SEARCH_RESULTS=Resultados +NO_SEARCH_RESULTS=No se encontró ningun mapa. +NO_SEARCH_TERM=No ingresó un criterio de busqueda. +ADVANCE_SEARCH=Busqueda avanzada +SIMPLE_SEARCH=Busqueda simple +TRYNOW= Prueba la Demo! +VIDEO=WiseMapping en 2 minutos + +FIELD_REQUIRED=Campo requerido +EMAIL_ALREADY_EXIST=e-mail ya existente +NO_VALID_EMAIL_ADDRESS=e-mail invalido +USERNAME_ALREADY_EXIST=Nombre de usuario ya existente +PASSWORD_MISSMATCH=La contraseña no concuerda +TYPE_CHARACTER_BELOW=Ingrese los caracteres de la imagen. +WISEMAPPING_ACCOUNT_MESSAGE=Por favor verifique la informacion que ha ingresado y lea los condiciones del servicio. +REGISTRATION_CLICK_ADVICE= Seleccionando 'Registración' esta aceptando las condiciones de uso de arriba y la politica de privacidad. +REGISTRATION_TITLE_MSG=Please, fill the fields and become a member of WiseMapping community.
    Registration is Free and takes just a moment. +CAPTCHA_ERROR=Enter the letters as they are shown in the image above. +DETAIL_INFORMATION=Detalles +CREATOR=Creador +CREATION_TIME=Fecha de creación +VIEWS=Vistas +STATE=Estado +COLLABORATORS=Colaboradores +ADD_COLLABORATOR=Agregar Colaborador +EDITORS=Editores +VIEWER=Lector +PRIVATE=Privado +PUBLIC=Público +SHARED=Compartido +ONLY_VIEW_PRIVATE = Este documento solo puede ser visualizado por usted. +ALL_VIEW_PUBLIC = Este documento puede ser visualizado por cualquier usuario. + +EMAILS_ADRESSES = Direcciones de e-mail +CURRENT_CONTACTS = Contactos actuales +MESSAGE=Mensaje +COLLABORATION=Colaboración +SHARE_DETAILS=Comparta los mapas con sus colegas. Invitelos a colaborar con usted. +NEW_MAP_MSG=Llene todos los campos para crear un mapa nuevo + +TAG=Etiqueta +PUBLISH=Publicar +PUBLISH_MSG = Que le parece usar sus mapas desde sus sitios y blogs? +PUBLISH_DETAILS=Publicando el mapa hara que el mismo sea visible por cualquier persona que utlice Internet. Copie el código de abajo para integrar el mapa con su sitio web o blog. +DETAIL=Detalle +RECENT_FILES=Mapas Recientes +MINDMAP_DETAIL = Detalle de Mind Map +EDIT=Editar +INSERT=Insertar +WISE_IT=Wise It! +EDITOR.LAST_SAVED=ultima modificación hecha por {0} +SHARE_IT=Compartilo +SETTINGS_DETAIL=Desea cambiar sus preferencias? Este es el lugar. +SETTINGS_MSG=Por favor, seleccione que opción desea modificar de su perfil: +TAGS=Etiquetas +AVAILABLE_TAGS = Etiquetas disponibles + +EMPTY_MINDMAP_TABLE=Mapear sus ideas es muy simple. Cree un mapa y haga la prueba! +EMPTY_RECENT_MINDMAP_TABLE=No hay mapas recientes +TAGS_DETAILS=Agregar etiquetas a sus mapas en muy facil! Intentelo! +TAG_IT=Etiquetalo! +PUBLISH_IT=Publicalo! +USUPPORTED_BROWSER=Navegador no soportado +FIELD_REQUIRED_MSG=Fields marked with an asterisk * are required. +TAGS_MSG=Tagging is a simple way to keep your maps in order and help other people to find your public maps +COMMA_SEPARATED_EMAILS=E-mails separados por comas +INVITE_USERS=Invitar usuarios +AS_COLLABORATOR=como Colaborador +AS_VIEWER=como Lector +CUSTOMIZE_INVITATION=Editar Invitación +INVITATION=Invitación +INVITATION_MSG= Acabo de compartir un mapa mental con usted.\nIngrese a www.wisemapping.com y podra visualizarlo en su lista de mapas. +SVG_EXPORT_FORMAT_DETAILS=Scalable Vector Graphics (SVG) es un XML markup language para describir greficos vectoriale de dos dimensiones. Este formato le permitira imprimir sus mapas sin perdida de calidad o resolución. +PDF_EXPORT_FORMAT_DETAILS=Obtenga su mapa como un documento (PDF) para compartirlo y usarlo en sus presentaciones. +IMG_EXPORT_FORMAT_DETAILS=Obtenga una representación grafica de su mapa incluyendo todo los colores y formas para reusarlo en documentos o para ser archivado +FREEMIND_EXPORT_FORMAT_DETAILS = FreeMind un aplicación de escritorio gratuita de diseno de mapas mentales +DELETE_MAP=Confirmación de borrado + +TERMSOFUSE=Términos de uso +PRIVACYPOLICY= Politica de privacidad +EXPORT_DETAILS=Exporte el mapa en el formato que desee y comience a utlizarlo en sus presentaciones +PUBLIC_MAP_VIEW=Información del mapa publico +HERE=aqui +DETAILS=Detalles +PUBLIC_VIEW_TITLE={0} vista de mapa +WHO_ARE_WE=Quienes somos? +MEMBERS=Miembros +WELCOME=Bienvenido + +RENAME=Renombrar +RENAME_DETAILS=Cambiar el nombre y descripción del mapa +MAX_CHARACTER_SIZE= El máximo mensaje permitido puede contener 512 caracteres. +PUBLISH_MAP_TO_INTERNET=Publicar el mapa en internet +URL=URL +DIRECT_LINK=Enlace directo +BLOG_INCLUSION=Para incluirlo en blogs y web pages +OPEN=Abrir +OPEN_MSG=Abrir el mapa para su edición + +ZOOM=Lupa +ZOOM_IN=Acercar +ZOOM_OUT=Alejar + +TOPIC=Tópico +TOPIC_BACKGROUND_COLOR=Color de fondo del tópico +TOPIC_BORDER_COLOR=Color del borde de tópico +TOPIC_SHAPE=Forma del tópico +TOPIC_ADD=Agregar tópico +TOPIC_DELETE=Borrar tópico +TOPIC_ICON=Agregar Icono +TOPIC_LINK=Agregar Enlace +TOPIC_NOTE=Agregar Nota + +FONT=Fuente +FONT_TYPE=Tipo de fuente +FONT_SIZE=Tamano de fuente +FONT_BOLD=Negrita +FONT_ITALIC=Italica +FONT_COLOR=Color de texto +UNEXPECTED_ERROR=Outch!!. Un error inesperado ha ocurrido +UNEXPECTED_ERROR_DETAILS=Disculpas, un error ha ocurrido y no podremos procesar su pedido. Por favor intente nuevamente o vaya a la pagina de inico. +NO_ENOUGH_PERMISSIONS=Outch!!. EL mapa buscado no se encuentra disponible. +NO_ENOUGH_PERMISSIONS_DETAILS=No tiene suficiente permisos de acceso para ver este mapa. El mapa no es mas publico o ha sido borrado. +SHARING=Colaboración +IMPORT_MINDMAP=Importar mapa +IMPORT_MINDMAP_DETAILS=Tiene mapas creados con FreeMind?. Ningun problema, los puede importar!. +IMPORT_MINDMAP_INFO=Ahora puedes importar mapas de FreeMind a WiseMapping. Por favor, seleccione el mapa FreeMind que desea importar.
    Los campos marcados con un asterisco * son requeridos. +PRINT=Imprimir +FREE_MIND_FILE=Archivo FreeMind +IMPORT_MAP_ERROR=El archivo importado no parece ser un archivo FreeMind válido +MAP_TITLE_ALREADY_EXISTS=Nombre de mapa ya existente. +EMBEDDED_VIEWER=Incluya un visor de mapa en su sitio web, blog o post. +EMBEDDED_VIEWER_MESSAGE=Una vez que su mapa es publico, usted podrá incorporar un visor de mapas mentales en su propio sitio web, blog o post tal como lo hicimos aquí! just as we did it here!
    Try it!!, you can drag nodes, pan the map, and zoom in and out. +FREEMIND_EXPORT_IMPORT=Importar y exportar mapas desde/hacia FreeMind +FREEMIND_EXPORT_IMPORT_MESSAGE=Ahora puedes importar y exportar mapas mentales desde/hacia FreeMind. +EDITOR_TOOLBAR_IMPROVED=La barra de herramientas ha sido rediseñr;ada. +EDITOR_TOOLBAR_IMPROVED_MESSAGE=La barra de herramientas ha sido rediseñada para mejorar la usabilidad. +COLLABORATE=Colaborar +PRINT_FEATURE_IMPLEMENTED=Ahora puedes imprimir tus mapas +PRINT_FEATURE_IMPLEMENTED_MESSAGE=Ahora usted puede imprimir fácilmente sus mapas desde el editor o desde el listado de mapas +EMBEDDED_MAP_SIZE=* Note: You can change embedded map size modifying 'height' and 'width' style properties. You can also adjust the zoom factor modifying 'zoom' parameter from the URL. + +NEWS_AND_ARTICLES=Noticias y Articulos +NEWS_TITLE_EMBEDDED_MAPS=Incluya sus mapas en cualquier lugar +NEWS_DESC_EMBEDDED_MAPS=Con esta nueva funcionalidad puede incluir sus mapas en blogs y sitios web. +NEWS_TITLE_FREEMIND=Importar y exportar mapas de FreeMind +NEWS_DESC_FREEMIND=Ahora, puede importar y exportar sus mapas con formato de FreeMind. +NEWS_TITLE_KEYBOARD_NAVIGATION=La creacion de mapas mentales es mas facil que nunca! +NEWS_DESC_KEYBOARD_NAVIGATION=WiseMapping lo deja crear sus mapas mentales utilzando solo el teclado. + +MOST_POPULAR_MAPS=Los mapas mas populares +JOIN_WISEMAPPING=Utilice WiseMapping +IT_IS_FREE=Es gratis! +CREATE_EDIT_ACCESS_FROM_ANYWHERE=Crear, editar y acceder a sus mapas mentales desde cualquier lugar de Internet + +#FOOTER +COPYRIGHT=All content Copyright 2007, WiseMapping Corporation +TERMS_AND_CONDITIONS=Términos and Condiciones +CONTACT=Contacto + +KEYBOARD=Atajos de Teclado +KEYBOARD_MSG=Estos son los atajos de teclado que puede utilizar en el editor! +FIRST_STEPS=Los Primeros Pasos en el Editor +FIRST_STEPS_MSG=Haga estos primeros pacitos en 2 minutos, y comience a correr en 5! +BROWSER=Browse +SEARCH_MSG=Search and discover mind maps created by people like you. +SEARCH_PUBLIC=Buscar mapas públicos +UNDO_EDITION=Undo Edition +REDO_EDITION=Redo Edition +REVERT=revert \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/defs/definitions.xml b/trunk/wise-webapp/src/main/webapp/WEB-INF/defs/definitions.xml new file mode 100644 index 00000000..90e54b5d --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/defs/definitions.xml @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/dwr.xml b/trunk/wise-webapp/src/main/webapp/WEB-INF/dwr.xml new file mode 100644 index 00000000..11470e35 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/dwr.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/spring.tld b/trunk/wise-webapp/src/main/webapp/WEB-INF/spring.tld new file mode 100644 index 00000000..40681a11 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/spring.tld @@ -0,0 +1,399 @@ + + + + + 1.1.2 + 1.2 + Spring + http://www.springframework.org/tags + Spring Framework JSP Tag Library. Authors: Rod Johnson, Juergen Hoeller + + + htmlEscape + org.springframework.web.servlet.tags.HtmlEscapeTag + JSP + + Sets default HTML escape value for the current page. + Overrides a "defaultHtmlEscape" context-param in web.xml, if any. + + + defaultHtmlEscape + true + true + Set the default value for HTML escaping, to be put + into the current PageContext. + + + + + + escapeBody + org.springframework.web.servlet.tags.EscapeBodyTag + JSP + + Escapes its enclosed body content, applying HTML escaping and/or JavaScript escaping. + The HTML escaping flag participates in a page-wide or application-wide setting + (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml). + + + htmlEscape + false + true + Set HTML escaping for this tag, as boolean value. Overrides the + default HTML escaping setting for the current page. + + + + javaScriptEscape + false + true + Set JavaScript escaping for this tag, as boolean value. + Default is false. + + + + + + message + org.springframework.web.servlet.tags.MessageTag + JSP + + + Retrieves the message with the given code, or text if code isn't resolvable. + The HTML escaping flag participates in a page-wide or application-wide setting + (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml). + + + + message + false + true + A MessageSourceResolvable argument (direct or through JSP EL). + Fits nicely when used in conjunction with Spring's own validation error + classes which all implement the MessageSourceResolvable interface. For + example, this allows you to iterate over all of the errors in a form, + passing each error (using a runtime expression) as the value of this + 'message' attribute, thus effecting the easy display of such error + messages. + + + + + code + false + true + The code (key) to use when looking up the message. + If code is not provided, the text attribute will be used. + + + + + arguments + false + true + Set optional message arguments for this tag, as a + (comma-)delimited String (each String argument can contain JSP EL), + an Object array (used as argument array), or a single Object (used + as single argument). + + + + + argumentSeparator + false + true + The separator character to be used for splitting the + arguments string value; defaults to a 'comma' (','). + + + + + text + false + true + Default text to output when a message for the given code + could not be found. If both text and code are not set, the tag will + output null. + + + + + var + false + true + The string to use when binding the result to the page, + request, session or application scope. If not specified, the result + gets outputted to the writer (i.e. typically directly to the JSP). + + + + + scope + false + true + The scope to use when exporting the result to a variable. + This attribute is only used when var is also set. Possible values are + page, request, session and application. + + + + + htmlEscape + false + true + Set HTML escaping for this tag, as boolean value. + Overrides the default HTML escaping setting for the current page. + + + + + javaScriptEscape + false + true + Set JavaScript escaping for this tag, as boolean value. Default is false. + + + + + + theme + org.springframework.web.servlet.tags.ThemeTag + JSP + + + Retrieves the theme message with the given code, or text if code isn't resolvable. + The HTML escaping flag participates in a page-wide or application-wide setting + (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml). + + + + message + false + true + A MessageSourceResolvable argument (direct or through JSP EL). + + + + code + false + true + The code (key) to use when looking up the message. + If code is not provided, the text attribute will be used. + + + + + arguments + false + true + Set optional message arguments for this tag, as a + (comma-)delimited String (each String argument can contain JSP EL), + an Object array (used as argument array), or a single Object (used + as single argument). + + + + + argumentSeparator + false + true + The separator character to be used for splitting the + arguments string value; defaults to a 'comma' (','). + + + + + text + false + true + Default text to output when a message for the given code + could not be found. If both text and code are not set, the tag will + output null. + + + + + var + false + true + The string to use when binding the result to the page, + request, session or application scope. If not specified, the result + gets outputted to the writer (i.e. typically directly to the JSP). + + + + + scope + false + true + The scope to use when exporting the result to a variable. + This attribute is only used when var is also set. Possible values are + page, request, session and application. + + + + + htmlEscape + false + true + Set HTML escaping for this tag, as boolean value. + Overrides the default HTML escaping setting for the current page. + + + + + javaScriptEscape + false + true + Set JavaScript escaping for this tag, as boolean value. Default is false. + + + + + + hasBindErrors + org.springframework.web.servlet.tags.BindErrorsTag + JSP + + Provides Errors instance in case of bind errors. + The HTML escaping flag participates in a page-wide or application-wide setting + (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml). + + + errors + org.springframework.validation.Errors + + + name + true + true + The name of the bean in the request, that needs to be + inspected for errors. If errors are available for this bean, they + will be bound under the 'errors' key. + + + + htmlEscape + false + true + Set HTML escaping for this tag, as boolean value. + Overrides the default HTML escaping setting for the current page. + + + + + + nestedPath + org.springframework.web.servlet.tags.NestedPathTag + JSP + + Sets a nested path to be used by the bind tag's path. + + + nestedPath + java.lang.String + + + path + true + true + Set the path that this tag should apply. E.g. 'customer' + to allow bind paths like 'address.street' rather than + 'customer.address.street'. + + + + + + bind + org.springframework.web.servlet.tags.BindTag + JSP + + Provides BindStatus object for the given bind path. + The HTML escaping flag participates in a page-wide or application-wide setting + (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml). + + + status + org.springframework.web.servlet.support.BindStatus + + + path + true + true + The path to the bean or bean property to bind status + information for. For instance account.name, company.address.zipCode + or just employee. The status object will exported to the page scope, + specifically for this bean or bean property + + + + ignoreNestedPath + false + true + Set whether to ignore a nested path, if any. Default is to not ignore. + + + htmlEscape + false + true + Set HTML escaping for this tag, as boolean value. Overrides + the default HTML escaping setting for the current page. + + + + + + transform + org.springframework.web.servlet.tags.TransformTag + JSP + + + Provides transformation of variables to Strings, using an appropriate + custom PropertyEditor from BindTag (can only be used inside BindTag). + The HTML escaping flag participates in a page-wide or application-wide setting + (i.e. by HtmlEscapeTag or a 'defaultHtmlEscape' context-param in web.xml). + + + + value + true + true + The value to transform. This is the actual object you want + to have transformed (for instance a Date). Using the PropertyEditor that + is currently in use by the 'spring:bind' tag. + + + + + var + false + true + The string to use when binding the result to the page, + request, session or application scope. If not specified, the result gets + outputted to the writer (i.e. typically directly to the JSP). + + + + + scope + false + true + The scope to use when exported the result to a variable. + This attribute is only used when var is also set. Possible values are + page, request, session and application. + + + + + htmlEscape + false + true + Set HTML escaping for this tag, as boolean value. Overrides + the default HTML escaping setting for the current page. + + + + + + diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/web.xml b/trunk/wise-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..b7f53b8f --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,129 @@ + + + + + + javax.servlet.jsp.jstl.fmt.localizationContext + messages + + + + contextConfigLocation + + /WEB-INF/wisemapping-security.xml + /WEB-INF/wisemapping-dao.xml + /WEB-INF/wisemapping-service.xml + /WEB-INF/wisemapping-model.xml + /WEB-INF/wisemapping-servlet.xml + /WEB-INF/wisemapping-captcha.xml + /WEB-INF/wisemapping-acegi-security.xml + + + + + + com.wisemapping.service.HibernateAppListener + + + + + charsetFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + UTF-8 + + + forceEncoding + true + + + + + charsetFilter + /* + + + hibernate + org.springframework.orm.hibernate3.support.OpenSessionInViewFilter + + singleSession + true + + + sessionFactoryBeanName + mindmapSessionFactory + + + + Acegi Filter Chain Proxy + org.acegisecurity.util.FilterToBeanProxy + + targetClass + org.acegisecurity.util.FilterChainProxy + + + + + Acegi Filter Chain Proxy + /* + + + + hibernate + /* + + + + org.springframework.web.context.ContextLoaderListener + + + + wisemapping + org.springframework.web.servlet.DispatcherServlet + 1 + + + + dwr-invoker + org.directwebremoting.servlet.DwrServlet + + debug + true + + + + + wisemapping + *.htm + + + + dwr-invoker + /dwr/* + + + + + index.jsp + + + + 180 + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-acegi-security.xml b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-acegi-security.xml new file mode 100644 index 00000000..02a1603a --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-acegi-security.xml @@ -0,0 +1,167 @@ + + + + + + + + + CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON + PATTERN_TYPE_APACHE_ANT + /**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /c/login.htm?login_error=2 + /c/login.htm?login_error=3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON + PATTERN_TYPE_APACHE_ANT + /index.jsp=IS_AUTHENTICATED_ANONYMOUSLY + /c/login*=IS_AUTHENTICATED_ANONYMOUSLY + /c/userregistration*=IS_AUTHENTICATED_ANONYMOUSLY + /c/activation.htm=IS_AUTHENTICATED_ANONYMOUSLY + /c/forgotpassword*=IS_AUTHENTICATED_ANONYMOUSLY + /c/captcha*=IS_AUTHENTICATED_ANONYMOUSLY + /c/home.htm=IS_AUTHENTICATED_ANONYMOUSLY + /c/try.htm=IS_AUTHENTICATED_ANONYMOUSLY + /c/search.htm=IS_AUTHENTICATED_ANONYMOUSLY + /c/keyboard.htm=IS_AUTHENTICATED_ANONYMOUSLY + /css/*=IS_AUTHENTICATED_ANONYMOUSLY + /js/**=IS_AUTHENTICATED_ANONYMOUSLY + /ws/**=IS_AUTHENTICATED_ANONYMOUSLY + /images/*=IS_AUTHENTICATED_ANONYMOUSLY + /c/embeddedview.htm=IS_AUTHENTICATED_ANONYMOUSLY + /c/export.htm=IS_AUTHENTICATED_ANONYMOUSLY + /c/publicview.htm=IS_AUTHENTICATED_ANONYMOUSLY + /dwr/engine.js=IS_AUTHENTICATED_ANONYMOUSLY + /dwr/interface/loggerservice.js=IS_AUTHENTICATED_ANONYMOUSLY + /dwr/call/plaincall/loggerservice.logerror.dwr=IS_AUTHENTICATED_ANONYMOUSLY + /**=IS_AUTHENTICATED_REMEMBERED + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-captcha.xml b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-captcha.xml new file mode 100755 index 00000000..d7ae09ab --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-captcha.xml @@ -0,0 +1,129 @@ + + + + + + + + + 0 + 150 + + + + + 0 + 150 + + + + + 0 + 150 + + + + + 255 + 255 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-dao.xml b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-dao.xml new file mode 100644 index 00000000..c84a871b --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-dao.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + com/wisemapping/model/Colaborator.hbm.xml + com/wisemapping/model/MindMap.hbm.xml + com/wisemapping/model/MindmapUser.hbm.xml + com/wisemapping/model/UserLogin.hbm.xml + com/wisemapping/model/MindmapNative.hbm.xml + com/wisemapping/model/MindMapHistory.hbm.xml + + + + + ${database.hibernate.dialect} + + + + + + + + + + + + + + + + + + + + + + + + + PROPAGATION_REQUIRED + + + + + + + + + + diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-model.xml b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-model.xml new file mode 100644 index 00000000..002aa249 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-model.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml new file mode 100755 index 00000000..7bb920c8 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + getMindmapUserBy + getMindmapById + + + + + + + + + + + update* + add* + remove* + remove* + + + + + + + + + + + + + diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml new file mode 100755 index 00000000..c02cd1e6 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + PROPAGATION_REQUIRED + + + + + + + + + + + + + + + txInterceptor + viewSecurityAdvisor + updateSecurityAdvisor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + ${mail.smtp.socketFactory.port} + javax.net.ssl.SSLSocketFactory + false + false + + + + + + + + + + + + + + + + + + + + + + resource.loader=class + class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader + + + + diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml new file mode 100644 index 00000000..785b9ca1 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml @@ -0,0 +1,367 @@ + + + + + + + + + / + /index.jsp + /c/home.htm + /c/login.htm + /c/userRegistration.htm + /c/captcha.htm + /c/publicView.htm + /c/export.htm + /c/search.htm + /c/keyboard.htm + /c/renameMap.htm + /c/embeddedView.htm + + + + + + + + + + browserNotSupported + + securityError + emailNotExistsError + + + + + + + + + + + + + + + + + + + + + + messages + + + + + + + + + + + tryEditor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + settings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mindmapController + userController + sharingController + homeController + loginController + captchaController + forgotPasswordController + activationController + changePasswordController + editorController + cookerController + settingsController + exportController + publishController + editProfileController + tagsController + searchController + keyboardController + publicView + embeddedView + renameMapController + importMapController + newMapController + historyController + + + + + + + + + + + + /WEB-INF/defs/definitions.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-ws-servlet.xml b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-ws-servlet.xml new file mode 100644 index 00000000..ddbea891 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/WEB-INF/wisemapping-ws-servlet.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + com.wisemapping.ws.LoadMindmapRequest + com.wisemapping.ws.LoadMindmapResponse + com.wisemapping.ws.AddMindmapRequest + com.wisemapping.ws.AddMindmapResponse + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/css/blank.gif b/trunk/wise-webapp/src/main/webapp/css/blank.gif new file mode 100644 index 00000000..75b945d2 Binary files /dev/null and b/trunk/wise-webapp/src/main/webapp/css/blank.gif differ diff --git a/trunk/wise-webapp/src/main/webapp/css/bubble.css b/trunk/wise-webapp/src/main/webapp/css/bubble.css new file mode 100644 index 00000000..f3eb5845 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/css/bubble.css @@ -0,0 +1,234 @@ +.bubbleContainer { + position:absolute; + z-index:50; + opacity:0; + width:auto; + overflow:hidden; +} + +.bublePartContainer { + clear:both; +} + +.bubblePart { + float:left; +} + +.bubbleLeft { + background: transparent url(../images/bubbleTip_left.png) top left; + width:12px; + height:4px; +} + +.bubbleCenter { + background-color:#362d2e; + text-align:center; + z-index:60; +} + +.bubbleRight { + background: transparent url(../images/bubbleTip_right.png) top left; + width:23px; + height:4px; +} + +.bubbleTopLeft { + background: transparent url(../images/bubbleTip_corner_top_left.png) top left; + width:12px; + height:12px; +} + +.bubbleHintTopLeft { + background: transparent url(../images/bubbleTip_pico_corner_top_left.png) top left; + width:12px; + height:57px; +} + +.bubbleTopRight { + background: transparent url(../images/bubbleTip_corner_top_right.png) top left; + width:23px; + height:12px; +} + +.bubbleHintTopRight { + background: transparent url(../images/bubbleTip_pico_corner_top_right.png) top left; + width:23px; + height:57px; +} + +.bubbleTop { + background: transparent url(../images/bubbleTip_top.png) top left; + height:12px; + width:4px; +} + +.bubbleHintTop { + background: transparent url(../images/bubbleTip_pico_top.png) top left; + height:57px; + width:4px; +} + +.bubbleBottomLeft { + background: transparent url(../images/bubbleTip_corner_bottom_left.png) top left; + width:12px; + height:26px; +} + +.bubbleHintBottomLeft { + background: transparent url(../images/bubbleTip_pico_corner_bottom_left.png) top left; + width:12px; + height:62px; +} + +.bubbleBottomRight { + background: transparent url(../images/bubbleTip_corner_bottom_right.png) top left; + width:23px; + height:26px; +} + +.bubbleHintBottomRight { + background: transparent url(../images/bubbleTip_pico_corner_bottom_right.png) top left; + width:23px; + height:62px; +} + +.bubbleBottom { + background: transparent url(../images/bubbleTip_bottom.png) top left; + height:26px; + width:4px; +} + +.bubbleHintBottom { + background: transparent url(../images/bubbleTip_pico_bottom.png) top left; + height:62px; + width:4px; +} +.bubbleBottomHint { + background: transparent url(../images/bubbleTip_bottom_pico.png) top left; + width:58px; + height:62px; +} + +.bubbleTopHint { + background: transparent url(../images/bubbleTip_top_pico.png) top left; + width:58px; + height:57px; +} + +.bubbleLeftBlue { + background: transparent url(../images/bubbleTip_left_blue.gif) top left; + width:12px; + height:4px; +} + +.bubbleCenterBlue { + background-color:#BCCCE1; + z-index:60; + overflow:'hidden'; +} + +.bubbleRightBlue { + background: transparent url(../images/bubbleTip_right_blue.gif) top left; + width:23px; + height:3px; +} + +.bubbleTopLeftBlue { + background: transparent url(../images/bubbleTip_corner_top_left_blue.gif) top left; + width:12px; + height:18px; +} + +.bubbleHintTopLeftBlue { + background: transparent url(../images/bubbleTip_pico_corner_top_left_blue.gif) top left; + width:13px; + height:61px; +} + +.bubbleTopRightBlue { + background: transparent url(../images/bubbleTip_corner_top_right_blue.gif) top left; + width:23px; + height:18px; +} + +.bubbleHintTopRightBlue { + background: transparent url(../images/bubbleTip_pico_corner_top_right_blue.gif) top left; + width:23px; + height:61px; +} + +.bubbleTopBlue { + background: transparent url(../images/bubbleTip_top_blue.gif) top left; + height:18px; + width:3px; +} + +.bubbleHintTopBlue { + background: transparent url(../images/bubbleTip_pico_top_blue.gif) top left; + height:61px; + width:3px; +} + +.bubbleBottomLeftBlue { + background: transparent url(../images/bubbleTip_corner_bottom_left_blue.gif) top left; + width:13px; + height:32px; +} + +.bubbleHintBottomLeftBlue { + background: transparent url(../images/bubbleTip_pico_corner_bottom_left_blue.gif) top left; + width:12px; + height:62px; +} + +.bubbleBottomRightBlue { + background: transparent url(../images/bubbleTip_corner_bottom_right_blue.gif) top left; + width:23px; + height:32px; +} + +.bubbleHintBottomRightBlue { + background: transparent url(../images/bubbleTip_pico_corner_bottom_right_blue.gif) top left; + width:23px; + height:62px; +} + +.bubbleBottomBlue { + background: transparent url(../images/bubbleTip_bottom_blue.gif) top left; + height:32px; + width:3px; +} + +.bubbleHintBottomBlue { + background: transparent url(../images/bubbleTip_pico_bottom_blue.gif) top left; + height:62px; + width:3px; +} +.bubbleBottomHintBlue { + background: transparent url(../images/bubbleTip_bottom_pico_blue.png) top left; + width:58px; + height:62px; + behavior: url( ../css/iepngfix.htc ); +} + +.bubbleTopHintBlue { + background: transparent url(../images/bubbleTip_top_pico_blue.png) top left; + width:58px; + height:61px; + behavior: url( ../css/iepngfix.htc ); +} + +.btn-primary { + background: #3399CC; + border: 1px solid #006699; + color: #FFFFFF; + font-family: arial, helvetica, sans-serif; + font-size: 72%; + font-style: normal; + font-variant: normal; + font-weight: normal; + line-height: normal; + overflow: visible; + padding: 2px 8px 1px; + vertical-align: middle; +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/css/common.css b/trunk/wise-webapp/src/main/webapp/css/common.css new file mode 100644 index 00000000..38296247 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/css/common.css @@ -0,0 +1,587 @@ +body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, textarea, p, blockquote, th, td { + margin: 0; + padding: 0; +} + +table { + border-collapse: collapse; + border-spacing: 0; +} + +fieldset, img { + border: 0; +} + +address, caption, cite, code, dfn, em, strong, th, var { + font-style: normal; + font-weight: normal; +} + +ol, ul { + list-style: none; +} + +caption, th { + text-align: left; +} + +h1, h2, h3, h4, h5, h6 { + font-size: 100%; + font-weight: normal; +} + +q:before, q:after { + content: ''; +} + +abbr, acronym { + border: 0; +} + +/** + * Percents could work for IE, but for backCompat purposes, we are using keywords. + * x-small is for IE6/7 quirks mode. + * + */ +body { + font: 13px arial, helvetica, clean, sans-serif; +* font-size : small; +* font : x-small; +} + +table { + font-size: inherit; + font: 100%; +} + +/** + * 99% for safari; 100% is too large + */ +select, input, textarea { + font: 99% arial, helvetica, clean, sans-serif; +} + +/** + * Bump up !IE to get to 13px equivalent + */ +pre, code { + font: 115% monospace; +* font-size : 100 %; +} + +/** + * Default line-height based on font-size rather than "computed-value" + * see: http://www.w3.org/TR/CSS21/visudet.html#line-height + */ + +body * { + line-height: 1.22em; +} + +* { + margin: 0; + padding: 0; +} + +body { + font: normal 80% "trebuchet ms", verdana, arial, helvetica, sans-serif; + background-color: #fff; +} + +img { + border: 0; +} + +form { + padding: 0px; + margin: 0px; +} + +p { + margin: 5px 0 5px 0; +} + +ul { + list-style-position: inside; +} + +a:link, a:visited { + font: bold 100%; + text-decoration: underline; + color: black; +} + +a:hover, a:active { + font: bold 100%; + text-decoration: underline; + color: black; +} + +h2 { + font: 160%; + color: #8e9181; +} + +h1 { + font: normal 180%; + color: white; + padding-bottom: 2px; +} + +h3 { +/* use as subhead on main body */ + clear: left; + font: normal 130%; + color: #6b6f5b; +} + +h4 { +/* use as headers in footer */ + font: bold 120%; + border-bottom: 1px solid #8e9181; + color: #e2e3dd; + padding-bottom: 10px; + width: 400px; +} + +#centerContent { + text-align: center; +} + +/* HEADER STYLES */ + +#header { + margin-top: 2px; + height: 78px; + width: 100%; + background: white; + border-bottom: 1px solid #bbb4d6; + position: absolute; + top: 0; + left: 0; +} + +#headerToolbar { + height: 25px; + width: 100%; + background-color: #171a17; + border-top: 1px solid #999999; + border-bottom: 1px solid #424141; + color: white; + font-size: small; + font-style: normal; +} + +#headerContent { + width: 800px; + height: 78px; + position: relative; + top: 0; + left: 0; + margin: auto; +} + +#headerLogo { + margin-top: 8px; + height: 80px; + width: 200px; + background-image: url( "../images/logo-small.png" ); + behavior: url( ../css/iepngfix.htc ); + background-repeat: no-repeat; + position: absolute; + top: 0; + left: 0; +} + +#headerPBetaLogo { + margin-top: 30px; + height: 35px; + width: 150px; + background-image: url( "../images/beta.png" ); + behavior: url( ../css/iepngfix.htc ); + background-repeat: no-repeat; + position: absolute; + top: -4px; + left: 140px; +} + +#headerSlogan { + position: absolute; + border-left: 1px dashed gray; + margin-top: 8px; + height: 1em; + width: 100px; + top: 47px; + left: 137px; + white-space: nowrap; + padding-left: 7px; + font-weight: bold; + vertical-align: middle; +} + +#headerButtons { + position: absolute; + top: 65px; + left: 150px; +} + +#newsLink, #blogLink, #aboutLink, #newsLink, #faqLink, #feedbackLink, #supportLink, #logoutLink{ + float: right; + z-index: 300; +} + +div#headerButtons a { + float: left; + color: #6F6F6F; + padding: 0 10px; + text-decoration: none; + font-weight: bold; + font-size: 120%; + white-space: nowrap; +} + +div#headerTitle { + float: left; + font-weight: bold; + font-size: 15px; + margin-right: 5px; + margin-left: 5px; +} + +div#printHeader { + background-color: black; + height: 35px; + color: white; +} + +span#headerSubTitle { + font-weight: lighter; + font-size: 12px; +} + +div#headerButtons a:hover { +/*text-decoration: underline;*/ + color: #7e72ad; +} + +div#headerButtons activelink a, div#headerButtons activelink a:hover { + text-decoration: none; + border-top: 0; + border-bottom: 0; +} + +#signUpHeader .sb-inner { + background-color: white; +} + +#signUpHeader { + padding-right: 8px; + padding-top: 4px; + position: absolute; + right: 0; + z-index: 50; + text-align: center; +} + +#signUpHeader a, #signUpHeader a:hover { + font-size: 100%; + color: #BBB4D6; + text-decoration: underline; +} + +#editorHeader { + height: 40px; + width: 100%; + background: white; + border-bottom: 1px solid #bbb4d6; + position: absolute; + top: 0; + left: 0; +} + +#editorHeader #headerToolbar { + height: 40px; + width: 100%; + background-color: #171a17; + border-top: 1px solid #999999; + border-bottom: 1px solid #424141; + color: white; + font-size: small; + font-style: normal; +} + +div#editorHeader div#headerTitle { + float: left; + font-weight: bold; + font-size: 22px; + margin-right: 5px; + margin-left: 5px; +} + +div#editorHeader span#headerSubTitle { + font-weight: lighter; + font-size: 12px; +} + +div#editorHeader div#headerActions { + padding-right: 8px; + padding-top: 4px; + position: absolute; + right: 0; + top: 4px; + z-index: 50; +} + +div#editorHeader div#headerActions a:hover, div#headerActions a:active, div#headerActions a:link, div#headerActions a:visited { + color: white; +} + +#footer { + width: 100%; + border-top: 1px solid #8e9181; + text-align: center; + font-size: 90%; + background-color: white; + float: left; +} + +div#printFooter { + height: 60px; + width: 100%; + background: #E5E5E5; + border-top: 1px solid #bbb4d6; +} + +div#printLogo { + height: 50px; + width: 80px; + float: right; + margin: 1px; + background: url( ../images/logo-vsmall.png ) no-repeat right top; + behavior: url( ../css/iepngfix.htc ); +} + +.btn-primary { + background: #3399CC; + border: 1px solid #006699; + color: #FFFFFF; + font-family: arial, helvetica, sans-serif; + font-size: 92%; + font-style: normal; + font-variant: normal; + font-weight: bold; + line-height: normal; + overflow: visible; + padding: 2px 8px 1px; + vertical-align: middle; +} + +div#paypal { + float: left; + margin: -29px; +} + +.errorMsg { + color: #990000; + font-size: 90%; + font-weight: bold; + padding-left: 5px; +} + +#headerLogo { + cursor: pointer; +} + +#headerLoading { + padding-left: 40px; + background: url( '../images/ajax-loader.gif' ) #BBB4D6 no-repeat left; + position: absolute; + right: 3px; + top: 5px; + width: 75px; + height: 20px; + color: white; + font-weight: bold; + border: 1px solid whitesmoke; + background-position: 5px 2px; + visibility: hidden; +} + +div#headerActions { + padding-right: 8px; + padding-top: 4px; + position: absolute; + right: 0; + z-index: 50; +} + +div#headerActions a:hover, div#headerActions a:active, div#headerActions a:link, div#headerActions a:visited { + color: white; +} + +#join .sb-inner { + background: #9a8fc3; +} + +#join .sb-shadow { + background: white; +} + +#join .sb-border { + background: #A29BBF; +} + +/*--- Modal Dialog Form ---*/ +div.modalDialog { + padding: 15px 30px; +} + +div.modalDialog td { + padding: 3px; +} + +div.modalDialog h1 { + color: #093A9D; + font-size: 200%; + margin-bottom: 5px; + font-weight: bold; +} + +div.modalDialog h2 { + color: gray; + font-size: 110%; + margin: 9px 0px; +} + +div.modalDialog h5 { + color: gray; + font-size: 90%; /*border-bottom: 1px dashed #BBB4D6;*/ +} + +/*--- End Modal Dialog Form ---*/ + +/*-- Main Page Style -- */ +div.pageBody { + margin: 10px auto; + width: 800px; + min-height: 500px; +} + +div.pageBodyContent { + padding-top: 30px; +} + +div.pageBodyContent h1 { + color: #093A9D; + font-size: 200%; + margin-bottom: 5px; + font-weight: bold; +} + +div.pageBodyContent h2 { + color: gray; + font-size: 150%; + border-bottom: 1px dashed #BBB4D6; + margin: 20px 0px; +} + +div.pageBodyContent ul { + padding: 5px; +} + +div.pageBodyContent li { + list-style-type: disc; + margin-left: 12px; +} + +/*-- End Main Page Style -- */ + +/* Share Styles */ +#userEmails { + float: left; + width: 50%; + padding: 5px; +} + +#userEmails textarea { + width: 100%; +} + +#currentUsers { + float: left; + width: 40%; + height: 400px; + padding: 5px; + padding-left: 15px; + margin-left: 15px; + border-left: 1px dotted gray; +} + +#currentUsers table { + width: 100%; +} + +#invitation { + border: 1px dotted gray; +} + +td.formLabel { + text-align: right; + padding: 2px 10px; + white-space: nowrap; + font-weight: bolder; + vertical-align: top; +} + +span.fieldRequired { + font-weight: bold; + color: orangered; + margin: 0px 4px; +} + +#keyboardTable { + clear: both; + width: 100%; + height: 300px; + overflow: auto; + border: 0px solid gray; + background-color: white; + z-index: 2; + position: relative; +} + +#keyboardTable table { + width: 100%; + border: 0px solid gray; +} + +#keyboardTable thead { + background-color: #093A9D; + font-size: 12px; + font-weight: normal; + padding: 5px; +} + +#keyboardTable td { + border-bottom: 1px solid #EEEEEE; + color: #5f5f5f; + font-size: 12px; + padding: 3px; +} + +#keyboardTable th { + color: white; + border-right: 1px dotted #ffffff; + font-weight: bold; + text-align: center; + font-size: 12px; + padding: 5px; +} + +#keyboardTable tbody tr:hover { + background-color: #E2f0f6; +} + +#keyboardTable tr { + padding: 5px; +} diff --git a/trunk/wise-webapp/src/main/webapp/css/commonLibs.css b/trunk/wise-webapp/src/main/webapp/css/commonLibs.css new file mode 100644 index 00000000..6bb678ff --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/css/commonLibs.css @@ -0,0 +1,73 @@ +/*Moodal Dialog styles*/ + +/* moodalbox CSS */ + +div#mb_overlay { + position: absolute; + left: 0; + width: 100%; + background-color: #000; + cursor: pointer; + z-index: 98; +} + +div#mb_center, div#mb_bottom { + position: absolute; + left: 50%; + overflow: hidden; + background-color: #DDD; + z-index: 98; +} + +div#mb_center { + background-color: #FFF; +} + +div#mb_contents { + width: 400px; + height: 400px; + border: 10px solid #DDD; + overflow: auto; + background-color: #FFF; + visibility: hidden; +} + +.mb_loading { + background: #DDD url( ../images/loading.gif ) no-repeat center center; +} + +#mb_error { + font-size: 1.2em; + color: #CD0000; + font-weight: bold; + text-align: center; + padding: 0.5em; + font-family: Verdana, Helvetica, sans-serif; +} + +#mb_error em { + font-size: 0.8em; +} + +div#mb_bottom { + font-family: Verdana, Helvetica, sans-serif; + font-size: 10px; + color: #666; + line-height: 1.4em; + text-align: left; + border: 10px solid #DDD; + border-top-style: none; +} + +a#mb_close_link { + display: block; + float: right; + width: 66px; + height: 22px; + background: transparent url( ../images/closelabel.gif ) no-repeat center; + margin: 5px 0; +} + +div#mb_caption { + margin-right: 71px; +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/css/editor.css b/trunk/wise-webapp/src/main/webapp/css/editor.css new file mode 100644 index 00000000..8a716d83 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/css/editor.css @@ -0,0 +1,720 @@ +@import "common.css"; +@import "commonLibs.css"; +@import "thirdparty.css"; + +html { + overflow: hidden; +} + +#waitDialog { + position: absolute; + top: 10px; + left: 10px; + height: 200px; +} + +#firstHeader { + width: 100%; +} + +#subHeader { + position: absolute; + width: 100%; + height: 55px; + top: 30px; +} + +#loadingContainer { + position: relative; + top: 80px; + height: 120px; /*background: whitesmoke;*/ + background: #FEFEFE; + opacity: .99; + padding: 15px; + width: 100%; + border: 1px solid darkgray; + +} + +#loadingContainer .loadingText { + position: relative; + top: 50%; + margin-top: -35px; + font-size: 30px; + font-weight: bold; + vertical-align: text-bottom; + height: 30px; + float: left; +} + +#loadingContainer .loadingIcon { + position: relative; + background: url( ../images/loadingIcon.gif ) no-repeat; + top: 50%; + margin-top: -65px; + height: 100px; + width: 121px; + float: left; + clear: both; +} + +#infoContainer { + float: left; +} + +#infoContainer { + float: left; + padding-left: 5px; +} + +#title { + position: relative; + left: 120px; + top: 80px; +} + +#operationsContainer { + font-size: 12px; + float: right; + padding: 0 5px; +} + +#operationsContainer a { + padding: 0px 5px; +} + +#user { + font-weight: bold; + margin-right: 5px; +} + +#toolbar { + width: 100%; + height: 25px; + color: #ffffff; + border-bottom: 2px solid black; + position: absolute; + top: 35px; +} + +div#toolbar .buttonContainer { + height: 44px; + float: left; + color: black; +} + +.buttonContainer fieldset { + border: 1px solid #BBB4D6; + padding: 2px; + margin: 1px; + padding-bottom:4px; +} + +.buttonContainer legend { + padding: 0.2em 0.5em; + border: 1px solid #BBB4D6; + background-color: #F5F5F5; + color: #BBB4D6; + font-size: 11px; + text-align: right; + margin: 0px; + -moz-margin-start:7px; + -moz-margin-end:7px; +} + +div#toolbar .button { + width: 32px; + height: 36px; + float: left; + margin: 0px 2px 2px 2px; + cursor: pointer; + text-align:center; +} + +div#toolbar .comboButton { + width: 34px; +} + +div#toolbar .button:hover { + width: 32px; + height: 36px; + float: left; + margin: 0px 1px; + cursor: pointer; + border: 1px solid black; + border-top-color: white; + border-left-color: white; +} + +div#toolbar .comboButton:hover { + width: 34px; +} + +div#toolbar .button img{ + width: 30px; + height: 30px; + border:0; +} + +div#toolbar .toolbarLabel{ + position:relative; + top:55%; + text-align:center; + width:34px; + height:36px; + font-size:10px; +} + + +.mapSeparator { + width: 1px; + height: 20px; + background-color: #166D66; + float: left; + margin: 5px 3px; +} + +div#file, div#zoom, div#node, div#font, div#share { + position:absolute; + top:-6px; + left:3px; +} + +div#zoom { + left:229px; +} + +div#node { + left:311px; +} + +div#font { + left:619px; + /*left:581px;*/ +} + +div#share { + left:815px; + /*left:777px;*/ +} + +div#saveButton { + background: url( ../images/save.png) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +div#discardButton { + background: url( ../images/close.png) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +div#history { + background: url( ../images/history.png) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +div#print { + background: url( ../images/file_printer.png) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +div#undoEdition { + background: url( ../images/file_undo_dis.png) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +div#redoEdition { + background: url( ../images/file_redo_dis.png) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +#export { + background: url( ../images/file_export.png) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +div#zoomIn { + background: url( ../images/zoom_in.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +#zoomOut { + background: url( ../images/zoom_out.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +#addTopic { + background: url( ../images/topic_add.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +#deleteTopic { + background: url( ../images/topic_delete.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +div#topicColor { + background: url( ../images/topic_bgcolor.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); + z-index: 4; +} + +div#topicIcon { + background: url( ../images/topic_icon.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); + z-index: 4; +} + +div#topicNote { + background: url( ../images/note.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); + z-index: 4; +} + +div#topicLink { + background: url( ../images/topic_link.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); + z-index: 4; +} + +div#topicNote { + background-image: url( ../images/note.png ); + behavior: url( ../css/iepngfix.htc ); + z-index: 4; +} + +#topicBorder { + background: url( ../images/topic_border.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); + width: 30px; +} + +#fontFamily { + background: url( ../images/font_type.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +#topicShape { + background: url( ../images/topic_shape.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); + width: 30px; +} + +#fontBold { + background: url( ../images/font_bold.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +#fontItalic { + background: url( ../images/font_italic.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +div#fontColor { + background: url( ../images/font_color.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); + z-index: 4; +} + +#fontSize { + float: left; + background: url( ../images/font_size.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +#font-size { + font-size: 10px; +} + +.wiseToolbarButton { + float: left; + height: 16px; + cursor: pointer; + font-size: 10px; + font-weight: bold; + margin-right: 15px; +} + +#shareIt { + background: url( ../images/collab_share.png ) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +#publishIt { + background: url( ../images/collab_publish.png) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); + +} + +#tagIt { + background: url( ../images/collab_tag.png) no-repeat center top; + behavior: url( ../css/iepngfix.htc ); +} + +#colorPalette { + border: 1px solid #bbb4d6; + display: none; + position: absolute; + z-index: 4; + width: 160px; + top: 89px; +} + +#paletteHeader { + background-color: #E5E5E5; + height: 4px; +} + +.toolbarPanel { + color: black; + border: 1px solid #bbb4d6; + background: #E5E5E5; + display: none; + position: absolute; + z-index: 4; + top: 71px; +} + +div.toolbarPanelLink { + cursor: pointer; + font-size: 14px; + color: black; + font-weight: bold; + padding: 0 3px 0px 4px; + margin: 1px; +} + +div.toolbarPanelLink { + cursor: pointer; + font-size: 12px; + font-weight: bold; + padding: 0px 3px 0px 4px; + margin: 1px; +} + +div.toolbarPanelLink:hover { + cursor: pointer; + font-weight: bold; + background-color: #c3def5; +} + +div.toolbarPanelLinkSelectedLink { + cursor: pointer; + color: white; + font-weight: bold; + padding: 0px 3px 0px 4px; + margin: 1px; + background-color: #c3def5; +} + +div#actionsContainer { + position: absolute; + z-index: 50; + top: 35px; + width: 190px; + right: 0; + margin: 10px; + float:left; +} + +#actionsContainer .button { + float: right; + font-size: 12px; + font-weight: bold; + white-space: nowrap; + color: #ffffff; + cursor: pointer; + margin: 2px; + z-index: 4; +} + +#actionsContainer .button:hover { + color: blue; +} + +#actionsContainer .mainButton { + float: right; + font-size: 12px; + font-weight: bold; + white-space: nowrap; + color: #ffffff; + cursor: pointer; + margin: 2px; + z-index: 4; +} + +#actionsContainer a { + text-decoration: none; +} + + +#actionsContainer .buttonStart { + width: 6px; + height: 25px; + background: url( ../images/btnStart2.png ) no-repeat left top; + behavior: url( ../css/iepngfix.htc ); + float: left; +} + +#actionsContainer .buttonBody { + background: url( ../images/btnBody2.png ); + float: left; + height: 18px; + padding: 0px 5px; + padding-top: 5px; + text-align: center; + color: black; +} + +#actionsContainer .buttonEnd { + width: 7px; + height: 23px; + background: url( ../images/btnEnd2.png ) no-repeat right top; + behavior: url( ../css/iepngfix.htc ); + float: left; +} + +/* ------------- Footer Styles -------------------------*/ +div#footerEditor { + position: absolute; + height: 60px; + width: 100%; + background: #E5E5E5; + border-top: 1px solid #bbb4d6; + bottom: 0; +} + +#logo { + height: 50px; + width: 80px; + float: right; + margin: 5px; + background: url( ../images/logo-vsmall.png ) no-repeat right top; + behavior: url( ../css/iepngfix.htc ); +} + +#footerEditor .msgLoggerContainer { + position: relative; + width: 550px; + height: 36px; + left: 50%; + margin-left: -300px; + top: 10px; + opacity: 0; + visibility: hidden; +} + +div#msgStart { + float: left; + height: 36px; + width: 16px; + background: url( ../images/footerStart.png ) no-repeat right top; +} + +div#msgEnd { + float: left; + height: 36px; + width: 16px; + background: url( ../images/footerEnd.png ) no-repeat right top; + +} + +div#msgLogger { + float: left; + height: 36px; + width: 500px; + background: url( ../images/footerBody.png ) repeat-x right top; + text-align: center; + white-space: nowrap; + padding: 5px; + font-size: 13px; + font-weight: bold; +} + +/** Tab labels */ +div#tabsHolder { + width: 100%; + height: 20px; +} + +div#tabs { + float: left; +} + +div.tabContent { + clear: left; + width: 100%; + height: 63px; + border-bottom: 1px solid #bbb4d6; + border-top: 1px solid #bbb4d6; + background: #E5E5E5; + display: none; + position: absolute; + left: 0; +} + +ol#toc { + height: 2em; + list-style: none; + margin: 0; + padding: 0; +} + +ol#toc li { + float: left; + margin: 0 1px 0 0; + border: 0; +} + +ol#toc a { + background: #fff url( ../images/tab4.png ); + color: #008; + display: block; + float: left; + height: 25px; + padding-left: 10px; + text-decoration: none; +} + +ol#toc a:hover { + background-color: #fff; + background-position: 0 -121px; +} + +ol#toc a:hover span { + background-position: 100% -121px; +} + +ol#toc li.current a { + background-color: #fff; + background-position: 0 -61px; + color: #008; + font-weight: bold; +} + +ol#toc li.current span { + background-position: 100% -61px; +} + +ol#toc span { + background: #fff url( ../images/tab4.png ) 100% 0; + display: block; + line-height: 2em; + padding-right: 10px; +} + +#mindplot { + position: relative; + top: 103px; + left: 0; + width: 100%; + border: 0; +} + +#workspaceContainer { + background: url( ../images/grid.gif ) bottom left repeat !important; + +} + +div#mapInfo { + float: right; + color: #008; + padding-right: 5px; + height: 25px; + white-space: nowrap; +} + +span#mapName { + font-size: 15px; + font-weight: bold; +} + +span#lastSaved { + font-size: 10px; +} + +.label { + border: none; + color: #ffffff; + font-weight: bold; +} + +.label :hover { + cursor: pointer; +} + +#tryEditorWarning { + position: absolute; + margin: 20px auto; + width: 300px; + right: 10px; + top: 100px; + padding: 20px; + opacity: 0.9; + cursor: move; + background-color: #69686F; + filter: alpha( opacity = 90 ); + color:#000c8f; +} + +#tryEditorWarning a { + color: white; + font-weight: bold; +} + +#tryEditorWarning h1 { + color: whitesmoke; + font-weight: bold; + margin-bottom: 5px; + font-size: 15px; +} + +div#helpContainer { + position: absolute; + margin: 20px auto; + z-index: 3; + opacity: 0.9; + width: 220px; + top: 100px; + left: 10px; + color: #000c8f; + padding: 20px; + cursor: move; + background-color: #69686F; + filter: alpha( opacity = 90 ); +} + +div#helpContent h1 { + font-weight: bold; + color: whitesmoke; + font-size: 15px; +} + +div#helpContent h2 { + font-weight: bold; + padding: 20px 0px 10px 0px; + color: #bfbfbf; +} + +div.close { + position: absolute; + height: 12px; + width: 12px; + top: 7px; + right: 10px; + cursor: pointer; + background: url( ../images/close12_1.gif ) bottom left no-repeat !important; +} + +div#helpContent li { + font-family: arial, helvetica, sans-serif; + list-style-type: disc; + margin-left: 12px; + font-size: 11px; +} + +div#small_error_icon { + padding-left: 18px; + min-height: 16px; + background: url( ../images/error_icon.png ) bottom left no-repeat !important; +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/css/embedded.css b/trunk/wise-webapp/src/main/webapp/css/embedded.css new file mode 100644 index 00000000..ae997af1 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/css/embedded.css @@ -0,0 +1,143 @@ +@import "common.css"; +@import "thirdparty.css"; + +html { + overflow: hidden; +} + +#waitDialog { + position: absolute; + top: 10px; + left: 10px; + height: 100px; +} + +#firstHeader { + width: 100%; +} + +#subHeader { + position: absolute; + width: 100%; + height: 55px; + top: 30px; +} + +#loadingContainer { + position: relative; + top: 80px; + height: 120px; /*background: whitesmoke;*/ + background: #FEFEFE; + opacity: .99; + padding: 15px; + width: 100%; + border: 1px solid darkgray; + +} + +#loadingContainer .loadingText { + position: relative; + top: 50%; + margin-top: -35px; + font-size: 30px; + font-weight: bold; + vertical-align: text-bottom; + height: 30px; + float: left; +} + +#loadingContainer .loadingIcon { + position: relative; + background: url( ../images/ajax-loader2.gif ) no-repeat; + top: 25px; + height: 100px; + width: 70px; + float: left; + clear: both; +} + +/* ------------- Footer Styles -------------------------*/ +div#embFooter { + position: absolute; + height: 35px; + width: 100%; + bottom: 0; + left: 0px; + border-top: 1px solid black; + background: #E5E5E5; +} + +div#logo { + height: 65px; + width: 80px; + position: absolute; + background: url( ../images/logo-vvsmall.png ) no-repeat right top; + behavior: url( ../css/iepngfix.htc ); + right: 10px; + top: -10px; +} + +.button { + width: 18px; + height: 16px; + float: left; + cursor: pointer; + white-space: nowrap; +} + +.button:hover { + float: left; + cursor: pointer; + border: 1px solid black; + border-top-color: white; + border-left-color: white; +} + +#zoomIn { + background: url( ../images/zoom_in.png ) no-repeat left top;; + behavior: url( ../css/iepngfix.htc ); + margin-top: 10px; + margin-left: 10px; +} + +#zoomOut { + background: url( ../images/zoom_out.png ) no-repeat left top;; + behavior: url( ../css/iepngfix.htc ); + margin-top: 10px +} + +div#mindplot { + position: relative; + top: 0; + left: 0; + width: 100%; +} + +#workspaceContainer { + background: url( ../images/grid.gif ) bottom left repeat !important; + +} + +#workspaceContainer { + background: url( ../images/grid.gif ) bottom left repeat !important; + +} + +div#mapContainer { + border-bottom: 1px solid black; + padding-bottom: 40px; + height: 400px; + width: 100%; +} + +div#mapDetails { + float: right; + padding-top: 10px; + margin-right: 100px; +} + +div#mapDetails .title { + font-weight: bold; + margin-left: 10px; + margin-right: 3px; +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/css/iepngfix.htc b/trunk/wise-webapp/src/main/webapp/css/iepngfix.htc new file mode 100644 index 00000000..6d15f325 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/css/iepngfix.htc @@ -0,0 +1,68 @@ + + + + + \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/css/mymaps.css b/trunk/wise-webapp/src/main/webapp/css/mymaps.css new file mode 100644 index 00000000..286779e8 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/css/mymaps.css @@ -0,0 +1,272 @@ +@import "common.css"; +@import "commonLibs.css"; +@import "thirdparty.css"; + +#recentText { + width: 100px; + font-size: 12px; + font-weight: bold; + padding: 5px; + padding-left: 0; + color: #808080; +} + +#mapListContainer { + padding: 15px; + height: 400px; +} + +#recentFiles { + margin: 10px auto; + width: 900px; + height: 100%; + padding: 8px; + margin-bottom: 5px; +} + +#recentFiles a { + text-decoration: none; + color: #464545; +} + +#recentFiles a:hover { + color: #093A9D; +} + +#recentFiles .recentItemContainer { + height: 20px; + background-color: white; +} + +#recentFiles .recentItemIcon { + float: left; + width: 20px; + height: 15px; + background: url( ../images/icon_list.png ) no-repeat left; +} + +#recentFiles .recentItemTitle { + float: left; + padding-left: 0px; + padding-right: 10px; + font-size: 12px; +} + +#mydocs { + margin: 20px auto; + width: 900px; + height: 300px; + padding: 10px; + background-color: #C3DEF5; + border: 1px solid #A7C6DF; +} + +#toolbar .button { + cursor: pointer; + border: 1px solid #E5E5E5; + float: left; + padding: 5px; + margin-right: 10px; + margin-left: 5px; + background-color: #838383; + color: white; + font-weight: bold; +} + +#mydocs .button a { + color: white; + text-decoration: none; +} + +#toolbar { + clear: both; + width: 900px; + height: 35px; + vertical-align: middle; + z-index: 3; + position: relative; +} + +#toolbar .buttonContainer { + float: left; + position: relative; + top: 50%; + margin: 0px 5px; + margin-top: -12px; + height: 24px; +} + +#toolbar .dropDownContainer { + margin-top: 5px; + height: 24px; +} + +#toolbar .buttonStart { + float: left; + width: 3px; + height: 24px; + background: url( ../images/start_btn.gif ) no-repeat left; +} + +#toolbar .buttonBody { + float: left; + height: 19px; + padding: 5px 5px 0px; + background: url( ../images/body_btn.gif ); +} + +#toolbar .buttonEnd { + float: left; + width: 3px; + height: 24px; + background: url( ../images/end_btn.gif ) no-repeat left; +} + +#actionsBtn { + float: left; + position: relative; + top: 50%; + margin: 0px 5px; + margin-top: -15px; + width: 78px; + height: 30px; +} + +#newMapButton { + float: left; + position: relative; + top: 50%; + margin: 0px 5px; + margin-top: -15px; + width: 78px; + height: 30px; +} + +.menuItem { + color: black; + padding: 2px; + cursor: pointer; + text-align: center; +} + +#docTable .button { + cursor: pointer; +} + +#docTable { + clear: both; + width: 100%; + height: 250px; + overflow: auto; + border: 0px solid gray; + background-color: white; + z-index: 2; + position: relative; +} + +#docTable table { + width: 100%; + border: 0px solid gray; +} + +#docTable thead { + background-color: #093A9D; + font-size: 12px; + font-weight: normal; + padding: 5px; +} + +#docTable td { + border-bottom: 1px solid #EEEEEE; + color: #999999; + font-size: 12px; + padding: 3px; +} + +#docTable th { + color: white; + border-right: 1px dotted #ffffff; + font-weight: bold; + text-align: center; + font-size: 12px; + padding: 5px; +} + +#docTable tbody tr:hover { + background-color: #E2f0f6; +} + +#docTable tr { + padding: 5px; +} + +#docTable .mapTitle { + font-size: 13px; + color: #666666; + font-weight: bold; +} + +#docTable .mapTags { + font-size: 11px; + color: black; +} + +.content { + background-color: white; + height: 550px; +} + +#myDocsContainer { + width: 100%; + text-align: center; + float: left; +} + +#recentItems { + height: 100%; + padding: 10px; +} + +#mapListContainer .sb-inner { + background: white; +} + +#mapListContainer .sb-shadow { + background: white; +} + +#mapListContainer .sb-border { + background: #A29BBF; +} + +#recentFiles .sb-inner { + background: #EEEEEE; +} + +#recentFiles .sb-border { + background: #E5E5E5; +} + +#toolbar .sb-border { + background: #A7C6DF; +} + +#toolbar .sb-inner { + background: #C3DEF5; +} + +#mydocs .sb-inner { + background: #C3DEF5; +} + +#mydocs .sb-border { + background: #A7C6DF; +} + +#recentItems .sb-inner { + background: white; +} + +#recentItems .sb-border { + background: #E5E5E5; +} \ No newline at end of file diff --git a/trunk/wise-webapp/src/main/webapp/css/thirdparty.css b/trunk/wise-webapp/src/main/webapp/css/thirdparty.css new file mode 100644 index 00000000..77171f92 --- /dev/null +++ b/trunk/wise-webapp/src/main/webapp/css/thirdparty.css @@ -0,0 +1,800 @@ +/************************************************************************************ +* Windoo Wise CSS +******************************************/ +div.windoo { + position: absolute; + overflow: hidden; +} + +div.windoo .windoo-drag { + cursor: move; +} + +div.windoo div.windoo-body { + position: relative; + overflow: auto; + width: auto; + padding: 0; + text-align: left; +} + +div.windoo +{ + border: 8px solid #dddddd; +} + +div.windoo div.windoo-frame { + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + line-height: 0; + background:white; +} + +div.windoo div.windoo-frame .strut { + line-height: 0; + font-size: 0px; +} + +div.windoo div.windoo-frame .title { + overflow: hidden; +} + +div.windoo div.windoo-frame .title .title-text { + width: 100%; + overflow: hidden; +} + +/* Windoo buttons */ +div.windoo a.windoo-button { + position: absolute; + display: block; + text-align: center; + text-decoration: none; + overflow: hidden; + text-indent: -1000em; + outline: none; + z-index: 10; +} + +/* Minimized and maximazed states */ +div.windoo-maximized .windoo-sizer, div.windoo-minimized .windoo-sizer, div.windoo-rolled .windoo-sizer, div.windoo-minimized a.windoo-button { + display: none !important; +} + +div.windoo-minimized a.windoo-restore { + display: block !important; +} + +div.windoo-minimized div.windoo-body, div.windoo-minimized .windoo-pane, + div.windoo-rolled div.windoo-body, div.windoo-rolled .windoo-pane { + display: none !important; +} + +/* Windoo sizers */ +div.windoo .windoo-sizer { + position: absolute; + overflow: hidden; + background: url( '../images/s.gif' ); + z-index: 5; + -moz-user-select: none; +} + +div.windoo .windoo-north { + top: 0; + left: 0; + width: 100%; + height: 6px; + cursor: n-resize; +} + +div.windoo .windoo-south { + bottom: 0; + left: 0; + width: 100%; + height: 6px; + cursor: s-resize; +} + +div.windoo .windoo-west { + top: 0; + left: 0; + height: 100%; + width: 6px; + cursor: w-resize; +} + +div.windoo .windoo-east { + top: 0; + right: 0; + height: 100%; + width: 6px; + cursor: e-resize; +} + +div.windoo .windoo-nw, + div.windoo .windoo-ne, + div.windoo .windoo-sw, + div.windoo .windoo-se { + width: 9px; + height: 9px; +} + +div.windoo .windoo-nw { + top: 0; + left: 0; + cursor: nw-resize; +} + +div.windoo .windoo-ne { + top: 0; + right: 0; + cursor: ne-resize; +} + +div.windoo .windoo-sw { + bottom: 0; + left: 0; + cursor: sw-resize; +} + +div.windoo .windoo-se { + bottom: 0; + right: 0; + cursor: se-resize; +} + +/* Windoo ghost sizer */ +div.windoo-ghost { + border: dotted #0d0 2px; + position: absolute; + -moz-user-select: none; + -moz-box-sizing: border-box; + box-sizing: border-box; + background: transparent url( '../images/s.gif' ); +} + +/* Windoo simple shadow */ +div.windoo-shadow-simple { + /*position: absolute;*/ + /*padding: 0;*/ + /*overflow: hidden;*/ +} + +div.windoo-shadow-simple div.c { + /*width: 100%;*/ + /*height: 100%;*/ + /*opacity: .4;*/ + /*filter: Alpha( opacity = 40 );*/ + /*-moz-border-radius: 4px;*/ + /*-khtml-border-radius: 4px;*/ + /*-webkit-border-radius: 4px;*/ + /*border-radius: 4px;*/ + /*background: #ccc;*/ +} + +/* Modal window shadow overlay */ +div.windoo-modal-overlay { + background: #000; + opacity: .6; + filter: Alpha( opacity = 60 ); +} + +/* ********* wise Styles ********** */ + +div.windoo-wise div.windoo-body { + margin: 50px 20px 0; + padding: 0; +} + +div.windoo-wise-ie .windoo-body { + top: 28px; +} + +div.windoo-wise-ghost { + border: dotted #00a 2px; +} + +div.windoo-wise .windoo-se { + bottom: 0; + right: 0; + width: 11px; + height: 11px; + cursor: se-resize; + /*background: url( ../images/se-handle.gif ) no-repeat left top;*/ +} + +div.windoo-wise div.windoo-frame { +} + +div.windoo-wise div.windoo-frame .top-left { + /*padding: 0 0 0 3px;*/ + /*background: transparent url( ../images/hd-sprite.gif ) no-repeat scroll left -41px;*/ +} + +div.windoo-wise div.windoo-frame .top-right { + padding: 0 3px 0 0; + /*background: transparent url( ../images/hd-sprite.gif ) no-repeat scroll right 0;*/ +} + +div.windoo-wise div.windoo-frame .title { + /*background: #AABACA url( ../images/hd-sprite.gif ) repeat-x scroll 0 -82px;*/ + color: #15428B; + height: 28px; + padding: 0 40px 0 .5em; + font: bold 13px "Sans Serif", Tahoma, Verdana, Helvetica; +} + +div.windoo-wise div.windoo-frame .title-text { + padding-top: 7px; + /*line-height: 13px;*/ + height: 13px; + text-align: left; +} + +div.windoo-wise div.windoo-frame .bot-left { + padding: 0 0 0 7px; + /*background: transparent url( ../images/bg-left.gif ) no-repeat scroll left bottom;*/ +} + +div.windoo-wise div.windoo-frame .bot-right { + padding: 0 7px 0 0; + /*background: transparent url( ../images/bg-right.gif ) no-repeat scroll right bottom;*/ +} + +div.windoo-wise div.windoo-frame .strut { + /*background: transparent url( ../images/bg-center.gif ) repeat-x scroll center bottom;*/ + text-align: left; +} + +div.windoo-wise a.windoo-button { + width: 23px; + height: 19px; + /*line-height: 19px;*/ + font-size: 9pt; + text-indent: -1000em; + background: url( '../images/buttons.gif' ) no-repeat scroll 0 0; +} + +div.windoo-wise a.windoo-close { + top: 0px; + right: 10px; + background-position: -69px 0; +} + +div.windoo-wise a.windoo-close:hover { + background-position: -69px -19px; +} + +div.windoo-wise a.windoo-close-disabled, div.windoo-wise a.windoo-close-disabled:hover { + background-position: -69px 0; + opacity: .3; + filter: Alpha( opacity = 30 ); +} + +div.windoo-wise a.windoo-maximize { + top: 0px; + right: 33px; + background-position: -46px 0; +} + +div.windoo-wise a.windoo-maximize:hover { + background-position: -46px -19px; +} + +div.windoo-wise a.windoo-maximize-disabled, div.windoo-wise a.windoo-maximize-disabled:hover { + background-position: -46px 0; + opacity: .3; + filter: Alpha( opacity = 30 ); +} + +div.windoo-wise a.windoo-minimize { + top: 0px; + right: 56px; + background-position: 0 0; +} + +div.windoo-wise a.windoo-minimize:hover { + background-position: 0 -19px; +} + +div.windoo-wise a.windoo-minimize-disabled, div.windoo-wise a.windoo-minimize-disabled:hover { + background-position: 0 0; + opacity: .3; + filter: Alpha( opacity = 30 ); +} + +div.windoo-wise a.windoo-restore { + display: none; + top: 0px; + right: 15px; + background-position: -46px 0; +} + +div.windoo-wise a.windoo-restore:hover { + background-position: -46px -19px; +} + +div.windoo-wise a.windoo-restore-disabled, div.windoo-wise a.windoo-restore-disabled:hover { + background-position: -46px 0; + opacity: .3; + filter: Alpha( opacity = 30 ); +} + +div.windoo-wise a.windoo-menu { + display: none; +} + +div.windoo-wise-minimized { + width: 165px !important; +} + +div.windoo-shadow-wise-maximized { + display: none !important; +} + +div.windoo-wise-alert-message { +} + +div.windoo-wise-confirm-message { +} + +div.windoo-wise-alert-pane, div.windoo-wise-confirm-pane { + text-align: center; +} + +div.windoo-wise-alert-pane input, div.windoo-wise-confirm-pane input { + margin: 0 .5em; + width: 4em; +} + + +div.windoo-wise-confirm-pane input { + background: #3399CC; + border: 1px solid #006699; + color: #FFFFFF; + font-family: arial, helvetica, sans-serif; + font-size: 92%; + font-style: normal; + font-variant: normal; + font-weight: bold; + /*line-height: normal;*/ + overflow: visible; + padding: 2px 8px 1px; + vertical-align: middle; +} + +/************************************************************************************ + * - mooRainbow: defaultCSS + * author: w00fz +*******************************************/ + +#mooRainbow { + font-size: 11px; + color: #000; +} + +.moor-box { + width: 125px; + height: 110px; + border: 1px solid #636163; + background-color: #e5e5e5; +} + +.moor-overlayBox { + width: 80px; /* Width and Height of the overlay must be setted here: default 256x256 */ + height: 80px; + margin-top: 3px; + margin-left: 3px; + border: 1px solid #000; +} + +.moor-slider { + border: 1px solid #000; + margin-top: 3px; + margin-left: 86px; + width: 10px; /* if you want a bigger or smaller slider... */ + height: 80px; +} + +.moor-colorBox { +/*display: none;*/ + visibility: hidden; + border: 1px solid #000; + width: 59px; + height: 68px; + margin-top: 20px; + margin-left: 315px; +} + +.moor-currentColor { +/* Bottom Box Color, the backup one */ +/*display: none;*/ + visibility: hidden; + margin-top: 55px; + margin-left: 316px; + width: 59px; + height: 34px; +} + +.moor-okButton { + font-family: Tahoma; + font-weight: bold; + font-size: 8px; + margin-top: 90px; + margin-left: 3px; + background: #e6e6e6; + height: 15px; + border: 1px solid #d6d6d6; + border-left-color: #f5f5f5; + border-top-color: #f5f5f5; +} + +label { + font-family: mono; +} + +/* Following are just