You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2006/10/07 20:22:39 UTC
svn commit: r453979 [3/8] - in
/tapestry/tapestry4/trunk/tapestry-framework/src/js: dojo/ dojo/src/
dojo/src/collections/ dojo/src/data/ dojo/src/data/csv/ dojo/src/date/
dojo/src/debug/ dojo/src/event/ dojo/src/gfx/ dojo/src/html/ dojo/src/i18n/
dojo/...
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/gfx/vml.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/gfx/vml.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/gfx/vml.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/gfx/vml.js Sat Oct 7 11:22:33 2006
@@ -18,6 +18,8 @@
dojo.require("dojo.gfx.color");
dojo.require("dojo.gfx.common");
+dojo.require("dojo.gfx.shape");
+dojo.require("dojo.gfx.path");
dojo.require("dojo.experimental");
dojo.experimental("dojo.gfx.vml");
@@ -281,7 +283,7 @@
}
});
-dojo.declare("dojo.gfx.Group", dojo.gfx.VirtualGroup, {
+dojo.declare("dojo.gfx.Group", dojo.gfx.shape.VirtualGroup, {
attach: function(rawNode){
if(rawNode){
this.rawNode = rawNode;
@@ -324,13 +326,10 @@
dojo.lang.extend(dojo.gfx.Group, zIndex);
delete zIndex;
-dojo.declare("dojo.gfx.Rect", dojo.gfx.Shape, {
- initializer: function(rawNode) {
- this.shape = dojo.lang.shallowCopy(dojo.gfx.defaultRect, true);
- this.attach(rawNode);
- },
+dojo.declare("dojo.gfx.Rect", dojo.gfx.shape.Rect, {
setShape: function(newShape){
var shape = this.shape = dojo.gfx.makeParameters(this.shape, newShape);
+ this.bbox = null;
var style = this.rawNode.style;
style.left = shape.x.toFixed();
style.top = shape.y.toFixed();
@@ -365,12 +364,13 @@
// a workaround for the VML's arcsize bug: cannot read arcsize of an instantiated node
var arcsize = rawNode.outerHTML.match(/arcsize = \"(\d*\.?\d+[%f]?)\"/)[1];
arcsize = (arcsize.indexOf("%") >= 0) ? parseFloat(arcsize) / 100 : dojo.gfx.vml._parseFloat(arcsize);
- var width = parseFloat(rawNode.style.width);
- var height = parseFloat(rawNode.style.height);
+ var style = rawNode.style;
+ var width = parseFloat(style.width);
+ var height = parseFloat(style.height);
// make an object
return dojo.gfx.makeParameters(dojo.gfx.defaultRect, {
- x: parseInt(rawNode.style.left),
- y: parseInt(rawNode.style.top),
+ x: parseInt(style.left),
+ y: parseInt(style.top),
width: width,
height: height,
r: Math.min(width, height) * arcsize
@@ -379,27 +379,24 @@
});
dojo.gfx.Rect.nodeType = "roundrect"; // use a roundrect so the stroke join type is respected
-dojo.declare("dojo.gfx.Ellipse", dojo.gfx.Shape, {
- initializer: function(rawNode) {
- this.shape = dojo.lang.shallowCopy(dojo.gfx.defaultEllipse, true);
- this.attach(rawNode);
- },
+dojo.declare("dojo.gfx.Ellipse", dojo.gfx.shape.Ellipse, {
setShape: function(newShape){
- var ts = this.shape = dojo.gfx.makeParameters(this.shape, newShape);
- with(this.rawNode.style){
- left = (ts.cx - ts.rx).toFixed();
- top = (ts.cy - ts.ry).toFixed();
- width = (ts.rx * 2).toFixed();
- height = (ts.ry * 2).toFixed();
- }
+ var shape = this.shape = dojo.gfx.makeParameters(this.shape, newShape);
+ this.bbox = null;
+ var style = this.rawNode.style;
+ style.left = (shape.cx - shape.rx).toFixed();
+ style.top = (shape.cy - shape.ry).toFixed();
+ style.width = (shape.rx * 2).toFixed();
+ style.height = (shape.ry * 2).toFixed();
return this.setTransform(this.matrix);
},
attachShape: function(rawNode){
- var rx = parseInt(rawNode.style.width ) / 2;
- var ry = parseInt(rawNode.style.height) / 2;
+ var style = this.rawNode.style;
+ var rx = parseInt(style.width ) / 2;
+ var ry = parseInt(style.height) / 2;
return dojo.gfx.makeParameters(dojo.gfx.defaultEllipse, {
- cx: parseInt(rawNode.style.left) + rx,
- cy: parseInt(rawNode.style.top ) + ry,
+ cx: parseInt(style.left) + rx,
+ cy: parseInt(style.top ) + ry,
rx: rx,
ry: ry
});
@@ -407,57 +404,51 @@
});
dojo.gfx.Ellipse.nodeType = "oval";
-dojo.declare("dojo.gfx.Circle", dojo.gfx.Shape, {
- initializer: function(rawNode) {
- this.shape = dojo.lang.shallowCopy(dojo.gfx.defaultCircle, true);
- this.attach(rawNode);
- },
+dojo.declare("dojo.gfx.Circle", dojo.gfx.shape.Circle, {
setShape: function(newShape){
- this.shape = dojo.gfx.makeParameters(this.shape, newShape);
- this.rawNode.style.left = (this.shape.cx - this.shape.r).toFixed();
- this.rawNode.style.top = (this.shape.cy - this.shape.r).toFixed();
- this.rawNode.style.width = (this.shape.r * 2).toFixed();
- this.rawNode.style.height = (this.shape.r * 2).toFixed();
+ var shape = this.shape = dojo.gfx.makeParameters(this.shape, newShape);
+ this.bbox = null;
+ var style = this.rawNode.style;
+ style.left = (shape.cx - shape.r).toFixed();
+ style.top = (shape.cy - shape.r).toFixed();
+ style.width = (shape.r * 2).toFixed();
+ style.height = (shape.r * 2).toFixed();
return this;
},
attachShape: function(rawNode){
- var r = parseInt(rawNode.style.width) / 2;
+ var style = this.rawNode.style;
+ var r = parseInt(style.width) / 2;
return dojo.gfx.makeParameters(dojo.gfx.defaultCircle, {
- cx: parseInt(rawNode.style.left) + r,
- cy: parseInt(rawNode.style.top) + r,
+ cx: parseInt(style.left) + r,
+ cy: parseInt(style.top) + r,
r: r
});
}
});
dojo.gfx.Circle.nodeType = "oval";
-dojo.declare("dojo.gfx.Line", dojo.gfx.Shape, {
- initializer: function(rawNode) {
- this.shape = dojo.lang.shallowCopy(dojo.gfx.defaultLine, true);
- this.attach(rawNode);
- },
+dojo.declare("dojo.gfx.Line", dojo.gfx.shape.Line, {
setShape: function(newShape){
- this.shape = dojo.gfx.makeParameters(this.shape, newShape);
- this.rawNode.from = this.shape.x1.toFixed() + "," + this.shape.y1.toFixed();
- this.rawNode.to = this.shape.x2.toFixed() + "," + this.shape.y2.toFixed();
+ var shape = this.shape = dojo.gfx.makeParameters(this.shape, newShape);
+ this.bbox = null;
+ var rawNode = this.rawNode;
+ rawNode.from = shape.x1.toFixed() + "," + shape.y1.toFixed();
+ rawNode.to = shape.x2.toFixed() + "," + shape.y2.toFixed();
return this;
},
attachShape: function(rawNode){
+ var rawNode = this.rawNode;
return dojo.gfx.makeParameters(dojo.gfx.defaultLine, {
- x1: this.rawNode.from.x,
- y1: this.rawNode.from.y,
- x2: this.rawNode.to.x,
- y2: this.rawNode.to.y
+ x1: rawNode.from.x,
+ y1: rawNode.from.y,
+ x2: rawNode.to.x,
+ y2: rawNode.to.y
});
}
});
dojo.gfx.Line.nodeType = "line";
-dojo.declare("dojo.gfx.Polyline", dojo.gfx.Shape, {
- initializer: function(rawNode) {
- this.shape = dojo.lang.shallowCopy(dojo.gfx.defaultPolyline, true);
- this.attach(rawNode);
- },
+dojo.declare("dojo.gfx.Polyline", dojo.gfx.shape.Polyline, {
setShape: function(points, closed){
if(points && points instanceof Array){
this.shape = dojo.gfx.makeParameters(this.shape, { points: points });
@@ -465,11 +456,14 @@
}else{
this.shape = dojo.gfx.makeParameters(this.shape, points);
}
- var attr = "";
- for(var i = 0; i< this.shape.points.length; ++i){
- attr += this.shape.points[i].x.toFixed(8) + " " + this.shape.points[i].y.toFixed(8) + " ";
+ this.bbox = null;
+ var attr = [];
+ var p = this.shape.points;
+ for(var i = 0; i< p.length; ++i){
+ attr.push(p[i].x.toFixed());
+ attr.push(p[i].y.toFixed());
}
- this.rawNode.points.value = attr;
+ this.rawNode.points.value = attr.join(" ");
return this.setTransform(this.matrix);
},
attachShape: function(rawNode){
@@ -485,7 +479,60 @@
});
dojo.gfx.Polyline.nodeType = "polyline";
-dojo.gfx.Path._calcArc = function(alpha){
+dojo.declare("dojo.gfx.Image", dojo.gfx.shape.Image, {
+ getEventSource: function() {
+ return this.rawNode ? this.rawNode.firstChild : null;
+ },
+ setShape: function(newShape){
+ var shape = this.shape = dojo.gfx.makeParameters(this.shape, newShape);
+ this.bbox = null;
+ var firstChild = this.rawNode.firstChild;
+ firstChild.src = shape.src;
+ if(shape.width || shape.height){
+ firstChild.style.width = shape.width;
+ firstChild.style.height = shape.height;
+ }
+ return this.setTransform(this.matrix);
+ },
+ setStroke: function() { return this; },
+ setFill: function() { return this; },
+ attachShape: function(rawNode){
+ var shape = dojo.lang.shallowCopy(dojo.gfx.defaultImage, true);
+ shape.src = rawNode.firstChild.src;
+ return shape;
+ },
+ attachStroke: function(rawNode){ return null; },
+ attachFill: function(rawNode){ return null; },
+ attachTransform: function(rawNode) {
+ var matrix = {};
+ if(rawNode){
+ var m = rawNode.filters["DXImageTransform.Microsoft.Matrix"];
+ matrix.xx = m.M11;
+ matrix.xy = m.M12;
+ matrix.yx = m.M21;
+ matrix.yy = m.M22;
+ matrix.dx = m.Dx;
+ matrix.dy = m.Dy;
+ }
+ return dojo.gfx.matrix.normalize(matrix);
+ },
+ _applyTransform: function() {
+ var matrix = this._getRealMatrix();
+ if(!matrix) return this;
+ with(this.rawNode.filters["DXImageTransform.Microsoft.Matrix"]){
+ M11 = matrix.xx;
+ M12 = matrix.xy;
+ M21 = matrix.yx;
+ M22 = matrix.yy;
+ Dx = matrix.dx;
+ Dy = matrix.dy;
+ }
+ return this;
+ }
+});
+dojo.gfx.Image.nodeType = "image";
+
+dojo.gfx.path._calcArc = function(alpha){
var cosa = Math.cos(alpha);
var sina = Math.sin(alpha);
// return a start point, 1st and 2nd control points, and an end point
@@ -498,6 +545,7 @@
};
};
+/*
dojo.lang.extend(dojo.gfx.Path, {
_pathVmlToSvgMap: { r: "l", l: "L", t: "m", m: "M", v: "c", c: "C", x: "z" },
_pathSvgToVmlMap: { l: "r", L: "l", m: "t", M: "m", c: "v", C: "c", z: "x" },
@@ -617,63 +665,408 @@
}
});
dojo.gfx.Path.nodeType = "shape";
+*/
-dojo.declare("dojo.gfx.Image", dojo.gfx.Shape, {
- initializer: function(rawNode) {
- this.shape = dojo.lang.shallowCopy(dojo.gfx.defaultImage, true);
- this.attach(rawNode);
- },
- getEventSource: function() {
- return this.rawNode ? this.rawNode.firstChild : null;
+dojo.declare("dojo.gfx.Path", dojo.gfx.path.Path, {
+ initializer: function(rawNode){
+ this.inherited("initializer", [rawNode]);
+ this.vmlPath = "";
+ this.lastControl = {};
+ // override inherited methods
+ var _this = this;
+ var old_updateWithSegment = this._updateWithSegment;
+ this._updateWithSegment = function(segment){
+ var last = dojo.lang.shallowCopy(_this.last);
+ old_updateWithSegment.call(_this, segment);
+ // add a VML path segment
+ var path = _this[_this.renderers[segment.action]](segment, last);
+ if(typeof(_this.vmlPath) == "string"){
+ _this.vmlPath += path.join("");
+ }else{
+ _this.vmlPath = _this.vmlPath.concat(path);
+ }
+ if(typeof(_this.vmlPath) == "string"){
+ _this.rawNode.path.v = _this.vmlPath + " e";
+ }
+ };
+ var oldSetShape = this.setShape;
+ this.setShape = function(newShape){
+ _this.vmlPath = [];
+ _this.lastControl = {};
+ oldSetShape.call(_this, newShape);
+ _this.vmlPath = _this.vmlPath.join("");
+ _this.rawNode.path.v = _this.vmlPath + " e";
+ return _this;
+ };
},
- setShape: function(newShape){
- var ts = this.shape = dojo.gfx.makeParameters(this.shape, newShape);
- this.rawNode.firstChild.src = ts.src;
- if(ts.width || ts.height){
- with(this.rawNode.firstChild.style){
- width = ts.width;
- height = ts.height;
+ // VML-specific segment renderers
+ renderers: {
+ M: "_moveToA", m: "_moveToR",
+ L: "_lineToA", l: "_lineToR",
+ H: "_hLineToA", h: "_hLineToR",
+ V: "_vLineToA", v: "_vLineToR",
+ C: "_curveToA", c: "_curveToR",
+ S: "_smoothCurveToA", s: "_smoothCurveToR",
+ Q: "_qCurveToA", q: "_qCurveToR",
+ T: "_qSmoothCurveToA", t: "_qSmoothCurveToR",
+ A: "_arcTo", a: "_arcTo",
+ Z: "_closePath", z: "_closePath"
+ },
+ _addArgs: function(path, args, from, upto){
+ if(typeof(upto) == "undefined"){
+ upto = args.length;
+ }
+ if(typeof(from) == "undefined"){
+ from = 0;
+ }
+ for(var i = from; i < upto; ++i){
+ path.push(" ");
+ path.push(args[i].toFixed());
+ }
+ },
+ _addArgsAdjusted: function(path, last, args, from, upto){
+ if(typeof(upto) == "undefined"){
+ upto = args.length;
+ }
+ if(typeof(from) == "undefined"){
+ from = 0;
+ }
+ for(var i = from; i < upto; i += 2){
+ path.push(" ");
+ path.push((last.x + args[i]).toFixed());
+ path.push(" ");
+ path.push((last.y + args[i + 1]).toFixed());
+ }
+ },
+ _moveToA: function(segment){
+ var p = [" m"];
+ var n = segment.args;
+ var l = n.length;
+ if(l == 2){
+ this._addArgs(p, n);
+ }else{
+ this._addArgs(p, n, 0, 2);
+ p.push(" l");
+ this._addArgs(p, n, 2);
+ }
+ this.lastControl = {};
+ return p;
+ },
+ _moveToR: function(segment, last){
+ var p = ["x" in last ? " t" : " m"];
+ var n = segment.args;
+ var l = n.length;
+ if(l == 2){
+ this._addArgs(p, n);
+ }else{
+ this._addArgs(p, n, 0, 2);
+ p.push(" r");
+ this._addArgs(p, n, 2);
+ }
+ this.lastControl = {};
+ return p;
+ },
+ _lineToA: function(segment){
+ var p = [" l"];
+ this._addArgs(p, segment.args);
+ this.lastControl = {};
+ return p;
+ },
+ _lineToR: function(segment){
+ var p = [" r"];
+ this._addArgs(p, segment.args);
+ this.lastControl = {};
+ return p;
+ },
+ _hLineToA: function(segment, last){
+ var p = [" l"];
+ var n = segment.args;
+ var l = n.length;
+ var y = " " + last.y.toFixed();
+ for(var i = 0; i < l; ++i){
+ p.push(" ");
+ p.push(n[i].toFixed());
+ p.push(y);
+ }
+ this.lastControl = {};
+ return p;
+ },
+ _hLineToR: function(segment){
+ var p = [" r"];
+ var n = segment.args;
+ var l = n.length;
+ for(var i = 0; i < l; ++i){
+ p.push(" ");
+ p.push(n[i].toFixed());
+ p.push(" 0");
+ }
+ this.lastControl = {};
+ return p;
+ },
+ _vLineToA: function(segment, last){
+ var p = [" l"];
+ var n = segment.args;
+ var l = n.length;
+ var x = " " + last.x.toFixed();
+ for(var i = 0; i < l; ++i){
+ p.push(x);
+ p.push(" ");
+ p.push(n[i].toFixed());
+ }
+ this.lastControl = {};
+ return p;
+ },
+ _vLineToR: function(segment){
+ var p = [" r"];
+ var n = segment.args;
+ var l = n.length;
+ for(var i = 0; i < l; ++i){
+ p.push(" 0 ");
+ p.push(n[i].toFixed());
+ }
+ this.lastControl = {};
+ return p;
+ },
+ _curveToA: function(segment){
+ var p = [];
+ var n = segment.args;
+ var l = n.length;
+ for(var i = 0; i < l; i += 6){
+ p.push(" c");
+ this._addArgs(p, n, i, i + 6);
+ }
+ this.lastControl = {x: n[l - 4], y: n[l - 3], type: "C"};
+ return p;
+ },
+ _curveToR: function(segment, last){
+ var p = [];
+ var n = segment.args;
+ var l = n.length;
+ for(var i = 0; i < l; i += 6){
+ p.push(" v");
+ this._addArgs(p, n, i, i + 6);
+ this.lastControl = {x: last.x + n[i + 2], y: last.y + n[i + 3]};
+ last.x += n[i + 4];
+ last.y += n[i + 5];
+ }
+ this.lastControl.type = "C";
+ return p;
+ },
+ _smoothCurveToA: function(segment, last){
+ var p = [];
+ var n = segment.args;
+ var l = n.length;
+ for(var i = 0; i < l; i += 4){
+ p.push(" c");
+ if(this.lastControl.type == "C"){
+ this._addArgs(p, [
+ 2 * last.x - this.lastControl.x,
+ 2 * last.y - this.lastControl.y
+ ]);
+ }else{
+ this._addArgs(p, [last.x, last.y]);
}
- }
- return this.setTransform(this.matrix);
+ this._addArgs(p, n, i, i + 4);
+ }
+ this.lastControl = {x: n[l - 4], y: n[l - 3], type: "C"};
+ return p;
},
- setStroke: function() { return this; },
- setFill: function() { return this; },
- attachShape: function(rawNode){
- var shape = dojo.lang.shallowCopy(dojo.gfx.defaultImage, true);
- shape.src = rawNode.firstChild.src;
- return shape;
+ _smoothCurveToR: function(segment, last){
+ var p = [];
+ var n = segment.args;
+ var l = n.length;
+ for(var i = 0; i < l; i += 4){
+ p.push(" v");
+ if(this.lastControl.type == "C"){
+ this._addArgs(p, [
+ last.x - this.lastControl.x,
+ last.y - this.lastControl.y
+ ]);
+ }else{
+ this._addArgs(p, [0, 0]);
+ }
+ this._addArgs(p, n, i, i + 4);
+ this.lastControl = {x: last.x + n[i], y: last.y + n[i + 1]};
+ last.x += n[i + 2];
+ last.y += n[i + 3];
+ }
+ this.lastControl.type = "C";
+ return p;
+ },
+ _qCurveToA: function(segment){
+ var p = [];
+ var n = segment.args;
+ var l = n.length;
+ for(var i = 0; i < l; i += 4){
+ p.push(" qb");
+ this._addArgs(p, n, i, i + 4);
+ }
+ this.lastControl = {x: n[l - 4], y: n[l - 3], type: "Q"};
+ return p;
+ },
+ _qCurveToR: function(segment, last){
+ var p = [];
+ var n = segment.args;
+ var l = n.length;
+ for(var i = 0; i < l; i += 4){
+ p.push(" qb");
+ this._addArgsAdjusted(p, last, n, i, i + 4);
+ this.lastControl = {x: last.x + n[i], y: last.y + n[i + 1]};
+ last.x += n[i + 2];
+ last.y += n[i + 3];
+ }
+ this.lastControl.type = "Q";
+ return p;
+ },
+ _qSmoothCurveToA: function(segment, last){
+ var p = [];
+ var n = segment.args;
+ var l = n.length;
+ for(var i = 0; i < l; i += 2){
+ p.push(" qb");
+ if(this.lastControl.type == "Q"){
+ this._addArgs(p, [
+ this.lastControl.x = 2 * last.x - this.lastControl.x,
+ this.lastControl.y = 2 * last.y - this.lastControl.y
+ ]);
+ }else{
+ this._addArgs(p, [
+ this.lastControl.x = last.x,
+ this.lastControl.y = last.y
+ ]);
+ }
+ this._addArgs(p, n, i, i + 2);
+ }
+ this.lastControl.type = "Q";
+ return p;
},
- attachStroke: function(rawNode){ return null; },
- attachFill: function(rawNode){ return null; },
- attachTransform: function(rawNode) {
- var matrix = {};
- if(rawNode){
- var m = rawNode.filters["DXImageTransform.Microsoft.Matrix"];
- matrix.xx = m.M11;
- matrix.xy = m.M12;
- matrix.yx = m.M21;
- matrix.yy = m.M22;
- matrix.dx = m.Dx;
- matrix.dy = m.Dy;
+ _qSmoothCurveToR: function(segment, last){
+ var p = [];
+ var n = segment.args;
+ var l = n.length;
+ for(var i = 0; i < l; i += 2){
+ p.push(" qb");
+ if(this.lastControl.type == "Q"){
+ this._addArgs(p, [
+ this.lastControl.x = 2 * last.x - this.lastControl.x,
+ this.lastControl.y = 2 * last.y - this.lastControl.y
+ ]);
+ }else{
+ this._addArgs(p, [
+ this.lastControl.x = last.x,
+ this.lastControl.y = last.y
+ ]);
+ }
+ this._addArgsAdjusted(p, last, n, i, i + 2);
}
- return dojo.gfx.matrix.normalize(matrix);
+ this.lastControl.type = "Q";
+ return p;
},
- _applyTransform: function() {
- var matrix = this._getRealMatrix();
- if(!matrix) return this;
- with(this.rawNode.filters["DXImageTransform.Microsoft.Matrix"]){
- M11 = matrix.xx;
- M12 = matrix.xy;
- M21 = matrix.yx;
- M22 = matrix.yy;
- Dx = matrix.dx;
- Dy = matrix.dy;
+ _PI4: Math.PI / 4,
+ _curvePI4: dojo.gfx.path._calcArc(Math.PI / 8),
+ _calcArcTo: function(path, last, rx, ry, xRotg, large, cw, x, y){
+ var m = dojo.gfx.matrix;
+ // calculate parameters
+ var xRot = -dojo.math.degToRad(xRotg);
+ var rx2 = rx * rx;
+ var ry2 = ry * ry;
+ var pa = m.multiplyPoint(
+ m.rotate(-xRot),
+ {x: (last.x - x) / 2, y: (last.y - y) / 2}
+ );
+ var pax2 = pa.x * pa.x;
+ var pay2 = pa.y * pa.y;
+ var c1 = Math.sqrt((rx2 * ry2 - rx2 * pay2 - ry2 * pax2) / (rx2 * pay2 + ry2 * pax2));
+ var ca = {
+ x: c1 * rx * pa.y / ry,
+ y: -c1 * ry * pa.x / rx
+ };
+ if(large == cw){
+ ca = {x: -ca.x, y: -ca.y};
}
- return this;
+ // our center
+ var c = m.multiplyPoint(
+ [
+ m.translate(
+ (last.x + x) / 2,
+ (last.y + y) / 2
+ ),
+ m.rotate(xRot)
+ ],
+ ca
+ );
+ // start of our arc
+ var startAngle = Math.atan2(c.y - last.y, last.x - c.x) - xRot;
+ var endAngle = Math.atan2(c.y - y, x - c.x) - xRot;
+ // size of our arc in radians
+ var theta = cw ? startAngle - endAngle : endAngle - startAngle;
+ if(theta < 0){
+ theta += this._2PI;
+ }else if(theta > this._2PI){
+ theta = this._2PI;
+ }
+ // calculate our elliptic transformation
+ var elliptic_transform = m.normalize([
+ m.translate(c.x, c.y),
+ m.rotate(xRot),
+ m.scale(rx, ry)
+ ]);
+ // draw curve chunks
+ var alpha = this._PI4 / 2;
+ var curve = this._curvePI4;
+ var step = cw ? -alpha : alpha;
+ for(var angle = theta; angle > 0; angle -= this._PI4){
+ if(angle < this._PI4){
+ alpha = angle / 2;
+ curve = dojo.gfx.path._calcArc(alpha);
+ step = cw ? -alpha : alpha;
+ }
+ var c1, c2, e;
+ var M = m.normalize([elliptic_transform, m.rotate(startAngle + step)]);
+ if(cw){
+ c1 = m.multiplyPoint(M, curve.c2);
+ c2 = m.multiplyPoint(M, curve.c1);
+ e = m.multiplyPoint(M, curve.s );
+ }else{
+ c1 = m.multiplyPoint(M, curve.c1);
+ c2 = m.multiplyPoint(M, curve.c2);
+ e = m.multiplyPoint(M, curve.e );
+ }
+ // draw the curve
+ path.push(" c");
+ this._addArgs(path, [c1.x, c1.y, c2.x, c2.y, e.x, e.y]);
+ startAngle += 2 * step;
+ }
+ },
+ _arcTo: function(segment, last){
+ var p = [];
+ var n = segment.args;
+ var l = n.length;
+ var relative = segment.action == "a";
+ for(var i = 0; i < l; i += 7){
+ var x1 = n[i + 5];
+ var y1 = n[i + 6];
+ if(relative){
+ x1 += last.x;
+ y1 += last.y;
+ }
+ this._calcArcTo(
+ p, last, n[i], n[i + 1], n[i + 2],
+ n[i + 3] ? 1 : 0, n[i + 4] ? 1 : 0,
+ x1, y1
+ );
+ last = {x: x1, y: y1};
+ }
+ this.lastControl = {};
+ return p;
+ },
+ _closePath: function(){
+ this.lastControl = {};
+ return ["x"];
}
});
-dojo.gfx.Image.nodeType = "image";
+dojo.gfx.Path.nodeType = "shape";
+
dojo.gfx._creators = {
createRect: function(rect){
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_adobesvg.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_adobesvg.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_adobesvg.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_adobesvg.js Sat Oct 7 11:22:33 2006
@@ -191,7 +191,7 @@
var stack = this.loadUriStack;
stack.push([uri, cb, null]);
var tcb = function(contents){
- // gratuitous hack for Adobe SVG 3, what a fucking POS
+ // gratuitous hack for Adobe SVG 3
if(contents.content){
contents = contents.content;
}
@@ -252,7 +252,7 @@
var stack = this.loadUriStack;
stack.push([uri, cb, null]);
var tcb = function(contents){
- // gratuitous hack for Adobe SVG 3, what a fucking POS
+ // gratuitous hack for Adobe SVG 3
if(contents.content){
contents = contents.content;
}
@@ -448,7 +448,7 @@
setTimeout("dojo.hostenv.unWindGetTextStack()", 100);
return;
}
- // we serialize because this goddamned environment is too fucked up
+ // we serialize because this environment is too messed up
// to know how to do anything else
dojo.hostenv.inFlightCount++;
var next = dojo.hostenv.getTextStack.pop();
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_browser.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_browser.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_browser.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_browser.js Sat Oct 7 11:22:33 2006
@@ -370,7 +370,7 @@
if(dojo.evalObjPath("dojo.widget.Parse")){
// we must do this on a delay to avoid:
// http://www.shaftek.org/blog/archives/000212.html
- // IE is such a tremendous peice of shit.
+ // (IE bug)
var parser = new dojo.xml.Parse();
if(sids.length > 0){
for(var x=0; x<sids.length; x++){
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_rhino.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_rhino.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_rhino.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_rhino.js Sat Oct 7 11:22:33 2006
@@ -218,6 +218,10 @@
return document;
}
+dojo.body = function(){
+ return document.body;
+}
+
function setTimeout(func, delay){
// summary: provides timed callbacks using Java threads
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_svg.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_svg.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_svg.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/hostenv_svg.js Sat Oct 7 11:22:33 2006
@@ -86,7 +86,7 @@
dojo.hostenv.loadUriAndCheck = function(uri, module){ };
// aliased in loader.js, don't ignore
-// we are going to kill loadModule for the first round of SVG stuff, and include shit manually.
+// we are going to kill loadModule for the first round of SVG stuff, and include stuff manually.
dojo.hostenv.loadModule = function(moduleName){
// just like startPackage, but this time we're just checking to make sure it exists already.
var a = moduleName.split(".");
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/metrics.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/metrics.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/metrics.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/metrics.js Sat Oct 7 11:22:33 2006
@@ -254,4 +254,4 @@
// return the remainder.
return ret; // string
-};
+};
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/util.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/util.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/util.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/html/util.js Sat Oct 7 11:22:33 2006
@@ -327,18 +327,28 @@
corners = ['TL'];
}
- var bestx, besty, bestDistance = Infinity;
+ var bestx, besty, bestDistance = Infinity, bestCorner;
for(var cidex=0; cidex<corners.length; ++cidex){
var corner = corners[cidex];
var match = true;
- var tryX = desiredX - (corner.charAt(1)=='L' ? 0 : w) + padding[0]// (corner.charAt(1)=='L' ? 1 : -1);
- var tryY = desiredY - (corner.charAt(0)=='T' ? 0 : h) + padding[1]// (corner.charAt(0)=='T' ? 1 : -1);
+ var tryX = desiredX - (corner.charAt(1)=='L' ? 0 : w) + padding[0]*(corner.charAt(1)=='L' ? 1 : -1);
+ var tryY = desiredY - (corner.charAt(0)=='T' ? 0 : h) + padding[1]*(corner.charAt(0)=='T' ? 1 : -1);
if(hasScroll) {
tryX -= scroll.x;
tryY -= scroll.y;
}
-
+
+ if(tryX < 0){
+ tryX = 0;
+ match = false;
+ }
+
+ if(tryY < 0){
+ tryY = 0;
+ match = false;
+ }
+
var x = tryX + w;
if(x > view.width) {
x = view.width - w;
@@ -361,6 +371,7 @@
bestx = x;
besty = y;
bestDistance = 0;
+ bestCorner = corner;
break;
}else{
//not perfect, find out whether it is better than the saved one
@@ -369,6 +380,7 @@
bestDistance = dist;
bestx = x;
besty = y;
+ bestCorner = corner;
}
}
}
@@ -378,7 +390,7 @@
node.style.top = besty + "px";
}
- return { left: bestx, top: besty, x: bestx, y: besty, dist: bestDistance }; // object
+ return { left: bestx, top: besty, x: bestx, y: besty, dist: bestDistance, corner: bestCorner}; // object
}
dojo.html.placeOnScreenPoint = function(node, desiredX, desiredY, padding, hasScroll) {
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/i18n/common.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/i18n/common.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/i18n/common.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/i18n/common.js Sat Oct 7 11:22:33 2006
@@ -16,7 +16,8 @@
// in a package, matching the specified locale.
//
// description:
-// Returns a hash containing name/value pairs. Throws an exception if the bundle is not found.
+// Returns a hash containing name/value pairs in its prototypesuch that values can be easily overridden.
+// Throws an exception if the bundle is not found.
// Bundle must have already been loaded by dojo.requireLocalization() or by a build optimization step.
//
// packageName: package which is associated with this resource
@@ -32,14 +33,23 @@
var module = [packageName,"nls",bundleName].join('.');
var bundle = dojo.hostenv.findModule(module, true);
+ var localization;
for(var i = elements.length; i > 0; i--){
var loc = elements.slice(0, i).join('_');
if(bundle[loc]){
- return bundle[loc]; // Object
+ localization = bundle[loc];
+ break;
}
}
- if(bundle.ROOT){
- return bundle.ROOT; // Object
+ if(!localization){
+ localization = bundle.ROOT;
+ }
+
+ // make a singleton prototype so that the caller won't accidentally change the values globally
+ if(localization){
+ var clazz = function(){};
+ clazz.prototype = localization;
+ return new clazz(); // Object
}
dojo.raise("Bundle not found: " + bundleName + " in " + packageName+" , locale=" + locale);
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/BrowserIO.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/BrowserIO.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/BrowserIO.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/BrowserIO.js Sat Oct 7 11:22:33 2006
@@ -312,28 +312,37 @@
// and this results in another sync call before the first sync call ends the browser hangs
if(!dojo.hostenv._blockAsync && !_this._blockAsync){
for(var x=this.inFlight.length-1; x>=0; x--){
- var tif = this.inFlight[x];
- if(!tif || tif.http._aborted || !tif.http.readyState){
- this.inFlight.splice(x, 1); continue;
- }
- if(4==tif.http.readyState){
- // remove it so we can clean refs
- this.inFlight.splice(x, 1);
- doLoad(tif.req, tif.http, tif.url, tif.query, tif.useCache);
- }else if (tif.startTime){
- //See if this is a timeout case.
- if(!now){
- now = (new Date()).getTime();
+ try{
+ var tif = this.inFlight[x];
+ if(!tif || tif.http._aborted || !tif.http.readyState){
+ this.inFlight.splice(x, 1); continue;
}
- if(tif.startTime + (tif.req.timeoutSeconds * 1000) < now){
- //Stop the request.
- if(typeof tif.http.abort == "function"){
- tif.http.abort();
- }
-
+ if(4==tif.http.readyState){
// remove it so we can clean refs
this.inFlight.splice(x, 1);
- tif.req[(typeof tif.req.timeout == "function") ? "timeout" : "handle"]("timeout", null, tif.http, tif.req);
+ doLoad(tif.req, tif.http, tif.url, tif.query, tif.useCache);
+ }else if (tif.startTime){
+ //See if this is a timeout case.
+ if(!now){
+ now = (new Date()).getTime();
+ }
+ if(tif.startTime + (tif.req.timeoutSeconds * 1000) < now){
+ //Stop the request.
+ if(typeof tif.http.abort == "function"){
+ tif.http.abort();
+ }
+
+ // remove it so we can clean refs
+ this.inFlight.splice(x, 1);
+ tif.req[(typeof tif.req.timeout == "function") ? "timeout" : "handle"]("timeout", null, tif.http, tif.req);
+ }
+ }
+ }catch(e){
+ try{
+ var errObj = new dojo.io.Error("XMLHttpTransport.watchInFlight Error: " + e);
+ tif.req[(typeof tif.req.error == "function") ? "error" : "handle"]("error", errObj, tif.http, tif.req);
+ }catch(e2){
+ dojo.debug("XMLHttpTransport error callback failed: " + e2);
}
}
}
@@ -524,10 +533,10 @@
if(kwArgs.method.toLowerCase() == "post"){
// FIXME: need to hack in more flexible Content-Type setting here!
- if (!kwArgs.usr) {
+ if (!kwArgs.user) {
http.open("POST", url, async);
}else{
- http.open("POST", url, async, kwArgs.usr, kwArgs.passwd);
+ http.open("POST", url, async, kwArgs.user, kwArgs.password);
}
setHeaders(http, kwArgs);
http.setRequestHeader("Content-Type", kwArgs.multipart ? ("multipart/form-data; boundary=" + this.multipartBoundary) :
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/IframeIO.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/IframeIO.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/IframeIO.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/IframeIO.js Sat Oct 7 11:22:33 2006
@@ -64,55 +64,59 @@
this.iframeName = "dojoIoIframe";
this.fireNextRequest = function(){
- if((this.currentRequest)||(this.requestQueue.length == 0)){ return; }
- // dojo.debug("fireNextRequest");
- var cr = this.currentRequest = this.requestQueue.shift();
- cr._contentToClean = [];
- var fn = cr["formNode"];
- var content = cr["content"] || {};
- if(cr.sendTransport) {
- content["dojo.transport"] = "iframe";
- }
- if(fn){
- if(content){
- // if we have things in content, we need to add them to the form
- // before submission
- for(var x in content){
- if(!fn[x]){
- var tn;
- if(dojo.render.html.ie){
- tn = document.createElement("<input type='hidden' name='"+x+"' value='"+content[x]+"'>");
- fn.appendChild(tn);
+ try{
+ if((this.currentRequest)||(this.requestQueue.length == 0)){ return; }
+ // dojo.debug("fireNextRequest");
+ var cr = this.currentRequest = this.requestQueue.shift();
+ cr._contentToClean = [];
+ var fn = cr["formNode"];
+ var content = cr["content"] || {};
+ if(cr.sendTransport) {
+ content["dojo.transport"] = "iframe";
+ }
+ if(fn){
+ if(content){
+ // if we have things in content, we need to add them to the form
+ // before submission
+ for(var x in content){
+ if(!fn[x]){
+ var tn;
+ if(dojo.render.html.ie){
+ tn = document.createElement("<input type='hidden' name='"+x+"' value='"+content[x]+"'>");
+ fn.appendChild(tn);
+ }else{
+ tn = document.createElement("input");
+ fn.appendChild(tn);
+ tn.type = "hidden";
+ tn.name = x;
+ tn.value = content[x];
+ }
+ cr._contentToClean.push(x);
}else{
- tn = document.createElement("input");
- fn.appendChild(tn);
- tn.type = "hidden";
- tn.name = x;
- tn.value = content[x];
+ fn[x].value = content[x];
}
- cr._contentToClean.push(x);
- }else{
- fn[x].value = content[x];
}
}
+ if(cr["url"]){
+ cr._originalAction = fn.getAttribute("action");
+ fn.setAttribute("action", cr.url);
+ }
+ if(!fn.getAttribute("method")){
+ fn.setAttribute("method", (cr["method"]) ? cr["method"] : "post");
+ }
+ cr._originalTarget = fn.getAttribute("target");
+ fn.setAttribute("target", this.iframeName);
+ fn.target = this.iframeName;
+ fn.submit();
+ }else{
+ // otherwise we post a GET string by changing URL location for the
+ // iframe
+ var query = dojo.io.argsFromMap(this.currentRequest.content);
+ var tmpUrl = (cr.url.indexOf("?") > -1 ? "&" : "?") + query;
+ dojo.io.setIFrameSrc(this.iframe, tmpUrl, true);
}
- if(cr["url"]){
- cr._originalAction = fn.getAttribute("action");
- fn.setAttribute("action", cr.url);
- }
- if(!fn.getAttribute("method")){
- fn.setAttribute("method", (cr["method"]) ? cr["method"] : "post");
- }
- cr._originalTarget = fn.getAttribute("target");
- fn.setAttribute("target", this.iframeName);
- fn.target = this.iframeName;
- fn.submit();
- }else{
- // otherwise we post a GET string by changing URL location for the
- // iframe
- var query = dojo.io.argsFromMap(this.currentRequest.content);
- var tmpUrl = (cr.url.indexOf("?") > -1 ? "&" : "?") + query;
- dojo.io.setIFrameSrc(this.iframe, tmpUrl, true);
+ }catch(e){
+ this.iframeOnload(e);
}
}
@@ -148,7 +152,7 @@
this.iframe = dojo.io.createIFrame(this.iframeName, "dojo.io.IframeTransport.iframeOnload();");
}
- this.iframeOnload = function(){
+ this.iframeOnload = function(errorObject /* Object */){
if(!_this.currentRequest){
_this.fireNextRequest();
return;
@@ -198,33 +202,35 @@
return doc;
};
- var ifd = contentDoc(_this.iframe);
- // handle successful returns
- // FIXME: how do we determine success for iframes? Is there an equiv of
- // the "status" property?
var value;
var success = false;
- try{
- var cmt = req.mimetype;
- if((cmt == "text/javascript")||(cmt == "text/json")){
- // FIXME: not sure what to do here? try to pull some evalulable
- // text from a textarea or cdata section?
- // how should we set up the contract for that?
- var js = ifd.getElementsByTagName("textarea")[0].value;
- if(cmt == "text/json") { js = "(" + js + ")"; }
- value = dj_eval(js);
- }else if(cmt == "text/html"){
- value = ifd;
- }else{ // text/plain
- value = ifd.getElementsByTagName("textarea")[0].value;
- }
- success = true;
- }catch(e){
- // looks like we didn't get what we wanted!
- var errObj = new dojo.io.Error("IframeTransport Error");
- if(dojo.lang.isFunction(req["error"])){
- req.error("error", errObj, req);
+ if (errorObject){
+ this._callError(req, "IframeTransport Request Error: " + errorObject);
+ }else{
+ var ifd = contentDoc(_this.iframe);
+ // handle successful returns
+ // FIXME: how do we determine success for iframes? Is there an equiv of
+ // the "status" property?
+
+ try{
+ var cmt = req.mimetype;
+ if((cmt == "text/javascript")||(cmt == "text/json")){
+ // FIXME: not sure what to do here? try to pull some evalulable
+ // text from a textarea or cdata section?
+ // how should we set up the contract for that?
+ var js = ifd.getElementsByTagName("textarea")[0].value;
+ if(cmt == "text/json") { js = "(" + js + ")"; }
+ value = dj_eval(js);
+ }else if(cmt == "text/html"){
+ value = ifd;
+ }else{ // text/plain
+ value = ifd.getElementsByTagName("textarea")[0].value;
+ }
+ success = true;
+ }catch(e){
+ // looks like we didn't get what we wanted!
+ this._callError(req, "IframeTransport Error: " + e);
}
}
@@ -239,6 +245,13 @@
} finally {
_this.currentRequest = null;
_this.fireNextRequest();
+ }
+ }
+
+ this._callError = function(req /* Object */, message /* String */){
+ var errObj = new dojo.io.Error(message);
+ if(dojo.lang.isFunction(req["error"])){
+ req.error("error", errObj, req);
}
}
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/cometd.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/cometd.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/cometd.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/cometd.js Sat Oct 7 11:22:33 2006
@@ -46,7 +46,7 @@
this.minimumVersion = 0.1;
this.clientId = null;
- this.isXD = false;
+ this._isXD = false;
this.handshakeReturn = null;
this.currentTransport = null;
this.url = null;
@@ -114,7 +114,7 @@
dojo.debug(thisHost, urlHost);
dojo.debug(thisPort, urlPort);
- this.isXD = true;
+ this._isXD = true;
bindArgs.transport = "ScriptSrcTransport";
bindArgs.jsonParamName = "jsonp";
}
@@ -127,6 +127,7 @@
}
this.finishInit = function(type, data, evt, request){
+ data = data[0];
this.handshakeReturn = data;
// pick a transport
if(data["authSuccessful"] == false){
@@ -140,7 +141,7 @@
this.currentTransport = this.connectionTypes.match(
data.supportedConnectionTypes,
data.version,
- this.isXD
+ this._isXD
);
this.currentTransport.version = data.version;
this.clientId = data.clientId;
@@ -155,7 +156,7 @@
}
}
- this.getRandStr = function(){
+ this._getRandStr = function(){
return Math.random().toString().substring(2, 10);
}
@@ -581,7 +582,7 @@
// NOTE: we require the server to cooperate by hosting
// cometdInit.html at the designated endpoint
- this.rcvNodeName = "cometdRcv_"+cometd.getRandStr();
+ this.rcvNodeName = "cometdRcv_"+cometd._getRandStr();
// the "forever frame" approach
var initUrl = cometd.url+"/?tunnelInit=iframe"; // &domain="+document.domain;
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/common.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/common.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/common.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/io/common.js Sat Oct 7 11:22:33 2006
@@ -28,7 +28,7 @@
* server classes. Wish it were always this easy.
*
* xpcshell:
- * XPCOM for I/O. A cluster-fuck to be sure.
+ * XPCOM for I/O.
*
* spidermonkey:
* S.O.L.
@@ -195,10 +195,16 @@
var tsName = "";
if(request["transport"]){
tsName = request["transport"];
- // FIXME: it would be good to call the error handler, although we'd
- // need to use setTimeout or similar to accomplish this and we can't
- // garuntee that this facility is available.
- if(!this[tsName]){ return request; }
+ if(!this[tsName]){
+ dojo.io.sendBindError(request, "No dojo.io.bind() transport with name '"
+ + request["transport"] + "'.");
+ return request;
+ }
+ if(!this[tsName].canHandle(request)){
+ dojo.io.sendBindError(request, "dojo.io.bind() transport with name '"
+ + request["transport"] + "' cannot handle this type of request.");
+ return request;
+ }
}else{
// otherwise we do our best to auto-detect what available transports
// will handle
@@ -208,11 +214,28 @@
tsName = tmp;
}
}
- if(tsName == ""){ return request; }
+ if(tsName == ""){
+ dojo.io.sendBindError(request, "None of the loaded transports for dojo.io.bind()"
+ + " can handle the request.");
+ return request;
+ }
}
this[tsName].bind(request);
request.bindSuccess = true;
return request;
+}
+
+dojo.io.sendBindError = function(request /* Object */, message /* String */){
+ //Need to be careful since not all hostenvs support setTimeout.
+ if((typeof request.error == "function" || typeof request.handle == "function")
+ && (typeof setTimeout == "function" || typeof setTimeout == "object")){
+ var errorObject = new dojo.io.Error(message);
+ setTimeout(function(){
+ request[(typeof request.error == "function") ? "error" : "handle"]("error", errorObject, null, request);
+ }, 50);
+ }else{
+ dojo.raise(message);
+ }
}
dojo.io.queueBind = function(request){
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/json.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/json.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/json.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/json.js Sat Oct 7 11:22:33 2006
@@ -14,33 +14,53 @@
dojo.require("dojo.AdapterRegistry");
dojo.json = {
+ // AdapterRegistry:
+ // a registry of type-based serializers
jsonRegistry: new dojo.AdapterRegistry(),
- register: function(name, check, wrap, /*optional*/ override){
- /***
-
- Register a JSON serialization function. JSON serialization
- functions should take one argument and return an object
- suitable for JSON serialization:
-
- - string
- - number
- - boolean
- - undefined
- - object
- - null
- - Array-like (length property that is a number)
- - Objects with a "json" method will have this method called
- - Any other object will be used as {key:value, ...} pairs
-
- If override is given, it is used as the highest priority
- JSON serialization, otherwise it will be used as the lowest.
- ***/
+ register: function( /*String*/ name,
+ /*function*/ check,
+ /*function*/ wrap,
+ /*optional, boolean*/ override){
+ // summary:
+ // Register a JSON serialization function. JSON serialization
+ // functions should take one argument and return an object
+ // suitable for JSON serialization:
+ // - string
+ // - number
+ // - boolean
+ // - undefined
+ // - object
+ // - null
+ // - Array-like (length property that is a number)
+ // - Objects with a "json" method will have this method called
+ // - Any other object will be used as {key:value, ...} pairs
+ //
+ // If override is given, it is used as the highest priority JSON
+ // serialization, otherwise it will be used as the lowest.
+ // name:
+ // a descriptive type for this serializer
+ // check:
+ // a unary function that will be passed an object to determine
+ // whether or not wrap will be used to serialize the object
+ // wrap:
+ // the serialization function
+ // override:
+ // optional, determines if the this serialization function will be
+ // given priority in the test order
dojo.json.jsonRegistry.register(name, check, wrap, override);
},
- evalJson: function(/* jsonString */ json){
+ evalJson: function(/*String*/ json){
+ // summary:
+ // evaluates the passed string-form of a JSON object
+ // json:
+ // a string literal of a JSON item, for instance:
+ // '{ "foo": [ "bar", 1, { "baz": "thud" } ] }'
+ // return:
+ // the result of the evaluation
+
// FIXME: should this accept mozilla's optional second arg?
try {
return eval("(" + json + ")");
@@ -50,11 +70,18 @@
}
},
- serialize: function(o){
- /***
- Create a JSON serialization of an object, note that this doesn't
- check for infinite recursion, so don't do that!
- ***/
+ serialize: function(/*Object*/ o){
+ // summary:
+ // Create a JSON serialization of an object, note that this
+ // doesn't check for infinite recursion, so don't do that!
+ // o:
+ // an object to be serialized. Objects may define their own
+ // serialization via a special "__json__" or "json" function
+ // property. If a specialized serializer has been defined, it will
+ // be used as a fallback.
+ // return:
+ // a String representing the serialized version of the passed
+ // object
var objtype = typeof(o);
if(objtype == "undefined"){
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/html.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/html.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/html.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/html.js Sat Oct 7 11:22:33 2006
@@ -340,7 +340,7 @@
with(node.style){
overflow = oprop.overflow;
visibility = "hidden";
- height = "";
+ height = "1px"; // 0 cause IE to display the whole panel
}
if(callback){ callback(node, anim); }
}
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/rounded.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/rounded.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/rounded.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/rounded.js Sat Oct 7 11:22:33 2006
@@ -506,4 +506,4 @@
}
return ret;
}
-};
+};
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/shadow.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/shadow.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/shadow.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/lfx/shadow.js Sat Oct 7 11:22:33 2006
@@ -77,3 +77,4 @@
}
}
});
+
Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/logging/ConsoleLogger.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/logging/ConsoleLogger.js?view=auto&rev=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/logging/ConsoleLogger.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/logging/ConsoleLogger.js Sat Oct 7 11:22:33 2006
@@ -0,0 +1,108 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.logging.ConsoleLogger");
+dojo.require("dojo.logging.Logger");
+
+dojo.lang.extend(dojo.logging.MemoryLogHandler,{
+
+ debug:function(){
+ dojo.hostenv.println.apply(this,arguments);
+ },
+ info:function(){
+ dojo.hostenv.println.apply(this,arguments);
+ },
+ warn:function(){
+ dojo.hostenv.println.apply(this,arguments);
+ },
+ error:function(){
+ dojo.hostenv.println.apply(this,arguments);
+ },
+ critical:function(){
+ dojo.hostenv.println.apply(this,arguments);
+ },
+
+ emit:function(record){
+ if (!djConfig.isDebug) { return; }
+
+ var funcName=null;
+ switch(record.level){
+ case 1:
+ funcName="debug";
+ break;
+ case 2:
+ funcName="info";
+ break;
+ case 3:
+ funcName="warn";
+ break;
+ case 4:
+ funcName="error";
+ break;
+ case 5:
+ funcName="critical";
+ break;
+ default:
+ funcName="debug";
+ }
+
+ var logStr = String(dojo.log.getLevelName(record.level)+": "
+ +record.time.toLocaleTimeString())+": "+record.message;
+ if(record.msgArgs && record.msgArgs.length > 0){
+ this[funcName].call(this, logStr, record.msgArgs);
+ } else {
+ this[funcName].call(this, logStr);
+ }
+
+ this.data.push(record);
+ if(this.numRecords != -1){
+ while(this.data.length>this.numRecords){
+ this.data.shift();
+ }
+ }
+ }
+});
+
+if(!dj_undef("console") && !dj_undef("info", console)){
+dojo.lang.extend(dojo.logging.MemoryLogHandler,{
+ debug:function(){
+ console.debug.apply(this, arguments);
+ },
+ info:function(){
+ console.info.apply(this, arguments);
+ },
+ warn:function(){
+ console.warn.apply(this, arguments);
+ },
+ error:function(){
+ console.error.apply(this, arguments);
+ },
+ critical:function(){
+ console.error.apply(this, arguments);
+ }
+});
+
+dojo.lang.extend(dojo.logging.Logger,{
+ exception: function(msg, e, squelch){
+ var args=[msg];
+
+ if(e){
+ msg+=" : "+ e.name + " " + (e.description||e.message);
+ args.push(e);
+ }
+
+ this.logType("ERROR", args);
+ if(!squelch){
+ throw e;
+ }
+ }
+});
+
+}
Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/logging/ConsoleLogger.js
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/logging/Logger.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/logging/Logger.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/logging/Logger.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/logging/Logger.js Sat Oct 7 11:22:33 2006
@@ -64,8 +64,18 @@
dojo.logging.Record = function(lvl, msg){
this.level = lvl;
- this.message = msg;
+ this.message = "";
+ this.msgArgs = [];
this.time = new Date();
+
+ if(dojo.lang.isArray(msg)){
+ if(msg.length > 0 && dojo.lang.isString(msg[0])){
+ this.message=msg.shift();
+ }
+ this.msgArgs=msg;
+ }else{
+ this.message=msg;
+ }
// FIXME: what other information can we receive/discover here?
}
@@ -89,7 +99,7 @@
this.handlers = [];
}
-dojo.extend(dojo.logging.Logger, {
+dojo.extend(dojo.logging.Logger,{
argsToArr: function(args){
// utility function, reproduced from __util__ here to remove dependency
var ret = [];
@@ -235,21 +245,21 @@
},
logType: function(type, args){
- if (!dojo.lang.isArray(args)){
- args = this.argsToArr(args);
- }
return this.log.apply(this, [dojo.logging.log.getLevel(type),
- args.join('')]);
+ args]);
+ },
+
+ warn:function(){
+ this.warning.apply(this,arguments);
+ },
+ err:function(){
+ this.error.apply(this,arguments);
+ },
+ crit:function(){
+ this.critical.apply(this,arguments);
}
});
-void(function(){
- var ptype = dojo.logging.Logger.prototype;
- ptype.warn = ptype.warning;
- ptype.err = ptype.error;
- ptype.crit = ptype.critical;
-})();
-
// the Handler class
dojo.logging.LogHandler = function(level){
this.cutOffLevel = (level) ? level : 0;
@@ -257,35 +267,26 @@
this.data = [];
this.filters = [];
}
-
-dojo.logging.LogHandler.prototype.setFormatter = function(fmtr){
- // FIXME: need to vet that it is indeed a formatter object
- dojo.unimplemented("setFormatter");
-}
-
-dojo.logging.LogHandler.prototype.flush = function(){
- dojo.unimplemented("flush");
-}
-
-dojo.logging.LogHandler.prototype.close = function(){
- dojo.unimplemented("close");
-}
-
-dojo.logging.LogHandler.prototype.handleError = function(){
- dojo.unimplemented("handleError");
-}
-
-dojo.logging.LogHandler.prototype.handle = function(record){
- // emits the passed record if it passes this object's filters
- if((this.filter(record))&&(record.level>=this.cutOffLevel)){
- this.emit(record);
+dojo.lang.extend(dojo.logging.LogHandler,{
+
+ setFormatter:function(formatter){
+ dojo.unimplemented("setFormatter");
+ },
+
+ flush:function(){},
+ close:function(){},
+ handleError:function(){},
+
+ handle:function(record){
+ if((this.filter(record))&&(record.level>=this.cutOffLevel)){
+ this.emit(record);
+ }
+ },
+
+ emit:function(record){
+ dojo.unimplemented("emit");
}
-}
-
-dojo.logging.LogHandler.prototype.emit = function(record){
- // do whatever is necessaray to actually log the record
- dojo.unimplemented("emit");
-}
+});
// set aliases since we don't want to inherit from dojo.logging.Logger
void(function(){ // begin globals protection closure
@@ -358,40 +359,30 @@
this.postType = (typeof djConfig['loggingPostType'] != 'undefined') ? djConfig['loggingPostType'] : ( postType || -1);
// milliseconds for time, interger for number of records, -1 for non-posting,
this.postInterval = (typeof djConfig['loggingPostInterval'] != 'undefined') ? djConfig['loggingPostInterval'] : ( postType || -1);
-
}
-// prototype inheritance
-dojo.logging.MemoryLogHandler.prototype = new dojo.logging.LogHandler();
-// FIXME
-// dojo.inherits(dojo.logging.MemoryLogHandler,
-
-// over-ride base-class
-dojo.logging.MemoryLogHandler.prototype.emit = function(record){
- this.data.push(record);
- if(this.numRecords != -1){
- while(this.data.length>this.numRecords){
- this.data.shift();
+dojo.lang.inherits(dojo.logging.MemoryLogHandler, dojo.logging.LogHandler);
+dojo.lang.extend(dojo.logging.MemoryLogHandler,{
+
+ emit:function(record){
+ if (!djConfig.isDebug) { return; }
+
+ var logStr = String(dojo.log.getLevelName(record.level)+": "
+ +record.time.toLocaleTimeString())+": "+record.message;
+ if(!dj_undef("println", dojo.hostenv)){
+ dojo.hostenv.println(logStr);
+ }
+
+ this.data.push(record);
+ if(this.numRecords != -1){
+ while(this.data.length>this.numRecords){
+ this.data.shift();
+ }
}
}
-}
+});
dojo.logging.logQueueHandler = new dojo.logging.MemoryLogHandler(0,50,0,10000);
-// actual logging event handler
-dojo.logging.logQueueHandler.emit = function(record){
- if (!djConfig.isDebug) { return; }
- // we should probably abstract this in the future
- var logStr = String(dojo.log.getLevelName(record.level)+": "+record.time.toLocaleTimeString())+": "+record.message;
- if(!dj_undef("println", dojo.hostenv)){
- dojo.hostenv.println(logStr);
- }
- this.data.push(record);
- if(this.numRecords != -1){
- while(this.data.length>this.numRecords){
- this.data.shift();
- }
- }
-}
dojo.logging.log.addHandler(dojo.logging.logQueueHandler);
dojo.log = dojo.logging.log;
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/namespaces/dojo.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/namespaces/dojo.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/namespaces/dojo.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/namespaces/dojo.js Sat Oct 7 11:22:33 2006
@@ -21,8 +21,6 @@
var map = {
html: {
"accordioncontainer": "dojo.widget.AccordionContainer",
- "treerpccontroller": "dojo.widget.TreeRPCController",
- "accordionpane": "dojo.widget.AccordionPane",
"button": "dojo.widget.Button",
"chart": "dojo.widget.Chart",
"checkbox": "dojo.widget.Checkbox",
@@ -40,8 +38,8 @@
"dropdownbutton": "dojo.widget.Button",
"dropdowndatepicker": "dojo.widget.DropdownDatePicker",
"dropdowntimepicker": "dojo.widget.DropdownTimePicker",
- "emaillisttextbox": "dojo.widget.validate.EmailListTextbox",
- "emailtextbox": "dojo.widget.validate.EmailTextbox",
+ "emaillisttextbox": "dojo.widget.validate.InternetTextbox",
+ "emailtextbox": "dojo.widget.validate.InternetTextbox",
"editor2": "dojo.widget.Editor2",
"editor2toolbar": "dojo.widget.Editor2Toolbar",
"editor": "dojo.widget.Editor",
@@ -57,8 +55,9 @@
"formcontainer": "dojo.widget.FormContainer",
"hslcolorpicker": "dojo.widget.HslColorPicker",
"inlineeditbox": "dojo.widget.InlineEditBox",
+ "integerspinner": "dojo.widget.IntegerSpinner",
"integertextbox": "dojo.widget.validate.IntegerTextbox",
- "ipaddresstextbox": "dojo.widget.validate.IpAddressTextbox",
+ "ipaddresstextbox": "dojo.widget.validate.InternetTextbox",
"layoutcontainer": "dojo.widget.LayoutContainer",
"linkpane": "dojo.widget.LinkPane",
"pagecontainer": "dojo.widget.PageContainer",
@@ -88,7 +87,7 @@
"taskbar": "dojo.widget.TaskBar",
"textbox": "dojo.widget.validate.Textbox",
"timepicker": "dojo.widget.TimePicker",
- "timetextbox": "dojo.widget.validate.TimeTextbox",
+ "timetextbox": "dojo.widget.validate.DateTextbox",
"titlepane": "dojo.widget.TitlePane",
"toaster": "dojo.widget.Toaster",
"toggler": "dojo.widget.Toggler",
@@ -100,7 +99,7 @@
"treeselector": "dojo.widget.TreeSelector",
"treecontrollerextension": "dojo.widget.TreeControllerExtension",
"treenode": "dojo.widget.TreeNode",
-
+ "treerpccontroller": "dojo.widget.TreeRPCController",
"treebasiccontrollerv3": "dojo.widget.TreeBasicControllerV3",
"treecontextmenuv3": "dojo.widget.TreeContextMenuV3",
"treedeselectondblselect": "dojo.widget.TreeDeselectOnDblselect",
@@ -111,16 +110,15 @@
"treeemphaseonselect": "dojo.widget.TreeEmphaseOnSelect",
"treelinkextension": "dojo.widget.TreeLinkExtension",
"treeloadingcontrollerv3": "dojo.widget.TreeLoadingControllerV3",
- "treemenuitemv3": "dojo.widget.TreeMenuItemV3",
+ "treemenuitemv3": "dojo.widget.TreeContextMenuV3",
"treerpccontrollerv3": "dojo.widget.TreeRpcControllerV3",
"treeselectorv3": "dojo.widget.TreeSelectorV3",
"treev3": "dojo.widget.TreeV3",
-
- "urltextbox": "dojo.widget.validate.UrlTextbox",
- "usphonenumbertextbox": "dojo.widget.validate.UsPhoneNumberTextbox",
- "ussocialsecuritynumbertextbox": "dojo.widget.validate.UsSocialSecurityNumberTextbox",
- "usstatetextbox": "dojo.widget.validate.UsStateTextbox",
- "usziptextbox": "dojo.widget.validate.UsZipTextbox",
+ "urltextbox": "dojo.widget.validate.InternetTextbox",
+ "usphonenumbertextbox": "dojo.widget.validate.UsTextbox",
+ "ussocialsecuritynumbertextbox": "dojo.widget.validate.UsTextbox",
+ "usstatetextbox": "dojo.widget.validate.UsTextbox",
+ "usziptextbox": "dojo.widget.validate.UsTextbox",
"validationtextbox": "dojo.widget.validate.ValidationTextbox",
"treeloadingcontroller": "dojo.widget.TreeLoadingController",
"widget": "dojo.widget.Widget",
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/profile.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/profile.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/profile.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/profile.js Sat Oct 7 11:22:33 2006
@@ -11,29 +11,27 @@
dojo.provide("dojo.profile");
-
-
-dojo.profile = new function(){
- var profiles = {};
- var pns = [];
-
- this.start = function(name){
- if(!profiles[name]){
- profiles[name] = {iters: 0, total: 0};
- pns[pns.length] = name;
+dojo.profile = {
+ _profiles: {},
+ _pns: [],
+
+ start:function(/*String*/ name){
+ if(!this._profiles[name]){
+ this._profiles[name] = {iters: 0, total: 0};
+ this._pns[this._pns.length] = name;
}else{
- if(profiles[name]["start"]){
+ if(this._profiles[name]["start"]){
this.end(name);
}
}
- profiles[name].end = null;
- profiles[name].start = new Date();
- }
+ this._profiles[name].end = null;
+ this._profiles[name].start = new Date();
+ },
- this.end = function(name){
+ end:function(/*String*/ name){
var ed = new Date();
- if((profiles[name])&&(profiles[name]["start"])){
- with(profiles[name]){
+ if((this._profiles[name])&&(this._profiles[name]["start"])){
+ with(this._profiles[name]){
end = ed;
total += (end - start);
start = null;
@@ -43,11 +41,9 @@
// oops! bad call to end(), what should we do here?
return true;
}
- }
-
- this.stop = this.end;
+ },
- this.dump = function(appendToDoc){
+ dump:function(/*boolean*/ appendToDoc){
var tbl = document.createElement("table");
with(tbl.style){
border = "1px solid black";
@@ -71,12 +67,12 @@
ntd.appendChild(document.createTextNode(cols[x]));
}
- for(var x=0; x < pns.length; x++){
- var prf = profiles[pns[x]];
- this.end(pns[x]);
+ for(var x=0; x < this._pns.length; x++){
+ var prf = this._profiles[this._pns[x]];
+ this.end(this._pns[x]);
if(prf.iters>0){
var bdytr = tbl.insertRow(true);
- var vals = [pns[x], prf.iters, prf.total, parseInt(prf.total/prf.iters)];
+ var vals = [this._pns[x], prf.iters, prf.total, parseInt(prf.total/prf.iters)];
for(var y=0; y<vals.length; y++){
var cc = bdytr.insertCell(y);
cc.appendChild(document.createTextNode(vals[y]));
@@ -118,3 +114,5 @@
return tbl;
}
}
+
+dojo.profile.stop = dojo.profile.end;
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/regexp.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/regexp.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/regexp.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/regexp.js Sat Oct 7 11:22:33 2006
@@ -472,6 +472,8 @@
// flags.amSymbol The symbol used for AM. Default is "AM".
// flags.pmSymbol The symbol used for PM. Default is "PM".
+ dojo.deprecated("dojo.regexp.time", "Use dojo.date.parse instead", "0.5");
+
// assign default values to missing paramters
flags = (typeof flags == "object") ? flags : {};
if(typeof flags.format == "undefined"){ flags.format = "h:mm:ss t"; }
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/svg.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/svg.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/svg.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/svg.js Sat Oct 7 11:22:33 2006
@@ -14,7 +14,7 @@
dojo.mixin(dojo.svg, dojo.dom);
-dojo.svg.graphics=dojo.svg.g=new function(/* DomDocument */ d){
+dojo.svg.graphics=dojo.svg.g=new function(/* DOMDocument */ d){
// summary
// Singleton to encapsulate SVG rendering functions.
this.suspend=function(){
@@ -109,27 +109,35 @@
// TODO ////////////////////////////////////////////////////////// TODO
dojo.svg.getCoords=function(/* SVGElement */ node){
+ // summary
+ // Returns the x/y coordinates of the passed node, if available.
if (node.getBBox) {
var box=node.getBBox();
- return { x: box.x, y: box.y };
+ return { x: box.x, y: box.y }; // object
}
- return null;
+ return null; // object
};
-dojo.svg.setCoords=function(node, coords){
+dojo.svg.setCoords=function(/* SVGElement */node, /* object */coords){
+ // summary
+ // Set the x/y coordinates of the passed node
var p=dojo.svg.getCoords();
if (!p) return;
var dx=p.x - coords.x;
var dy=p.y - coords.y;
dojo.svg.translate(node, dx, dy);
};
-dojo.svg.getDimensions=function(node){
+dojo.svg.getDimensions=function(/* SVGElement */node){
+ // summary
+ // Get the height and width of the passed node.
if (node.getBBox){
var box=node.getBBox();
- return { width: box.width, height : box.height };
+ return { width: box.width, height : box.height }; // object
}
- return null;
+ return null; // object
};
-dojo.svg.setDimensions=function(node, dim){
+dojo.svg.setDimensions=function(/* SVGElement */node, /* object */dim){
+ // summary
+ // Set the dimensions of the passed element if possible.
// will only support shape-based and container elements; path-based elements are ignored.
if (node.width){
node.width.baseVal.value=dim.width;
@@ -147,14 +155,18 @@
/**
* Transformations.
*/
-dojo.svg.translate=function(node, dx, dy){
+dojo.svg.translate=function(/* SVGElement */node, /* int */dx, /* int */dy){
+ // summary
+ // Translates the passed node by dx and dy
if (node.transform && node.ownerSVGElement && node.ownerSVGElement.createSVGTransform){
var t=node.ownerSVGElement.createSVGTransform();
t.setTranslate(dx, dy);
node.transform.baseVal.appendItem(t);
}
};
-dojo.svg.scale=function(node, scaleX, scaleY){
+dojo.svg.scale=function(/* SVGElement */node, /* float */scaleX, /* float? */scaleY){
+ // summary
+ // Scales the passed element by factor scaleX and scaleY. If scaleY not passed, scaleX is used.
if (!scaleY) var scaleY=scaleX;
if (node.transform && node.ownerSVGElement && node.ownerSVGElement.createSVGTransform){
var t=node.ownerSVGElement.createSVGTransform();
@@ -162,15 +174,19 @@
node.transform.baseVal.appendItem(t);
}
};
-dojo.svg.rotate=function(node, ang, cx, cy){
+dojo.svg.rotate=function(/* SVGElement */node, /* float */ang, /* int? */cx, /* int? */cy){
+ // summary
+ // rotate the passed node by ang, with optional cx/cy as the rotation point.
if (node.transform && node.ownerSVGElement && node.ownerSVGElement.createSVGTransform){
var t=node.ownerSVGElement.createSVGTransform();
- if (!cx) t.setMatrix(t.matrix.rotate(ang));
+ if (cx == null) t.setMatrix(t.matrix.rotate(ang));
else t.setRotate(ang, cx, cy);
node.transform.baseVal.appendItem(t);
}
};
-dojo.svg.skew=function(node, ang, axis){
+dojo.svg.skew=function(/* SVGElement */node, /* float */ang, /* string? */axis){
+ // summary
+ // skew the passed node by ang over axis.
var dir=axis || "x";
if (node.transform && node.ownerSVGElement && node.ownerSVGElement.createSVGTransform){
var t=node.ownerSVGElement.createSVGTransform();
@@ -179,7 +195,9 @@
node.transform.baseVal.appendItem(t);
}
};
-dojo.svg.flip=function(node, axis){
+dojo.svg.flip=function(/* SVGElement */node, /* string? */axis){
+ // summary
+ // flip the passed element over axis
var dir=axis || "x";
if (node.transform && node.ownerSVGElement && node.ownerSVGElement.createSVGTransform){
var t=node.ownerSVGElement.createSVGTransform();
@@ -187,14 +205,26 @@
node.transform.baseVal.appendItem(t);
}
};
-dojo.svg.invert=function(node){
+dojo.svg.invert=function(/* SVGElement */node){
+ // summary
+ // transform the passed node by the inverse of the current matrix
if (node.transform && node.ownerSVGElement && node.ownerSVGElement.createSVGTransform){
var t=node.ownerSVGElement.createSVGTransform();
t.setMatrix(t.matrix.inverse());
node.transform.baseVal.appendItem(t);
}
};
-dojo.svg.applyMatrix=function(node, a, b, c, d, e, f){
+dojo.svg.applyMatrix=function(
+ /* SVGElement */node,
+ /* int || SVGMatrix */a,
+ /* int? */b,
+ /* int? */c,
+ /* int? */d,
+ /* int? */e,
+ /* int? */f
+){
+ // summary
+ // apply the passed matrix to node. If params b - f are passed, a matrix will be created.
if (node.transform && node.ownerSVGElement && node.ownerSVGElement.createSVGTransform){
var m;
if (b){
@@ -215,7 +245,8 @@
/**
* Grouping and z-index operations.
*/
-dojo.svg.group=function(nodes){
+dojo.svg.group=function(/* Nodelist || array */nodes){
+ // summary
// expect an array of nodes, attaches the group to the parent of the first node.
var p=nodes.item(0).parentNode;
var g=document.createElementNS(this.xmlns.svg, "g");
@@ -223,14 +254,16 @@
p.appendChild(g);
return g;
};
-dojo.svg.ungroup=function(g){
+dojo.svg.ungroup=function(/* SVGGElement */g){
+ // summary
// puts the children of the group on the same level as group was.
var p=g.parentNode;
while (g.childNodes.length > 0) p.appendChild(g.childNodes.item(0));
p.removeChild(g);
};
// if the node is part of a group, return the group, else return null.
-dojo.svg.getGroup=function(node){
+dojo.svg.getGroup=function(/* SVGElement */node){
+ // summary
// if the node is part of a group, return the group, else return null.
var a=this.getAncestors(node);
for (var i=0; i < a.length; i++){
@@ -239,23 +272,31 @@
}
return null;
};
-dojo.svg.bringToFront=function(node){
+dojo.svg.bringToFront=function(/* SVGElement */node){
+ // summary
+ // move the passed node the to top of the group (i.e. last child)
var n=this.getGroup(node) || node;
n.ownerSVGElement.appendChild(n);
};
-dojo.svg.sendToBack=function(node){
+dojo.svg.sendToBack=function(/* SVGElement */node){
+ // summary
+ // move the passed node to the bottom of the group (i.e. first child)
var n=this.getGroup(node) || node;
n.ownerSVGElement.insertBefore(n, n.ownerSVGElement.firstChild);
};
// TODO: possibly push node up a level in the DOM if it's at the beginning or end of the childNodes list.
-dojo.svg.bringForward=function(node){
+dojo.svg.bringForward=function(/* SVGElement */node){
+ // summary
+ // move the passed node up one in the child node chain
var n=this.getGroup(node) || node;
if (this.getLastChildElement(n.parentNode) != n){
this.insertAfter(n, this.getNextSiblingElement(n), true);
}
};
-dojo.svg.sendBackward=function(node){
+dojo.svg.sendBackward=function(/* SVGElement */node){
+ // summary
+ // move the passed node down one in the child node chain
var n=this.getGroup(node) || node;
if (this.getFirstChildElement(n.parentNode) != n){
this.insertBefore(n, this.getPreviousSiblingElement(n), true);
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/validate/check.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/validate/check.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/validate/check.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/validate/check.js Sat Oct 7 11:22:33 2006
@@ -97,7 +97,9 @@
missing[missing.length] = elem.name;
}
// Does drop-down box have option selected.
- else if ( (elem.type == "select-one" || elem.type == "select-multiple") && elem.selectedIndex == -1 ) {
+ else if ( (elem.type == "select-one" || elem.type == "select-multiple")
+ && (elem.selectedIndex == -1
+ || /^\s*$/.test(elem.options[elem.selectedIndex].value)) ) {
missing[missing.length] = elem.name;
}
// Does radio button group (or check box group) have option checked.
@@ -136,7 +138,7 @@
else if ( elem.type == "select-multiple" ) {
var selected = 0;
for (var j = 0; j < elem.options.length; j++) {
- if (elem.options[j].selected) { selected++; }
+ if (elem.options[j].selected && !/^\s*$/.test(elem.options[j].value)) { selected++; }
}
if ( selected < numRequired ) {
missing[missing.length] = elem.name;
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/validate/datetime.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/validate/datetime.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/validate/datetime.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/validate/datetime.js Sat Oct 7 11:22:33 2006
@@ -38,6 +38,7 @@
@return true or false
*/
dojo.validate.isValidTime = function(value, flags) {
+ dojo.deprecated("dojo.validate.datetime", "use dojo.date.parse instead", "0.5");
var re = new RegExp("^" + dojo.regexp.time(flags) + "$", "i");
return re.test(value);
}
@@ -51,6 +52,7 @@
@return true or false
*/
dojo.validate.is12HourTime = function(value) {
+ dojo.deprecated("dojo.validate.datetime", "use dojo.date.parse instead", "0.5");
return dojo.validate.isValidTime(value, {format: ["h:mm:ss t", "h:mm t"]});
}
@@ -63,6 +65,7 @@
@return true or false
*/
dojo.validate.is24HourTime = function(value) {
+ dojo.deprecated("dojo.validate.datetime", "use dojo.date.parse instead", "0.5");
return dojo.validate.isValidTime(value, {format: ["HH:mm:ss", "HH:mm"]} );
}
@@ -95,6 +98,7 @@
19.10.2005 D.M.YYYY
*/
dojo.validate.isValidDate = function(dateValue, format) {
+ dojo.deprecated("dojo.validate.datetime", "use dojo.date.parse instead", "0.5");
// Default is the American format
if (typeof format == "object" && typeof format.format == "string"){ format = format.format; }
if (typeof format != "string") { format = "MM/DD/YYYY"; }
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/widget/AccordionContainer.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/widget/AccordionContainer.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/widget/AccordionContainer.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/widget/AccordionContainer.js Sat Oct 7 11:22:33 2006
@@ -8,26 +8,39 @@
http://dojotoolkit.org/community/licensing.shtml
*/
+dojo.provide("dojo.widget.AccordionContainer");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.html.*");
+dojo.require("dojo.lfx.html");
+dojo.require("dojo.html.selection");
+dojo.require("dojo.widget.html.layout");
+dojo.require("dojo.widget.PageContainer");
+
+
/**
- * Holds a set of panes where every pane's title is visible, but only one pane's content is visible at a time.
+ *summary
+ * Holds a set of panes where every pane's title is visible, but only one pane's content is visible at a time,
+ * and switching between panes is visualized by sliding the other panes up/down.
*
- * Front view (3 panes, pane #2 open)
- * ------------------------
- * |:::Pane#1 title::: |
- * |:::Pane#2 title::: |
- * | |
- * | pane#2 contents |
- * | |
- * |:::Pane#3 title::: |
- * ------------------------
+ * description
+ * Front view (3 panes, pane #2 open)
+ * ------------------------
+ * |:::Pane#1 title::: |
+ * |:::Pane#2 title::: |
+ * | |
+ * | pane#2 contents |
+ * | |
+ * |:::Pane#3 title::: |
+ * ------------------------
*
- * Side view (showing implementation):
+ * Side view (showing implementation):
*
* viewport pane#3 pane#2 pane#1
* =
* | =
* | = |
- * front | | |
+ * front | | |
* | | =
* | =
* | =
@@ -35,25 +48,31 @@
* |
* =
*
- * Panes are stacked by z-index like a stack of cards, so they can be slid correctly.
- * The panes on the bottom extend past the bottom of the viewport.
+ * Panes are stacked by z-index like a stack of cards, so they can be slid correctly.
+ * The panes on the bottom extend past the bottom of the viewport (but are hidden).
+ *
+ * usage
+ * <div dojoType="AccordionContainer">
+ * <div dojoType="ContentPane" label="pane 1">...</div>
+ * ...
+ * </div>
*
- * TODO: this class should extend PageContainer
+ * TODO:
+ * * this widget should extend PageContainer
+ * * call child.onShow(), child.onHide() so you can attach to those methods if you want
*/
-
-dojo.provide("dojo.widget.AccordionContainer");
-
-dojo.require("dojo.widget.*");
-dojo.require("dojo.html.*");
-dojo.require("dojo.lfx.html");
-dojo.require("dojo.widget.AccordionPane");
-
-dojo.widget.defineWidget(
+ dojo.widget.defineWidget(
"dojo.widget.AccordionContainer",
dojo.widget.HtmlWidget,
{
isContainer: true,
+
+ // String
+ // CSS class name for dom node w/the title
labelNodeClass: "label",
+
+ // String
+ // CSS class name for dom node holding the content
containerNodeClass: "accBody",
// Integer
@@ -70,27 +89,32 @@
}
},
- addChild: function(widget, overrideContainerNode, pos, ref, insertIndex){
+ addChild: function(/*Widget*/ widget){
var child = this._addChild(widget);
this._setSizes();
- return child;
+ return child; // Widget
},
_addChild: function(/*Widget*/ widget){
// summary
// Internal call to add child, used during postCreate() and by the real addChild() call
+ if(widget.open){
+ dojo.deprecated("open parameter deprecated, use 'selected=true' instead will be removed in ", "0.5");
+ dojo.debug(widget.widgetId + ": open == " + widget.open);
+ widget.selected=true;
+ }
if (widget.widgetType != "AccordionPane") {
- var wrapper=dojo.widget.createWidget("AccordionPane",{label: widget.label, open: widget.open, labelNodeClass: this.labelNodeClass, containerNodeClass: this.containerNodeClass, allowCollapse: this.allowCollapse });
+ var wrapper=dojo.widget.createWidget("AccordionPane",{label: widget.label, selected: widget.selected, labelNodeClass: this.labelNodeClass, containerNodeClass: this.containerNodeClass, allowCollapse: this.allowCollapse });
wrapper.addChild(widget);
this.addWidgetAsDirectChild(wrapper);
this.registerChild(wrapper, this.children.length);
- return wrapper;
+ return wrapper; // Widget
} else {
dojo.html.addClass(widget.containerNode, this.containerNodeClass);
dojo.html.addClass(widget.labelNode, this.labelNodeClass);
this.addWidgetAsDirectChild(widget);
this.registerChild(widget, this.children.length);
- return widget;
+ return widget; // Widget
}
},
@@ -102,7 +126,7 @@
this._setSizes();
},
- removeChild: function(widget) {
+ removeChild: function(/*Widget*/ widget) {
dojo.widget.AccordionContainer.superclass.removeChild.call(this, widget);
this._setSizes();
},
@@ -113,19 +137,18 @@
_setSizes: function() {
// summary
- // Move panes to right position based on current open node.
- // Set "slide" to false for initial widget creation, or true when changing the open pane
- var mySize=dojo.html.getContentBox(this.domNode);
+ // Set panes' size/position based on my size, and the current open node.
// get cumulative height of all the title bars, and figure out which pane is open
var totalCollapsedHeight = 0;
var openIdx = 0;
dojo.lang.forEach(this.children, function(child, idx){
totalCollapsedHeight += child.getLabelHeight();
- if(child.open){ openIdx=idx; }
+ if(child.selected){ openIdx=idx; }
});
// size and position each pane
+ var mySize=dojo.html.getContentBox(this.domNode);
var y = 0;
dojo.lang.forEach(this.children, function(child, idx){
var childCollapsedHeight = child.getLabelHeight();
@@ -137,7 +160,7 @@
});
},
- selectPage: function(/*Widget*/ page){
+ selectChild: function(/*Widget*/ page){
// summary
// close the current page and select a new one
dojo.lang.forEach(this.children, function(child){child.setSelected(child==page);});
@@ -149,17 +172,108 @@
if(child.domNode.style.top != (y+"px")){
anims.push(dojo.lfx.html.slideTo(child.domNode, {top: y, left: 0}, this.duration));
}
- y += child.open ? dojo.html.getBorderBox(child.domNode).height : child.getLabelHeight();
+ y += child.selected ? dojo.html.getBorderBox(child.domNode).height : child.getLabelHeight();
});
dojo.lfx.combine(anims).play();
}
}
);
+/**
+ * summary
+ * AccordionPane is a box with a title that contains another widget (often a ContentPane).
+ * It's a widget used internally by AccordionContainer.
+ */
+dojo.widget.defineWidget(
+ "dojo.widget.AccordionPane",
+ dojo.widget.HtmlWidget,
+{
+ // parameters
+
+ // String
+ // label to print on top of AccordionPane
+ label: "",
+
+ // String
+ // CSS class name for the AccordionPane's dom node
+ "class": "dojoAccordionPane",
+
+ // String
+ // CSS class name for the AccordionPane's label node
+ labelNodeClass: "label",
+
+ // String
+ // CSS class name for the AccordionPane's container node
+ containerNodeClass: "accBody",
+
+ // Boolean
+ // if true, this is the open pane
+ selected: false,
+
+ templatePath: dojo.uri.dojoUri("src/widget/templates/AccordionPane.html"),
+ templateCssPath: dojo.uri.dojoUri("src/widget/templates/AccordionPane.css"),
+
+ isContainer: true,
+
+ fillInTemplate: function() {
+ dojo.html.addClass(this.domNode, this["class"]);
+ dojo.widget.AccordionPane.superclass.fillInTemplate.call(this);
+ dojo.html.disableSelection(this.labelNode);
+ this.setSelected(this.selected);
+ },
+
+ setLabel: function(/*String*/ label) {
+ // summary: set the title of the node
+ this.labelNode.innerHTML=label;
+ },
+
+ resizeTo: function(width, height){
+ dojo.html.setMarginBox(this.domNode, {width: width, height: height});
+ var children = [
+ {domNode: this.labelNode, layoutAlign: "top"},
+ {domNode: this.containerNode, layoutAlign: "client"}
+ ];
+ dojo.widget.html.layout(this.domNode, children);
+ var childSize = dojo.html.getContentBox(this.containerNode);
+ this.children[0].resizeTo(childSize.width, childSize.height);
+ },
+
+ getLabelHeight: function() {
+ // summary: returns the height of the title dom node
+ return dojo.html.getMarginBox(this.labelNode).height; // Integer
+ },
+
+ onLabelClick: function() {
+ // summary: callback when someone clicks my label
+ this.parent.selectChild(this);
+ },
+
+ setSelected: function(/*Boolean*/ isSelected){
+ this.selected=isSelected;
+ (isSelected ? dojo.html.addClass : dojo.html.removeClass)(this.domNode, this["class"]+"-selected");
+
+ // make sure child is showing (lazy load), and also that onShow()/onHide() is called
+ var child = this.children[0];
+ if(child){
+ if(isSelected){
+ if(!child.isShowing()){
+ child.show();
+ }else{
+ child.onShow();
+ }
+ }else{
+ child.onHide();
+ }
+ }
+ }
+});
+
// These arguments can be specified for the children of an AccordionContainer
// Since any widget can be specified as a child, mix them
// into the base widget class. (This is a hack, but it's effective.)
dojo.lang.extend(dojo.widget.Widget, {
- label: "",
+ // String
+ // is this the selected child?
+ // DEPRECATED: will be removed in 0.5. Used "selected" attribute instead.
open: false
});
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/widget/AnimatedPng.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/widget/AnimatedPng.js?view=diff&rev=453979&r1=453978&r2=453979
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/widget/AnimatedPng.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/widget/AnimatedPng.js Sat Oct 7 11:22:33 2006
@@ -14,26 +14,46 @@
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.HtmlWidget");
-
+// summary
+// PNGs have great tranparency, but lack animation.
+// This widget lets you point an img tag at an animated gif for graceful degrading,
+// while letting you specify a png containing a grid of cells to animate between.
+//
+// usage
+// <img dojoType="AnimatedPng"
+// src="images/animatedpng_static.gif" (for degradation; in case javascript is disabled)
+// aniSrc="images/animatedpng_frames.gif"
+// width="20"
+// height="20"
+// interval="50"
+// />
+//
+// var params = {src: "images/animatedpng_static.gif", aniSrc: "images/animatedpng_frames.gif", width: 20, height: 20, interval: 50};
+// var widget = dojo.widget.createWidget("AnimatedPng", params, document.getElementById("pngContainer"));
+//
dojo.widget.defineWidget(
"dojo.widget.AnimatedPng",
dojo.widget.HtmlWidget,
{
isContainer: false,
- domNode: null,
+ // Integer
+ // width (of each frame) in pixels
width: 0,
+
+ // Integer
+ // height (of each frame) in pixels
height: 0,
+
+ // String
+ // pathname to png file containing frames to be animated (ie, displayed sequentially)
aniSrc: '',
+
+ // Integer
+ // time to display each frame
interval: 100,
- cellWidth: 0,
- cellHeight: 0,
- aniCols: 1,
- aniRows: 1,
- aniCells: 1,
-
- blankSrc: dojo.uri.dojoUri("src/widget/templates/images/blank.gif"),
+ _blankSrc: dojo.uri.dojoUri("src/widget/templates/images/blank.gif"),
templateString: '<img class="dojoAnimatedPng" />',
@@ -44,13 +64,12 @@
var img = new Image();
var self = this;
- img.onload = function(){ self.initAni(img.width, img.height); };
+ img.onload = function(){ self._initAni(img.width, img.height); };
img.src = this.aniSrc;
},
- initAni: function(w, h){
-
- this.domNode.src = this.blankSrc;
+ _initAni: function(w, h){
+ this.domNode.src = this._blankSrc;
this.domNode.width = this.cellWidth;
this.domNode.height = this.cellHeight;
this.domNode.style.backgroundImage = 'url('+this.aniSrc+')';
@@ -61,11 +80,10 @@
this.aniCells = this.aniCols * this.aniRows;
this.aniFrame = 0;
- window.setInterval(dojo.lang.hitch(this, 'tick'), this.interval);
+ window.setInterval(dojo.lang.hitch(this, '_tick'), this.interval);
},
- tick: function(){
-
+ _tick: function(){
this.aniFrame++;
if (this.aniFrame == this.aniCells) this.aniFrame = 0;