summaryrefslogtreecommitdiffstats
path: root/js/wwwsqldesigner.js
diff options
context:
space:
mode:
authorondrej.zara <none@none>2010-03-14 08:47:01 +0000
committerondrej.zara <none@none>2010-03-14 08:47:01 +0000
commit11da9df5e5c40c023b8cffb20e4879f588b0a8e4 (patch)
tree50b2d0b893d67ba94c113165e7a026ca833bd2c5 /js/wwwsqldesigner.js
parenta3845d3e9907bd67e7be9a9f86458d2c80bb568c (diff)
downloadwwwsqldesigner-11da9df5e5c40c023b8cffb20e4879f588b0a8e4.zip
wwwsqldesigner-11da9df5e5c40c023b8cffb20e4879f588b0a8e4.tar.gz
wwwsqldesigner-11da9df5e5c40c023b8cffb20e4879f588b0a8e4.tar.bz2
#69 relation colors
--HG-- extra : convert_revision : svn%3Ab267cdba-c1da-11dd-874b-8bacd04a0a74/trunk%4082
Diffstat (limited to 'js/wwwsqldesigner.js')
-rw-r--r--js/wwwsqldesigner.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/js/wwwsqldesigner.js b/js/wwwsqldesigner.js
index 9f4d0bb..d57a243 100644
--- a/js/wwwsqldesigner.js
+++ b/js/wwwsqldesigner.js
@@ -346,7 +346,7 @@ SQL.Row.prototype.destroy = function() {
SQL.Row.prototype.toXML = function() {
var xml = "";
- var t = this.getTitle().replace(/"/g,"&quot;");
+ var t = this.getTitle().replace(/"/g,"&quot;"); //"
var nn = (this.data.nll ? "1" : "0");
var ai = (this.data.ai ? "1" : "0");
xml += '<row name="'+t+'" null="'+nn+'" autoincrement="'+ai+'">\n';
@@ -449,8 +449,9 @@ SQL.Row.prototype.enter = function(e) {
/* --------------------------- relation (connector) ----------- */
SQL.Relation = OZ.Class().extend(SQL.Visual);
-
+SQL.Relation._counter = 0;
SQL.Relation.prototype.init = function(owner, row1, row2) {
+ this.constructor._counter++;
this.owner = owner;
this.row1 = row1;
this.row2 = row2;
@@ -461,12 +462,18 @@ SQL.Relation.prototype.init = function(owner, row1, row2) {
this.row2.addRelation(this);
this.dom = [];
+ if (CONFIG.RELATION_COLORS) {
+ var colorIndex = this.constructor._counter - 1;
+ var color = CONFIG.RELATION_COLORS[colorIndex % CONFIG.RELATION_COLORS.length];
+ } else {
+ var color = "#000";
+ }
if (this.owner.vector == "svg") {
var path = document.createElementNS(this.owner.svgNS, "path");
- path.setAttribute("stroke","black");
- path.setAttribute("stroke-width",CONFIG.RELATION_THICKNESS);
- path.setAttribute("fill","none");
+ path.setAttribute("stroke", color);
+ path.setAttribute("stroke-width", CONFIG.RELATION_THICKNESS);
+ path.setAttribute("fill", "none");
this.owner.dom.svg.appendChild(path);
this.dom.push(path);
} else if (this.owner.vector == "vml") {
@@ -476,7 +483,7 @@ SQL.Relation.prototype.init = function(owner, row1, row2) {
curve.to = "0 0";
curve.control1 = "10 10";
curve.control2 = "100 300";
- curve.strokecolor = "#000";
+ curve.strokecolor = color;
curve.filled = false;
this.owner.dom.content.appendChild(curve);
this.dom.push(curve);