Compare commits
288 Commits
v3.0.beta3
...
v3.0.RC3
Author | SHA1 | Date | |
---|---|---|---|
|
c1318e496c | ||
|
8de31d9edc | ||
|
90b584569b | ||
|
df98282620 | ||
|
751692837c | ||
|
3f2f23d3c1 | ||
|
4ac8a41a46 | ||
|
cba00adc41 | ||
|
0f66d6fb6d | ||
|
b36df012f8 | ||
|
e302171ac9 | ||
|
abdb56c35d | ||
|
a228ea6ed5 | ||
|
6c2d277f02 | ||
|
10f8b5748e | ||
|
6a9d1c684e | ||
|
2f8cd121e3 | ||
|
fe8516bb94 | ||
|
29e397ab3f | ||
|
c1d041e3f8 | ||
|
98729c2582 | ||
|
53768b5400 | ||
|
7feb29b151 | ||
|
031bbe50e1 | ||
|
17ea409542 | ||
|
37b4298579 | ||
|
5cb2289cbc | ||
|
c86bd15382 | ||
|
aed1c0afcb | ||
|
a74efa4647 | ||
|
cf0f0a8c00 | ||
|
52ce817e3a | ||
|
45a190bbac | ||
|
d7c74e289e | ||
|
27a82d9e41 | ||
|
806bb96ce1 | ||
|
9067a6cff2 | ||
|
ef88ee06de | ||
|
b4005c8159 | ||
|
2d58e9a0f5 | ||
|
af8d833356 | ||
|
6303ba93c7 | ||
|
04d43e62c7 | ||
|
a179875fee | ||
|
e5e2e86fce | ||
|
dafe8eeb03 | ||
|
a492521a10 | ||
|
ddaa89acee | ||
|
a155477eff | ||
|
24b4f4b190 | ||
|
cc57fae5cf | ||
|
d17b8397f7 | ||
|
ad9d00843f | ||
|
742fa9d03e | ||
|
7fa766c2d0 | ||
|
3fdbcb31d3 | ||
|
3672d2a8e2 | ||
|
4f1bb45fc2 | ||
|
c37b632ac9 | ||
|
c7f7b20260 | ||
|
9985384a7f | ||
|
295fbba387 | ||
|
dfe07e2da0 | ||
|
dbf8b0e28c | ||
|
1811749964 | ||
|
e72ae37ac7 | ||
|
6b76c53663 | ||
|
3bd2242080 | ||
|
e5ab234d01 | ||
|
22d9f7a199 | ||
|
1e5e11a309 | ||
|
f6e5018272 | ||
|
4a0d70e3b3 | ||
|
3d1dc9bfc6 | ||
|
14e9bf0e06 | ||
|
f8fb56e49f | ||
|
65f4238c3e | ||
|
66fcc68677 | ||
|
63d4de6da1 | ||
|
8320ae0abf | ||
|
be4d7d1c91 | ||
|
f6b1499322 | ||
|
25ac0bbadd | ||
|
b847782079 | ||
|
cfaa8f786d | ||
|
0dafb4b31b | ||
|
acd149bfc9 | ||
|
155ec74dea | ||
|
56ac4aaed3 | ||
|
7db5bb3591 | ||
|
9c632faf77 | ||
|
85d41300bf | ||
|
a42c54678a | ||
|
88f5f1a5bd | ||
|
f5d3b51f6e | ||
|
ff63b4f89c | ||
|
d2f9749d61 | ||
|
7bbcd82488 | ||
|
a0ee153ca0 | ||
|
8a8922f2a6 | ||
|
7c4f500361 | ||
|
9cbb6eadc2 | ||
|
310a6b9e03 | ||
|
cd776073dc | ||
|
6555203a94 | ||
|
f8cb849597 | ||
|
5e93c0a98c | ||
|
4ec8e75bdb | ||
|
a19003077c | ||
|
8a9c219b9d | ||
|
662fc82919 | ||
|
029bfa809a | ||
|
7246260220 | ||
|
000b6a693d | ||
|
e1d4f0afc8 | ||
|
849cb4a9ce | ||
|
de64764306 | ||
|
c44d88eb09 | ||
|
66e214ca88 | ||
|
bb26d73462 | ||
|
6badd972b0 | ||
|
7b1574150a | ||
|
46f3ec96c5 | ||
|
69ed3d8126 | ||
|
1400130ebf | ||
|
a0ea9a6980 | ||
|
36a35b44d7 | ||
|
f90dd4f22a | ||
|
f1c9c95ed5 | ||
|
15e03c690f | ||
|
e0a67fe1d7 | ||
|
b4f036745f | ||
|
5719e54091 | ||
|
3895365d93 | ||
|
7d073920df | ||
|
5c9a10b878 | ||
|
bef8711138 | ||
|
011acba666 | ||
|
a1199687d4 | ||
|
4c988d4ae2 | ||
|
022e3d982a | ||
|
69912ecef4 | ||
|
a263a05520 | ||
|
2e2e978c43 | ||
|
1e53ba827f | ||
|
d811c8f011 | ||
|
0cbe108910 | ||
|
3fb746f79b | ||
|
6efc068a6c | ||
|
db49d96b97 | ||
|
3fda0c9dab | ||
|
e83fa28ae8 | ||
|
84fcad2688 | ||
|
3f2b343a06 | ||
|
e76a2372d0 | ||
|
861d265891 | ||
|
0b0cb960f7 | ||
|
c15c1824b3 | ||
|
8321363333 | ||
|
c950e68a27 | ||
|
8d9fb53741 | ||
|
4cce432bb8 | ||
|
337a67a8f6 | ||
|
743164ade4 | ||
|
9a94326469 | ||
|
a86a38d157 | ||
|
9ab4c4975c | ||
|
1efa24f2aa | ||
|
3f173ec2f1 | ||
|
6008376ad5 | ||
|
c4c3f30303 | ||
|
bcc5676b49 | ||
|
ca37d3f384 | ||
|
04a221799a | ||
|
1fee2bc349 | ||
|
dfb5bb7c3a | ||
|
154a442428 | ||
|
8839b8d333 | ||
|
6c8d556bdb | ||
|
7dfb044ae4 | ||
|
c4f4756e4a | ||
|
00829bfcc4 | ||
|
b855da47d0 | ||
|
052494a6a5 | ||
|
6dce37d794 | ||
|
98e29e0dc4 | ||
|
a580dceaea | ||
|
7390025bf4 | ||
|
d1ce3540ed | ||
|
9be46d6822 | ||
|
3efd3ef172 | ||
|
1cb7a3d3d7 | ||
|
1e02650800 | ||
|
65d5ddb604 | ||
|
b808fcdbb8 | ||
|
45858f393e | ||
|
df52d57a1d | ||
|
4b76fe42bf | ||
|
39a8fc1891 | ||
|
396ed9a147 | ||
|
592886519e | ||
|
96de014d52 | ||
|
d54a689ace | ||
|
7e8745f875 | ||
|
4288ad52dc | ||
|
0a655ff802 | ||
|
d85dfcba02 | ||
|
a442c487e4 | ||
|
878a040708 | ||
|
1555560415 | ||
|
ed71bbc775 | ||
|
80deb4922b | ||
|
8f87359b78 | ||
|
30c13905c0 | ||
|
e42af6a952 | ||
|
21cae14ddd | ||
|
f961f7f071 | ||
|
601cbe6d25 | ||
|
ad190b575d | ||
|
fbed936c45 | ||
|
1dfe6ab711 | ||
|
666cf329a8 | ||
|
1265d978e8 | ||
|
81af279e21 | ||
|
4c93a72072 | ||
|
183f472f52 | ||
|
c4f3feb92e | ||
|
361beb371f | ||
|
fc299e1fe6 | ||
|
95f409e839 | ||
|
dfa3a9ca29 | ||
|
d7d269d97c | ||
|
4ebf0bad4a | ||
|
9354d6ae64 | ||
|
29b4503135 | ||
|
173f5f5f82 | ||
|
46831e110b | ||
|
e2682108e0 | ||
|
7fa7d8ca8b | ||
|
c9217265fd | ||
|
dcd15d8fa4 | ||
|
73056de872 | ||
|
c191136de9 | ||
|
9aba9993e2 | ||
|
448c9e55e7 | ||
|
b787abad9b | ||
|
3e7f02907c | ||
|
db6a9d90b4 | ||
|
4891fbb024 | ||
|
7afc442824 | ||
|
0ffe8236e1 | ||
|
be635f550a | ||
|
0879a9427c | ||
|
28bbc4c846 | ||
|
da6859313b | ||
|
9b2a24c437 | ||
|
eb709699b7 | ||
|
04fda82ba0 | ||
|
bff79159e1 | ||
|
c432bef6b1 | ||
|
ea75b33553 | ||
|
81a85aaadf | ||
|
b6b0f460de | ||
|
1883210837 | ||
|
141d691148 | ||
|
05301dea6d | ||
|
f6953aad9c | ||
|
6a673d187b | ||
|
03bb887907 | ||
|
4cd765cfb9 | ||
|
73b72a32da | ||
|
2e8b166b8a | ||
|
49727943da | ||
|
4e6fc7722a | ||
|
77766e0a8f | ||
|
731beef4e8 | ||
|
5a765b2f2c | ||
|
34bd8edd42 | ||
|
5f441c2c20 | ||
|
dde7806b38 | ||
|
70cebe97fc | ||
|
78274fe3f2 | ||
|
09ed4f68b7 | ||
|
6d7c12ca60 | ||
|
71f0c32943 | ||
|
ed2b9190ba | ||
|
f2cdc96a96 | ||
|
98846768fe |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,3 +9,4 @@ wisemapping.log*
|
||||
*/.DS_Store
|
||||
.DS_Store
|
||||
target
|
||||
.idea
|
||||
|
1
Procfile
Normal file
1
Procfile
Normal file
@@ -0,0 +1 @@
|
||||
web: java $JAVA_OPTS -Dspring.profiles.active=heroku -jar wise-webapp/target/dependency/jetty-runner.jar --port $PORT wise-webapp/target/*.war
|
@@ -6,96 +6,57 @@
|
||||
obj - object to inspect
|
||||
*/
|
||||
|
||||
$defined = function(obj) {
|
||||
$defined = function (obj) {
|
||||
return (obj != undefined);
|
||||
};
|
||||
|
||||
|
||||
$assert = function(assert, message) {
|
||||
$assert = function (assert, message) {
|
||||
if (!$defined(assert) || !assert) {
|
||||
var stack;
|
||||
try {
|
||||
null.eval();
|
||||
} catch(e) {
|
||||
stack = e;
|
||||
}
|
||||
console.log(message + "," + stack);
|
||||
window.errorStack = stackTrace();
|
||||
throw message;
|
||||
logStackTrace();
|
||||
console.log(message);
|
||||
throw new Error(message);
|
||||
}
|
||||
};
|
||||
|
||||
Math.sign = function(value) {
|
||||
Math.sign = function (value) {
|
||||
return (value >= 0) ? 1 : -1;
|
||||
};
|
||||
|
||||
function stackTrace() {
|
||||
var result = "";
|
||||
var isCallstackPopulated = false;
|
||||
try {
|
||||
null.eval();
|
||||
} catch(e) {
|
||||
if (e.stack) { //Firefox and Chrome...
|
||||
result = e.stack;
|
||||
isCallstackPopulated = true;
|
||||
}
|
||||
else if (window.opera && e.message) { //Opera
|
||||
result = e.message;
|
||||
isCallstackPopulated = true;
|
||||
function logStackTrace(exception) {
|
||||
|
||||
if (!$defined(exception)) {
|
||||
try {
|
||||
throw Error("Unexpected Exception");
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
}
|
||||
var result = "";
|
||||
if (exception.stack) { //Firefox and Chrome...
|
||||
result = exception.stack;
|
||||
}
|
||||
else if (window.opera && exception.message) { //Opera
|
||||
result = exception.message;
|
||||
} else { //IE and Safari
|
||||
result = exception.sourceURL + ': ' + exception.line + "\n\n";
|
||||
|
||||
var currentFunction = arguments.callee.caller;
|
||||
while (currentFunction) {
|
||||
var fn = currentFunction.toString();
|
||||
result = result + "\n" + fn;
|
||||
currentFunction = currentFunction.caller;
|
||||
}
|
||||
}
|
||||
window.errorStack = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Support for Windows ...
|
||||
if (!window.console) {
|
||||
console = {
|
||||
log:function (e) {
|
||||
|
||||
/*
|
||||
* DOMParser HTML extension
|
||||
* 2012-02-02
|
||||
*
|
||||
* By Eli Grey, http://eligrey.com
|
||||
* Public domain.
|
||||
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
*/
|
||||
|
||||
/*! @source https://gist.github.com/1129031 */
|
||||
/*global document, DOMParser*/
|
||||
|
||||
(function(DOMParser) {
|
||||
"use strict";
|
||||
|
||||
var DOMParser_proto = DOMParser.prototype , real_parseFromString = DOMParser_proto.parseFromString;
|
||||
|
||||
// Firefox/Opera/IE throw errors on unsupported types
|
||||
try {
|
||||
// WebKit returns null on unsupported types
|
||||
if ((new DOMParser).parseFromString("", "text/html")) {
|
||||
// text/html parsing is natively supported
|
||||
return;
|
||||
}
|
||||
} catch (ex) {
|
||||
}
|
||||
|
||||
DOMParser_proto.parseFromString = function(markup, type) {
|
||||
if (/^\s*text\/html\s*(?:;|$)/i.test(type)) {
|
||||
var
|
||||
doc = document.implementation.createHTMLDocument("")
|
||||
, doc_elt = doc.documentElement
|
||||
, first_elt
|
||||
;
|
||||
|
||||
doc_elt.innerHTML = markup;
|
||||
first_elt = doc_elt.firstElementChild;
|
||||
|
||||
if (// are we dealing with an entire document or a fragment?
|
||||
doc_elt.childElementCount === 1
|
||||
&& first_elt.localName.toLowerCase() === "html"
|
||||
) {
|
||||
doc.replaceChild(first_elt, doc_elt);
|
||||
}
|
||||
|
||||
return doc;
|
||||
} else {
|
||||
return real_parseFromString.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}(DOMParser));
|
||||
}
|
@@ -1,64 +1,61 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
core.Utils = {
|
||||
|
||||
};
|
||||
|
||||
|
||||
core.Utils.innerXML = function(/*Node*/node) {
|
||||
// summary:
|
||||
// Implementation of MS's innerXML function.
|
||||
if ($defined(node.innerXML)) {
|
||||
return node.innerXML;
|
||||
// string
|
||||
} else if ($defined(node.xml)) {
|
||||
return node.xml;
|
||||
// string
|
||||
} else if ($defined(XMLSerializer)) {
|
||||
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 ($defined(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 ($defined(doc)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if ((_document.implementation) &&
|
||||
(_document.implementation.createDocument)) {
|
||||
doc = _document.implementation.createDocument("", "", null);
|
||||
}
|
||||
|
||||
return doc;
|
||||
// DOMDocument
|
||||
/*
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
core.Utils = {
|
||||
|
||||
};
|
||||
|
||||
|
||||
core.Utils.innerXML = function (node) {
|
||||
// summary:
|
||||
// Implementation of MS's innerXML function.
|
||||
if ($defined(node.innerXML)) {
|
||||
return node.innerXML;
|
||||
// string
|
||||
} else if ($defined(node.xml)) {
|
||||
return node.xml;
|
||||
// string
|
||||
} else if ($defined(XMLSerializer)) {
|
||||
return (new XMLSerializer()).serializeToString(node);
|
||||
// string
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Cross-browser implementation of creating an XML document object.
|
||||
*/
|
||||
core.Utils.createDocument = function () {
|
||||
var doc = null;
|
||||
if ($defined(window.ActiveXObject)) {
|
||||
//http://blogs.msdn.com/b/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx
|
||||
var progIDs = [ 'Msxml2.DOMDocument.6.0', 'Msxml2.DOMDocument.3.0'];
|
||||
for (var i = 0; i < progIDs.length; i++) {
|
||||
try {
|
||||
doc = new ActiveXObject(progIDs[i]);
|
||||
break;
|
||||
}
|
||||
catch (ex) {
|
||||
}
|
||||
}
|
||||
} else if (window.document.implementation && window.document.implementation.createDocument) {
|
||||
doc = window.document.implementation.createDocument("", "", null);
|
||||
}
|
||||
$assert(doc, "Parser could not be instantiated");
|
||||
|
||||
return doc;
|
||||
};
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -16,5 +16,6 @@ WISE_BIN_FILE_PATH=./target/${WISE_BIN_FILE_NAME}
|
||||
scp ${WISE_BIN_FILE_PATH} thecrow@wisemapping.com:${SERVER_DOWNLOAD_DIR}
|
||||
|
||||
# It's there ?
|
||||
cd target
|
||||
wget -S http://downloads.wisemapping.org/stable/${WISE_BIN_FILE_NAME}
|
||||
#wget -S http://downloads.wisemapping.org/stable/${WISE_SRC_FILE_NAME}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
set -e
|
||||
set -u
|
||||
|
||||
@@ -9,7 +8,8 @@ BASE_DIR=`pwd`
|
||||
TARGET_DIR=$BASE_DIR/target
|
||||
JETTY_DIR=$TARGET_DIR/wisemapping-$WISE_VERSION
|
||||
WISE_WEBAPP_DIR=$JETTY_DIR/webapps/wisemapping
|
||||
JETTY_DIST_DIR=jetty-distribution-8.1.4.v20120524
|
||||
JETTY_VERSION=8.1.5.v20120716
|
||||
JETTY_DIST_DIR=jetty-distribution-${JETTY_VERSION}
|
||||
JETTY_ZIP=${JETTY_DIST_DIR}.zip
|
||||
|
||||
# Clean ...
|
||||
@@ -24,7 +24,7 @@ mvn -o -f $BASE_DIR/../pom.xml package -Dmaven.test.skip=true
|
||||
if [ ! -f ./target/${JETTY_ZIP} ]
|
||||
then
|
||||
echo "Download Jetty"
|
||||
wget http://download.eclipse.org/jetty/8.1.4.v20120524/dist/jetty-distribution-8.1.4.v20120524.zip -P $TARGET_DIR
|
||||
wget http://download.eclipse.org/jetty/${JETTY_VERSION}/dist/${JETTY_ZIP} -P $TARGET_DIR
|
||||
fi
|
||||
|
||||
echo "Unzip Jetty ...:"
|
||||
@@ -42,10 +42,9 @@ mkdir $WISE_WEBAPP_DIR
|
||||
unzip $BASE_DIR/../wise-webapp/target/wisemapping.war -d $WISE_WEBAPP_DIR >/dev/null
|
||||
|
||||
# DB Configuration ...
|
||||
sed 's/target\/db\/wisemapping/webapps\/wisemapping\/WEB-INF\/database\/wisemapping/' $WISE_WEBAPP_DIR/WEB-INF/app.properties > $WISE_WEBAPP_DIR/WEB-INF/app.properties2
|
||||
sed 's/\${database.base.url}\/db\/wisemapping/webapps\/wisemapping\/WEB-INF\/database\/wisemapping/' $WISE_WEBAPP_DIR/WEB-INF/app.properties > $WISE_WEBAPP_DIR/WEB-INF/app.properties2
|
||||
mv $WISE_WEBAPP_DIR/WEB-INF/app.properties2 $WISE_WEBAPP_DIR/WEB-INF/app.properties
|
||||
|
||||
|
||||
mkdir $WISE_WEBAPP_DIR/WEB-INF/database
|
||||
cp -r $BASE_DIR/../wise-webapp/target/db/* $WISE_WEBAPP_DIR/WEB-INF/database/
|
||||
cp $BASE_DIR/wisemapping.xml $JETTY_DIR/contexts/
|
||||
@@ -53,6 +52,7 @@ cp $BASE_DIR/wisemapping.xml $JETTY_DIR/contexts/
|
||||
|
||||
# Distribute scripts
|
||||
cp -r $BASE_DIR/../wise-webapp/src/test/sql $TARGET_DIR/wisemapping-$WISE_VERSION/config
|
||||
cp ./start.sh ${JETTY_DIR}/
|
||||
|
||||
# Store version
|
||||
echo $1 > $WISE_WEBAPP_DIR/version
|
||||
|
4
distribution/start.sh
Executable file
4
distribution/start.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
java -Xmx256m -Dorg.apache.jasper.compiler.disablejsr199=true -jar start.jar
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Copyright [2011] [wisemapping]
|
||||
Copyright [2012] [wisemapping]
|
||||
|
||||
Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -36,6 +36,48 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.gmaven</groupId>
|
||||
<artifactId>gmaven-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>execute</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<source>
|
||||
def outdir = new File(project.basedir, 'src/main/javascript');
|
||||
if (project.packaging != 'pom')
|
||||
{
|
||||
def dir = new File(project.basedir, 'src/main/resources/');
|
||||
|
||||
dir.eachFile { file ->
|
||||
def matcher = file.name =~ /messages_(.+)\.properties/;
|
||||
def lang = matcher[0][1];
|
||||
def outfile = new File(outdir, "MessageBundle_${lang}.js");
|
||||
println "Converting ${file.name} to ${outfile.name}";
|
||||
|
||||
outfile.withWriter('UTF-8') { out ->
|
||||
out.writeLine "mindplot.Messages.BUNDLES['${lang.toLowerCase()}'] = { ";
|
||||
file.eachLine('UTF-8') { line ->
|
||||
if( line.trim()!="" && line[0]!='#' ) {
|
||||
matcher = line =~ /(.+)=(.+)/;
|
||||
out.writeLine("'${matcher[0][1]}' : \"${matcher[0][2]}\",");
|
||||
}
|
||||
}
|
||||
out.writeLine("'DUMMY' : '' ");
|
||||
out.writeLine "};"
|
||||
}
|
||||
}
|
||||
}
|
||||
</source>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
@@ -98,6 +140,7 @@
|
||||
<include>Workspace.js</include>
|
||||
<include>ShrinkConnector.js</include>
|
||||
<include>DesignerKeyboard.js</include>
|
||||
<include>TopicStyle.js</include>
|
||||
<include>NodeGraph.js</include>
|
||||
<include>Topic.js</include>
|
||||
<include>CentralTopic.js</include>
|
||||
@@ -153,6 +196,7 @@
|
||||
<include>collaboration/CollaborationManager.js</include>
|
||||
<include>collaboration/framework/AbstractCollaborativeFramework.js</include>
|
||||
<include>collaboration/framework/AbstractCollaborativeModelFactory.js</include>
|
||||
<include>widget/ModalDialogNotifier.js</include>
|
||||
<include>widget/ToolbarNotifier.js</include>
|
||||
<include>widget/ToolbarItem.js</include>
|
||||
<include>widget/ToolbarPaneItem.js</include>
|
||||
@@ -182,6 +226,12 @@
|
||||
<include>layout/GridSorter.js</include>
|
||||
<include>layout/OriginalLayout.js</include>
|
||||
<include>layout/EventBus.js</include>
|
||||
<include>MessageBundle_en.js</include>
|
||||
<include>MessageBundle_es.js</include>
|
||||
<include>MessageBundle_fr.js</include>
|
||||
<include>MessageBundle_pt_BR.js</include>
|
||||
<include>MessageBundle_zh_CN.js</include>
|
||||
<include>MessageBundle_zh_TW.js</include>
|
||||
<include>footer.js</include>
|
||||
</includes>
|
||||
</aggregation>
|
||||
@@ -197,7 +247,6 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.4.2</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
|
1
mindplot/src/main/javascript/.gitignore
vendored
Normal file
1
mindplot/src/main/javascript/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
MessageBundle_*
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -36,29 +36,11 @@ mindplot.CentralTopic = new Class({
|
||||
return this.getPosition();
|
||||
},
|
||||
|
||||
_getInnerPadding:function () {
|
||||
return 11;
|
||||
},
|
||||
|
||||
getTopicType:function () {
|
||||
return mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE;
|
||||
},
|
||||
|
||||
setCursor:function (type) {
|
||||
type = (type == 'move') ? 'default' : type;
|
||||
this.parent(type);
|
||||
},
|
||||
|
||||
isConnectedToCentralTopic:function () {
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
_defaultShapeType:function () {
|
||||
return mindplot.model.TopicShape.ROUNDED_RECT;
|
||||
},
|
||||
|
||||
|
||||
updateTopicShape:function () {
|
||||
|
||||
},
|
||||
@@ -70,28 +52,6 @@ mindplot.CentralTopic = new Class({
|
||||
this.setPosition(zeroPoint);
|
||||
},
|
||||
|
||||
_defaultText:function () {
|
||||
return $msg('CENTRAL_TOPIC');
|
||||
},
|
||||
|
||||
_defaultBackgroundColor:function () {
|
||||
return "rgb(80,157,192)";
|
||||
},
|
||||
|
||||
_defaultBorderColor:function () {
|
||||
return "rgb(57,113,177)";
|
||||
},
|
||||
|
||||
_defaultFontStyle:function () {
|
||||
return {
|
||||
font:"Verdana",
|
||||
size:10,
|
||||
style:"normal",
|
||||
weight:"bold",
|
||||
color:"#ffffff"
|
||||
};
|
||||
},
|
||||
|
||||
getShrinkConnector:function () {
|
||||
return null;
|
||||
},
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -20,7 +20,7 @@ mindplot.ConnectionLine = new Class({
|
||||
initialize:function (sourceNode, targetNode, lineType) {
|
||||
$assert(targetNode, 'parentNode node can not be null');
|
||||
$assert(sourceNode, 'childNode node can not be null');
|
||||
$assert(sourceNode != targetNode, 'Cilcular connection');
|
||||
$assert(sourceNode != targetNode, 'Circular connection');
|
||||
|
||||
this._targetTopic = targetNode;
|
||||
this._sourceTopic = sourceNode;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -55,9 +55,15 @@ mindplot.Designer = new Class({
|
||||
|
||||
// Register events
|
||||
if (!this.isReadOnly()) {
|
||||
this._registerEvents();
|
||||
// Register mouse events ...
|
||||
this._registerMouseEvents();
|
||||
|
||||
// Register keyboard events ...
|
||||
mindplot.DesignerKeyboard.register(this);
|
||||
|
||||
this._dragManager = this._buildDragManager(this._workspace);
|
||||
}
|
||||
this._registerWheelEvents();
|
||||
|
||||
this._relPivot = new mindplot.RelationshipPivot(this._workspace, this);
|
||||
|
||||
@@ -76,6 +82,32 @@ mindplot.Designer = new Class({
|
||||
this.deselectAll();
|
||||
},
|
||||
|
||||
_registerWheelEvents:function () {
|
||||
var workspace = this._workspace;
|
||||
var screenManager = workspace.getScreenManager();
|
||||
|
||||
// Zoom In and Zoom Out must active event
|
||||
$(document).addEvent('mousewheel', function (event) {
|
||||
// Change mousewheel handling so we let the default
|
||||
//event happen if we are outside the container.
|
||||
var coords = screenManager.getContainer().getCoordinates();
|
||||
var isOutsideContainer = event.client.y < coords.top ||
|
||||
event.client.y > coords.bottom ||
|
||||
event.client.x < coords.left ||
|
||||
event.client.x > coords.right;
|
||||
|
||||
if (!isOutsideContainer) {
|
||||
if (event.wheel > 0) {
|
||||
this.zoomIn(1.05);
|
||||
}
|
||||
else {
|
||||
this.zoomOut(1.05);
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Activates the keyboard events so you can enter text into forms
|
||||
*/
|
||||
@@ -84,14 +116,6 @@ mindplot.Designer = new Class({
|
||||
},
|
||||
|
||||
|
||||
_registerEvents:function () {
|
||||
// Register mouse events ...
|
||||
this._registerMouseEvents();
|
||||
|
||||
// Register keyboard events ...
|
||||
mindplot.DesignerKeyboard.register(this);
|
||||
},
|
||||
|
||||
addEvent:function (type, listener) {
|
||||
if (type == mindplot.TopicEvent.EDIT || type == mindplot.TopicEvent.CLICK) {
|
||||
var editor = mindplot.TopicEventDispatcher.getInstance();
|
||||
@@ -136,26 +160,48 @@ mindplot.Designer = new Class({
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
// Register mouse drag and drop event ...
|
||||
function noopHandler(evt) {
|
||||
evt.stopPropagation();
|
||||
evt.preventDefault();
|
||||
}
|
||||
|
||||
$(document).addEvent('mousewheel', function (event) {
|
||||
// Change mousewheel handling so we let the default
|
||||
//event happen if we are outside the container.
|
||||
var coords = screenManager.getContainer().getCoordinates();
|
||||
var isOutsideContainer = event.client.y < coords.top ||
|
||||
event.client.y > coords.bottom ||
|
||||
event.client.x < coords.left ||
|
||||
event.client.x > coords.right;
|
||||
// Enable drag events ...
|
||||
// @Todo: Images support on progress ...
|
||||
// Element.NativeEvents.dragenter = 2;
|
||||
// Element.NativeEvents.dragexit = 2;
|
||||
// Element.NativeEvents.dragover = 2;
|
||||
// Element.NativeEvents.drop = 2;
|
||||
//
|
||||
// screenManager.addEvent('dragenter', noopHandler);
|
||||
// screenManager.addEvent('dragexit', noopHandler);
|
||||
// screenManager.addEvent('dragover', noopHandler);
|
||||
// screenManager.addEvent('drop', function (evt) {
|
||||
// evt.stopPropagation();
|
||||
// evt.preventDefault();
|
||||
////
|
||||
// var files = evt.event.dataTransfer.files;
|
||||
// console.log(event);
|
||||
//
|
||||
// var count = files.length;
|
||||
//
|
||||
// // Only call the handler if 1 or more files was dropped.
|
||||
// if (count > 0) {
|
||||
//
|
||||
// var model = this.getMindmap().createNode();
|
||||
// model.setImageSize(80, 43);
|
||||
// model.setMetadata("{'media':'video,'url':'http://www.youtube.com/watch?v=P3FrXftyuzw&feature=g-vrec&context=G2b4ab69RVAAAAAAAAAA'}");
|
||||
// model.setImageUrl("images/logo-small.png");
|
||||
// model.setShapeType(mindplot.model.TopicShape.IMAGE);
|
||||
//
|
||||
// var position = screenManager.getWorkspaceMousePosition(evt);
|
||||
// model.setPosition(position.x, position.y);
|
||||
// model.setPosition(100, 100);
|
||||
//
|
||||
// this._actionDispatcher.addTopics([model]);
|
||||
// }
|
||||
// }.bind(this));
|
||||
|
||||
if (!isOutsideContainer) {
|
||||
if (event.wheel > 0) {
|
||||
this.zoomIn(1.05);
|
||||
}
|
||||
else {
|
||||
this.zoomOut(1.05);
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
},
|
||||
|
||||
@@ -203,12 +249,8 @@ mindplot.Designer = new Class({
|
||||
|
||||
|
||||
_buildNodeGraph:function (model, readOnly) {
|
||||
var workspace = this._workspace;
|
||||
|
||||
// Create node graph ...
|
||||
var topic = mindplot.NodeGraph.create(model, {readOnly:readOnly});
|
||||
|
||||
// Append it to the workspace ...
|
||||
this.getModel().addTopic(topic);
|
||||
|
||||
// Add Topic events ...
|
||||
@@ -244,7 +286,7 @@ mindplot.Designer = new Class({
|
||||
}
|
||||
}
|
||||
$assert(targetTopic, "Could not find a topic to connect");
|
||||
topic.connectTo(targetTopic, workspace);
|
||||
topic.connectTo(targetTopic, this._workspace);
|
||||
}
|
||||
|
||||
topic.addEvent('ontblur', function () {
|
||||
@@ -358,7 +400,7 @@ mindplot.Designer = new Class({
|
||||
|
||||
// Exclude central topic ..
|
||||
topics = topics.filter(function (topic) {
|
||||
return topic.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE
|
||||
return !topic.isCentralTopic();
|
||||
});
|
||||
|
||||
this._clipboard = topics.map(function (topic) {
|
||||
@@ -473,7 +515,7 @@ mindplot.Designer = new Class({
|
||||
}
|
||||
|
||||
var topic = nodes[0];
|
||||
if (topic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (!topic.getOutgoingConnectedTopic()) { // Central topic and isolated topics ....
|
||||
// Central topic doesn't have siblings ...
|
||||
this.createChildForSelectedNode();
|
||||
|
||||
@@ -552,7 +594,7 @@ mindplot.Designer = new Class({
|
||||
for (var i = 0; i < branches.length; i++) {
|
||||
// NodeModel -> NodeGraph ...
|
||||
var nodeModel = branches[i];
|
||||
var nodeGraph = this._nodeModelToNodeGraph(nodeModel, false);
|
||||
var nodeGraph = this._nodeModelToNodeGraph(nodeModel);
|
||||
|
||||
// Update shrink render state...
|
||||
nodeGraph.setBranchVisibility(true);
|
||||
@@ -590,7 +632,7 @@ mindplot.Designer = new Class({
|
||||
return this._options.readOnly;
|
||||
},
|
||||
|
||||
_nodeModelToNodeGraph:function (nodeModel, isVisible) {
|
||||
_nodeModelToNodeGraph:function (nodeModel) {
|
||||
$assert(nodeModel, "Node model can not be null");
|
||||
var children = nodeModel.getChildren().slice();
|
||||
children = children.sort(function (a, b) {
|
||||
@@ -598,16 +640,13 @@ mindplot.Designer = new Class({
|
||||
});
|
||||
|
||||
var nodeGraph = this._buildNodeGraph(nodeModel, this.isReadOnly());
|
||||
|
||||
if (isVisible) {
|
||||
nodeGraph.setVisibility(isVisible);
|
||||
}
|
||||
nodeGraph.setVisibility(false);
|
||||
|
||||
this._workspace.appendChild(nodeGraph);
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
if ($defined(child))
|
||||
this._nodeModelToNodeGraph(child, false);
|
||||
this._nodeModelToNodeGraph(child);
|
||||
}
|
||||
|
||||
return nodeGraph;
|
||||
@@ -684,12 +723,11 @@ mindplot.Designer = new Class({
|
||||
dmodel.addRelationship(result);
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
_removeTopic:function (node) {
|
||||
if (node.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (!node.isCentralTopic()) {
|
||||
var parent = node._parent;
|
||||
node.disconnect(this._workspace);
|
||||
|
||||
@@ -719,14 +757,14 @@ mindplot.Designer = new Class({
|
||||
// If there are more than one node selected,
|
||||
$notify($msg('ENTITIES_COULD_NOT_BE_DELETED'));
|
||||
return;
|
||||
} else if (topics.length == 1 && topics[0].getTopicType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
} else if (topics.length == 1 && topics[0].isCentralTopic()) {
|
||||
$notify($msg('CENTRAL_TOPIC_CAN_NOT_BE_DELETED'));
|
||||
return;
|
||||
}
|
||||
|
||||
// If the central topic has been selected, I must filter ir
|
||||
var topicIds = topics.filter(function (topic) {
|
||||
return topic.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE
|
||||
return !topic.isCentralTopic();
|
||||
}).map(function (topic) {
|
||||
return topic.getId()
|
||||
});
|
||||
@@ -827,13 +865,17 @@ mindplot.Designer = new Class({
|
||||
addLink:function () {
|
||||
var model = this.getModel();
|
||||
var topic = model.selectedTopic();
|
||||
topic.showLinkEditor();
|
||||
if (topic) {
|
||||
topic.showLinkEditor();
|
||||
}
|
||||
},
|
||||
|
||||
addNote:function () {
|
||||
var model = this.getModel();
|
||||
var topic = model.selectedTopic();
|
||||
topic.showNoteEditor();
|
||||
if (topic) {
|
||||
topic.showNoteEditor();
|
||||
}
|
||||
},
|
||||
|
||||
goToNode:function (node) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -60,15 +60,32 @@ mindplot.DesignerKeyboard = new Class({
|
||||
}
|
||||
}.bind(this),
|
||||
|
||||
'delete':function () {
|
||||
'delete':function (event) {
|
||||
designer.deleteSelectedEntities();
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}.bind(this),
|
||||
|
||||
'enter':function () {
|
||||
designer.createSiblingForSelectedNode();
|
||||
}.bind(this),
|
||||
|
||||
'insert':function () {
|
||||
'insert':function (event) {
|
||||
designer.createChildForSelectedNode();
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}.bind(this),
|
||||
|
||||
'tab':function (event) {
|
||||
designer.createChildForSelectedNode();
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}.bind(this),
|
||||
|
||||
'-':function () { // "-" is a insert on several Browsers. Don't ask why ...
|
||||
designer.createChildForSelectedNode();
|
||||
}.bind(this),
|
||||
|
||||
@@ -79,7 +96,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
|
||||
}.bind(this),
|
||||
|
||||
'ctrl+z':function () {
|
||||
'ctrl+z':function (event) {
|
||||
event.preventDefault(event);
|
||||
event.stopPropagation();
|
||||
designer.undo();
|
||||
@@ -93,7 +110,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
|
||||
}.bind(this),
|
||||
|
||||
'ctrl+c':function () {
|
||||
'ctrl+c':function (event) {
|
||||
event.preventDefault(event);
|
||||
event.stopPropagation();
|
||||
designer.copyToClipboard();
|
||||
@@ -107,7 +124,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
|
||||
}.bind(this),
|
||||
|
||||
'ctrl+v':function () {
|
||||
'ctrl+v':function (event) {
|
||||
event.preventDefault(event);
|
||||
event.stopPropagation();
|
||||
|
||||
@@ -221,10 +238,39 @@ mindplot.DesignerKeyboard = new Class({
|
||||
designer.selectAll();
|
||||
},
|
||||
|
||||
'right':function () {
|
||||
'meta+=':function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
designer.zoomIn();
|
||||
},
|
||||
|
||||
'meta+-':function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
designer.zoomOut();
|
||||
},
|
||||
|
||||
'ctrl++':function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
designer.zoomIn();
|
||||
},
|
||||
|
||||
'ctrl+-':function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
designer.zoomOut();
|
||||
},
|
||||
|
||||
|
||||
'right':function (event) {
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (node.isCentralTopic()) {
|
||||
this._goToSideChild(designer, node, 'RIGHT');
|
||||
}
|
||||
else {
|
||||
@@ -236,15 +282,17 @@ mindplot.DesignerKeyboard = new Class({
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var centralTopic = designer.getCentralTopic();
|
||||
var centralTopic = model.getCentralTopic();
|
||||
this._goToNode(designer, centralTopic);
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}.bind(this),
|
||||
|
||||
'left':function () {
|
||||
'left':function (event) {
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (node.isCentralTopic()) {
|
||||
this._goToSideChild(designer, node, 'LEFT');
|
||||
}
|
||||
else {
|
||||
@@ -256,40 +304,51 @@ mindplot.DesignerKeyboard = new Class({
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var centralTopic = designer.getCentralTopic();
|
||||
var centralTopic = model.getCentralTopic();
|
||||
this._goToNode(designer, centralTopic);
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}.bind(this),
|
||||
|
||||
'up':function () {
|
||||
'up':function (event) {
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (!node.isCentralTopic()) {
|
||||
this._goToBrother(designer, node, 'UP');
|
||||
}
|
||||
} else {
|
||||
var centralTopic = designer.getCentralTopic();
|
||||
var centralTopic = model.getCentralTopic();
|
||||
this._goToNode(designer, centralTopic);
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}.bind(this),
|
||||
|
||||
'down':function () {
|
||||
'down':function (event) {
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (!node.isCentralTopic()) {
|
||||
this._goToBrother(designer, node, 'DOWN');
|
||||
}
|
||||
} else {
|
||||
var centralTopic = designer.getCentralTopic();
|
||||
var centralTopic = model.getCentralTopic();
|
||||
this._goToNode(designer, centralTopic);
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}.bind(this)
|
||||
};
|
||||
this.addEvents(keyboardEvents);
|
||||
|
||||
var regex = /^(?:shift|control|ctrl|alt|meta)$/;
|
||||
var modifiers = ['shift', 'control', 'alt', 'meta'];
|
||||
|
||||
var excludes = ['esc', 'capslock', 'tab', 'f1', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12', 'backspace', 'down', 'up', 'left', 'right', 'control'];
|
||||
if (!Browser.Platform.mac) {
|
||||
// This is to avoid enter on edition mode in the node when alt+tab is pressed.
|
||||
excludes.push("alt");
|
||||
}
|
||||
|
||||
$(document).addEvent('keydown', function (event) {
|
||||
|
||||
@@ -331,39 +390,43 @@ mindplot.DesignerKeyboard = new Class({
|
||||
},
|
||||
|
||||
_goToBrother:function (designer, 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);
|
||||
var parent = node.getParent();
|
||||
if (parent) {
|
||||
var brothers = 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];
|
||||
}
|
||||
}
|
||||
if (dist == null || dist > distancia) {
|
||||
dist = distancia;
|
||||
target = brothers[i];
|
||||
}
|
||||
}
|
||||
else if (direction == "UP" && brotherY < y) {
|
||||
var distance = y - brotherY;
|
||||
if (distance < 0) {
|
||||
distance = distance * (-1);
|
||||
}
|
||||
if (dist == null || dist > distance) {
|
||||
dist = distance;
|
||||
target = brothers[i];
|
||||
else if (direction == "UP" && brotherY < y) {
|
||||
var distance = y - brotherY;
|
||||
if (distance < 0) {
|
||||
distance = distance * (-1);
|
||||
}
|
||||
if (dist == null || dist > distance) {
|
||||
dist = distance;
|
||||
target = brothers[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this._goToNode(designer, target);
|
||||
}
|
||||
this._goToNode(designer, target);
|
||||
},
|
||||
|
||||
|
||||
@@ -394,8 +457,10 @@ mindplot.DesignerKeyboard = new Class({
|
||||
},
|
||||
|
||||
_goToParent:function (designer, node) {
|
||||
var parent = node._parent;
|
||||
this._goToNode(designer, parent);
|
||||
var parent = node.getParent();
|
||||
if (parent) {
|
||||
this._goToNode(designer, parent);
|
||||
}
|
||||
},
|
||||
|
||||
_goToChild:function (designer, node) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -83,6 +83,7 @@ mindplot.DesignerModel = new Class({
|
||||
|
||||
addTopic:function (topic) {
|
||||
$assert(topic, "topic can not be null");
|
||||
$assert(typeof topic.getId() == "number", "id is not a number:" + topic.getId());
|
||||
this._topics.push(topic);
|
||||
},
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,100 +1,112 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
mindplot.DragConnector = new Class({
|
||||
initialize:function(designerModel, workspace) {
|
||||
$assert(designerModel, 'designerModel can not be null');
|
||||
$assert(workspace, 'workspace can not be null');
|
||||
|
||||
// this._layoutManager = layoutManager;
|
||||
this._designerModel = designerModel;
|
||||
this._workspace = workspace;
|
||||
},
|
||||
|
||||
checkConnection : function(dragTopic) {
|
||||
var topics = this._designerModel.getTopics();
|
||||
|
||||
// Must be disconnected from their current connection ?.
|
||||
var mainTopicToMainTopicConnection = this._lookUpForMainTopicToMainTopicConnection(dragTopic);
|
||||
var currentConnection = dragTopic.getConnectedToTopic();
|
||||
if ($defined(currentConnection)) {
|
||||
// MainTopic->MainTopicConnection.
|
||||
if (currentConnection.getType() == mindplot.model.INodeModel.MAIN_TOPIC_TYPE) {
|
||||
if (mainTopicToMainTopicConnection != currentConnection) {
|
||||
dragTopic.disconnect(this._workspace);
|
||||
}
|
||||
}
|
||||
else if (currentConnection.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
// Distance if greater that the allowed.
|
||||
var dragXPosition = dragTopic.getPosition().x;
|
||||
var currentXPosition = currentConnection.getPosition().x;
|
||||
|
||||
if ($defined(mainTopicToMainTopicConnection)) {
|
||||
// I have to change the current connection to a main topic.
|
||||
dragTopic.disconnect(this._workspace);
|
||||
} else
|
||||
if (Math.abs(dragXPosition - currentXPosition) > mindplot.DragConnector.CENTRAL_TO_MAINTOPIC_MAX_HORIZONTAL_DISTANCE) {
|
||||
dragTopic.disconnect(this._workspace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, connect nodes ...
|
||||
if (!dragTopic.isConnected()) {
|
||||
var centralTopic = topics[0];
|
||||
if ($defined(mainTopicToMainTopicConnection)) {
|
||||
dragTopic.connectTo(mainTopicToMainTopicConnection);
|
||||
} else if (Math.abs(dragTopic.getPosition().x - centralTopic.getPosition().x) <= mindplot.DragConnector.CENTRAL_TO_MAINTOPIC_MAX_HORIZONTAL_DISTANCE) {
|
||||
dragTopic.connectTo(centralTopic);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_lookUpForMainTopicToMainTopicConnection : function(dragTopic) {
|
||||
var topics = this._designerModel.getTopics();
|
||||
var result = null;
|
||||
var draggedNode = dragTopic.getDraggedTopic();
|
||||
var distance = null;
|
||||
|
||||
// Check MainTopic->MainTopic connection...
|
||||
for (var i = 0; i < topics.length; i++) {
|
||||
var targetTopic = topics[i];
|
||||
var position = dragTopic.getPosition();
|
||||
if (targetTopic.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE && targetTopic != draggedNode) {
|
||||
var canBeConnected = dragTopic.canBeConnectedTo(targetTopic);
|
||||
if (canBeConnected) {
|
||||
var targetPosition = targetTopic.getPosition();
|
||||
var fix = position.y > targetPosition.y;
|
||||
var gap = 0;
|
||||
if (targetTopic.getChildren().length > 0) {
|
||||
gap = Math.abs(targetPosition.y - targetTopic.getChildren()[0].getPosition().y)
|
||||
}
|
||||
var yDistance = Math.abs(position.y - fix * gap - targetPosition.y);
|
||||
if (distance == null || yDistance < distance) {
|
||||
result = targetTopic;
|
||||
distance = yDistance;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
mindplot.DragConnector.CENTRAL_TO_MAINTOPIC_MAX_HORIZONTAL_DISTANCE = 400;
|
||||
/*
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
mindplot.DragConnector = new Class({
|
||||
initialize:function (designerModel, workspace) {
|
||||
$assert(designerModel, 'designerModel can not be null');
|
||||
$assert(workspace, 'workspace can not be null');
|
||||
|
||||
// this._layoutManager = layoutManager;
|
||||
this._designerModel = designerModel;
|
||||
this._workspace = workspace;
|
||||
},
|
||||
|
||||
checkConnection:function (dragTopic) {
|
||||
var topics = this._designerModel.getTopics();
|
||||
|
||||
// Must be disconnected from their current connection ?.
|
||||
var candidates = this._searchConnectionCandidates(dragTopic);
|
||||
var currentConnection = dragTopic.getConnectedToTopic();
|
||||
|
||||
|
||||
if (currentConnection && (candidates.length == 0 || candidates[0] != currentConnection)) {
|
||||
dragTopic.disconnect(this._workspace);
|
||||
}
|
||||
|
||||
// Finally, connect nodes ...
|
||||
if (!dragTopic.isConnected() && candidates.length > 0) {
|
||||
dragTopic.connectTo(candidates[0]);
|
||||
}
|
||||
},
|
||||
|
||||
_searchConnectionCandidates:function (dragTopic) {
|
||||
var topics = this._designerModel.getTopics();
|
||||
var draggedNode = dragTopic.getDraggedTopic();
|
||||
|
||||
// Drag node connects to the border ...
|
||||
var dragTopicWidth = dragTopic.getSize ? dragTopic.getSize().width : 0; // Hack...
|
||||
var xMouseGap = dragTopic.getPosition().x > 0 ? 0 : dragTopicWidth;
|
||||
var sPos = {x:dragTopic.getPosition().x - xMouseGap, y:dragTopic.getPosition().y};
|
||||
|
||||
// Perform a initial filter to discard topics:
|
||||
// - Exclude dragged topic
|
||||
// - Exclude dragTopic pivot
|
||||
// - Nodes that are collapsed
|
||||
// - It's not part of the branch dragged itself
|
||||
topics = topics.filter(function (topic) {
|
||||
var result = draggedNode != topic;
|
||||
result = result && topic != draggedNode;
|
||||
result = result && !topic.areChildrenShrunken() && !topic.isCollapsed();
|
||||
result = result && !draggedNode.isChildTopic(topic);
|
||||
return result;
|
||||
});
|
||||
|
||||
// Filter all the nodes that are outside the vertical boundary:
|
||||
// * The node is to out of the x scope
|
||||
// * The x distance greater the vertical tolerated distance
|
||||
topics = topics.filter(function (topic) {
|
||||
var tpos = topic.getPosition();
|
||||
// Center topic has different alignment than the rest of the nodes. That's why i need to divide it by two...
|
||||
var txborder = tpos.x + (topic.getSize().width / 2) * Math.sign(sPos.x);
|
||||
var distance = (sPos.x - txborder) * Math.sign(sPos.x);
|
||||
return distance > 0 && (distance < mindplot.DragConnector.MAX_VERTICAL_CONNECTION_TOLERANCE);
|
||||
|
||||
});
|
||||
|
||||
// Assign a priority based on the distance:
|
||||
// - Alignment with the targetNode
|
||||
// - Vertical distance
|
||||
// - Horizontal proximity
|
||||
// - It's already connected.
|
||||
var currentConnection = dragTopic.getConnectedToTopic();
|
||||
topics = topics.sort(function (a, b) {
|
||||
var aPos = a.getPosition();
|
||||
var bPos = b.getPosition();
|
||||
|
||||
var av = this._isVerticallyAligned(a.getSize(), aPos, sPos);
|
||||
var bv = this._isVerticallyAligned(b.getSize(), bPos, sPos);
|
||||
return this._proximityWeight(av, a, sPos, currentConnection) - this._proximityWeight(bv, b, sPos, currentConnection);
|
||||
|
||||
}.bind(this));
|
||||
return topics;
|
||||
},
|
||||
|
||||
_proximityWeight:function (isAligned, target, sPos, currentConnection) {
|
||||
var tPos = target.getPosition();
|
||||
return (isAligned ? 0 : 200 ) + Math.abs(tPos.x - sPos.x) + Math.abs(tPos.y - sPos.y) + (currentConnection == target ? 0 : 100);
|
||||
},
|
||||
|
||||
_isVerticallyAligned:function (targetSize, targetPosition, sourcePosition) {
|
||||
|
||||
return Math.abs(sourcePosition.y - targetPosition.y) < targetSize.height / 2;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
mindplot.DragConnector.MAX_VERTICAL_CONNECTION_TOLERANCE = 80;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
mindplot.DragTopic = new Class({
|
||||
initialize:function(dragShape, draggedNode, layoutManger) {
|
||||
initialize:function (dragShape, draggedNode, layoutManger) {
|
||||
$assert(dragShape, 'Rect can not be null.');
|
||||
$assert(draggedNode, 'draggedNode can not be null.');
|
||||
$assert(layoutManger, 'layoutManger can not be null.');
|
||||
@@ -31,13 +31,13 @@ mindplot.DragTopic = new Class({
|
||||
this._isFreeLayoutEnabled = false;
|
||||
},
|
||||
|
||||
setOrder : function(order) {
|
||||
setOrder:function (order) {
|
||||
this._order = order;
|
||||
},
|
||||
|
||||
setPosition : function(x, y) {
|
||||
setPosition:function (x, y) {
|
||||
// Update drag shadow position ....
|
||||
var position = {x:x,y:y};
|
||||
var position = {x:x, y:y};
|
||||
if (this.isFreeLayoutOn() && this.isConnected()) {
|
||||
var _layoutManager = this._layoutManager;
|
||||
var par = this.getConnectedToTopic();
|
||||
@@ -49,7 +49,7 @@ mindplot.DragTopic = new Class({
|
||||
// All topic element must be positioned based on the innerShape.
|
||||
var draggedNode = this._draggedNode;
|
||||
var size = draggedNode.getSize();
|
||||
var cx = Math.ceil(position.x - (size.width / 2));
|
||||
var cx = position.x - (position.x > 0 ? 0 : size.width);
|
||||
var cy = Math.ceil(position.y - (size.height / 2));
|
||||
this._elem2d.setPosition(cx, cy);
|
||||
|
||||
@@ -66,7 +66,7 @@ mindplot.DragTopic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
updateFreeLayout: function(event) {
|
||||
updateFreeLayout:function (event) {
|
||||
var isFreeEnabled = (event.meta && Browser.Platform.mac) || (event.control && !Browser.Platform.mac);
|
||||
if (this.isFreeLayoutOn() != isFreeEnabled) {
|
||||
var dragPivot = this._getDragPivot();
|
||||
@@ -75,50 +75,27 @@ mindplot.DragTopic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
setVisibility:function(value) {
|
||||
setVisibility:function (value) {
|
||||
var dragPivot = this._getDragPivot();
|
||||
dragPivot.setVisibility(value);
|
||||
},
|
||||
|
||||
isVisible:function() {
|
||||
isVisible:function () {
|
||||
var dragPivot = this._getDragPivot();
|
||||
return dragPivot.isVisible();
|
||||
},
|
||||
|
||||
getInnerShape : function() {
|
||||
getInnerShape:function () {
|
||||
return this._elem2d;
|
||||
},
|
||||
|
||||
disconnect : function(workspace) {
|
||||
disconnect:function (workspace) {
|
||||
// Clear connection line ...
|
||||
var dragPivot = this._getDragPivot();
|
||||
dragPivot.disconnect(workspace);
|
||||
},
|
||||
|
||||
canBeConnectedTo : function(targetTopic) {
|
||||
$assert(targetTopic, 'parent can not be null');
|
||||
|
||||
var result = true;
|
||||
if (!targetTopic.areChildrenShrunken() && !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();
|
||||
|
||||
result = targetTopicModel.canBeConnected(childTopicModel, topicPosition, 18, targetTopic.getSize());
|
||||
}
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
connectTo : function(parent) {
|
||||
connectTo:function (parent) {
|
||||
$assert(parent, 'Parent connection node can not be null.');
|
||||
|
||||
// Where it should be connected ?
|
||||
@@ -133,11 +110,11 @@ mindplot.DragTopic = new Class({
|
||||
this.setOrder(predict.order);
|
||||
},
|
||||
|
||||
getDraggedTopic : function() {
|
||||
getDraggedTopic:function () {
|
||||
return this._draggedNode;
|
||||
},
|
||||
|
||||
removeFromWorkspace : function(workspace) {
|
||||
removeFromWorkspace:function (workspace) {
|
||||
// Remove drag shadow.
|
||||
workspace.removeChild(this._elem2d);
|
||||
this._isInWorkspace = false;
|
||||
@@ -148,30 +125,30 @@ mindplot.DragTopic = new Class({
|
||||
|
||||
},
|
||||
|
||||
isInWorkspace: function() {
|
||||
isInWorkspace:function () {
|
||||
return this._isInWorkspace;
|
||||
},
|
||||
|
||||
addToWorkspace : function(workspace) {
|
||||
addToWorkspace:function (workspace) {
|
||||
workspace.appendChild(this._elem2d);
|
||||
var dragPivot = this._getDragPivot();
|
||||
dragPivot.addToWorkspace(workspace);
|
||||
this._isInWorkspace = true;
|
||||
},
|
||||
|
||||
_getDragPivot : function() {
|
||||
_getDragPivot:function () {
|
||||
return mindplot.DragTopic.__getDragPivot();
|
||||
},
|
||||
|
||||
getPosition:function() {
|
||||
getPosition:function () {
|
||||
return this._position;
|
||||
},
|
||||
|
||||
isDragTopic : function() {
|
||||
isDragTopic:function () {
|
||||
return true;
|
||||
},
|
||||
|
||||
applyChanges : function(workspace) {
|
||||
applyChanges:function (workspace) {
|
||||
$assert(workspace, 'workspace can not be null');
|
||||
|
||||
|
||||
@@ -197,16 +174,16 @@ mindplot.DragTopic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
getConnectedToTopic : function() {
|
||||
getConnectedToTopic:function () {
|
||||
var dragPivot = this._getDragPivot();
|
||||
return dragPivot.getTargetTopic();
|
||||
},
|
||||
|
||||
isConnected : function() {
|
||||
isConnected:function () {
|
||||
return this.getConnectedToTopic() != null;
|
||||
},
|
||||
|
||||
isFreeLayoutOn: function() {
|
||||
isFreeLayoutOn:function () {
|
||||
// return this._isFreeLayoutEnabled;
|
||||
// Disable free layout ...
|
||||
return false;
|
||||
@@ -214,16 +191,16 @@ mindplot.DragTopic = new Class({
|
||||
|
||||
});
|
||||
|
||||
mindplot.DragTopic.PIVOT_SIZE = {width:50,height:6};
|
||||
mindplot.DragTopic.PIVOT_SIZE = {width:50, height:6};
|
||||
|
||||
mindplot.DragTopic.init = function(workspace) {
|
||||
mindplot.DragTopic.init = function (workspace) {
|
||||
|
||||
$assert(workspace, "workspace can not be null");
|
||||
var pivot = mindplot.DragTopic.__getDragPivot();
|
||||
workspace.appendChild(pivot);
|
||||
};
|
||||
|
||||
mindplot.DragTopic.__getDragPivot = function() {
|
||||
mindplot.DragTopic.__getDragPivot = function () {
|
||||
var result = mindplot.DragTopic._dragPivot;
|
||||
if (!$defined(result)) {
|
||||
result = new mindplot.DragPivot();
|
||||
|
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
mindplot.EditorOptions =
|
||||
{
|
||||
LayoutManager:"OriginalLayout",
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
|
||||
mindplot.IconGroup = new Class({
|
||||
initialize : function(topicId, iconSize) {
|
||||
initialize:function (topicId, iconSize) {
|
||||
$assert($defined(topicId), "topicId can not be null");
|
||||
$assert($defined(iconSize), "iconSize can not be null");
|
||||
|
||||
this._icons = [];
|
||||
this._group = new web2d.Group({width: 0, height:iconSize,x: 0, y:0, coordSizeWidth:0,coordSizeHeight:100});
|
||||
this._group = new web2d.Group({width:0, height:iconSize, x:0, y:0, coordSizeWidth:0, coordSizeHeight:100});
|
||||
this._removeTip = new mindplot.IconGroup.RemoveTip(this._group, topicId);
|
||||
this.seIconSize(iconSize, iconSize);
|
||||
|
||||
@@ -30,28 +30,28 @@ mindplot.IconGroup = new Class({
|
||||
|
||||
},
|
||||
|
||||
setPosition : function(x, y) {
|
||||
setPosition:function (x, y) {
|
||||
this._group.setPosition(x, y);
|
||||
},
|
||||
|
||||
getPosition : function() {
|
||||
getPosition:function () {
|
||||
return this._group.getPosition();
|
||||
},
|
||||
|
||||
getNativeElement : function() {
|
||||
getNativeElement:function () {
|
||||
return this._group;
|
||||
},
|
||||
|
||||
getSize : function() {
|
||||
getSize:function () {
|
||||
return this._group.getSize();
|
||||
},
|
||||
|
||||
seIconSize : function(width, height) {
|
||||
this._iconSize = {width:width,height:height};
|
||||
seIconSize:function (width, height) {
|
||||
this._iconSize = {width:width, height:height};
|
||||
this._resize(this._icons.length);
|
||||
},
|
||||
|
||||
addIcon : function(icon, remove) {
|
||||
addIcon:function (icon, remove) {
|
||||
$defined(icon, "icon is not defined");
|
||||
|
||||
icon.setGroup(this);
|
||||
@@ -70,9 +70,9 @@ mindplot.IconGroup = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_findIconFromModel : function(iconModel) {
|
||||
_findIconFromModel:function (iconModel) {
|
||||
var result = null;
|
||||
this._icons.each(function(icon) {
|
||||
this._icons.each(function (icon) {
|
||||
var elModel = icon.getModel();
|
||||
if (elModel.getId() == iconModel.getId()) {
|
||||
result = icon;
|
||||
@@ -80,20 +80,20 @@ mindplot.IconGroup = new Class({
|
||||
}, this);
|
||||
|
||||
if (result == null) {
|
||||
throw "Icon can no be found.";
|
||||
throw new Error("Icon can no be found:" + iconModel.getId() + ", Icons:" + this._icons);
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
removeIconByModel : function(featureModel) {
|
||||
removeIconByModel:function (featureModel) {
|
||||
$assert(featureModel, "featureModel can not be null");
|
||||
|
||||
var icon = this._findIconFromModel(featureModel);
|
||||
this._removeIcon(icon);
|
||||
},
|
||||
|
||||
_removeIcon : function(icon) {
|
||||
_removeIcon:function (icon) {
|
||||
$assert(icon, "icon can not be null");
|
||||
|
||||
this._removeTip.close(0);
|
||||
@@ -103,36 +103,36 @@ mindplot.IconGroup = new Class({
|
||||
this._resize(this._icons.length);
|
||||
|
||||
// Add all again ...
|
||||
this._icons.each(function(elem, i) {
|
||||
this._icons.each(function (elem, i) {
|
||||
this._positionIcon(elem, i);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
moveToFront : function() {
|
||||
moveToFront:function () {
|
||||
this._group.moveToFront();
|
||||
},
|
||||
|
||||
_registerListeners : function() {
|
||||
this._group.addEvent('click', function(event) {
|
||||
_registerListeners:function () {
|
||||
this._group.addEvent('click', function (event) {
|
||||
// Avoid node creation ...
|
||||
event.stopPropagation();
|
||||
|
||||
});
|
||||
|
||||
this._group.addEvent('dblclick', function(event) {
|
||||
this._group.addEvent('dblclick', function (event) {
|
||||
event.stopPropagation();
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
_resize : function(iconsLength) {
|
||||
_resize:function (iconsLength) {
|
||||
this._group.setSize(iconsLength * this._iconSize.width, this._iconSize.height);
|
||||
|
||||
var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2);
|
||||
this._group.setCoordSize(iconsLength * iconSize, iconSize);
|
||||
},
|
||||
|
||||
_positionIcon : function(icon, order) {
|
||||
_positionIcon:function (icon, order) {
|
||||
|
||||
var iconSize = mindplot.Icon.SIZE + (mindplot.IconGroup.ICON_PADDING * 2);
|
||||
icon.getImage().setPosition(iconSize * order + mindplot.IconGroup.ICON_PADDING, mindplot.IconGroup.ICON_PADDING);
|
||||
@@ -141,13 +141,13 @@ mindplot.IconGroup = new Class({
|
||||
mindplot.IconGroup.ICON_PADDING = 5;
|
||||
|
||||
mindplot.IconGroup.RemoveTip = new Class({
|
||||
initialize : function(container) {
|
||||
initialize:function (container) {
|
||||
$assert(container, "group can not be null");
|
||||
this._fadeElem = container;
|
||||
},
|
||||
|
||||
|
||||
show : function(topicId, icon) {
|
||||
show:function (topicId, icon) {
|
||||
$assert(icon, 'icon can not be null');
|
||||
|
||||
// Nothing to do ...
|
||||
@@ -162,15 +162,15 @@ mindplot.IconGroup.RemoveTip = new Class({
|
||||
|
||||
// Register events ...
|
||||
var widget = this._buildWeb2d();
|
||||
widget.addEvent('click', function() {
|
||||
widget.addEvent('click', function () {
|
||||
icon.remove();
|
||||
});
|
||||
|
||||
widget.addEvent('mouseover', function() {
|
||||
widget.addEvent('mouseover', function () {
|
||||
this.show(topicId, icon);
|
||||
}.bind(this));
|
||||
|
||||
widget.addEvent('mouseout', function() {
|
||||
widget.addEvent('mouseout', function () {
|
||||
this.hide();
|
||||
}.bind(this));
|
||||
|
||||
@@ -186,11 +186,11 @@ mindplot.IconGroup.RemoveTip = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
hide : function() {
|
||||
hide:function () {
|
||||
this.close(200);
|
||||
},
|
||||
|
||||
close : function(delay) {
|
||||
close:function (delay) {
|
||||
|
||||
// This is not ok, trying to close the same dialog twice ?
|
||||
if (this._closeTimeoutId) {
|
||||
@@ -199,7 +199,7 @@ mindplot.IconGroup.RemoveTip = new Class({
|
||||
|
||||
if (this._activeIcon) {
|
||||
var widget = this._widget;
|
||||
var close = function() {
|
||||
var close = function () {
|
||||
|
||||
this._activeIcon = null;
|
||||
this._fadeElem.removeChild(widget);
|
||||
@@ -218,19 +218,19 @@ mindplot.IconGroup.RemoveTip = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_buildWeb2d : function() {
|
||||
_buildWeb2d:function () {
|
||||
var result = new web2d.Group({
|
||||
width: 10,
|
||||
width:10,
|
||||
height:10,
|
||||
x: 0,
|
||||
x:0,
|
||||
y:0,
|
||||
coordSizeWidth:10,
|
||||
coordSizeHeight:10
|
||||
});
|
||||
|
||||
var outerRect = new web2d.Rect(0, {
|
||||
x: 0,
|
||||
y: 0,
|
||||
x:0,
|
||||
y:0,
|
||||
width:10,
|
||||
height:10,
|
||||
stroke:'0',
|
||||
@@ -240,8 +240,8 @@ mindplot.IconGroup.RemoveTip = new Class({
|
||||
outerRect.setCursor('pointer');
|
||||
|
||||
var innerRect = new web2d.Rect(0, {
|
||||
x: 1,
|
||||
y: 1,
|
||||
x:1,
|
||||
y:1,
|
||||
width:8,
|
||||
height:8,
|
||||
stroke:'1 solid white',
|
||||
@@ -260,10 +260,10 @@ mindplot.IconGroup.RemoveTip = new Class({
|
||||
result.appendChild(line2);
|
||||
|
||||
// Some events ...
|
||||
result.addEvent('mouseover', function() {
|
||||
result.addEvent('mouseover', function () {
|
||||
innerRect.setFill('#CC0033');
|
||||
});
|
||||
result.addEvent('mouseout', function() {
|
||||
result.addEvent('mouseout', function () {
|
||||
innerRect.setFill('gray');
|
||||
});
|
||||
|
||||
@@ -271,14 +271,14 @@ mindplot.IconGroup.RemoveTip = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
decorate : function(topicId, icon) {
|
||||
decorate:function (topicId, icon) {
|
||||
|
||||
if (!icon.__remove) {
|
||||
icon.addEvent('mouseover', function() {
|
||||
icon.addEvent('mouseover', function () {
|
||||
this.show(topicId, icon);
|
||||
}.bind(this));
|
||||
|
||||
icon.addEvent('mouseout', function() {
|
||||
icon.addEvent('mouseout', function () {
|
||||
this.hide();
|
||||
}.bind(this));
|
||||
icon.__remove = true;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -18,27 +18,23 @@
|
||||
|
||||
mindplot.ImageIcon = new Class({
|
||||
Extends:mindplot.Icon,
|
||||
initialize:function(topic, iconModel) {
|
||||
initialize:function (topic, iconModel, readOnly) {
|
||||
$assert(iconModel, 'iconModel can not be null');
|
||||
$assert(topic, 'topic can not be null');
|
||||
|
||||
this._topicId = topic.getId();
|
||||
this._featureModel = iconModel;
|
||||
|
||||
// @Todo: Read only must be a property ...
|
||||
this._readOnly = designer._readOnly;
|
||||
|
||||
// Build graph image representation ...
|
||||
var iconType = iconModel.getIconType();
|
||||
var imgUrl = this._getImageUrl(iconType);
|
||||
this.parent(imgUrl);
|
||||
|
||||
//Remove
|
||||
if (!this._readOnly) {
|
||||
if (!readOnly) {
|
||||
|
||||
//Icon
|
||||
var image = this.getImage();
|
||||
image.addEvent('click', function() {
|
||||
image.addEvent('click', function () {
|
||||
|
||||
var iconType = iconModel.getIconType();
|
||||
var newIconType = this._getNextFamilyIconId(iconType);
|
||||
@@ -52,15 +48,15 @@ mindplot.ImageIcon = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_getImageUrl : function(iconId) {
|
||||
_getImageUrl:function (iconId) {
|
||||
return "icons/" + iconId + ".png";
|
||||
},
|
||||
|
||||
getModel : function() {
|
||||
getModel:function () {
|
||||
return this._featureModel;
|
||||
},
|
||||
|
||||
_getNextFamilyIconId : function(iconId) {
|
||||
_getNextFamilyIconId:function (iconId) {
|
||||
|
||||
var familyIcons = this._getFamilyIcons(iconId);
|
||||
$assert(familyIcons != null, "Family Icon not found!");
|
||||
@@ -81,7 +77,7 @@ mindplot.ImageIcon = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
_getFamilyIcons : function(iconId) {
|
||||
_getFamilyIcons:function (iconId) {
|
||||
$assert(iconId != null, "id must not be null");
|
||||
$assert(iconId.indexOf("_") != -1, "Invalid icon id (it must contain '_')");
|
||||
|
||||
@@ -98,7 +94,7 @@ mindplot.ImageIcon = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
remove : function() {
|
||||
remove:function () {
|
||||
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
|
||||
var featureId = this._featureModel.getId();
|
||||
var topicId = this._topicId;
|
||||
@@ -108,29 +104,29 @@ mindplot.ImageIcon = new Class({
|
||||
|
||||
|
||||
mindplot.ImageIcon.prototype.ICON_FAMILIES = [
|
||||
{"id": "face", "icons" : ["face_plain","face_sad","face_crying","face_smile","face_surprise","face_wink"]},
|
||||
{"id": "funy", "icons" : ["funy_angel","funy_devilish","funy_glasses","funy_grin","funy_kiss","funy_monkey"]},
|
||||
{"id": "conn", "icons" : ["conn_connect","conn_disconnect"]},
|
||||
{"id": "sport", "icons" : ["sport_basketball","sport_football","sport_golf","sport_raquet","sport_shuttlecock","sport_soccer","sport_tennis"]},
|
||||
{"id": "bulb", "icons" : ["bulb_light_on","bulb_light_off"]},
|
||||
{"id": "thumb", "icons" : ["thumb_thumb_up","thumb_thumb_down"]},
|
||||
{"id": "tick", "icons" : ["tick_tick","tick_cross"]},
|
||||
{"id": "onoff", "icons" : ["onoff_clock","onoff_clock_red","onoff_add","onoff_delete","onoff_status_offline","onoff_status_online"]},
|
||||
{"id": "money", "icons" : ["money_money","money_dollar","money_euro","money_pound","money_yen","money_coins","money_ruby"]},
|
||||
{"id": "time", "icons" : ["time_calendar","time_clock","time_hourglass"]},
|
||||
{"id": "chart", "icons" : ["chart_bar","chart_line","chart_curve","chart_pie","chart_organisation"]},
|
||||
{"id": "sign", "icons" : ["sign_warning","sign_info","sign_stop","sign_help","sign_cancel"]},
|
||||
{"id": "hard", "icons" : ["hard_cd","hard_computer","hard_controller","hard_driver_disk","hard_ipod","hard_keyboard","hard_mouse","hard_printer"]},
|
||||
{"id": "soft", "icons" : ["soft_bug","soft_cursor","soft_database_table","soft_database","soft_feed","soft_folder_explore","soft_rss","soft_penguin"]},
|
||||
{"id": "arrow", "icons" : ["arrow_up","arrow_down","arrow_left","arrow_right"]},
|
||||
{"id": "arrowc", "icons" : ["arrowc_rotate_anticlockwise","arrowc_rotate_clockwise","arrowc_turn_left","arrowc_turn_right"]},
|
||||
{"id": "people", "icons" : ["people_group","people_male1","people_male2","people_female1","people_female2"]},
|
||||
{"id": "mail", "icons" : ["mail_envelop","mail_mailbox","mail_edit","mail_list"]},
|
||||
{"id": "flag", "icons" : ["flag_blue","flag_green","flag_orange","flag_pink","flag_purple","flag_yellow"]},
|
||||
{"id": "bullet", "icons" : ["bullet_black","bullet_blue","bullet_green","bullet_orange","bullet_red","bullet_pink","bullet_purple"]},
|
||||
{"id": "tag", "icons" : ["tag_blue","tag_green","tag_orange","tag_red","tag_pink","tag_yellow"]},
|
||||
{"id": "object", "icons" : ["object_bell","object_clanbomber","object_key","object_pencil","object_phone","object_magnifier","object_clip","object_music","object_star","object_wizard","object_house","object_cake","object_camera","object_palette","object_rainbow"]},
|
||||
{"id": "weather", "icons" : ["weather_clear-night","weather_clear","weather_few-clouds-night","weather_few-clouds","weather_overcast","weather_severe-alert","weather_showers-scattered","weather_showers","weather_snow","weather_storm"]}
|
||||
{"id":"face", "icons":["face_plain", "face_sad", "face_crying", "face_smile", "face_surprise", "face_wink"]},
|
||||
{"id":"funy", "icons":["funy_angel", "funy_devilish", "funy_glasses", "funy_grin", "funy_kiss", "funy_monkey"]},
|
||||
{"id":"conn", "icons":["conn_connect", "conn_disconnect"]},
|
||||
{"id":"sport", "icons":["sport_basketball", "sport_football", "sport_golf", "sport_raquet", "sport_shuttlecock", "sport_soccer", "sport_tennis"]},
|
||||
{"id":"bulb", "icons":["bulb_light_on", "bulb_light_off"]},
|
||||
{"id":"thumb", "icons":["thumb_thumb_up", "thumb_thumb_down"]},
|
||||
{"id":"tick", "icons":["tick_tick", "tick_cross"]},
|
||||
{"id":"onoff", "icons":["onoff_clock", "onoff_clock_red", "onoff_add", "onoff_delete", "onoff_status_offline", "onoff_status_online"]},
|
||||
{"id":"money", "icons":["money_money", "money_dollar", "money_euro", "money_pound", "money_yen", "money_coins", "money_ruby"]},
|
||||
{"id":"time", "icons":["time_calendar", "time_clock", "time_hourglass"]},
|
||||
{"id":"chart", "icons":["chart_bar", "chart_line", "chart_curve", "chart_pie", "chart_organisation"]},
|
||||
{"id":"sign", "icons":["sign_warning", "sign_info", "sign_stop", "sign_help", "sign_cancel"]},
|
||||
{"id":"hard", "icons":["hard_cd", "hard_computer", "hard_controller", "hard_driver_disk", "hard_ipod", "hard_keyboard", "hard_mouse", "hard_printer"]},
|
||||
{"id":"soft", "icons":["soft_bug", "soft_cursor", "soft_database_table", "soft_database", "soft_feed", "soft_folder_explore", "soft_rss", "soft_penguin"]},
|
||||
{"id":"arrow", "icons":["arrow_up", "arrow_down", "arrow_left", "arrow_right"]},
|
||||
{"id":"arrowc", "icons":["arrowc_rotate_anticlockwise", "arrowc_rotate_clockwise", "arrowc_turn_left", "arrowc_turn_right"]},
|
||||
{"id":"people", "icons":["people_group", "people_male1", "people_male2", "people_female1", "people_female2"]},
|
||||
{"id":"mail", "icons":["mail_envelop", "mail_mailbox", "mail_edit", "mail_list"]},
|
||||
{"id":"flag", "icons":["flag_blue", "flag_green", "flag_orange", "flag_pink", "flag_purple", "flag_yellow"]},
|
||||
{"id":"bullet", "icons":["bullet_black", "bullet_blue", "bullet_green", "bullet_orange", "bullet_red", "bullet_pink", "bullet_purple"]},
|
||||
{"id":"tag", "icons":["tag_blue", "tag_green", "tag_orange", "tag_red", "tag_pink", "tag_yellow"]},
|
||||
{"id":"object", "icons":["object_bell", "object_clanbomber", "object_key", "object_pencil", "object_phone", "object_magnifier", "object_clip", "object_music", "object_star", "object_wizard", "object_house", "object_cake", "object_camera", "object_palette", "object_rainbow"]},
|
||||
{"id":"weather", "icons":["weather_clear-night", "weather_clear", "weather_few-clouds-night", "weather_few-clouds", "weather_overcast", "weather_severe-alert", "weather_showers-scattered", "weather_showers", "weather_snow", "weather_storm"]}
|
||||
];
|
||||
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -18,32 +18,34 @@
|
||||
|
||||
mindplot.LinkIcon = new Class({
|
||||
|
||||
Extends: mindplot.Icon,
|
||||
initialize : function(topic, linkModel) {
|
||||
Extends:mindplot.Icon,
|
||||
initialize:function (topic, linkModel, readOnly) {
|
||||
$assert(topic, 'topic can not be null');
|
||||
$assert(linkModel, 'linkModel can not be null');
|
||||
|
||||
|
||||
this.parent(mindplot.LinkIcon.IMAGE_URL);
|
||||
this._linksModel = linkModel;
|
||||
this._topic = topic;
|
||||
this._readOnly = readOnly;
|
||||
|
||||
this._registerEvents();
|
||||
},
|
||||
|
||||
_registerEvents : function() {
|
||||
_registerEvents:function () {
|
||||
this._image.setCursor('pointer');
|
||||
|
||||
// Add on click event to open the editor ...
|
||||
this.addEvent('click', function(event) {
|
||||
this._topic.showLinkEditor();
|
||||
event.stopPropagation();
|
||||
}.bind(this));
|
||||
if (!this._readOnly) {
|
||||
// Add on click event to open the editor ...
|
||||
this.addEvent('click', function (event) {
|
||||
this._topic.showLinkEditor();
|
||||
event.stopPropagation();
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this._tip = new mindplot.widget.LinkIconTooltip(this);
|
||||
},
|
||||
|
||||
getModel : function() {
|
||||
getModel:function () {
|
||||
return this._linksModel;
|
||||
}
|
||||
});
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -18,28 +18,27 @@
|
||||
|
||||
mindplot.LocalStorageManager = new Class({
|
||||
Extends:mindplot.PersistenceManager,
|
||||
initialize: function() {
|
||||
initialize:function () {
|
||||
this.parent();
|
||||
},
|
||||
|
||||
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
|
||||
saveMapXml:function (mapId, mapXml, pref, saveHistory, events) {
|
||||
localStorage.setItem(mapId + "-xml", mapXml);
|
||||
events.onSuccess();
|
||||
},
|
||||
|
||||
discardChanges : function(mapId) {
|
||||
discardChanges:function (mapId) {
|
||||
localStorage.removeItem(mapId + "-xml");
|
||||
},
|
||||
|
||||
loadMapDom : function(mapId) {
|
||||
loadMapDom:function (mapId) {
|
||||
var xml = localStorage.getItem(mapId + "-xml");
|
||||
if (xml == null) {
|
||||
// Let's try to open one from the local directory ...
|
||||
var xmlRequest = new Request({
|
||||
url: 'samples/' + mapId + '.xml',
|
||||
method: 'get',
|
||||
async: false,
|
||||
onSuccess: function(responseText) {
|
||||
url:'samples/' + mapId + '.xml',
|
||||
method:'get',
|
||||
async:false,
|
||||
onSuccess:function (responseText) {
|
||||
xml = responseText;
|
||||
}
|
||||
});
|
||||
@@ -47,13 +46,16 @@ mindplot.LocalStorageManager = new Class({
|
||||
|
||||
// If I could not load it from a file, hard code one.
|
||||
if (xml == null) {
|
||||
throw "Map could not be loaded";
|
||||
throw new Error("Map could not be loaded");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var parser = new DOMParser();
|
||||
return parser.parseFromString(xml, "text/xml");
|
||||
},
|
||||
|
||||
unlockMap:function (mindmap) {
|
||||
// Ignore, no implementation required ...
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -17,14 +17,14 @@
|
||||
*/
|
||||
|
||||
mindplot.MainTopic = new Class({
|
||||
Extends: mindplot.Topic,
|
||||
initialize : function(model, options) {
|
||||
Extends:mindplot.Topic,
|
||||
initialize:function (model, options) {
|
||||
this.parent(model, options);
|
||||
},
|
||||
|
||||
INNER_RECT_ATTRIBUTES : {stroke:'0.5 solid #009900'},
|
||||
INNER_RECT_ATTRIBUTES:{stroke:'0.5 solid #009900'},
|
||||
|
||||
_buildDragShape : function() {
|
||||
_buildDragShape:function () {
|
||||
var innerShape = this._buildShape(this.INNER_RECT_ATTRIBUTES, this.getShapeType());
|
||||
var size = this.getSize();
|
||||
innerShape.setSize(size.width, size.height);
|
||||
@@ -40,7 +40,7 @@ mindplot.MainTopic = new Class({
|
||||
innerShape.setAttribute("fillColor", bgColor);
|
||||
|
||||
// Create group ...
|
||||
var groupAttributes = {width: 100, height:100,coordSizeWidth:100,coordSizeHeight:100};
|
||||
var groupAttributes = {width:100, height:100, coordSizeWidth:100, coordSizeHeight:100};
|
||||
var group = new web2d.Group(groupAttributes);
|
||||
group.appendChild(innerShape);
|
||||
|
||||
@@ -55,16 +55,11 @@ mindplot.MainTopic = new Class({
|
||||
return group;
|
||||
},
|
||||
|
||||
|
||||
_defaultShapeType : function() {
|
||||
return mindplot.model.TopicShape.LINE;
|
||||
},
|
||||
|
||||
updateTopicShape : function(targetTopic, workspace) {
|
||||
updateTopicShape:function (targetTopic, workspace) {
|
||||
// Change figure based on the connected topic ...
|
||||
var model = this.getModel();
|
||||
var shapeType = model.getShapeType();
|
||||
if (targetTopic.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (!targetTopic.isCentralTopic()) {
|
||||
if (!$defined(shapeType)) {
|
||||
// Get the real shape type ...
|
||||
shapeType = this.getShapeType();
|
||||
@@ -73,7 +68,7 @@ mindplot.MainTopic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
disconnect : function(workspace) {
|
||||
disconnect:function (workspace) {
|
||||
this.parent(workspace);
|
||||
var size = this.getSize();
|
||||
|
||||
@@ -88,11 +83,7 @@ mindplot.MainTopic = new Class({
|
||||
innerShape.setVisibility(true);
|
||||
},
|
||||
|
||||
getTopicType : function() {
|
||||
return "MainTopic";
|
||||
},
|
||||
|
||||
_updatePositionOnChangeSize : function(oldSize, newSize) {
|
||||
_updatePositionOnChangeSize:function (oldSize, newSize) {
|
||||
|
||||
var xOffset = Math.round((newSize.width - oldSize.width) / 2);
|
||||
var pos = this.getPosition();
|
||||
@@ -106,7 +97,7 @@ mindplot.MainTopic = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
workoutIncomingConnectionPoint : function(sourcePosition) {
|
||||
workoutIncomingConnectionPoint:function (sourcePosition) {
|
||||
$assert(sourcePosition, 'sourcePoint can not be null');
|
||||
var pos = this.getPosition();
|
||||
var size = this.getSize();
|
||||
@@ -131,7 +122,7 @@ mindplot.MainTopic = new Class({
|
||||
|
||||
},
|
||||
|
||||
workoutOutgoingConnectionPoint : function(targetPosition) {
|
||||
workoutOutgoingConnectionPoint:function (targetPosition) {
|
||||
$assert(targetPosition, 'targetPoint can not be null');
|
||||
var pos = this.getPosition();
|
||||
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos);
|
||||
@@ -167,81 +158,6 @@ mindplot.MainTopic = new Class({
|
||||
result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight, true);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
_getInnerPadding : function() {
|
||||
var result;
|
||||
var parent = this.getModel().getParent();
|
||||
if (parent && mindplot.model.INodeModel.MAIN_TOPIC_TYPE == parent.getType()) {
|
||||
result = 3;
|
||||
}
|
||||
else {
|
||||
result = 4;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
isConnectedToCentralTopic : function() {
|
||||
var model = this.getModel();
|
||||
var parent = model.getParent();
|
||||
|
||||
return parent && parent.getType() === mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE;
|
||||
},
|
||||
|
||||
_defaultText : function() {
|
||||
var targetTopic = this.getOutgoingConnectedTopic();
|
||||
var result = "";
|
||||
if ($defined(targetTopic)) {
|
||||
if (targetTopic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
result = $msg('MAIN_TOPIC');
|
||||
} else {
|
||||
result = $msg('SUB_TOPIC');
|
||||
}
|
||||
} else {
|
||||
result = $msg('ISOLATED_TOPIC');;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
_defaultFontStyle : function() {
|
||||
var targetTopic = this.getOutgoingConnectedTopic();
|
||||
var result;
|
||||
if ($defined(targetTopic)) {
|
||||
if (targetTopic.getType() == mindplot.model.INodeModel.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;
|
||||
},
|
||||
|
||||
_defaultBackgroundColor : function() {
|
||||
return "#E0E5EF";
|
||||
},
|
||||
|
||||
_defaultBorderColor : function() {
|
||||
return '#023BB9';
|
||||
}
|
||||
|
||||
});
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -40,206 +40,5 @@ $msg = function (key) {
|
||||
return msg ? msg : key;
|
||||
};
|
||||
|
||||
mindplot.Messages.BUNDLES = {
|
||||
'en':{
|
||||
|
||||
ZOOM_IN:'Zoom In',
|
||||
ZOOM_OUT:'Zoom Out',
|
||||
TOPIC_SHAPE:'Topic Shape',
|
||||
TOPIC_ADD:'Add Topic',
|
||||
TOPIC_DELETE:'Delete Topic',
|
||||
TOPIC_ICON:'Add Icon',
|
||||
TOPIC_LINK:'Add Link',
|
||||
TOPIC_RELATIONSHIP:'Relationship',
|
||||
TOPIC_COLOR:'Topic Color',
|
||||
TOPIC_BORDER_COLOR:'Topic Border Color',
|
||||
TOPIC_NOTE:'Add Note',
|
||||
FONT_FAMILY:'Font Type',
|
||||
FONT_SIZE:'Text Size',
|
||||
FONT_BOLD:'Text Bold',
|
||||
FONT_ITALIC:'Text Italic',
|
||||
UNDO_EDITION:'Undo Edition',
|
||||
REDO_EDITION:'Redo Edition',
|
||||
UNDO:'Undo',
|
||||
REDO:'Redo',
|
||||
INSERT:'Insert',
|
||||
SAVE:'Save',
|
||||
NOTE:'Note',
|
||||
ADD_TOPIC:'Add Topic',
|
||||
LOADING:'Loading ...',
|
||||
EXPORT:'Export',
|
||||
PRINT:'Print',
|
||||
PUBLISH:'Publish',
|
||||
COLLABORATE:'Share',
|
||||
HISTORY:'History',
|
||||
DISCARD_CHANGES:'Discard Changes',
|
||||
FONT_COLOR:'Text Color',
|
||||
SAVING:'Saving ...',
|
||||
SAVE_COMPLETE:'Save Complete',
|
||||
ZOOM_IN_ERROR:'Zoom too high.',
|
||||
ZOOM_ERROR:'No more zoom can be applied.',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'Could not create a topic. Only one topic must be selected.',
|
||||
ONE_TOPIC_MUST_BE_SELECTED:'Could not create a topic. One topic must be selected.',
|
||||
SAVE_COULD_NOT_BE_COMPLETED:'Save could not be completed. Try latter.',
|
||||
UNEXPECTED_ERROR_LOADING:"We're sorry, an unexpected error has occurred. Try again reloading the editor.\nIf the problem persists, contact us to support@wisemapping.com.",
|
||||
MAIN_TOPIC:'Main Topic',
|
||||
SUB_TOPIC:'Sub Topic',
|
||||
ISOLATED_TOPIC:'Isolated Topic',
|
||||
CENTRAL_TOPIC:'Central Topic',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'Children can not be collapsed. One topic must be selected.',
|
||||
SHORTCUTS:'Keyboard Shortcuts',
|
||||
ENTITIES_COULD_NOT_BE_DELETED:'Could not delete topic or relation. At least one map entity must be selected.',
|
||||
CENTRAL_TOPIC_CAN_NOT_BE_DELETED:'Central topic can not be deleted.',
|
||||
SELECTION_COPIED_TO_CLIPBOARD:'Topics copied to the clipboard',
|
||||
CLIPBOARD_IS_EMPTY:'Nothing to copy. Clipboard is empty',
|
||||
AT_LEAST_ONE_TOPIC_MUST_BE_SELECTED:'At least one topic must be selected.',
|
||||
RELATIONSHIP_COULD_NOT_BE_CREATED:'Relationship could not be created. A parent relationship topic must be selected first.'
|
||||
|
||||
},
|
||||
'es':{
|
||||
DISCARD_CHANGES:'Descartar Cambios',
|
||||
SAVE:'Guardar',
|
||||
INSERT:'Insertar',
|
||||
ZOOM_IN:'Acercar',
|
||||
ZOOM_OUT:'Alejar',
|
||||
TOPIC_BORDER_COLOR:'Color del Borde',
|
||||
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',
|
||||
TOPIC_COLOR:'Color Tópico',
|
||||
TOPIC_RELATIONSHIP:'Relación',
|
||||
FONT_FAMILY:'Tipo de Fuente',
|
||||
FONT_SIZE:'Tamaño de Texto',
|
||||
FONT_BOLD:'Negrita',
|
||||
FONT_ITALIC:'Italica',
|
||||
FONT_COLOR:'Color de Texto',
|
||||
UNDO_EDITION:'Undo Edition',
|
||||
REDO_EDITION:'Redo Edition',
|
||||
UNDO:'Rehacer',
|
||||
NOTE:'Nota',
|
||||
LOADING:'Cargando ...',
|
||||
PRINT:'Imprimir',
|
||||
PUBLISH:'Publicar',
|
||||
REDO:'Deshacer',
|
||||
ADD_TOPIC:'Agregar Tópico',
|
||||
COLLABORATE:'Compartir',
|
||||
EXPORT:'Exportar',
|
||||
HISTORY:'History',
|
||||
SAVE_COMPLETE:'Grabado Completo',
|
||||
SAVING:'Grabando ...',
|
||||
ONE_TOPIC_MUST_BE_SELECTED:'No ha sido posible crear un nuevo tópico. Al menos un tópico debe ser seleccionado.',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'No ha sido posible crear un nuevo tópico. Solo un tópico debe ser seleccionado.',
|
||||
SAVE_COULD_NOT_BE_COMPLETED:'Grabación no pudo ser completada. Intentelo mas tarde.',
|
||||
UNEXPECTED_ERROR_LOADING:"Lo sentimos, un error inesperado ha ocurrido. Intentelo nuevamente recargando el editor.\n Si el problema persiste, contactenos a support@wisemapping.com.",
|
||||
ZOOM_ERROR:'No es posible aplicar mas zoom.',
|
||||
ZOOM_IN_ERROR:'El zoom es muy alto.',
|
||||
MAIN_TOPIC:'Tópico Principal',
|
||||
SUB_TOPIC:'Tópico Secundario',
|
||||
ISOLATED_TOPIC:'Tópico Aislado',
|
||||
CENTRAL_TOPIC:'Tópico Central',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'Tópicos hijos no pueden ser colapsados. Solo un topic debe ser seleccionado.',
|
||||
SHORTCUTS:'Accesos directos',
|
||||
ENTITIES_COULD_NOT_BE_DELETED:'El tópico o la relación no pudo ser borrada. Debe selecionar al menos una.',
|
||||
CENTRAL_TOPIC_CAN_NOT_BE_DELETED:'El tópico central no puede ser borrado.',
|
||||
SELECTION_COPIED_TO_CLIPBOARD:'Tópicos copiados al clipboard',
|
||||
CLIPBOARD_IS_EMPTY:'Nada que copiar. Clipboard está vacio.',
|
||||
AT_LEAST_ONE_TOPIC_MUST_BE_SELECTED:'Al menos un tópico debe ser seleccionado.',
|
||||
RELATIONSHIP_COULD_NOT_BE_CREATED:'La relación no pudo ser creada. Una relación padre debe ser seleccionada primero.'
|
||||
|
||||
},
|
||||
zh_cn:{
|
||||
ZOOM_IN:'放大',
|
||||
ZOOM_OUT:'缩小',
|
||||
TOPIC_SHAPE:'节点外形',
|
||||
TOPIC_ADD:'添加节点',
|
||||
TOPIC_DELETE:'删除节点',
|
||||
TOPIC_ICON:'加入图标',
|
||||
TOPIC_LINK:'添加链接',
|
||||
TOPIC_RELATIONSHIP:'关系',
|
||||
TOPIC_COLOR:'节点颜色',
|
||||
TOPIC_BORDER_COLOR:'边框颜色',
|
||||
TOPIC_NOTE:'添加注释',
|
||||
FONT_FAMILY:'字体',
|
||||
FONT_SIZE:'文字大小',
|
||||
FONT_BOLD:'粗体',
|
||||
FONT_ITALIC:'斜体',
|
||||
UNDO:'撤销',
|
||||
REDO:'重做',
|
||||
INSERT:'插入',
|
||||
SAVE:'保存',
|
||||
NOTE:'注释',
|
||||
ADD_TOPIC:'添加节点',
|
||||
LOADING:'载入中……',
|
||||
EXPORT:'导出',
|
||||
PRINT:'打印',
|
||||
PUBLISH:'公开',
|
||||
COLLABORATE:'共享',
|
||||
HISTORY:'历史',
|
||||
DISCARD_CHANGES:'清除改变',
|
||||
FONT_COLOR:'文本颜色',
|
||||
SAVING:'保存中……',
|
||||
SAVE_COMPLETE:'完成保存',
|
||||
ZOOM_IN_ERROR:'缩放过多。',
|
||||
ZOOM_ERROR:'不能再缩放。',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'不能创建节点。仅能选择一个节点。',
|
||||
ONE_TOPIC_MUST_BE_SELECTED:'不能创建节点。必须选择一个节点。',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'子节点不能折叠。必须选择一个节点。',
|
||||
SAVE_COULD_NOT_BE_COMPLETED:'保存未完成。稍后再试。',
|
||||
UNEXPECTED_ERROR_LOADING:'抱歉,突遭错误,我们无法处理你的请求。\n尝试重新装载编辑器。如果问题依然存在请联系support@wisemapping.com。',
|
||||
MAIN_TOPIC:'主节点',
|
||||
SUB_TOPIC:'子节点',
|
||||
ISOLATED_TOPIC:'独立节点',
|
||||
CENTRAL_TOPIC:'中心节点',
|
||||
SHORTCUTS:'快捷键'
|
||||
},
|
||||
zh_tw:{
|
||||
ZOOM_IN:'放大',
|
||||
ZOOM_OUT:'縮小',
|
||||
TOPIC_SHAPE:'節點外形',
|
||||
TOPIC_ADD:'添加節點',
|
||||
TOPIC_DELETE:'刪除節點',
|
||||
TOPIC_ICON:'加入圖示',
|
||||
TOPIC_LINK:'添加鏈接',
|
||||
TOPIC_RELATIONSHIP:'關係',
|
||||
TOPIC_COLOR:'節點顏色',
|
||||
TOPIC_BORDER_COLOR:'邊框顏色',
|
||||
TOPIC_NOTE:'添加注釋',
|
||||
FONT_FAMILY:'字體',
|
||||
FONT_SIZE:'文字大小',
|
||||
FONT_BOLD:'粗體',
|
||||
FONT_ITALIC:'斜體',
|
||||
UNDO:'撤銷',
|
||||
REDO:'重做',
|
||||
INSERT:'插入',
|
||||
SAVE:'保存',
|
||||
NOTE:'注釋',
|
||||
ADD_TOPIC:'添加節點',
|
||||
LOADING:'載入中……',
|
||||
EXPORT:'導出',
|
||||
PRINT:'列印',
|
||||
PUBLISH:'公開',
|
||||
COLLABORATE:'共用',
|
||||
HISTORY:'歷史',
|
||||
DISCARD_CHANGES:'清除改變',
|
||||
FONT_COLOR:'文本顏色',
|
||||
SAVING:'保存中……',
|
||||
SAVE_COMPLETE:'完成保存',
|
||||
ZOOM_IN_ERROR:'縮放過多。',
|
||||
ZOOM_ERROR:'不能再縮放。',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED:'不能創建節點。僅能選擇一個節點。',
|
||||
ONE_TOPIC_MUST_BE_SELECTED:'不能創建節點。必須選擇一個節點。',
|
||||
ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE:'子節點不能折疊。必須選擇一個節點。',
|
||||
SAVE_COULD_NOT_BE_COMPLETED:'保存未完成。稍後再試。',
|
||||
UNEXPECTED_ERROR_LOADING:'抱歉,突遭錯誤,我們無法處理你的請求。\n嘗試重新裝載編輯器。如果問題依然存在請聯繫support@wisemapping.com。',
|
||||
MAIN_TOPIC:'主節點',
|
||||
SUB_TOPIC:'子節點',
|
||||
ISOLATED_TOPIC:'獨立節點',
|
||||
CENTRAL_TOPIC:'中心節點',
|
||||
SHORTCUTS:'快捷鍵'
|
||||
}
|
||||
};
|
||||
mindplot.Messages.BUNDLES['zh'] = mindplot.Messages.zh_tw;
|
||||
mindplot.Messages.BUNDLES = {};
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -17,20 +17,21 @@
|
||||
*/
|
||||
|
||||
mindplot.MultilineTextEditor = new Class({
|
||||
Extends: Events,
|
||||
initialize:function() {
|
||||
Extends:Events,
|
||||
initialize:function () {
|
||||
this._topic = null;
|
||||
this._timeoutId = -1;
|
||||
},
|
||||
|
||||
_buildEditor : function() {
|
||||
_buildEditor:function () {
|
||||
|
||||
var result = new Element('div');
|
||||
result.setStyles({
|
||||
position:"absolute",
|
||||
display: "none",
|
||||
zIndex: "8",
|
||||
display:"none",
|
||||
zIndex:"8",
|
||||
overflow:"hidden",
|
||||
border: "0 none"
|
||||
border:"0 none"
|
||||
}
|
||||
);
|
||||
|
||||
@@ -42,17 +43,17 @@ mindplot.MultilineTextEditor = new Class({
|
||||
);
|
||||
|
||||
textareaElem.setStyles({
|
||||
border: "1px gray dashed",
|
||||
border:"1px gray dashed",
|
||||
background:"rgba(98, 135, 167, .3)",
|
||||
outline: '0 none',
|
||||
resize: 'none',
|
||||
outline:'0 none',
|
||||
resize:'none',
|
||||
overflow:"hidden"
|
||||
});
|
||||
textareaElem.inject(result);
|
||||
return result;
|
||||
},
|
||||
|
||||
_registerEvents : function(containerElem) {
|
||||
_registerEvents:function (containerElem) {
|
||||
var textareaElem = this._getTextareaElem();
|
||||
|
||||
textareaElem.addEvent('keydown', function (event) {
|
||||
@@ -63,8 +64,30 @@ mindplot.MultilineTextEditor = new Class({
|
||||
case 'enter':
|
||||
if (event.meta || event.control) {
|
||||
|
||||
// @todo: Enters must be in any place ...
|
||||
textareaElem.value = textareaElem.value + "\n";
|
||||
// Add return ...
|
||||
var text = textareaElem.value;
|
||||
var cursorPosition = text.length;
|
||||
if (textareaElem.selectionStart) {
|
||||
cursorPosition = textareaElem.selectionStart;
|
||||
}
|
||||
|
||||
var head = text.substring(0, cursorPosition);
|
||||
var tail = "";
|
||||
if (cursorPosition < text.length) {
|
||||
tail = text.substring(cursorPosition, text.length);
|
||||
}
|
||||
textareaElem.value = head + "\n" + tail;
|
||||
|
||||
// Position cursor ...
|
||||
if (textareaElem.setSelectionRange) {
|
||||
textareaElem.focus();
|
||||
textareaElem.setSelectionRange(cursorPosition + 1, cursorPosition + 1);
|
||||
} else if (textareaElem.createTextRange) {
|
||||
var range = textareaElem.createTextRange();
|
||||
range.moveStart('character', cursorPosition + 1);
|
||||
range.select();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
this.close(true);
|
||||
@@ -74,36 +97,36 @@ mindplot.MultilineTextEditor = new Class({
|
||||
event.stopPropagation();
|
||||
}.bind(this));
|
||||
|
||||
textareaElem.addEvent('keypress', function(event) {
|
||||
textareaElem.addEvent('keypress', function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
textareaElem.addEvent('keyup', function(event) {
|
||||
textareaElem.addEvent('keyup', function (event) {
|
||||
var text = this._getTextareaElem().value;
|
||||
this.fireEvent('input', [event, text]);
|
||||
this._adjustEditorSize();
|
||||
}.bind(this));
|
||||
|
||||
// If the user clicks on the input, all event must be ignored ...
|
||||
containerElem.addEvent('click', function(event) {
|
||||
containerElem.addEvent('click', function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
containerElem.addEvent('dblclick', function(event) {
|
||||
containerElem.addEvent('dblclick', function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
containerElem.addEvent('mousedown', function(event) {
|
||||
containerElem.addEvent('mousedown', function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
},
|
||||
|
||||
_adjustEditorSize : function() {
|
||||
_adjustEditorSize:function () {
|
||||
|
||||
if (this.isVisible()) {
|
||||
var textElem = this._getTextareaElem();
|
||||
|
||||
var lines = textElem.value.split('\n');
|
||||
var maxLineLength = 1;
|
||||
lines.each(function(line) {
|
||||
lines.each(function (line) {
|
||||
if (maxLineLength < line.length)
|
||||
maxLineLength = line.length;
|
||||
});
|
||||
@@ -112,17 +135,17 @@ mindplot.MultilineTextEditor = new Class({
|
||||
textElem.setAttribute('rows', lines.length);
|
||||
|
||||
this._containerElem.setStyles({
|
||||
width: (maxLineLength + 3) + 'em',
|
||||
height: textElem.getSize().height
|
||||
width:(maxLineLength + 3) + 'em',
|
||||
height:textElem.getSize().height
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
isVisible : function () {
|
||||
isVisible:function () {
|
||||
return $defined(this._containerElem) && this._containerElem.getStyle('display') == 'block';
|
||||
},
|
||||
|
||||
_updateModel : function () {
|
||||
_updateModel:function () {
|
||||
|
||||
if (this._topic.getText() != this._getText()) {
|
||||
var text = this._getText();
|
||||
@@ -133,7 +156,11 @@ mindplot.MultilineTextEditor = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
show : function (topic,text) {
|
||||
show:function (topic, text) {
|
||||
// Close a previous node editor if it's opened ...
|
||||
if (this._topic) {
|
||||
this.close(false);
|
||||
}
|
||||
|
||||
this._topic = topic;
|
||||
if (!this.isVisible()) {
|
||||
@@ -147,7 +174,7 @@ mindplot.MultilineTextEditor = new Class({
|
||||
}
|
||||
},
|
||||
|
||||
_showEditor : function (defaultText) {
|
||||
_showEditor:function (defaultText) {
|
||||
|
||||
var topic = this._topic;
|
||||
|
||||
@@ -162,12 +189,12 @@ mindplot.MultilineTextEditor = new Class({
|
||||
this._setStyle(font);
|
||||
|
||||
// Set editor's initial size
|
||||
var displayFunc = function() {
|
||||
var displayFunc = function () {
|
||||
// Position the editor and set the size...
|
||||
var textShape = this._topic.getTextShape();
|
||||
textShape.positionRelativeTo(this._containerElem, {
|
||||
position: {x: 'left',y:'top'},
|
||||
edge: {x: 'left', y: 'top'}
|
||||
position:{x:'left', y:'top'},
|
||||
edge:{x:'left', y:'top'}
|
||||
});
|
||||
this._containerElem.setStyle('display', 'block');
|
||||
|
||||
@@ -181,10 +208,10 @@ mindplot.MultilineTextEditor = new Class({
|
||||
|
||||
}.bind(this);
|
||||
|
||||
displayFunc.delay(10);
|
||||
this._timeoutId = displayFunc.delay(10);
|
||||
},
|
||||
|
||||
_setStyle : function (fontStyle) {
|
||||
_setStyle:function (fontStyle) {
|
||||
var inputField = this._getTextareaElem();
|
||||
if (!$defined(fontStyle.font)) {
|
||||
fontStyle.font = "Arial";
|
||||
@@ -199,31 +226,31 @@ mindplot.MultilineTextEditor = new Class({
|
||||
fontStyle.size = 12;
|
||||
}
|
||||
var style = {
|
||||
fontSize : fontStyle.size + "px",
|
||||
fontFamily : fontStyle.font,
|
||||
fontStyle : fontStyle.style,
|
||||
fontWeight : fontStyle.weight,
|
||||
color : fontStyle.color
|
||||
fontSize:fontStyle.size + "px",
|
||||
fontFamily:fontStyle.font,
|
||||
fontStyle:fontStyle.style,
|
||||
fontWeight:fontStyle.weight,
|
||||
color:fontStyle.color
|
||||
};
|
||||
inputField.setStyles(style);
|
||||
this._containerElem.setStyles(style);
|
||||
},
|
||||
|
||||
_setText : function(text) {
|
||||
_setText:function (text) {
|
||||
var textareaElem = this._getTextareaElem();
|
||||
textareaElem.value = text;
|
||||
this._adjustEditorSize();
|
||||
},
|
||||
|
||||
_getText : function() {
|
||||
_getText:function () {
|
||||
return this._getTextareaElem().value;
|
||||
},
|
||||
|
||||
_getTextareaElem : function() {
|
||||
_getTextareaElem:function () {
|
||||
return this._containerElem.getElement('textarea');
|
||||
},
|
||||
|
||||
_positionCursor : function(textareaElem, selectText) {
|
||||
_positionCursor:function (textareaElem, selectText) {
|
||||
textareaElem.focus();
|
||||
if (selectText) {
|
||||
// Mark text as selected ...
|
||||
@@ -248,9 +275,11 @@ mindplot.MultilineTextEditor = new Class({
|
||||
|
||||
},
|
||||
|
||||
close : function(update) {
|
||||
if (this.isVisible()) {
|
||||
close:function (update) {
|
||||
if (this.isVisible() && this._topic) {
|
||||
// Update changes ...
|
||||
clearTimeout(this._timeoutId);
|
||||
|
||||
if (!$defined(update) || update) {
|
||||
this._updateModel();
|
||||
}
|
||||
@@ -261,8 +290,9 @@ mindplot.MultilineTextEditor = new Class({
|
||||
// Remove it form the screen ...
|
||||
this._containerElem.dispose();
|
||||
this._containerElem = null;
|
||||
this._topic = null;
|
||||
this._timeoutId = -1;
|
||||
}
|
||||
this._topic = null;
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -38,6 +38,7 @@ mindplot.NodeGraph = new Class({
|
||||
},
|
||||
|
||||
setId : function(id) {
|
||||
$assert(typeof topic.getId() == "number", "id is not a number:" + id);
|
||||
this.getModel().setId(id);
|
||||
},
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -17,45 +17,49 @@
|
||||
*/
|
||||
|
||||
mindplot.NoteIcon = new Class({
|
||||
Extends: mindplot.Icon,
|
||||
initialize : function(topic, noteModel) {
|
||||
Extends:mindplot.Icon,
|
||||
initialize:function (topic, noteModel, readOnly) {
|
||||
$assert(topic, 'topic can not be null');
|
||||
|
||||
this.parent(mindplot.NoteIcon.IMAGE_URL);
|
||||
this._linksModel = noteModel;
|
||||
this._topic = topic;
|
||||
this._readOnly = readOnly;
|
||||
|
||||
this._registerEvents();
|
||||
},
|
||||
|
||||
_registerEvents : function() {
|
||||
_registerEvents:function () {
|
||||
this._image.setCursor('pointer');
|
||||
|
||||
// Add on click event to open the editor ...
|
||||
this.addEvent('click', function(event) {
|
||||
this._topic.showNoteEditor();
|
||||
event.stopPropagation();
|
||||
}.bind(this));
|
||||
if (!this._readOnly) {
|
||||
|
||||
// Add on click event to open the editor ...
|
||||
this.addEvent('click', function (event) {
|
||||
this._topic.showNoteEditor();
|
||||
event.stopPropagation();
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this._tip = new mindplot.widget.FloatingTip(this.getImage()._peer._native, {
|
||||
// Content can also be a function of the target element!
|
||||
content: function() {
|
||||
content:function () {
|
||||
var result = new Element('div');
|
||||
result.setStyles({padding:'5px'});
|
||||
|
||||
var title = new Element('div', {text:'Note'});
|
||||
var title = new Element('div', {text:$msg('NOTE')});
|
||||
title.setStyles({
|
||||
'font-weight':'bold',
|
||||
color:'black',
|
||||
'padding-bottom':'5px',
|
||||
width: '100px'
|
||||
width:'100px'
|
||||
});
|
||||
title.inject(result);
|
||||
|
||||
var text = new Element('div', {text:this._linksModel.getText()});
|
||||
text.setStyles({
|
||||
'white-space': 'pre-wrap',
|
||||
'word-wrap': 'break-word'
|
||||
'white-space':'pre-wrap',
|
||||
'word-wrap':'break-word'
|
||||
}
|
||||
);
|
||||
text.inject(result);
|
||||
@@ -63,17 +67,17 @@ mindplot.NoteIcon = new Class({
|
||||
|
||||
return result;
|
||||
}.bind(this),
|
||||
html: true,
|
||||
position: 'bottom',
|
||||
arrowOffset : 10,
|
||||
center: true,
|
||||
arrowSize: 15,
|
||||
offset : {x:10,y:20},
|
||||
html:true,
|
||||
position:'bottom',
|
||||
arrowOffset:10,
|
||||
center:true,
|
||||
arrowSize:15,
|
||||
offset:{x:10, y:20},
|
||||
className:'notesTip'
|
||||
});
|
||||
},
|
||||
|
||||
getModel : function() {
|
||||
getModel:function () {
|
||||
return this._linksModel;
|
||||
}
|
||||
});
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -31,7 +31,7 @@ mindplot.PersistenceManager = new Class({
|
||||
|
||||
},
|
||||
|
||||
save:function (mindmap, editorProperties, saveHistory, events) {
|
||||
save:function (mindmap, editorProperties, saveHistory, events, sync) {
|
||||
$assert(mindmap, "mindmap can not be null");
|
||||
$assert(editorProperties, "editorProperties can not be null");
|
||||
|
||||
@@ -44,10 +44,10 @@ mindplot.PersistenceManager = new Class({
|
||||
|
||||
var pref = JSON.encode(editorProperties);
|
||||
try {
|
||||
this.saveMapXml(mapId, mapXml, pref, saveHistory, events);
|
||||
this.saveMapXml(mapId, mapXml, pref, saveHistory, events, sync);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
events.onError();
|
||||
events.onError(this._buildError());
|
||||
}
|
||||
},
|
||||
|
||||
@@ -58,15 +58,19 @@ mindplot.PersistenceManager = new Class({
|
||||
},
|
||||
|
||||
discardChanges:function (mapId) {
|
||||
throw "Method must be implemented";
|
||||
throw new Error("Method must be implemented");
|
||||
},
|
||||
|
||||
loadMapDom:function (mapId) {
|
||||
throw "Method must be implemented";
|
||||
throw new Error("Method must be implemented");
|
||||
},
|
||||
|
||||
saveMapXml:function (mapId, mapXml, pref, saveHistory, events) {
|
||||
throw "Method must be implemented";
|
||||
saveMapXml:function (mapId, mapXml, pref, saveHistory, events, sync) {
|
||||
throw new Error("Method must be implemented");
|
||||
},
|
||||
|
||||
unlockMap:function (mindmap) {
|
||||
throw new Error("Method must be implemented");
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -39,13 +39,24 @@ mindplot.RelationshipPivot = new Class({
|
||||
this._workspace.enableWorkspaceEvents(false);
|
||||
|
||||
var sourcePos = sourceTopic.getPosition();
|
||||
var strokeColor = mindplot.Relationship.getStrokeColor();
|
||||
|
||||
this._pivot = new web2d.CurvedLine();
|
||||
this._pivot.setStyle(web2d.CurvedLine.SIMPLE_LINE);
|
||||
this._pivot.setDashed(2, 2);
|
||||
this._pivot.setFrom(sourcePos.x, sourcePos.y);
|
||||
this._pivot.setTo(targetPos.x, targetPos.y);
|
||||
this._workspace.appendChild(this._pivot);
|
||||
|
||||
this._pivot.setTo(targetPos.x, targetPos.y);
|
||||
this._pivot.setStroke(2, 'solid', strokeColor);
|
||||
this._pivot.setDashed(4, 2);
|
||||
|
||||
this._startArrow = new web2d.Arrow();
|
||||
this._startArrow.setStrokeColor(strokeColor);
|
||||
this._startArrow.setStrokeWidth(2);
|
||||
this._startArrow.setFrom(sourcePos.x, sourcePos.y);
|
||||
|
||||
|
||||
this._workspace.appendChild(this._pivot);
|
||||
this._workspace.appendChild(this._startArrow);
|
||||
|
||||
this._workspace.addEvent('mousemove', this._mouseMoveEvent);
|
||||
this._workspace.addEvent('click', this._onClickEvent);
|
||||
@@ -74,10 +85,12 @@ mindplot.RelationshipPivot = new Class({
|
||||
}.bind(this));
|
||||
|
||||
workspace.removeChild(this._pivot);
|
||||
workspace.removeChild(this._startArrow);
|
||||
workspace.enableWorkspaceEvents(true);
|
||||
|
||||
this._sourceTopic = null;
|
||||
this._pivot = null;
|
||||
this._startArrow = null;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -85,7 +98,15 @@ mindplot.RelationshipPivot = new Class({
|
||||
var screen = this._workspace.getScreenManager();
|
||||
var pos = screen.getWorkspaceMousePosition(event);
|
||||
|
||||
this._pivot.setTo(pos.x - 1, pos.y - 1);
|
||||
// Leave the arrow a couple of pixels away from the cursor.
|
||||
var gapDistance = Math.sign(pos.x - this._sourceTopic.getPosition().x) * 5;
|
||||
|
||||
this._pivot.setTo(pos.x - gapDistance, pos.y);
|
||||
|
||||
var controlPoints = this._pivot.getControlPoints();
|
||||
this._startArrow.setFrom(pos.x - gapDistance, pos.y);
|
||||
this._startArrow.setControlPoint(controlPoints[1]);
|
||||
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
},
|
||||
@@ -100,8 +121,12 @@ mindplot.RelationshipPivot = new Class({
|
||||
_connectOnFocus:function (targetTopic) {
|
||||
var sourceTopic = this._sourceTopic;
|
||||
var mindmap = this._designer.getMindmap();
|
||||
var relModel = mindmap.createRelationship(targetTopic.getId(), sourceTopic.getId());
|
||||
this._designer._actionDispatcher.addRelationship(relModel);
|
||||
|
||||
// Avoid circular connections ...
|
||||
if (targetTopic.getId() != sourceTopic.getId()) {
|
||||
var relModel = mindmap.createRelationship(targetTopic.getId(), sourceTopic.getId());
|
||||
this._designer._actionDispatcher.addRelationship(relModel);
|
||||
}
|
||||
this.dispose();
|
||||
},
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -18,15 +18,22 @@
|
||||
|
||||
mindplot.RESTPersistenceManager = new Class({
|
||||
Extends:mindplot.PersistenceManager,
|
||||
initialize:function (saveUrl, revertUrl) {
|
||||
initialize:function (options) {
|
||||
this.parent();
|
||||
$assert(saveUrl, "saveUrl can not be null");
|
||||
$assert(revertUrl, "revertUrl can not be null");
|
||||
this.saveUrl = saveUrl;
|
||||
this.revertUrl = revertUrl;
|
||||
$assert(options.saveUrl, "saveUrl can not be null");
|
||||
$assert(options.revertUrl, "revertUrl can not be null");
|
||||
$assert(options.lockUrl, "lockUrl can not be null");
|
||||
$assert(options.session, "session can not be null");
|
||||
$assert(options.timestamp, "timestamp can not be null");
|
||||
|
||||
this.saveUrl = options.saveUrl;
|
||||
this.revertUrl = options.revertUrl;
|
||||
this.lockUrl = options.lockUrl;
|
||||
this.timestamp = options.timestamp;
|
||||
this.session = options.session;
|
||||
},
|
||||
|
||||
saveMapXml:function (mapId, mapXml, pref, saveHistory, events) {
|
||||
saveMapXml:function (mapId, mapXml, pref, saveHistory, events, sync) {
|
||||
|
||||
var data = {
|
||||
id:mapId,
|
||||
@@ -34,24 +41,76 @@ mindplot.RESTPersistenceManager = new Class({
|
||||
properties:pref
|
||||
};
|
||||
|
||||
var request = new Request({
|
||||
url:this.saveUrl.replace("{id}", mapId) + "?minor=" + !saveHistory,
|
||||
method:'put',
|
||||
onSuccess:function (responseText, responseXML) {
|
||||
events.onSuccess();
|
||||
var persistence = this;
|
||||
var query = "minor=" + !saveHistory;
|
||||
query = query + (this.timestamp ? "×tamp=" + this.timestamp : "");
|
||||
query = query + (this.session ? "&session=" + this.session : "");
|
||||
|
||||
},
|
||||
onException:function (headerName, value) {
|
||||
events.onError();
|
||||
},
|
||||
onFailure:function (xhr) {
|
||||
events.onError();
|
||||
},
|
||||
headers:{"Content-Type":"application/json", "Accept":"application/json"},
|
||||
emulation:false,
|
||||
urlEncoded:false
|
||||
});
|
||||
request.put(JSON.encode(data));
|
||||
if (!persistence.onSave) {
|
||||
|
||||
// Mark save in process and fire a event unlocking the save ...
|
||||
persistence.onSave = true;
|
||||
persistence.clearTimeout = setTimeout(function () {
|
||||
persistence.clearTimeout = null;
|
||||
persistence.onSave = false;
|
||||
}, 10000);
|
||||
|
||||
var request = new Request({
|
||||
url:this.saveUrl.replace("{id}", mapId) + "?" + query,
|
||||
method:'put',
|
||||
async:!sync,
|
||||
|
||||
onSuccess:function (responseText, responseXML) {
|
||||
persistence.timestamp = responseText;
|
||||
events.onSuccess();
|
||||
},
|
||||
|
||||
onException:function (headerName, value) {
|
||||
events.onError(persistence._buildError());
|
||||
},
|
||||
|
||||
onComplete:function () {
|
||||
// Clear event timeout ...
|
||||
if (persistence.clearTimeout) {
|
||||
clearTimeout(persistence.clearTimeout);
|
||||
}
|
||||
persistence.onSave = false;
|
||||
},
|
||||
|
||||
onFailure:function (xhr) {
|
||||
|
||||
var responseText = xhr.responseText;
|
||||
var userMsg = {severity:"SEVERE", message:$msg('SAVE_COULD_NOT_BE_COMPLETED')};
|
||||
|
||||
var contentType = this.getHeader("Content-Type");
|
||||
if (contentType != null && contentType.indexOf("application/json") != -1) {
|
||||
var serverMsg = null;
|
||||
try {
|
||||
serverMsg = JSON.decode(responseText);
|
||||
serverMsg = serverMsg.globalSeverity ? serverMsg : null;
|
||||
} catch (e) {
|
||||
// Message could not be decoded ...
|
||||
}
|
||||
userMsg = persistence._buildError(serverMsg);
|
||||
|
||||
} else {
|
||||
if (this.status == 405) {
|
||||
userMsg = {severity:"SEVERE", message:$msg('SESSION_EXPIRED')};
|
||||
}
|
||||
}
|
||||
events.onError(userMsg);
|
||||
|
||||
// @Todo: Only for debug. Remove.
|
||||
persistence.onSave = false;
|
||||
throw new Error("responseText:" + responseText + ",status:" + this.status);
|
||||
},
|
||||
|
||||
headers:{"Content-Type":"application/json", "Accept":"application/json"},
|
||||
emulation:false,
|
||||
urlEncoded:false
|
||||
});
|
||||
request.put(JSON.encode(data));
|
||||
}
|
||||
},
|
||||
|
||||
discardChanges:function (mapId) {
|
||||
@@ -60,7 +119,6 @@ mindplot.RESTPersistenceManager = new Class({
|
||||
async:false,
|
||||
method:'post',
|
||||
onSuccess:function () {
|
||||
console.log("Revert success ....");
|
||||
},
|
||||
onException:function () {
|
||||
},
|
||||
@@ -71,8 +129,41 @@ mindplot.RESTPersistenceManager = new Class({
|
||||
urlEncoded:false
|
||||
});
|
||||
request.post();
|
||||
}
|
||||
},
|
||||
|
||||
unlockMap:function (mindmap) {
|
||||
var mapId = mindmap.getId();
|
||||
var request = new Request({
|
||||
url:this.lockUrl.replace("{id}", mapId),
|
||||
async:false,
|
||||
method:'put',
|
||||
onSuccess:function () {
|
||||
|
||||
},
|
||||
onException:function () {
|
||||
},
|
||||
onFailure:function () {
|
||||
},
|
||||
headers:{"Content-Type":"text/plain"},
|
||||
emulation:false,
|
||||
urlEncoded:false
|
||||
});
|
||||
request.put("false");
|
||||
},
|
||||
|
||||
_buildError:function (jsonSeverResponse) {
|
||||
var message = jsonSeverResponse ? jsonSeverResponse.globalErrors[0] : null;
|
||||
var severity = jsonSeverResponse ? jsonSeverResponse.globalSeverity : null;
|
||||
|
||||
if (!message) {
|
||||
message = $msg('SAVE_COULD_NOT_BE_COMPLETED');
|
||||
}
|
||||
|
||||
if (!severity) {
|
||||
severity = "INFO";
|
||||
}
|
||||
return {severity:severity, message:message};
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -43,14 +43,16 @@ mindplot.ScreenManager = new Class({
|
||||
if (event == 'click')
|
||||
this._clickEvents.push(listener);
|
||||
else
|
||||
$(this._divContainer).addEvent(event, listener);
|
||||
this._divContainer.addEvent(event, listener);
|
||||
},
|
||||
|
||||
removeEvent : function(event, listener) {
|
||||
if (event == 'click')
|
||||
if (event == 'click') {
|
||||
this._clickEvents.remove(listener);
|
||||
else
|
||||
$(this._divContainer).removeEvent(event, listener);
|
||||
}
|
||||
else{
|
||||
this._divContainer.removeEvent(event, listener);
|
||||
}
|
||||
},
|
||||
|
||||
fireEvent : function(type, event) {
|
||||
@@ -60,7 +62,7 @@ mindplot.ScreenManager = new Class({
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(this._divContainer).fireEvent(type, event);
|
||||
this._divContainer.fireEvent(type, event);
|
||||
}
|
||||
},
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -83,6 +83,7 @@ mindplot.StandaloneActionDispatcher = new Class({
|
||||
topic.setText(value);
|
||||
return result;
|
||||
};
|
||||
commandFunc.commandType = "changeTextToTopic";
|
||||
|
||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, text);
|
||||
this.execute(command);
|
||||
@@ -242,18 +243,26 @@ mindplot.CommandContext = new Class({
|
||||
}
|
||||
|
||||
var designerTopics = this._designer.getModel().getTopics();
|
||||
return designerTopics.filter(function (topic) {
|
||||
var result = designerTopics.filter(function (topic) {
|
||||
return topicsIds.contains(topic.getId());
|
||||
});
|
||||
|
||||
if (result.length != topicsIds.length) {
|
||||
var ids = designerTopics.map(function (topic) {
|
||||
return topic.getId();
|
||||
});
|
||||
$assert(result.length == topicsIds.length, "Could not find topic. Result:" + result + ", Filter Criteria:" + topicsIds + ", Current Topics: [" + ids + "]");
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
deleteTopic:function (topic) {
|
||||
this._designer._removeTopic(topic);
|
||||
},
|
||||
|
||||
createTopic:function (model, isVisible) {
|
||||
createTopic:function (model) {
|
||||
$assert(model, "model can not be null");
|
||||
return this._designer._nodeModelToNodeGraph(model, isVisible);
|
||||
return this._designer._nodeModelToNodeGraph(model);
|
||||
},
|
||||
|
||||
createModel:function () {
|
||||
@@ -261,8 +270,8 @@ mindplot.CommandContext = new Class({
|
||||
return mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE);
|
||||
},
|
||||
|
||||
connect:function (childTopic, parentTopic, isVisible) {
|
||||
childTopic.connectTo(parentTopic, this._designer._workspace, isVisible);
|
||||
connect:function (childTopic, parentTopic) {
|
||||
childTopic.connectTo(parentTopic, this._designer._workspace);
|
||||
},
|
||||
|
||||
disconnect:function (topic) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -29,7 +29,7 @@ mindplot.Topic = new Class({
|
||||
|
||||
// Position a topic ....
|
||||
var pos = model.getPosition();
|
||||
if (pos != null && model.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (pos != null && this.isCentralTopic()) {
|
||||
this.setPosition(pos);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
var result = model.getShapeType();
|
||||
if (!$defined(result)) {
|
||||
result = this._defaultShapeType();
|
||||
result = mindplot.TopicStyle.defaultShapeType(this);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
@@ -134,7 +134,7 @@ mindplot.Topic = new Class({
|
||||
this._setBorderColor(brColor, false);
|
||||
|
||||
// Define the pointer ...
|
||||
if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE && !this.isReadOnly()) {
|
||||
if (!this.isCentralTopic() && !this.isReadOnly()) {
|
||||
this._innerShape.setCursor('move');
|
||||
} else {
|
||||
this._innerShape.setCursor('default');
|
||||
@@ -259,7 +259,7 @@ mindplot.Topic = new Class({
|
||||
_buildIconGroup:function () {
|
||||
var textHeight = this.getTextShape().getFontHeight();
|
||||
var result = new mindplot.IconGroup(this.getId(), textHeight);
|
||||
var padding = this._getInnerPadding();
|
||||
var padding = mindplot.TopicStyle.getInnerPadding(this);
|
||||
result.setPosition(padding, padding);
|
||||
|
||||
// Load topic features ...
|
||||
@@ -267,25 +267,23 @@ mindplot.Topic = new Class({
|
||||
var featuresModel = model.getFeatures();
|
||||
for (var i = 0; i < featuresModel.length; i++) {
|
||||
var featureModel = featuresModel[i];
|
||||
var icon = mindplot.TopicFeature.createIcon(this, featureModel);
|
||||
result.addIcon(icon, featureModel.getType() == "icon"); // @Todo: Remove hack ...
|
||||
var icon = mindplot.TopicFeature.createIcon(this, featureModel, this.isReadOnly());
|
||||
result.addIcon(icon, featureModel.getType() == mindplot.TopicFeature.Icon.id && !this.isReadOnly());
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
addFeature:function (type, attributes) {
|
||||
addFeature:function (featureModel) {
|
||||
var iconGroup = this.getOrBuildIconGroup();
|
||||
this.closeEditors();
|
||||
|
||||
var model = this.getModel();
|
||||
|
||||
// Update model ...
|
||||
var feature = model.createFeature(type, attributes);
|
||||
model.addFeature(feature);
|
||||
var model = this.getModel();
|
||||
model.addFeature(featureModel);
|
||||
|
||||
var result = mindplot.TopicFeature.createIcon(this, feature);
|
||||
iconGroup.addIcon(result, type == "icon"); // @Todo: Remove hack ...
|
||||
var result = mindplot.TopicFeature.createIcon(this, featureModel, this.isReadOnly());
|
||||
iconGroup.addIcon(result, featureModel.getType() == mindplot.TopicFeature.Icon.id && !this.isReadOnly());
|
||||
|
||||
this._adjustShapes();
|
||||
return result;
|
||||
@@ -336,7 +334,7 @@ mindplot.Topic = new Class({
|
||||
|
||||
if (!readOnly) {
|
||||
// Propagate mouse events ...
|
||||
if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (!this.isCentralTopic()) {
|
||||
result.setCursor('move');
|
||||
} else {
|
||||
result.setCursor('default');
|
||||
@@ -346,10 +344,6 @@ mindplot.Topic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
_getInnerPadding:function () {
|
||||
throw "this must be implemented";
|
||||
},
|
||||
|
||||
setFontFamily:function (value, updateModel) {
|
||||
var textShape = this.getTextShape();
|
||||
textShape.setFontFamily(value);
|
||||
@@ -397,7 +391,7 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
var result = model.getFontWeight();
|
||||
if (!$defined(result)) {
|
||||
var font = this._defaultFontStyle();
|
||||
var font = mindplot.TopicStyle.defaultFontStyle(this);
|
||||
result = font.weight;
|
||||
}
|
||||
return result;
|
||||
@@ -407,7 +401,7 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
var result = model.getFontFamily();
|
||||
if (!$defined(result)) {
|
||||
var font = this._defaultFontStyle();
|
||||
var font = mindplot.TopicStyle.defaultFontStyle(this);
|
||||
result = font.font;
|
||||
}
|
||||
return result;
|
||||
@@ -417,7 +411,7 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
var result = model.getFontColor();
|
||||
if (!$defined(result)) {
|
||||
var font = this._defaultFontStyle();
|
||||
var font = mindplot.TopicStyle.defaultFontStyle(this);
|
||||
result = font.color;
|
||||
}
|
||||
return result;
|
||||
@@ -427,7 +421,7 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
var result = model.getFontStyle();
|
||||
if (!$defined(result)) {
|
||||
var font = this._defaultFontStyle();
|
||||
var font = mindplot.TopicStyle.defaultFontStyle(this);
|
||||
result = font.style;
|
||||
}
|
||||
return result;
|
||||
@@ -437,7 +431,7 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
var result = model.getFontSize();
|
||||
if (!$defined(result)) {
|
||||
var font = this._defaultFontStyle();
|
||||
var font = mindplot.TopicStyle.defaultFontStyle(this);
|
||||
result = font.size;
|
||||
}
|
||||
return result;
|
||||
@@ -454,7 +448,7 @@ mindplot.Topic = new Class({
|
||||
|
||||
_setText:function (text, updateModel) {
|
||||
var textShape = this.getTextShape();
|
||||
textShape.setText(text == null ? this._defaultText() : text);
|
||||
textShape.setText(text == null ? mindplot.TopicStyle.defaultText(this) : text);
|
||||
|
||||
if ($defined(updateModel) && updateModel) {
|
||||
var model = this.getModel();
|
||||
@@ -464,7 +458,7 @@ mindplot.Topic = new Class({
|
||||
|
||||
setText:function (text) {
|
||||
// Avoid empty nodes ...
|
||||
if (text.trim().length == 0) {
|
||||
if (!text || text.trim().length == 0) {
|
||||
text = null;
|
||||
}
|
||||
|
||||
@@ -476,7 +470,7 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
var result = model.getText();
|
||||
if (!$defined(result)) {
|
||||
result = this._defaultText();
|
||||
result = mindplot.TopicStyle.defaultText(this);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
@@ -504,7 +498,7 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
var result = model.getBackgroundColor();
|
||||
if (!$defined(result)) {
|
||||
result = this._defaultBackgroundColor();
|
||||
result = mindplot.TopicStyle.defaultBackgroundColor(this);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
@@ -532,7 +526,7 @@ mindplot.Topic = new Class({
|
||||
var model = this.getModel();
|
||||
var result = model.getBorderColor();
|
||||
if (!$defined(result)) {
|
||||
result = this._defaultBorderColor();
|
||||
result = mindplot.TopicStyle.defaultBorderColor(this);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
@@ -633,9 +627,20 @@ mindplot.Topic = new Class({
|
||||
var elements = this._flatten2DElements(this);
|
||||
var fade = new mindplot.util.FadeEffect(elements, !value);
|
||||
fade.addEvent('complete', function () {
|
||||
// Set focus on the parent node ...
|
||||
if (value) {
|
||||
this.setOnFocus(true);
|
||||
}
|
||||
|
||||
});
|
||||
// Set focus in false for all the children ...
|
||||
elements.forEach(function (elem) {
|
||||
if (elem.setOnFocus) {
|
||||
elem.setOnFocus(false);
|
||||
}
|
||||
});
|
||||
}.bind(this));
|
||||
fade.start();
|
||||
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeShrinkEvent, model);
|
||||
|
||||
},
|
||||
@@ -825,7 +830,7 @@ mindplot.Topic = new Class({
|
||||
setBranchVisibility:function (value) {
|
||||
var current = this;
|
||||
var parent = this;
|
||||
while (parent != null && parent.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
while (parent != null && !parent.isCentralTopic()) {
|
||||
current = parent;
|
||||
parent = current.getParent();
|
||||
}
|
||||
@@ -839,7 +844,14 @@ mindplot.Topic = new Class({
|
||||
// Hide all children...
|
||||
this._setChildrenVisibility(value);
|
||||
|
||||
// If there there are connection to the node, topic must be hidden.
|
||||
this._setRelationshipLinesVisibility(value);
|
||||
|
||||
// If it's connected, the connection must be rendered.
|
||||
var outgoingLine = this.getOutgoingLine();
|
||||
if (outgoingLine) {
|
||||
outgoingLine.setVisibility(value);
|
||||
}
|
||||
},
|
||||
|
||||
moveToBack:function () {
|
||||
@@ -1019,9 +1031,9 @@ mindplot.Topic = new Class({
|
||||
model.setOrder(value);
|
||||
},
|
||||
|
||||
connectTo:function (targetTopic, workspace, isVisible) {
|
||||
connectTo:function (targetTopic, workspace) {
|
||||
$assert(!this._outgoingLine, 'Could not connect an already connected node');
|
||||
$assert(targetTopic != this, 'Cilcular connection are not allowed');
|
||||
$assert(targetTopic != this, 'Circular connection are not allowed');
|
||||
$assert(targetTopic, 'Parent Graph can not be null');
|
||||
$assert(workspace, 'Workspace can not be null');
|
||||
|
||||
@@ -1036,9 +1048,8 @@ mindplot.Topic = new Class({
|
||||
|
||||
// Create a connection line ...
|
||||
var outgoingLine = new mindplot.ConnectionLine(this, targetTopic);
|
||||
if ($defined(isVisible)) {
|
||||
outgoingLine.setVisibility(isVisible);
|
||||
}
|
||||
outgoingLine.setVisibility(false);
|
||||
|
||||
this._outgoingLine = outgoingLine;
|
||||
workspace.appendChild(outgoingLine);
|
||||
|
||||
@@ -1070,7 +1081,6 @@ mindplot.Topic = new Class({
|
||||
if (this.isInWorkspace()) {
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeConnectEvent, {parentNode:targetTopic.getModel(), childNode:this.getModel()});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
appendChild:function (child) {
|
||||
@@ -1107,7 +1117,7 @@ mindplot.Topic = new Class({
|
||||
var elem = this.get2DElement();
|
||||
workspace.appendChild(elem);
|
||||
if (!this.isInWorkspace()) {
|
||||
if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (!this.isCentralTopic()) {
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeAdded, this.getModel());
|
||||
}
|
||||
|
||||
@@ -1150,7 +1160,7 @@ mindplot.Topic = new Class({
|
||||
var textHeight = textShape.getHeight();
|
||||
textHeight = textHeight != 0 ? textHeight : 20;
|
||||
|
||||
var topicPadding = this._getInnerPadding();
|
||||
var topicPadding = mindplot.TopicStyle.getInnerPadding(this);
|
||||
|
||||
// Adjust the icon size to the size of the text ...
|
||||
var iconGroup = this.getOrBuildIconGroup();
|
||||
@@ -1193,12 +1203,34 @@ mindplot.Topic = new Class({
|
||||
var relationships = child.getRelationships();
|
||||
result = result.concat(relationships);
|
||||
|
||||
var innerChilds = this._flatten2DElements(child);
|
||||
result = result.concat(innerChilds);
|
||||
if(!child.areChildrenShrunken()){
|
||||
var innerChilds = this._flatten2DElements(child);
|
||||
result = result.concat(innerChilds);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
isChildTopic:function (childTopic) {
|
||||
var result = (this.getId() == childTopic.getId());
|
||||
if (!result) {
|
||||
var children = this.getChildren();
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var parent = children[i];
|
||||
result = parent.isChildTopic(childTopic);
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
isCentralTopic:function () {
|
||||
return this.getModel().getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -17,51 +17,51 @@
|
||||
*/
|
||||
|
||||
mindplot.TopicFeature = {
|
||||
Icon: {
|
||||
Icon:{
|
||||
id:mindplot.model.IconModel.FEATURE_TYPE,
|
||||
model: mindplot.model.IconModel,
|
||||
icon : mindplot.ImageIcon
|
||||
model:mindplot.model.IconModel,
|
||||
icon:mindplot.ImageIcon
|
||||
},
|
||||
|
||||
Link: {
|
||||
id: mindplot.model.LinkModel.FEATURE_TYPE,
|
||||
model: mindplot.model.LinkModel,
|
||||
icon : mindplot.LinkIcon
|
||||
Link:{
|
||||
id:mindplot.model.LinkModel.FEATURE_TYPE,
|
||||
model:mindplot.model.LinkModel,
|
||||
icon:mindplot.LinkIcon
|
||||
},
|
||||
|
||||
Note: {
|
||||
id: mindplot.model.NoteModel.FEATURE_TYPE,
|
||||
model: mindplot.model.NoteModel,
|
||||
icon : mindplot.NoteIcon
|
||||
Note:{
|
||||
id:mindplot.model.NoteModel.FEATURE_TYPE,
|
||||
model:mindplot.model.NoteModel,
|
||||
icon:mindplot.NoteIcon
|
||||
},
|
||||
|
||||
isSupported : function(id) {
|
||||
return mindplot.TopicFeature._featuresMetadataById.some(function(elem) {
|
||||
isSupported:function (id) {
|
||||
return mindplot.TopicFeature._featuresMetadataById.some(function (elem) {
|
||||
return elem.id == id;
|
||||
});
|
||||
},
|
||||
|
||||
createModel : function(id, attributes) {
|
||||
$assert(id, 'type can not be null');
|
||||
createModel:function (type, attributes) {
|
||||
$assert(type, 'type can not be null');
|
||||
$assert(attributes, 'attributes can not be null');
|
||||
|
||||
var model = mindplot.TopicFeature._featuresMetadataById.filter(function(elem) {
|
||||
return elem.id == id;
|
||||
var model = mindplot.TopicFeature._featuresMetadataById.filter(function (elem) {
|
||||
return elem.id == type;
|
||||
})[0].model;
|
||||
return new model(attributes);
|
||||
},
|
||||
|
||||
createIcon : function(topic, model) {
|
||||
createIcon:function (topic, model, readOnly) {
|
||||
$assert(topic, 'topic can not be null');
|
||||
$assert(model, 'model can not be null');
|
||||
|
||||
var icon = mindplot.TopicFeature._featuresMetadataById.filter(function(elem) {
|
||||
var icon = mindplot.TopicFeature._featuresMetadataById.filter(function (elem) {
|
||||
return elem.id == model.getType();
|
||||
})[0].icon;
|
||||
return new icon(topic, model);
|
||||
return new icon(topic, model, readOnly);
|
||||
}
|
||||
};
|
||||
|
||||
mindplot.TopicFeature._featuresMetadataById = [mindplot.TopicFeature.Icon,mindplot.TopicFeature.Link,mindplot.TopicFeature.Note];
|
||||
mindplot.TopicFeature._featuresMetadataById = [mindplot.TopicFeature.Icon, mindplot.TopicFeature.Link, mindplot.TopicFeature.Note];
|
||||
|
||||
|
||||
|
132
mindplot/src/main/javascript/TopicStyle.js
Normal file
132
mindplot/src/main/javascript/TopicStyle.js
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.TopicStyle = new Class({
|
||||
Static:{
|
||||
_getStyles:function (topic) {
|
||||
$assert(topic, "topic can not be null");
|
||||
|
||||
var result;
|
||||
if (topic.isCentralTopic()) {
|
||||
result = mindplot.TopicStyle.STYLES.CENTRAL_TOPIC;
|
||||
} else {
|
||||
var targetTopic = topic.getOutgoingConnectedTopic();
|
||||
if ($defined(targetTopic)) {
|
||||
if (targetTopic.isCentralTopic()) {
|
||||
result = mindplot.TopicStyle.STYLES.MAIN_TOPIC;
|
||||
} else {
|
||||
result = mindplot.TopicStyle.STYLES.SUB_TOPIC;
|
||||
}
|
||||
} else {
|
||||
result = mindplot.TopicStyle.STYLES.ISOLATED_TOPIC;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
defaultText:function (topic) {
|
||||
var msgKey = this._getStyles(topic).msgKey;
|
||||
return $msg(msgKey);
|
||||
},
|
||||
|
||||
defaultFontStyle:function (topic) {
|
||||
return this._getStyles(topic).fontStyle;
|
||||
},
|
||||
|
||||
defaultBackgroundColor:function (topic) {
|
||||
return this._getStyles(topic).backgroundColor;
|
||||
},
|
||||
|
||||
defaultBorderColor:function (topic) {
|
||||
return this._getStyles(topic).borderColor;
|
||||
},
|
||||
|
||||
getInnerPadding:function (topic) {
|
||||
return this._getStyles(topic).innerPadding;
|
||||
},
|
||||
|
||||
defaultShapeType:function (topic) {
|
||||
return this._getStyles(topic).shapeType;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mindplot.TopicStyle.STYLES =
|
||||
{
|
||||
CENTRAL_TOPIC:{
|
||||
borderColor:'rgb(57,113,177)',
|
||||
backgroundColor:'rgb(80,157,192)',
|
||||
fontStyle:{
|
||||
font:"Verdana",
|
||||
size:10,
|
||||
style:"normal",
|
||||
weight:"bold",
|
||||
color:"#ffffff"
|
||||
},
|
||||
msgKey:'CENTRAL_TOPIC',
|
||||
innerPadding:11,
|
||||
shapeType:mindplot.model.TopicShape.ROUNDED_RECT
|
||||
},
|
||||
|
||||
MAIN_TOPIC:{
|
||||
borderColor:'rgb(2,59,185)',
|
||||
backgroundColor:'rgb(224,229,239)',
|
||||
fontStyle:{
|
||||
font:"Arial",
|
||||
size:8,
|
||||
style:"normal",
|
||||
weight:"normal",
|
||||
color:"rgb(82,92,97)"
|
||||
},
|
||||
msgKey:'MAIN_TOPIC',
|
||||
innerPadding:3,
|
||||
shapeType:mindplot.model.TopicShape.LINE
|
||||
|
||||
},
|
||||
|
||||
SUB_TOPIC:{
|
||||
borderColor:'rgb(2,59,185)',
|
||||
backgroundColor:'rgb(224,229,239)',
|
||||
fontStyle:{
|
||||
font:"Arial",
|
||||
size:6,
|
||||
style:"normal",
|
||||
weight:"normal",
|
||||
color:"rgb(82,92,97)"
|
||||
},
|
||||
msgKey:'SUB_TOPIC',
|
||||
innerPadding:3,
|
||||
shapeType:mindplot.model.TopicShape.LINE
|
||||
},
|
||||
|
||||
ISOLATED_TOPIC:{
|
||||
borderColor:'rgb(2,59,185)',
|
||||
backgroundColor:'rgb(224,229,239)',
|
||||
fontStyle:{
|
||||
font:"Verdana",
|
||||
size:8,
|
||||
style:"normal",
|
||||
weight:"normal",
|
||||
color:"rgb(82,92,97)"
|
||||
},
|
||||
msgKey:'ISOLATED_TOPIC',
|
||||
innerPadding:4,
|
||||
shapeType:mindplot.model.TopicShape.LINE
|
||||
}
|
||||
};
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
mindplot.commands.AddFeatureToTopicCommand = new Class({
|
||||
Extends:mindplot.Command,
|
||||
initialize: function(topicId, featureType, attributes) {
|
||||
initialize:function (topicId, featureType, attributes) {
|
||||
|
||||
$assert($defined(topicId), 'topicId can not be null');
|
||||
$assert(featureType, 'featureType can not be null');
|
||||
@@ -28,15 +28,21 @@ mindplot.commands.AddFeatureToTopicCommand = new Class({
|
||||
this._topicId = topicId;
|
||||
this._featureType = featureType;
|
||||
this._attributes = attributes;
|
||||
this._featureModel = null;
|
||||
},
|
||||
|
||||
execute: function(commandContext) {
|
||||
execute:function (commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicId)[0];
|
||||
var icon = topic.addFeature(this._featureType, this._attributes);
|
||||
this._featureModel = icon.getModel();
|
||||
|
||||
// Feature must be created only one time.
|
||||
if (!this._featureModel) {
|
||||
var model = topic.getModel();
|
||||
this._featureModel = model.createFeature(this._featureType, this._attributes);
|
||||
}
|
||||
topic.addFeature(this._featureModel);
|
||||
},
|
||||
|
||||
undoExecute: function(commandContext) {
|
||||
undoExecute:function (commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicId)[0];
|
||||
topic.removeFeature(this._featureModel);
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -32,7 +32,7 @@ mindplot.commands.AddTopicCommand = new Class({
|
||||
this._models.each(function (model, index) {
|
||||
|
||||
// Add a new topic ...
|
||||
var topic = commandContext.createTopic(model, false);
|
||||
var topic = commandContext.createTopic(model);
|
||||
|
||||
// Connect to topic ...
|
||||
if (this._parentsIds) {
|
||||
@@ -43,14 +43,14 @@ mindplot.commands.AddTopicCommand = new Class({
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, focus ...
|
||||
// Select just created node ...
|
||||
var designer = commandContext._designer;
|
||||
var fade = new mindplot.util.FadeEffect([topic, topic.getOutgoingLine()], true);
|
||||
fade.addEvent('complete', function () {
|
||||
designer.onObjectFocusEvent(topic);
|
||||
topic.setOnFocus(true);
|
||||
});
|
||||
fade.start();
|
||||
designer.onObjectFocusEvent(topic);
|
||||
topic.setOnFocus(true);
|
||||
|
||||
// Render node ...
|
||||
topic.setVisibility(true);
|
||||
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -34,9 +34,11 @@ mindplot.commands.DeleteCommand = new Class({
|
||||
// If a parent has been selected for deletion, the children must be excluded from the delete ...
|
||||
var topics = this._filterChildren(this._topicIds, commandContext);
|
||||
|
||||
|
||||
if (topics.length > 0) {
|
||||
topics.each(function (topic) {
|
||||
// In case that it's editing text node, force close without update ...
|
||||
topic.closeEditors();
|
||||
|
||||
var model = topic.getModel();
|
||||
|
||||
// Delete relationships
|
||||
@@ -76,24 +78,40 @@ mindplot.commands.DeleteCommand = new Class({
|
||||
|
||||
undoExecute:function (commandContext) {
|
||||
|
||||
var parent = commandContext.findTopics(this._parentTopicIds);
|
||||
this._deletedTopicModels.each(function (model, index) {
|
||||
var topic = commandContext.createTopic(model);
|
||||
|
||||
// Was the topic connected?
|
||||
var parentTopic = parent[index];
|
||||
if (parentTopic != null) {
|
||||
commandContext.connect(topic, parentTopic);
|
||||
topic.setOnFocus(true);
|
||||
}
|
||||
|
||||
// Add all the topics ...
|
||||
this._deletedTopicModels.each(function (model) {
|
||||
commandContext.createTopic(model);
|
||||
}, this);
|
||||
|
||||
// Do they need to be connected ?
|
||||
this._deletedTopicModels.each(function (topicModel, index) {
|
||||
var topics = commandContext.findTopics(topicModel.getId());
|
||||
|
||||
var parentId = this._parentTopicIds[index];
|
||||
if (parentId) {
|
||||
var parentTopics = commandContext.findTopics(parentId);
|
||||
commandContext.connect(topics[0], parentTopics[0]);
|
||||
}
|
||||
}, this);
|
||||
|
||||
// Add rebuild relationships ...
|
||||
this._deletedRelModel.each(function (model) {
|
||||
commandContext.addRelationship(model);
|
||||
}.bind(this));
|
||||
|
||||
// Finally display the topics ...
|
||||
this._deletedTopicModels.each(function (topicModel) {
|
||||
var topics = commandContext.findTopics(topicModel.getId());
|
||||
topics[0].setBranchVisibility(true);
|
||||
}, this);
|
||||
|
||||
// Focus on last recovered topic ..
|
||||
if (this._deletedTopicModels.length > 0) {
|
||||
var firstTopic = this._deletedTopicModels[0];
|
||||
var topic = commandContext.findTopics(firstTopic.getId())[0];
|
||||
topic.setOnFocus(true);
|
||||
}
|
||||
|
||||
this._deletedTopicModels = [];
|
||||
this._parentTopicIds = [];
|
||||
this._deletedRelModel = [];
|
||||
@@ -124,15 +142,13 @@ mindplot.commands.DeleteCommand = new Class({
|
||||
|
||||
_collectInDepthRelationships:function (topic) {
|
||||
var result = [];
|
||||
result.append(topic.getRelationships());
|
||||
|
||||
var children = topic.getChildren();
|
||||
if (children.length > 0) {
|
||||
var rels = children.map(function (topic) {
|
||||
return this._collectInDepthRelationships(topic);
|
||||
}, this);
|
||||
result.append(rels.flatten());
|
||||
} else {
|
||||
result.append(topic.getRelationships());
|
||||
}
|
||||
var rels = children.map(function (topic) {
|
||||
return this._collectInDepthRelationships(topic);
|
||||
}, this);
|
||||
result.append(rels.flatten());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -18,22 +18,22 @@
|
||||
|
||||
mindplot.commands.DragTopicCommand = new Class({
|
||||
Extends:mindplot.Command,
|
||||
initialize:function (topicIds, position, order, parentTopic) {
|
||||
$assert(topicIds, "topicIds must be defined");
|
||||
initialize:function (topicId, position, order, parentTopic) {
|
||||
$assert(topicId, "topicId must be defined");
|
||||
|
||||
this._topicsIds = topicIds;
|
||||
this._topicsId = topicId;
|
||||
if ($defined(parentTopic))
|
||||
this._parentId = parentTopic.getId();
|
||||
|
||||
this.parent();
|
||||
this._position = position;
|
||||
this._order = order;
|
||||
this._id = mindplot.Command._nextUUID();
|
||||
},
|
||||
|
||||
execute:function (commandContext) {
|
||||
|
||||
var topic = commandContext.findTopics([this._topicsIds])[0];
|
||||
var topic = commandContext.findTopics(this._topicsId)[0];
|
||||
topic.setVisibility(false);
|
||||
|
||||
// Save old position ...
|
||||
var origParentTopic = topic.getOutgoingConnectedTopic();
|
||||
@@ -60,7 +60,7 @@ mindplot.commands.DragTopicCommand = new Class({
|
||||
if (origParentTopic != this._parentId) {
|
||||
|
||||
if ($defined(this._parentId)) {
|
||||
var parentTopic = commandContext.findTopics([this._parentId])[0];
|
||||
var parentTopic = commandContext.findTopics(this._parentId)[0];
|
||||
commandContext.connect(topic, parentTopic);
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ mindplot.commands.DragTopicCommand = new Class({
|
||||
this._parentId = origParentTopic.getId();
|
||||
}
|
||||
}
|
||||
topic.setVisibility(true);
|
||||
|
||||
// Store for undo ...
|
||||
this._order = origOrder;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -18,35 +18,51 @@
|
||||
|
||||
mindplot.commands.GenericFunctionCommand = new Class({
|
||||
Extends:mindplot.Command,
|
||||
initialize: function(commandFunc, topicsIds,value) {
|
||||
initialize:function (commandFunc, topicsIds, value) {
|
||||
$assert(commandFunc, "commandFunc must be defined");
|
||||
$assert($defined(topicsIds), "topicsIds must be defined");
|
||||
|
||||
this.parent();
|
||||
this._value = value;
|
||||
this._topicsIds = topicsIds;
|
||||
this._topicsId = topicsIds;
|
||||
this._commandFunc = commandFunc;
|
||||
this._oldValues = [];
|
||||
},
|
||||
|
||||
execute: function(commandContext) {
|
||||
execute:function (commandContext) {
|
||||
if (!this.applied) {
|
||||
var topics = commandContext.findTopics(this._topicsIds);
|
||||
topics.each(function(topic) {
|
||||
var oldValue = this._commandFunc(topic, this._value);
|
||||
this._oldValues.push(oldValue);
|
||||
}.bind(this));
|
||||
|
||||
var topics = null;
|
||||
try {
|
||||
topics = commandContext.findTopics(this._topicsId);
|
||||
} catch (e) {
|
||||
if (this._commandFunc.commandType != "changeTextToTopic") {
|
||||
// Workaround: For some reason, there is a combination of events that involves
|
||||
// making some modification and firing out of focus event. This is causing
|
||||
// that a remove node try to be removed. In some other life, I will come with the solution.
|
||||
// Almost aways occurs with IE9. I could be related with some change of order in sets o something similar.
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
if (topics != null) {
|
||||
topics.each(function (topic) {
|
||||
var oldValue = this._commandFunc(topic, this._value);
|
||||
this._oldValues.push(oldValue);
|
||||
}.bind(this));
|
||||
}
|
||||
this.applied = true;
|
||||
|
||||
} else {
|
||||
throw "Command can not be applied two times in a row.";
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
undoExecute: function(commandContext) {
|
||||
undoExecute:function (commandContext) {
|
||||
if (this.applied) {
|
||||
var topics = commandContext.findTopics(this._topicsIds);
|
||||
topics.each(function(topic, index) {
|
||||
var topics = commandContext.findTopics(this._topicsId);
|
||||
topics.each(function (topic, index) {
|
||||
this._commandFunc(topic, this._oldValues[index]);
|
||||
|
||||
}.bind(this));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
mindplot.commands.RemoveFeatureFromTopicCommand = new Class({
|
||||
Extends:mindplot.Command,
|
||||
initialize: function(topicId, featureId) {
|
||||
initialize:function (topicId, featureId) {
|
||||
$assert($defined(topicId), 'topicId can not be null');
|
||||
$assert(featureId, 'iconModel can not be null');
|
||||
|
||||
@@ -28,19 +28,16 @@ mindplot.commands.RemoveFeatureFromTopicCommand = new Class({
|
||||
this._oldFeature = null;
|
||||
},
|
||||
|
||||
execute: function(commandContext) {
|
||||
execute:function (commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicId)[0];
|
||||
|
||||
var feature = topic.findFeatureById(this._featureId);
|
||||
topic.removeFeature(feature);
|
||||
this._oldFeature = feature;
|
||||
},
|
||||
|
||||
undoExecute: function(commandContext) {
|
||||
undoExecute:function (commandContext) {
|
||||
var topic = commandContext.findTopics(this._topicId)[0];
|
||||
|
||||
var feature = this._oldFeature;
|
||||
topic.addFeature(feature.getType(), feature.getAttributes());
|
||||
topic.addFeature(this._oldFeature);
|
||||
this._oldFeature = null;
|
||||
}
|
||||
});
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -70,7 +70,7 @@ mindplot.layout.BalancedSorter = new Class({
|
||||
|
||||
// No children?
|
||||
if (children.length == 0) {
|
||||
return [order, {x:parent.getPosition().x + direction * (parent.getSize().width + mindplot.layout.BalancedSorter.INTERNODE_HORIZONTAL_PADDING * 2), y:parent.getPosition().y}];
|
||||
return [order, {x:parent.getPosition().x + direction * (parent.getSize().width / 2 + mindplot.layout.BalancedSorter.INTERNODE_HORIZONTAL_PADDING * 2), y:parent.getPosition().y}];
|
||||
}
|
||||
|
||||
// Try to fit within ...
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -84,7 +84,7 @@ mindplot.layout.RootedTreeSet = new Class({
|
||||
}
|
||||
}
|
||||
validate = !$defined(validate) ? true : validate;
|
||||
$assert(validate ? result : true, 'node could not be found id:' + id);
|
||||
$assert(validate ? result : true, 'node could not be found id:' + id + "\n,RootedTreeSet" + this.dump());
|
||||
return result;
|
||||
|
||||
},
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -21,13 +21,26 @@ mindplot.layout.SymmetricSorter = new Class({
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Predict the order and position of a dragged node.
|
||||
*
|
||||
* @param graph The tree set
|
||||
* @param parent The parent of the node
|
||||
* @param node The node
|
||||
* @param position The position of the drag
|
||||
* @param free Free drag or not
|
||||
* @return {*}
|
||||
*/
|
||||
predict:function (graph, parent, node, position, free) {
|
||||
|
||||
var self = this;
|
||||
var rootNode = graph.getRootNode(parent);
|
||||
|
||||
// If its a free node...
|
||||
if (free) {
|
||||
$assert($defined(position), "position cannot be null for predict in free positioning");
|
||||
$assert($defined(node), "node cannot be null for predict in free positioning");
|
||||
|
||||
var rootNode = graph.getRootNode(parent);
|
||||
var direction = this._getRelativeDirection(rootNode.getPosition(), parent.getPosition());
|
||||
var limitXPos = parent.getPosition().x + direction * (parent.getSize().width / 2 + node.getSize().width / 2 + mindplot.layout.SymmetricSorter.INTERNODE_HORIZONTAL_PADDING);
|
||||
|
||||
@@ -38,61 +51,81 @@ mindplot.layout.SymmetricSorter = new Class({
|
||||
return [0, {x:xPos, y:position.y}];
|
||||
}
|
||||
|
||||
var rootNode = graph.getRootNode(parent);
|
||||
|
||||
// If it is a dragged node...
|
||||
if (node) {
|
||||
$assert($defined(position), "position cannot be null for predict in dragging");
|
||||
var nodeDirection = this._getRelativeDirection(rootNode.getPosition(), node.getPosition());
|
||||
var positionDirection = this._getRelativeDirection(rootNode.getPosition(), position);
|
||||
var siblings = graph.getSiblings(node);
|
||||
|
||||
var sameParent = parent == graph.getParent(node);
|
||||
if (siblings.length == 0 && nodeDirection == positionDirection && sameParent) {
|
||||
return [node.getOrder(), node.getPosition()];
|
||||
}
|
||||
}
|
||||
|
||||
// Regular node
|
||||
var direction = parent.getPosition().x > rootNode.getPosition().x ? 1 : -1;
|
||||
|
||||
// No children...
|
||||
var children = graph.getChildren(parent).filter(function (child) {
|
||||
return child != node;
|
||||
});
|
||||
if (children.length == 0) {
|
||||
position = position || {x:parent.getPosition().x + direction, y:parent.getPosition().y};
|
||||
var pos = {
|
||||
x:parent.getPosition().x + direction * (parent.getSize().width + mindplot.layout.SymmetricSorter.INTERNODE_HORIZONTAL_PADDING),
|
||||
// Its not a dragged node (it is being added)
|
||||
if (!node) {
|
||||
var parentDirection = self._getRelativeDirection(rootNode.getPosition(), parent.getPosition());
|
||||
var position = {
|
||||
x:parent.getPosition().x + parentDirection * (parent.getSize().width + mindplot.layout.SymmetricSorter.INTERNODE_HORIZONTAL_PADDING),
|
||||
y:parent.getPosition().y
|
||||
};
|
||||
return [0, pos];
|
||||
return [graph.getChildren(parent).length, position];
|
||||
}
|
||||
|
||||
// Try to fit within ...
|
||||
var result = null;
|
||||
var last = children.getLast();
|
||||
position = position || {x:last.getPosition().x + direction, y:last.getPosition().y + 1};
|
||||
children.each(function (child, index) {
|
||||
var cpos = child.getPosition();
|
||||
if (position.y > cpos.y) {
|
||||
var yOffset = child == last ?
|
||||
child.getSize().height + mindplot.layout.SymmetricSorter.INTERNODE_VERTICAL_PADDING * 2 :
|
||||
(children[index + 1].getPosition().y + children[index + 1].getSize().height / 2 - child.getPosition().y) / 2;
|
||||
result = [child.getOrder() + 1, {x:cpos.x, y:cpos.y + yOffset}];
|
||||
// If it is a dragged node...
|
||||
$assert($defined(position), "position cannot be null for predict in dragging");
|
||||
var nodeDirection = this._getRelativeDirection(rootNode.getPosition(), node.getPosition());
|
||||
var positionDirection = this._getRelativeDirection(rootNode.getPosition(), position);
|
||||
var siblings = graph.getSiblings(node);
|
||||
|
||||
// node has no siblings and its trying to reconnect to its own parent
|
||||
var sameParent = parent == graph.getParent(node);
|
||||
if (siblings.length == 0 && nodeDirection == positionDirection && sameParent) {
|
||||
return [node.getOrder(), node.getPosition()];
|
||||
}
|
||||
|
||||
var parentChildren = graph.getChildren(parent);
|
||||
|
||||
if (parentChildren.length == 0) {
|
||||
// Fit as a child of the parent node...
|
||||
var position = {
|
||||
x:parent.getPosition().x + positionDirection * (parent.getSize().width + mindplot.layout.SymmetricSorter.INTERNODE_HORIZONTAL_PADDING),
|
||||
y:parent.getPosition().y
|
||||
};
|
||||
return [0, position];
|
||||
} else {
|
||||
// Try to fit within ...
|
||||
var result = null;
|
||||
var last = parentChildren.getLast();
|
||||
for (var i = 0; i < parentChildren.length; i++) {
|
||||
var parentChild = parentChildren[i];
|
||||
var nodeAfter = (i + 1) == parentChild.length ? null : parentChildren[i + 1];
|
||||
|
||||
// Fit at the bottom
|
||||
if (!nodeAfter && position.y > parentChild.getPosition().y) {
|
||||
var order = (graph.getParent(node) && graph.getParent(node).getId() == parent.getId()) ?
|
||||
last.getOrder() : last.getOrder() + 1;
|
||||
var position = {
|
||||
x:parentChild.getPosition().x,
|
||||
y:parentChild.getPosition().y + parentChild.getSize().height + mindplot.layout.SymmetricSorter.INTERNODE_VERTICAL_PADDING * 2
|
||||
};
|
||||
return [order, position];
|
||||
}
|
||||
|
||||
// Fit after this node
|
||||
if (nodeAfter && position.y > parentChild.getPosition().y && position.y < nodeAfter.getPosition().y) {
|
||||
if (nodeAfter.getId() == node.getId() || parentChild.getId() == node.getId()) {
|
||||
return [node.getOrder(), node.getPosition()];
|
||||
} else {
|
||||
var order = position.y > node.getPosition().y ?
|
||||
nodeAfter.getOrder() - 1 : parentChild.getOrder() + 1;
|
||||
var position = {
|
||||
x:parentChild.getPosition().x,
|
||||
y:parentChild.getPosition().y + (nodeAfter.getPosition().y - parentChild.getPosition().y) / 2
|
||||
};
|
||||
|
||||
return [order, position];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Position wasn't below any node, so it must be inserted above
|
||||
if (!result) {
|
||||
var first = children[0];
|
||||
result = [0, {
|
||||
x:first.getPosition().x,
|
||||
y:first.getPosition().y - first.getSize().height - mindplot.layout.SymmetricSorter.INTERNODE_VERTICAL_PADDING * 2
|
||||
}];
|
||||
}
|
||||
|
||||
return result;
|
||||
// Position wasn't below any node, so it must be fitted above the first
|
||||
var first = parentChildren[0];
|
||||
var position = {
|
||||
x:first.getPosition().x,
|
||||
y:first.getPosition().y - first.getSize().height - mindplot.layout.SymmetricSorter.INTERNODE_VERTICAL_PADDING * 2
|
||||
};
|
||||
return [0, position];
|
||||
},
|
||||
|
||||
insert:function (treeSet, parent, child, order) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -17,54 +17,60 @@
|
||||
*/
|
||||
|
||||
mindplot.model.FeatureModel = new Class({
|
||||
initialize:function(type) {
|
||||
$assert(type, 'type can not be null');
|
||||
Static:{
|
||||
_nextUUID:function () {
|
||||
if (!$defined(mindplot.model.FeatureModel._uuid)) {
|
||||
mindplot.model.FeatureModel._uuid = 0;
|
||||
}
|
||||
|
||||
mindplot.model.FeatureModel._uuid = mindplot.model.FeatureModel._uuid + 1;
|
||||
return mindplot.model.FeatureModel._uuid;
|
||||
}
|
||||
},
|
||||
|
||||
initialize:function (type) {
|
||||
$assert(type, 'type can not be null');
|
||||
this._id = mindplot.model.FeatureModel._nextUUID();
|
||||
|
||||
this._type = type;
|
||||
this._attributes = {};
|
||||
|
||||
// Create type method ...
|
||||
this['is' + type.camelCase() + 'Model'] = function() {
|
||||
this['is' + type.camelCase() + 'Model'] = function () {
|
||||
return true;
|
||||
};
|
||||
},
|
||||
|
||||
getAttributes : function() {
|
||||
getAttributes:function () {
|
||||
return Object.clone(this._attributes);
|
||||
},
|
||||
|
||||
setAttributes : function(attributes) {
|
||||
setAttributes:function (attributes) {
|
||||
for (key in attributes) {
|
||||
this["set" + key.capitalize()](attributes[key]);
|
||||
}
|
||||
},
|
||||
|
||||
setAttribute : function(key, value) {
|
||||
setAttribute:function (key, value) {
|
||||
$assert(key, 'key id can not be null');
|
||||
this._attributes[key] = value;
|
||||
},
|
||||
|
||||
getAttribute : function(key) {
|
||||
getAttribute:function (key) {
|
||||
$assert(key, 'key id can not be null');
|
||||
|
||||
return this._attributes[key];
|
||||
},
|
||||
|
||||
getId : function() {
|
||||
getId:function () {
|
||||
return this._id;
|
||||
},
|
||||
|
||||
getType:function() {
|
||||
setId:function (id) {
|
||||
this._id = id;
|
||||
},
|
||||
|
||||
getType:function () {
|
||||
return this._type;
|
||||
}
|
||||
});
|
||||
|
||||
mindplot.model.FeatureModel._nextUUID = function() {
|
||||
if (!$defined(this._uuid)) {
|
||||
this._uuid = 0;
|
||||
}
|
||||
|
||||
this._uuid = this._uuid + 1;
|
||||
return this._uuid;
|
||||
};
|
||||
});
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -17,17 +17,17 @@
|
||||
*/
|
||||
|
||||
mindplot.model.IconModel = new Class({
|
||||
Extends: mindplot.model.FeatureModel,
|
||||
initialize:function(attributes) {
|
||||
Extends:mindplot.model.FeatureModel,
|
||||
initialize:function (attributes) {
|
||||
this.parent(mindplot.model.IconModel.FEATURE_TYPE);
|
||||
this.setIconType(attributes.id);
|
||||
},
|
||||
|
||||
getIconType : function() {
|
||||
getIconType:function () {
|
||||
return this.getAttribute('id');
|
||||
},
|
||||
|
||||
setIconType : function(iconType) {
|
||||
setIconType:function (iconType) {
|
||||
$assert(iconType, 'iconType id can not be null');
|
||||
this.setAttribute('id', iconType);
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -17,33 +17,37 @@
|
||||
*/
|
||||
|
||||
mindplot.model.LinkModel = new Class({
|
||||
Extends: mindplot.model.FeatureModel,
|
||||
initialize : function(attributes) {
|
||||
Extends:mindplot.model.FeatureModel,
|
||||
initialize:function (attributes) {
|
||||
this.parent(mindplot.model.LinkModel.FEATURE_TYPE);
|
||||
this.setUrl(attributes.url);
|
||||
},
|
||||
|
||||
getUrl : function() {
|
||||
getUrl:function () {
|
||||
return this.getAttribute('url');
|
||||
},
|
||||
|
||||
setUrl : function(url) {
|
||||
setUrl:function (url) {
|
||||
$assert(url, 'url can not be null');
|
||||
|
||||
var fixedUrl = this._fixUrl(url);
|
||||
this.setAttribute('url', fixedUrl);
|
||||
|
||||
var type = fixedUrl.contains('mailto:') ? 'mail' : 'url';
|
||||
this.setAttribute('type', type);
|
||||
|
||||
this.setAttribute('urlType', type);
|
||||
},
|
||||
|
||||
_fixUrl : function(url) {
|
||||
_fixUrl:function (url) {
|
||||
var result = url;
|
||||
if (!result.contains('http://') && !result.contains('https://') && !result.contains('mailto://')) {
|
||||
result = "http://" + result;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
setUrlType:function (urlType) {
|
||||
$assert(urlType, 'urlType can not be null');
|
||||
this.setAttribute('urlType', urlType);
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -47,7 +47,12 @@ mindplot.model.NodeModel = new Class({
|
||||
|
||||
removeFeature:function (feature) {
|
||||
$assert(feature, 'feature can not be null');
|
||||
this._feature.erase(feature);
|
||||
var size = this._feature.length;
|
||||
this._feature = this._feature.filter(function (f) {
|
||||
return feature.getId() != f.getId();
|
||||
});
|
||||
$assert(size - 1 == this._feature.length, 'Could not be removed ...');
|
||||
|
||||
},
|
||||
|
||||
findFeatureByType:function (type) {
|
||||
@@ -59,9 +64,11 @@ mindplot.model.NodeModel = new Class({
|
||||
|
||||
findFeatureById:function (id) {
|
||||
$assert($defined(id), 'id can not be null');
|
||||
return this._feature.filter(function (feature) {
|
||||
var result = this._feature.filter(function (feature) {
|
||||
return feature.getId() == id;
|
||||
})[0];
|
||||
});
|
||||
$assert(result.length == 1, "Feature could not be found:" + id);
|
||||
return result[0]
|
||||
},
|
||||
|
||||
getPropertiesKeys:function () {
|
||||
@@ -142,53 +149,6 @@ mindplot.model.NodeModel = new Class({
|
||||
this._parent = parent;
|
||||
},
|
||||
|
||||
canBeConnected:function (sourceModel, sourcePosition, targetTopicHeight, targetTopicSize) {
|
||||
$assert(sourceModel != this, 'The same node can not be parent and child if itself.');
|
||||
$assert(sourcePosition, 'childPosition can not be null.');
|
||||
$assert(targetTopicHeight, 'childrenWidth can not be null.');
|
||||
$assert(targetTopicSize, 'targetTopicSize 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.model.INodeModel.MAIN_TOPIC_TYPE) {
|
||||
// Finally, check current node position ...
|
||||
var yDistance = Math.abs(sourcePosition.y - targetPosition.y);
|
||||
var gap = 35 + targetTopicHeight / 2;
|
||||
if (targetModel.getChildren().length > 0) {
|
||||
gap += Math.abs(targetPosition.y - targetModel.getChildren()[0].getPosition().y);
|
||||
}
|
||||
|
||||
if (yDistance <= gap) {
|
||||
// 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 >= -targetTopicSize.width / 2 && xDistance <= mindplot.model.INodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE / 2 + (targetTopicSize.width / 2)) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (xDistance <= targetTopicSize.width / 2 && Math.abs(xDistance) <= mindplot.model.INodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE / 2 + (targetTopicSize.width / 2)) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw "No implemented yet";
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
_isChildNode:function (node) {
|
||||
var result = false;
|
||||
if (node == this) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -17,17 +17,18 @@
|
||||
*/
|
||||
|
||||
mindplot.model.NoteModel = new Class({
|
||||
Extends: mindplot.model.FeatureModel,
|
||||
initialize : function(attributes) {
|
||||
Extends:mindplot.model.FeatureModel,
|
||||
initialize:function (attributes) {
|
||||
this.parent(mindplot.model.NoteModel.FEATURE_TYPE);
|
||||
this.setText(attributes.text);
|
||||
var noteText = attributes.text ? attributes.text : " ";
|
||||
this.setText(noteText);
|
||||
},
|
||||
|
||||
getText:function() {
|
||||
getText:function () {
|
||||
return this.getAttribute('text');
|
||||
},
|
||||
|
||||
setText : function(text) {
|
||||
setText:function (text) {
|
||||
$assert(text, 'text can not be null');
|
||||
this.setAttribute('text', text);
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -16,19 +16,37 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.persistence.Beta2PelaMigrator = new Class({
|
||||
initialize : function(betaSerializer) {
|
||||
initialize:function (betaSerializer) {
|
||||
this._betaSerializer = betaSerializer;
|
||||
this._pelaSerializer = new mindplot.persistence.XMLSerializer_Pela();
|
||||
},
|
||||
|
||||
toXML : function(mindmap) {
|
||||
toXML:function (mindmap) {
|
||||
return this._pelaSerializer.toXML(mindmap);
|
||||
},
|
||||
|
||||
loadFromDom : function(dom, mapId) {
|
||||
loadFromDom:function (dom, mapId) {
|
||||
$assert($defined(mapId), "mapId can not be null");
|
||||
var mindmap = this._betaSerializer.loadFromDom(dom, mapId);
|
||||
mindmap.setVersion(mindplot.persistence.ModelCodeName.PELA);
|
||||
|
||||
// Beta does not set position on second level nodes ...
|
||||
var branches = mindmap.getBranches();
|
||||
branches.each(function (model) {
|
||||
this._fixPosition(model);
|
||||
}.bind(this));
|
||||
|
||||
return mindmap;
|
||||
},
|
||||
|
||||
_fixPosition:function (parentModel) {
|
||||
var parentPos = parentModel.getPosition();
|
||||
var isRight = parentPos.x > 0;
|
||||
parentModel.getChildren().each(function (child) {
|
||||
if (!child.getPosition()) {
|
||||
child.setPosition(parentPos.x + (50 * isRight ? 1 : -1), parentPos.y);
|
||||
}
|
||||
this._fixPosition(child);
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* Copyright [2011] [wisemapping]
|
||||
/* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
mindplot.persistence.XMLSerializer_Beta = new Class({
|
||||
|
||||
toXML : function(mindmap) {
|
||||
toXML:function (mindmap) {
|
||||
$assert(mindmap, "Can not save a null mindmap");
|
||||
|
||||
var document = core.Utils.createDocument();
|
||||
@@ -40,7 +40,7 @@ mindplot.persistence.XMLSerializer_Beta = new Class({
|
||||
return document;
|
||||
},
|
||||
|
||||
_topicToXML : function(document, topic) {
|
||||
_topicToXML:function (document, topic) {
|
||||
var parentTopic = document.createElement("topic");
|
||||
|
||||
// Set topic attributes...
|
||||
@@ -105,8 +105,9 @@ mindplot.persistence.XMLSerializer_Beta = new Class({
|
||||
}
|
||||
|
||||
//ICONS
|
||||
var i;
|
||||
var icons = topic.getIcons();
|
||||
for (var i = 0; i < icons.length; i++) {
|
||||
for (i = 0; i < icons.length; i++) {
|
||||
var icon = icons[i];
|
||||
var iconDom = this._iconToXML(document, icon);
|
||||
parentTopic.appendChild(iconDom);
|
||||
@@ -114,14 +115,14 @@ mindplot.persistence.XMLSerializer_Beta = new Class({
|
||||
|
||||
//LINKS
|
||||
var links = topic.getLinks();
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
for (i = 0; i < links.length; i++) {
|
||||
var link = links[i];
|
||||
var linkDom = this._linkToXML(document, link);
|
||||
parentTopic.appendChild(linkDom);
|
||||
}
|
||||
|
||||
var notes = topic.getNotes();
|
||||
for (var i = 0; i < notes.length; i++) {
|
||||
for (i = 0; i < notes.length; i++) {
|
||||
var note = notes[i];
|
||||
var noteDom = this._noteToXML(document, note);
|
||||
parentTopic.appendChild(noteDom);
|
||||
@@ -129,7 +130,7 @@ mindplot.persistence.XMLSerializer_Beta = new Class({
|
||||
|
||||
//CHILDREN TOPICS
|
||||
var childTopics = topic.getChildren();
|
||||
for (var i = 0; i < childTopics.length; i++) {
|
||||
for (i = 0; i < childTopics.length; i++) {
|
||||
var childTopic = childTopics[i];
|
||||
var childDom = this._topicToXML(document, childTopic);
|
||||
parentTopic.appendChild(childDom);
|
||||
@@ -139,39 +140,41 @@ mindplot.persistence.XMLSerializer_Beta = new Class({
|
||||
return parentTopic;
|
||||
},
|
||||
|
||||
_iconToXML : function(document, icon) {
|
||||
_iconToXML:function (document, icon) {
|
||||
var iconDom = document.createElement("icon");
|
||||
iconDom.setAttribute('id', icon.getIconType());
|
||||
return iconDom;
|
||||
},
|
||||
|
||||
_linkToXML : function(document, link) {
|
||||
_linkToXML:function (document, link) {
|
||||
var linkDom = document.createElement("link");
|
||||
linkDom.setAttribute('url', link.getUrl());
|
||||
return linkDom;
|
||||
},
|
||||
|
||||
_noteToXML : function(document, note) {
|
||||
_noteToXML:function (document, note) {
|
||||
var noteDom = document.createElement("note");
|
||||
noteDom.setAttribute('text', note.getText());
|
||||
return noteDom;
|
||||
},
|
||||
|
||||
loadFromDom : function(dom, mapId) {
|
||||
loadFromDom:function (dom, mapId) {
|
||||
$assert(dom, "Dom can not be null");
|
||||
$assert(mapId, "mapId can not be null");
|
||||
|
||||
var rootElem = dom.documentElement;
|
||||
// Is a valid object ?
|
||||
var documentElement = dom.documentElement;
|
||||
$assert(documentElement.nodeName != "parsererror", "Error while parsing: '" + documentElement.childNodes[0].nodeValue);
|
||||
|
||||
// Is a wisemap?.
|
||||
$assert(rootElem.tagName == mindplot.persistence.XMLSerializer_Beta.MAP_ROOT_NODE, "This seem not to be a map document.");
|
||||
$assert(documentElement.tagName == mindplot.persistence.XMLSerializer_Beta.MAP_ROOT_NODE, "This seem not to be a map document. Root Tag: '" + documentElement.tagName);
|
||||
|
||||
// Start the loading process ...
|
||||
var version = rootElem.getAttribute("version");
|
||||
var version = documentElement.getAttribute("version");
|
||||
version = !$defined(version) ? mindplot.persistence.ModelCodeName.BETA : version;
|
||||
var mindmap = new mindplot.model.Mindmap(mapId, version);
|
||||
|
||||
var children = rootElem.childNodes;
|
||||
var children = documentElement.childNodes;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
if (child.nodeType == 1) {
|
||||
@@ -183,7 +186,7 @@ mindplot.persistence.XMLSerializer_Beta = new Class({
|
||||
return mindmap;
|
||||
},
|
||||
|
||||
_deserializeNode : function(domElem, mindmap) {
|
||||
_deserializeNode:function (domElem, mindmap) {
|
||||
var type = (domElem.getAttribute('central') != null) ? mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE : mindplot.model.INodeModel.MAIN_TOPIC_TYPE;
|
||||
var topic = mindmap.createNode(type);
|
||||
|
||||
@@ -274,19 +277,19 @@ mindplot.persistence.XMLSerializer_Beta = new Class({
|
||||
return topic;
|
||||
},
|
||||
|
||||
_deserializeIcon : function(domElem, topic) {
|
||||
_deserializeIcon:function (domElem) {
|
||||
var icon = domElem.getAttribute("id");
|
||||
icon = icon.replace("images/", "icons/legacy/");
|
||||
return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Icon.id, topic, {id:icon});
|
||||
return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Icon.id, {id:icon});
|
||||
},
|
||||
|
||||
_deserializeLink : function(domElem, topic) {
|
||||
return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Link.id, topic, {url:domElem.getAttribute("url")});
|
||||
_deserializeLink:function (domElem) {
|
||||
return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Link.id, {url:domElem.getAttribute("url")});
|
||||
},
|
||||
|
||||
_deserializeNote : function(domElem, topic) {
|
||||
_deserializeNote:function (domElem) {
|
||||
var text = domElem.getAttribute("text");
|
||||
return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Note.id, topic, {text:text == null ? " " : text});
|
||||
return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Note.id, {text:text == null ? " " : text});
|
||||
}});
|
||||
|
||||
mindplot.persistence.XMLSerializer_Beta.MAP_ROOT_NODE = 'map';
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -47,9 +47,14 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
// Create Relationships
|
||||
var relationships = mindmap.getRelationships();
|
||||
if (relationships.length > 0) {
|
||||
|
||||
for (var j = 0; j < relationships.length; j++) {
|
||||
var relationDom = this._relationshipToXML(document, relationships[j]);
|
||||
mapElem.appendChild(relationDom);
|
||||
var relationship = relationships[j];
|
||||
if (mindmap.findNodeById(relationship.getFromNode()) !== null && mindmap.findNodeById(relationship.getToNode()) !== null) {
|
||||
// Isolated relationships are not persisted ....
|
||||
var relationDom = this._relationshipToXML(document, relationship);
|
||||
mapElem.appendChild(relationDom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +66,7 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
|
||||
// Set topic attributes...
|
||||
if (topic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
parentTopic.setAttribute("central", true);
|
||||
parentTopic.setAttribute('central', 'true');
|
||||
} else {
|
||||
|
||||
var pos = topic.getPosition();
|
||||
@@ -88,7 +93,7 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
}
|
||||
|
||||
if (topic.areChildrenShrunken()) {
|
||||
parentTopic.setAttribute('shrink', true);
|
||||
parentTopic.setAttribute('shrink', 'true');
|
||||
}
|
||||
|
||||
// Font properties ...
|
||||
@@ -180,6 +185,7 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
result.setAttribute("srcTopicId", relationship.getFromNode());
|
||||
result.setAttribute("destTopicId", relationship.getToNode());
|
||||
|
||||
|
||||
var lineType = relationship.getLineType();
|
||||
result.setAttribute("lineType", lineType);
|
||||
if (lineType == mindplot.ConnectionLine.CURVED || lineType == mindplot.ConnectionLine.SIMPLE_CURVED) {
|
||||
@@ -249,28 +255,15 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
}
|
||||
|
||||
var topic = mindmap.createNode(type, id);
|
||||
|
||||
// Set text property is it;s defined...
|
||||
var text = domElem.getAttribute('text');
|
||||
if ($defined(text)) {
|
||||
if ($defined(text) && text) {
|
||||
topic.setText(text);
|
||||
}
|
||||
|
||||
var shape = domElem.getAttribute('shape');
|
||||
if ($defined(shape)) {
|
||||
topic.setShapeType(shape);
|
||||
|
||||
if (shape == mindplot.model.TopicShape.IMAGE) {
|
||||
var image = domElem.getAttribute('image');
|
||||
var size = image.substring(0, image.indexOf(':'));
|
||||
var url = image.substring(image.indexOf(':') + 1, image.length);
|
||||
topic.setImageUrl(url);
|
||||
|
||||
var split = size.split(',');
|
||||
topic.setImageSize(split[0], split[1]);
|
||||
}
|
||||
}
|
||||
|
||||
var fontStyle = domElem.getAttribute('fontStyle');
|
||||
if ($defined(fontStyle)) {
|
||||
if ($defined(fontStyle) && fontStyle) {
|
||||
var font = fontStyle.split(';');
|
||||
|
||||
if (font[0]) {
|
||||
@@ -294,6 +287,22 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
}
|
||||
}
|
||||
|
||||
var shape = domElem.getAttribute('shape');
|
||||
if ($defined(shape)) {
|
||||
topic.setShapeType(shape);
|
||||
|
||||
if (shape == mindplot.model.TopicShape.IMAGE) {
|
||||
var image = domElem.getAttribute('image');
|
||||
var size = image.substring(0, image.indexOf(':'));
|
||||
var url = image.substring(image.indexOf(':') + 1, image.length);
|
||||
topic.setImageUrl(url);
|
||||
|
||||
var split = size.split(',');
|
||||
topic.setImageSize(split[0], split[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var bgColor = domElem.getAttribute('bgColor');
|
||||
if ($defined(bgColor)) {
|
||||
topic.setBackgroundColor(bgColor);
|
||||
@@ -305,7 +314,7 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
}
|
||||
|
||||
var order = domElem.getAttribute('order');
|
||||
if ($defined(order)) {
|
||||
if ($defined(order) && order != "NaN") { // Hack for broken maps ...
|
||||
topic.setOrder(parseInt(order));
|
||||
}
|
||||
|
||||
@@ -423,8 +432,8 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
|
||||
if ($defined(destCtrlPoint) && destCtrlPoint != "") {
|
||||
model.setDestCtrlPoint(core.Point.fromString(destCtrlPoint));
|
||||
}
|
||||
model.setEndArrow(endArrow == "true");
|
||||
model.setStartArrow(startArrow == "true");
|
||||
model.setEndArrow('false');
|
||||
model.setStartArrow('true');
|
||||
return model;
|
||||
}
|
||||
});
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
mindplot.util.Shape =
|
||||
{
|
||||
isAtRight: function(sourcePoint, targetPoint) {
|
||||
isAtRight:function (sourcePoint, targetPoint) {
|
||||
$assert(sourcePoint, "Source can not be null");
|
||||
$assert(targetPoint, "Target can not be null");
|
||||
return sourcePoint.x < targetPoint.x;
|
||||
},
|
||||
|
||||
calculateRectConnectionPoint: function(rectCenterPoint, rectSize, isAtRight) {
|
||||
calculateRectConnectionPoint:function (rectCenterPoint, rectSize, isAtRight) {
|
||||
$assert(rectCenterPoint, 'rectCenterPoint can not be null');
|
||||
$assert(rectSize, 'rectSize can not be null');
|
||||
$assert($defined(isAtRight), 'isRight can not be null');
|
||||
@@ -43,11 +43,14 @@ mindplot.util.Shape =
|
||||
return result;
|
||||
},
|
||||
|
||||
calculateRelationShipPointCoordinates : function(topic, controlPoint) {
|
||||
calculateRelationShipPointCoordinates:function (topic, controlPoint) {
|
||||
var size = topic.getSize();
|
||||
var position = topic.getPosition();
|
||||
var m = (position.y - controlPoint.y) / (position.x - controlPoint.x);
|
||||
var y,x;
|
||||
var div = (position.x - controlPoint.x);
|
||||
div = (Math.abs(div) > 0.1 ? div : 0.1); // Prevent division by 0.
|
||||
|
||||
var m = (position.y - controlPoint.y) / div;
|
||||
var y, x;
|
||||
var gap = 5;
|
||||
if (controlPoint.y > position.y + (size.height / 2)) {
|
||||
y = position.y + (size.height / 2) + gap;
|
||||
@@ -76,10 +79,12 @@ mindplot.util.Shape =
|
||||
return new core.Point(x, y);
|
||||
},
|
||||
|
||||
calculateDefaultControlPoints : function(srcPos, tarPos) {
|
||||
calculateDefaultControlPoints:function (srcPos, tarPos) {
|
||||
var y = srcPos.y - tarPos.y;
|
||||
var x = srcPos.x - tarPos.x;
|
||||
var m = y / x;
|
||||
var div = (Math.abs(x) > 0.1 ? x : 0.1); // Prevent division by 0.
|
||||
|
||||
var m = y / div;
|
||||
var l = Math.sqrt(y * y + x * x) / 3;
|
||||
var fix = 1;
|
||||
if (srcPos.x > tarPos.x) {
|
||||
@@ -91,7 +96,7 @@ mindplot.util.Shape =
|
||||
var x2 = tarPos.x + Math.sqrt(l * l / (1 + (m * m))) * fix * -1;
|
||||
var y2 = m * (x2 - tarPos.x) + tarPos.y;
|
||||
|
||||
return [new core.Point(-srcPos.x + x1, -srcPos.y + y1),new core.Point(-tarPos.x + x2, -tarPos.y + y2)];
|
||||
return [new core.Point(-srcPos.x + x1, -srcPos.y + y1), new core.Point(-tarPos.x + x2, -tarPos.y + y2)];
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
* Copyright [2012] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
@@ -17,34 +17,33 @@
|
||||
*/
|
||||
|
||||
mindplot.widget.ColorPalettePanel = new Class({
|
||||
Extends: mindplot.widget.ToolbarPaneItem,
|
||||
Extends:mindplot.widget.ToolbarPaneItem,
|
||||
|
||||
initialize : function(buttonId, model, baseUrl) {
|
||||
initialize:function (buttonId, model, baseUrl) {
|
||||
this._baseUrl = baseUrl;
|
||||
this.parent(buttonId, model);
|
||||
$assert($defined(baseUrl), "baseUrl can not be null");
|
||||
},
|
||||
|
||||
_load : function() {
|
||||
_load:function () {
|
||||
|
||||
if (!mindplot.widget.ColorPalettePanel._panelContent) {
|
||||
|
||||
// Load all the CSS styles ...
|
||||
Asset.css(this._baseUrl + '/colorPalette.css', {id: 'colorPaletteStyle', title: 'colorPalette'});
|
||||
Asset.css(this._baseUrl + '/colorPalette.css', {id:'colorPaletteStyle', title:'colorPalette'});
|
||||
|
||||
// Load panel html fragment ...
|
||||
var result;
|
||||
var request = new Request({
|
||||
url: this._baseUrl + '/colorPalette.html',
|
||||
method: 'get',
|
||||
async: false,
|
||||
onRequest: function() {
|
||||
console.log("loading ...");
|
||||
url:this._baseUrl + '/colorPalette.html',
|
||||
method:'get',
|
||||
async:false,
|
||||
onRequest:function () {
|
||||
},
|
||||
onSuccess: function(responseText) {
|
||||
onSuccess:function (responseText) {
|
||||
result = responseText;
|
||||
},
|
||||
onFailure: function() {
|
||||
onFailure:function () {
|
||||
result = '<div>Sorry, your request failed :(</div>';
|
||||
}
|
||||
});
|
||||
@@ -56,15 +55,15 @@ mindplot.widget.ColorPalettePanel = new Class({
|
||||
},
|
||||
|
||||
|
||||
buildPanel: function() {
|
||||
var content = new Element("div", {'class':'toolbarPanel','id': this._buttonId + 'colorPalette'});
|
||||
buildPanel:function () {
|
||||
var content = new Element("div", {'class':'toolbarPanel', 'id':this._buttonId + 'colorPalette'});
|
||||
content.innerHTML = this._load();
|
||||
|
||||
// Register on toolbar elements ...
|
||||
var colorCells = content.getElements('div[class=palette-colorswatch]');
|
||||
var model = this.getModel();
|
||||
colorCells.each(function(elem) {
|
||||
elem.addEvent('click', function() {
|
||||
colorCells.each(function (elem) {
|
||||
elem.addEvent('click', function () {
|
||||
var color = elem.getStyle("background-color");
|
||||
model.setValue(color);
|
||||
this.hide();
|
||||
@@ -74,12 +73,12 @@ mindplot.widget.ColorPalettePanel = new Class({
|
||||
return content;
|
||||
},
|
||||
|
||||
_updateSelectedItem : function() {
|
||||
_updateSelectedItem:function () {
|
||||
var panelElem = this.getPanelElem();
|
||||
|
||||
// Clear selected cell based on the color ...
|
||||
var tdCells = panelElem.getElements("td[class='palette-cell palette-cell-selected']");
|
||||
tdCells.each(function(elem) {
|
||||
tdCells.each(function (elem) {
|
||||
elem.className = 'palette-cell';
|
||||
});
|
||||
|
||||
@@ -87,9 +86,13 @@ mindplot.widget.ColorPalettePanel = new Class({
|
||||
var colorCells = panelElem.getElements('div[class=palette-colorswatch]');
|
||||
var model = this.getModel();
|
||||
var modelValue = model.getValue();
|
||||
colorCells.each(function(elem) {
|
||||
colorCells.each(function (elem) {
|
||||
var color = elem.getStyle("background-color");
|
||||
if (modelValue == color) {
|
||||
if (modelValue != null && modelValue[0] == 'r') {
|
||||
modelValue = modelValue.rgbToHex();
|
||||
}
|
||||
|
||||
if (modelValue != null && modelValue.toUpperCase() == color.toUpperCase()) {
|
||||
elem.parentNode.className = 'palette-cell palette-cell-selected';
|
||||
}
|
||||
});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user