activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r397975 [4/4] - in /incubator/activemq/trunk/activemq-web-console: ./ src/main/webapp/ src/main/webapp/decorators/ src/main/webapp/js/mochi/ src/main/webapp/js/plotkit/
Date Fri, 28 Apr 2006 18:14:54 GMT
Added: incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetCanvas.js
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetCanvas.js?rev=397975&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetCanvas.js
(added)
+++ incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetCanvas.js
Fri Apr 28 11:14:51 2006
@@ -0,0 +1,281 @@
+/*
+    PlotKit Sweet Canvas Renderer
+    =============================
+    Canvas Renderer for PlotKit which looks pretty!
+
+    Copyright
+    ---------
+    Copyright 2005,2006 (c) Alastair Tse <alastair^liquidx.net>
+    For use under the BSD license. <http://www.liquidx.net/plotkit>
+*/
+
+// -------------------------------------------------------------------------
+// Check required components
+// -------------------------------------------------------------------------
+
+try {    
+    if (typeof(PlotKit.CanvasRenderer) == 'undefined')
+    {
+        throw "";    
+    }
+} 
+catch (e) {    
+    throw "SweetCanvas depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, Canvas}"
+}
+
+
+if (typeof(PlotKit.SweetCanvasRenderer) == 'undefined') {
+    PlotKit.SweetCanvasRenderer = {};
+}
+
+PlotKit.SweetCanvasRenderer = function(element, layout, options) {
+    if (arguments.length > 0) {
+        this.__init__(element, layout, options);
+    }
+};
+
+PlotKit.SweetCanvasRenderer.NAME = "PlotKit.SweetCanvasRenderer";
+PlotKit.SweetCanvasRenderer.VERSION = PlotKit.VERSION;
+
+PlotKit.SweetCanvasRenderer.__repr__ = function() {
+    return "[" + this.NAME + " " + this.VERSION + "]";
+};
+
+PlotKit.SweetCanvasRenderer.toString = function() {
+    return this.__repr__();
+};
+
+// ---------------------------------------------------------------------
+// Subclassing Magic
+// ---------------------------------------------------------------------
+
+PlotKit.SweetCanvasRenderer.prototype = new PlotKit.CanvasRenderer();
+PlotKit.SweetCanvasRenderer.prototype.constructor = PlotKit.SweetCanvasRenderer;
+PlotKit.SweetCanvasRenderer.__super__ = PlotKit.CanvasRenderer.prototype;
+
+// ---------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------
+
+PlotKit.SweetCanvasRenderer.prototype.__init__ = function(el, layout, opts) { 
+    var moreOpts = PlotKit.Base.officeBlue();
+    MochiKit.Base.update(moreOpts, opts);
+    PlotKit.SweetCanvasRenderer.__super__.__init__.call(this, el, layout, moreOpts);
+};
+
+// ---------------------------------------------------------------------
+// Extended Plotting Functions
+// ---------------------------------------------------------------------
+
+PlotKit.SweetCanvasRenderer.prototype._renderBarChart = function() {
+    var bind = MochiKit.Base.bind;
+    var shadowColor = Color.blackColor().colorWithAlpha(0.1).toRGBString();
+
+    var prepareFakeShadow = function(context, x, y, w, h) {
+        context.fillStyle = shadowColor;
+        context.fillRect(x-2, y-2, w+4, h+2); 
+        context.fillStyle = shadowColor;
+        context.fillRect(x-1, y-1, w+2, h+1); 
+    };
+
+    var colorCount = this.options.colorScheme.length;
+    var colorScheme =  this.options.colorScheme;
+    var setNames = MochiKit.Base.keys(this.layout.datasets);
+    var setCount = setNames.length;
+
+    var chooseColor = function(name) {
+        for (var i = 0; i < setCount; i++) {
+            if (name == setNames[i])
+                return colorScheme[i%colorCount];
+        }
+        return colorScheme[0];
+    };
+
+    var drawRect = function(context, bar) {
+        var x = this.area.w * bar.x + this.area.x;
+        var y = this.area.h * bar.y + this.area.y;
+        var w = this.area.w * bar.w;
+        var h = this.area.h * bar.h;
+
+        if ((w < 1) || (h < 1))
+            return;        
+
+        context.save();
+
+        context.shadowBlur = 5.0;
+        context.shadowColor = Color.fromHexString("#888888").toRGBString();
+
+        if (this.isIE) {
+            context.save();
+            context.fillStyle = "#cccccc";
+            context.fillRect(x-2, y-2, w+4, h+2); 
+            context.restore();
+        }
+        else {
+            prepareFakeShadow(context, x, y, w, h);
+        }
+
+        context.fillStyle = chooseColor(bar.name).toRGBString();
+        context.fillRect(x, y, w, h);
+
+        context.shadowBlur = 0;
+        context.strokeStyle = Color.whiteColor().toRGBString();
+        context.lineWidth = 2.0;
+
+        context.strokeRect(x, y, w, h);                
+
+        context.restore();
+
+    };
+    this._renderBarChartWrap(this.layout.bars, bind(drawRect, this));
+};
+
+PlotKit.CanvasRenderer.prototype._renderLineChart = function() {
+    var context = this.element.getContext("2d");
+    var colorCount = this.options.colorScheme.length;
+    var colorScheme = this.options.colorScheme;
+    var setNames = MochiKit.Base.keys(this.layout.datasets);
+    var setCount = setNames.length;
+    var bind = MochiKit.Base.bind;
+
+
+    for (var i = 0; i < setCount; i++) {
+        var setName = setNames[i];
+        var color = colorScheme[i%colorCount];
+        var strokeX = this.options.strokeColorTransform;
+
+        // setup graphics context
+        context.save();
+        
+        // create paths
+        var makePath = function() {
+            context.beginPath();
+            context.moveTo(this.area.x, this.area.y + this.area.h);
+            var addPoint = function(context, point) {
+            if (point.name == setName)
+                context.lineTo(this.area.w * point.x + this.area.x,
+                               this.area.h * point.y + this.area.y);
+            };
+            MochiKit.Iter.forEach(this.layout.points, partial(addPoint, context), this);
+            context.lineTo(this.area.w + this.area.x,
+                           this.area.h + this.area.y);
+            context.lineTo(this.area.x, this.area.y + this.area.h);
+            context.closePath();
+        };
+
+        // faux shadow for firefox
+        context.save();
+        if (this.isIE) {
+            context.fillStyle = "#cccccc";
+        }
+        else {
+            context.fillStyle = Color.blackColor().colorWithAlpha(0.2).toRGBString();
+        }
+
+        context.translate(-1, -2);
+        bind(makePath, this)();        
+        context.fill();
+        context.restore();
+
+        context.shadowBlur = 5.0;
+        context.shadowColor = Color.fromHexString("#888888").toRGBString();
+        context.fillStyle = color.toRGBString();
+        context.lineWidth = 2.0;
+        context.strokeStyle = Color.whiteColor().toRGBString();
+
+        bind(makePath, this)();
+        context.fill();
+        bind(makePath, this)();
+        context.stroke();
+
+        context.restore();
+    }
+};
+
+PlotKit.CanvasRenderer.prototype._renderPieChart = function() {
+    var context = this.element.getContext("2d");
+
+    var colorCount = this.options.colorScheme.length;
+    var slices = this.layout.slices;
+
+    var centerx = this.area.x + this.area.w * 0.5;
+    var centery = this.area.y + this.area.h * 0.5;
+    var radius = Math.min(this.area.w * this.options.pieRadius, 
+                          this.area.h * this.options.pieRadius);
+
+    if (this.isIE) {
+        centerx = parseInt(centerx);
+        centery = parseInt(centery);
+        radius = parseInt(radius);
+    }
+
+	// NOTE NOTE!! Canvas Tag draws the circle clockwise from the y = 0, x = 1
+	// so we have to subtract 90 degrees to make it start at y = 1, x = 0
+
+    if (!this.isIE) {
+        context.save();
+        var shadowColor = Color.blackColor().colorWithAlpha(0.2);
+        context.fillStyle = shadowColor.toRGBString();
+        context.shadowBlur = 5.0;
+        context.shadowColor = Color.fromHexString("#888888").toRGBString();
+        context.translate(1, 1);
+        context.beginPath();
+        context.moveTo(centerx, centery);
+        context.arc(centerx, centery, radius + 2, 0, Math.PI*2, false);
+        context.closePath();
+        context.fill();
+        context.restore();
+    }
+
+    context.save();
+    context.strokeStyle = Color.whiteColor().toRGBString();
+    context.lineWidth = 2.0;    
+    for (var i = 0; i < slices.length; i++) {
+        var color = this.options.colorScheme[i%colorCount];
+        context.fillStyle = color.toRGBString();
+
+        var makePath = function() {
+            context.beginPath();
+            context.moveTo(centerx, centery);
+            context.arc(centerx, centery, radius, 
+                        slices[i].startAngle - Math.PI/2,
+                        slices[i].endAngle - Math.PI/2,
+                        false);
+            context.lineTo(centerx, centery);
+            context.closePath();
+        };
+
+        if (Math.abs(slices[i].startAngle - slices[i].endAngle) > 0.0001) {
+            makePath();
+            context.fill();
+            makePath();
+            context.stroke();
+        }
+    }
+    context.restore();
+};
+
+PlotKit.SweetCanvasRenderer.prototype._renderBackground = function() {
+    var context = this.element.getContext("2d");
+   
+    if (this.layout.style == "bar" || this.layout.style == "line") {
+        context.save();
+        context.fillStyle = this.options.backgroundColor.toRGBString();
+        context.fillRect(this.area.x, this.area.y, this.area.w, this.area.h);
+        context.strokeStyle = Color.whiteColor().toRGBString();
+        context.lineWidth = 1.0;
+        for (var i = 0; i < this.layout.yticks.length; i++) {
+            var y = this.layout.yticks[i][0] * this.area.h + this.area.y;
+            var x = this.area.x;
+            context.beginPath();
+            context.moveTo(x, y);
+            context.lineTo(x + this.area.w, y);
+            context.closePath();
+            context.stroke();
+        }
+        context.restore();
+    }
+    else {
+        PlotKit.SweetCanvasRenderer.__super__._renderBackground.call(this);
+    }
+};

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetCanvas.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetCanvas.js
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetCanvas.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetSVG.js
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetSVG.js?rev=397975&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetSVG.js (added)
+++ incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetSVG.js Fri
Apr 28 11:14:51 2006
@@ -0,0 +1,196 @@
+/*
+    PlotKit Sweet SVG Renderer
+    ==========================
+    SVG Renderer for PlotKit which looks pretty!
+
+    Copyright
+    ---------
+    Copyright 2005,2006 (c) Alastair Tse <alastair^liquidx.net>
+    For use under the BSD license. <http://www.liquidx.net/plotkit>
+*/
+
+
+// -------------------------------------------------------------------------
+// Check required components
+// -------------------------------------------------------------------------
+
+try {    
+    if (typeof(PlotKit.SVGRenderer) == 'undefined')
+    {
+        throw "";    
+    }
+} 
+catch (e) {    
+    throw "SweetSVG depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, SVG}"
+}
+
+
+if (typeof(PlotKit.SweetSVGRenderer) == 'undefined') {
+    PlotKit.SweetSVGRenderer = {};
+}
+
+PlotKit.SweetSVGRenderer = function(element, layout, options) {
+    if (arguments.length > 0) {
+        this.__init__(element, layout, options);
+    }
+};
+
+PlotKit.SweetSVGRenderer.NAME = "PlotKit.SweetSVGRenderer";
+PlotKit.SweetSVGRenderer.VERSION = PlotKit.VERSION;
+
+PlotKit.SweetSVGRenderer.__repr__ = function() {
+    return "[" + this.NAME + " " + this.VERSION + "]";
+};
+
+PlotKit.SweetSVGRenderer.toString = function() {
+    return this.__repr__();
+};
+
+// ---------------------------------------------------------------------
+// Subclassing Magic
+// ---------------------------------------------------------------------
+
+PlotKit.SweetSVGRenderer.prototype = new PlotKit.SVGRenderer();
+PlotKit.SweetSVGRenderer.prototype.constructor = PlotKit.SweetSVGRenderer;
+PlotKit.SweetSVGRenderer.__super__ = PlotKit.SVGRenderer.prototype;
+
+// ---------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------
+
+PlotKit.SweetSVGRenderer.prototype.__init__ = function(element, layout, options) { 
+    var moreOpts = PlotKit.Base.officeBlue();
+    MochiKit.Base.update(moreOpts, options);
+    PlotKit.SweetSVGRenderer.__super__.__init__.call(this, element, layout, moreOpts);
+    //this._addDropShadowFilter();
+};
+
+PlotKit.SweetSVGRenderer.prototype._addDropShadowFilter = function() {
+    var filter = this.createSVGElement("filter", {x: 0, y: 0, "id":"dropShadow"});
+    var goffset = this.createSVGElement("feOffset",
+        {"in": "SourceGraphic", "dx": 0, "dy": 0, "result": "topCopy"});
+    var blur = this.createSVGElement("feGaussianBlur",
+        {"in": "SourceAlpha", "StdDeviation": 2, "result": "shadow"});
+    var soffset = this.createSVGElement("feOffset",
+        {"in": "shadow", "dx": -1, "dy": -2, "result":"movedShadow"});
+    var merge = this.createSVGElement("feMerge");
+    var gmerge = this.createSVGElement("feMergeNode", {"in":"topCopy"});
+    var smerge = this.createSVGElement("feMergeNode", {"in":"movedShadow"});
+    
+    merge.appendChild(gmerge);
+    merge.appendChild(smerge);
+    filter.appendChild(goffset);
+    filter.appendChild(blur);
+    filter.appendChild(soffset);
+    filter.appendChild(merge);
+    this.defs.appendChild(filter);
+};
+
+// ---------------------------------------------------------------------
+// Extended Plotting Functions
+// ---------------------------------------------------------------------
+
+PlotKit.SweetSVGRenderer.prototype._renderBarChart = function() {
+    var bind = MochiKit.Base.bind;
+    var shadowColor = Color.blackColor().toRGBString();
+    var shadowStyle = "fill:" + shadowColor + ";fill-opacity:0.15";
+    var strokeStyle = "stroke-width: 2.0; stroke:" + Color.whiteColor().toRGBString();
+    
+    var drawRect = function(attrs, bar) {
+        var x = this.area.w * bar.x + this.area.x;
+        var y = this.area.h * bar.y + this.area.y;
+        var w = this.area.w * bar.w;
+        var h = this.area.h * bar.h;
+
+        if ((w < 1) || (h < 1))
+            return;        
+
+        //attrs["filter"] = "url(#dropShadow)";
+        attrs["style"] = strokeStyle;
+        this._drawRect(x - 2, y - 1, w+4, h+2, {"style":shadowStyle});
+        this._drawRect(x, y, w, h, attrs);
+    };
+    this._renderBarOrLine(this.layout.bars, bind(drawRect, this));
+
+};
+
+PlotKit.SweetSVGRenderer.prototype._renderLineChart = function() {
+    var bind = MochiKit.Base.bind;
+    var shadowColor = Color.blackColor().toRGBString();
+    var shadowStyle = "fill:" + shadowColor + ";fill-opacity:0.15";
+    var strokeStyle = "stroke-width: 2.0; stroke:" + Color.whiteColor().toRGBString();
+
+    var addPoint = function(attrs, point) {
+        this._tempPointsBuffer += (this.area.w * point.x + this.area.x) + "," +
+                                 (this.area.h * point.y + this.area.y) + " ";
+    };
+
+    var startLine = function(attrs) {
+        this._tempPointsBuffer = "";
+        this._tempPointsBuffer += (this.area.x) + "," + (this.area.y+this.area.h) + " ";
+    };
+
+    var endLine = function(attrs) {
+        this._tempPointsBuffer += (this.area.w + this.area.x) + ","  +(this.area.h + this.area.y);
+        attrs["points"] = this._tempPointsBuffer;    
+            
+        attrs["stroke"] = "none";
+        attrs["transform"] = "translate(-2, -1)";
+        attrs["style"] = shadowStyle;
+        var shadow = this.createSVGElement("polygon", attrs);
+        this.root.appendChild(shadow);
+        
+        attrs["transform"] = "";
+        attrs["style"] = strokeStyle;
+        var elem = this.createSVGElement("polygon", attrs);
+        this.root.appendChild(elem);
+        
+       
+    };
+
+    this._renderBarOrLine(this.layout.points, 
+                             bind(addPoint, this), 
+                             bind(startLine, this), 
+                             bind(endLine, this));
+};
+
+PlotKit.SweetSVGRenderer.prototype._renderPieChart = function() {
+    var centerx = this.area.x + this.area.w * 0.5;
+    var centery = this.area.y + this.area.h * 0.5;
+    var shadowColor = Color.blackColor().toRGBString();
+    var radius = Math.min(this.area.w * this.options.pieRadius, 
+                          this.area.h * this.options.pieRadius);
+    var shadowStyle = "fill:" + shadowColor + ";fill-opacity:0.15";
+    
+    var shadow = this.createSVGElement("circle", 
+        {"style": shadowStyle, "cx": centerx + 1, "cy": centery + 1, "r": radius + 1});
+    this.root.appendChild(shadow);
+                             
+    PlotKit.SweetSVGRenderer.__super__._renderPieChart.call(this);
+};
+    
+
+PlotKit.SweetSVGRenderer.prototype._renderBackground = function() {
+    var attrs = {
+        "fill": this.options.backgroundColor.toRGBString(),
+        "stroke": "none"
+    };
+    
+
+    if (this.layout.style == "bar" || this.layout.style == "line") {
+        this._drawRect(this.area.x, this.area.y, 
+                       this.area.w, this.area.h, attrs);                
+        for (var i = 0; i < this.layout.yticks.length; i++) {
+            this._drawRect(this.area.x,
+                           this.layout.yticks[i][0] * this.area.h + this.area.y,
+                           this.area.w,
+                           1,
+                           {"fill": Color.whiteColor().toRGBString()});
+        }
+    }
+    else {
+        PlotKit.SweetSVGRenderer.__super__._renderBackground.call(this);
+        
+    }
+    
+};

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetSVG.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetSVG.js
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/SweetSVG.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/dummy.svg
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/dummy.svg?rev=397975&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/dummy.svg (added)
+++ incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/dummy.svg Fri
Apr 28 11:14:51 2006
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink">
+</svg>

Added: incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/iecanvas.htc
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/iecanvas.htc?rev=397975&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/iecanvas.htc
(added)
+++ incubator/activemq/trunk/activemq-web-console/src/main/webapp/js/plotkit/iecanvas.htc
Fri Apr 28 11:14:51 2006
@@ -0,0 +1,389 @@
+/*----------------------------------------------------------------------------\
+|                                IE Canvas 1.0                                |
+|-----------------------------------------------------------------------------|
+|                          Created by Emil A Eklund                           |
+|                        (http://eae.net/contact/emil)                        |
+|-----------------------------------------------------------------------------|
+| Implementation of the canvas API for Internet Explorer. Uses VML.           |
+|-----------------------------------------------------------------------------|
+|                      Copyright (c) 2005 Emil A Eklund                       |
+|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
+| This program is  free software;  you can redistribute  it and/or  modify it |
+| under the terms of the MIT License.                                         |
+|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
+| Permission  is hereby granted,  free of charge, to  any person  obtaining a |
+| copy of this software and associated documentation files (the "Software"),  |
+| to deal in the  Software without restriction,  including without limitation |
+| the  rights to use, copy, modify,  merge, publish, distribute,  sublicense, |
+| and/or  sell copies  of the  Software, and to  permit persons to  whom  the |
+| Software is  furnished  to do  so, subject  to  the  following  conditions: |
+| The above copyright notice and this  permission notice shall be included in |
+| all copies or substantial portions of the Software.                         |
+|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
+| THE SOFTWARE IS PROVIDED "AS IS",  WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
+| IMPLIED,  INCLUDING BUT NOT LIMITED TO  THE WARRANTIES  OF MERCHANTABILITY, |
+| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
+| AUTHORS OR  COPYRIGHT  HOLDERS BE  LIABLE FOR  ANY CLAIM,  DAMAGES OR OTHER |
+| LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT, TORT OR  OTHERWISE,  ARISING |
+| FROM,  OUT OF OR  IN  CONNECTION  WITH  THE  SOFTWARE OR THE  USE OR  OTHER |
+| DEALINGS IN THE SOFTWARE.                                                   |
+|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
+|                         http://eae.net/license/mit                          |
+|-----------------------------------------------------------------------------|
+| Dependencies: canvas.js           - For initialization of canvas elements   |
+|-----------------------------------------------------------------------------|
+| 2005-12-27 | Work started.                                                  |
+| 2005-12-29 | First version posted.                                          |
+| 2006-01-03 | Fixed bug in moveTo and lineTo,  arguments where not converted |
+|            | to int which could cause IE to enter an endless loop. Disabled |
+|            | antalias for fillRect to better comply with the Mozilla, Opera |
+|            | and possibly  Safari  implementations where  using fillRect is |
+|            | about the only way to raw non antialiased lines.               |
+|-----------------------------------------------------------------------------|
+| Created 2005-12-27 | All changes are in the log above. | Updated 2006-01-03 |
+\----------------------------------------------------------------------------*/
+
+<public:component>
+	<public:method name="getContext" />
+	<public:attach event="oncontentready" onevent="initCanvas()"/>
+</public:component>
+
+<script language="JScript">
+
+	function getContext() {
+		return element.context;
+	}
+
+	function initCanvas() {
+		element.context = new IECanvasContext();
+		element.style.position = 'relative';
+		element.style.display  = 'block';
+		element.style.overflow = 'hidden';
+	}
+
+
+
+	function IECanvasContext() {
+		this.fillStyle = 'black';
+		this.globalAlpha = 1.0;
+		this.globalCompositeOperation = '';
+		this.lineCap = '';
+		this.lineJoin = '';
+		this.lineWidth = '0';
+		this.miterLimit = '';
+		this.shadowBlur = '';
+		this.shadowColor = '';
+		this.shadowOffsetX = '';
+		this.shadowOffsetY = '';
+		this.strokeStyle = 'black';
+		this._path = '';
+		this._stateStack = new Array();
+		this._offsetX = 0;
+		this._offsetY = 0;
+		this._rotation = 0;
+	};
+
+	IECanvasContext.prototype.save = function() {
+		var o;
+
+		o = new Object();
+		this._copyState(this, o);
+		this._stateStack.push(o);
+	};
+
+	IECanvasContext.prototype.restore = function() {
+		var o, n;
+
+		n = this._stateStack.length - 1;
+		if (n < 0) { return; }
+
+		o = this._stateStack[n];
+		this._copyState(o, this);
+		this._stateStack.splice(n, 1);
+	};
+
+	IECanvasContext.prototype._copyState = function(oFrom, oTo) {
+		oTo.fillStyle     = oFrom.fillStyle;
+		oTo.lineCap       = oFrom.lineCap;
+		oTo.lineJoin      = oFrom.lineJoin;
+		oTo.lineWidth     = oFrom.lineWidth;
+		oTo.miterLimit    = oFrom.miterLimit;
+		oTo.shadowBlur    = oFrom.shadowBlur;
+		oTo.shadowColor   = oFrom.shadowColor;
+		oTo.shadowOffsetX = oFrom.shadowOffsetX;
+		oTo.shadowOffsetY = oFrom.shadowOffsetY;
+		oTo._offsetX      = oFrom._offsetX;
+		oTo._offsetY      = oFrom._offsetY;
+		oTo._rotation     = oFrom._rotation;
+	};
+
+	IECanvasContext.prototype.rotate = function(r) {
+		var MAX = Math.PI * 2;
+
+		this._rotation += r;
+		while (this._rotation > MAX) { this._rotation = MAX - this._rotation; }
+	};
+
+	IECanvasContext.prototype.scale = function() { };
+
+	IECanvasContext.prototype.translate = function(x, y) {
+		this._offsetX += x;
+		this._offsetY += y;
+	};
+
+	IECanvasContext.prototype.bezierCurveTo = function(cp1x, cp1y, cp2x, cp2y, x, y) {
+		if (this._path) { this._path += ' '; }
+
+		this._path += 'qb' + cp1x + ',' + cp1y + ',' + cp2x + ',' + cp2y + ',' + x + ',' + y;
+	};
+
+
+	IECanvasContext.prototype.clip = function() { };
+
+	IECanvasContext.prototype.beginPath = function() {
+		this._path = '';
+	};
+
+	IECanvasContext.prototype.closePath = function() {
+		if (this._path) { this._path += ' '; }
+		this._path += 'x';
+	};
+
+	IECanvasContext.prototype.lineTo = function(x, y) {
+		if (this._path) { this._path += ' '; }
+		this._path += 'l' + parseInt(x) + ',' + parseInt(y);
+	};
+
+	IECanvasContext.prototype.moveTo = function(x, y) {
+		if (this._path) { this._path += ' '; }
+		this._path += 'm' + parseInt(x) + ',' + parseInt(y);
+	};
+
+	IECanvasContext.prototype.stroke = function() {
+		var o, s, cosa, sina, cx, cy, x, y;
+
+		if (!this._path) { return; }
+
+		this._path += ' e';
+
+		o = element.ownerDocument.createElement('v:shape');
+		o.fillColor = 'none';
+		o.filled = false;
+		o.strokeColor = this.strokeStyle;
+		o.stroked = true;
+		o.weight = this.lineWidth;
+		o.coordsize = element.offsetWidth + ',' + element.offsetHeight;
+		o.style.position = 'absolute';
+		o.style.left = this._offsetX;
+		o.style.top = this._offsetY;
+		o.style.width = element.offsetWidth;
+		o.style.height = element.offsetHeight;
+		o.path = this._path;
+
+		s = element.ownerDocument.createElement('v:stroke');
+		s.opacity = this.globalAlpha;
+		o.appendChild(s);
+
+		if (this._rotation) {
+			r = element.ownerDocument.createElement('v:group');
+			r.style.position = 'absolute';
+			r.style.left = 0;
+			r.style.top = 0;
+			r.style.width = element.offsetWidth;
+			r.style.height = element.offsetHeight;
+			r.coordsize = o.coordsize;
+			r.style.rotation = Math.round((this._rotation * 180) / Math.PI);
+			r.style.rotationCenter = '0,0';
+			r.appendChild(o);
+			element.appendChild(r);
+
+			cosa = Math.cos(this._rotation);
+			sina = Math.sin(this._rotation);
+			cx = element.offsetWidth / 2;
+			cy = element.offsetHeight / 2;
+
+			x = ( cx*(1-cosa) + cy*sina);
+			y = (-cx*sina     + cy*(1-cosa));
+
+			r.style.left = x * -1;
+			r.style.top = y * -1;
+		}
+		else { element.appendChild(o); }
+	};
+
+	IECanvasContext.prototype.fill = function() {
+		var o, f, r;
+
+		if (!this._path) { return; }
+
+		this._path += ' e';
+
+		o = element.ownerDocument.createElement('v:shape');
+		o.fillColor = this.fillStyle;
+		o.strokeColor = this.strokeStyle;
+		o.stroked = false;
+		o.weight = this.lineWidth;
+		o.coordsize = element.offsetWidth + ',' + element.offsetHeight;
+		o.style.position = 'absolute';
+		o.style.left = this._offsetX;
+		o.style.top = this._offsetY;
+		o.style.width = element.offsetWidth;
+		o.style.height = element.offsetHeight;
+		o.path = this._path;
+
+		f = element.ownerDocument.createElement('v:fill');
+		f.opacity = this.globalAlpha;
+		o.appendChild(f);
+
+		if (this._rotation) {
+			r = element.ownerDocument.createElement('v:group');
+			r.style.position = 'absolute';
+			r.style.left = 0;
+			r.style.top = 0;
+			r.style.width = element.offsetWidth;
+			r.style.height = element.offsetHeight;
+			r.coordsize = o.coordsize;
+			r.style.rotation = Math.round((this._rotation * 180) / Math.PI);
+			r.style.rotationCenter = '0,0';
+			r.appendChild(o);
+			element.appendChild(r);
+
+			cosa = Math.cos(this._rotation);
+			sina = Math.sin(this._rotation);
+			cx = (element.offsetWidth) / 2;
+			cy = (element.offsetHeight) / 2;
+			x = ( cx*(1-cosa) + cy*sina);
+			y = (-cx*sina     + cy*(1-cosa));
+
+			r.style.left = x * -1;
+			r.style.top = y * -1;
+		}
+		else { element.appendChild(o); }
+	};
+
+	IECanvasContext.prototype.arcTo = function(x1, y1, x2, y2, radius) {
+		// not implemented in gecko, not implemented here
+	};
+
+	IECanvasContext.prototype.quadraticCurveTo = function(cpx, cpy, x, y) {
+		if (this._path) { this._path += ' '; }
+
+		this._path += 'qb' + cpx + ',' + cpy + ',' + x + ',' + y;
+	};
+
+	IECanvasContext.prototype.arc = function(x, y, radius, startAngle, endAngle, clockwise)
{
+		var xi, yi, x1, y1, x2, y2, x3, y3, x4, y4;
+
+		if (this._path) { this._path += ' '; }
+
+		xi = parseFloat(x);
+		yi = parseFloat(y);
+
+        x1 = xi - radius;
+        y1 = yi - radius;
+        
+        x2 = xi + radius;
+        y2 = yi + radius;
+
+        if (clockwise) {
+            x3 = xi + (Math.cos(startAngle) * radius);
+            y3 = yi + (Math.sin(startAngle) * radius);
+
+            x4 = xi + (Math.cos(endAngle) * radius);
+            y4 = yi + (Math.sin(endAngle) * radius);
+        }
+        else {
+            x3 = xi + (Math.cos(endAngle) * radius);
+            y3 = yi + (Math.sin(endAngle) * radius);
+
+            x4 = xi + (Math.cos(startAngle) * radius);
+            y4 = yi + (Math.sin(startAngle) * radius);
+        }
+
+		x3 = Math.round(x3);
+		y3 = Math.round(y3);
+		x4 = Math.round(x4);
+		y4 = Math.round(y4);
+
+		this._path += 'ar' + x1 + ',' + y1 + ',' + x2 + ',' + y2 + ',' + x3 + ',' + y3 + ',' +
x4 + ',' + y4;
+	};
+
+
+	IECanvasContext.prototype.rect = function(x, y, w, h) {
+		var x1, y1, x2, y2;
+
+		x2 = x + w;
+		y2 = y + h;
+
+		x1 = Math.round(x);
+		y1 = Math.round(y);
+		x2 = Math.round(x2);
+		y2 = Math.round(y2);
+
+		this._path += 'm' + x1 + ',' + y1;
+		this._path += ' l' + x2 + ',' + y1;
+		this._path += ' l' + x2 + ',' + y2;
+		this._path += ' l' + x1 + ',' + y2;
+		this._path += ' x'
+	};
+
+	IECanvasContext.prototype.strokeRect = function(x, y, w, h) {
+		var o, s;
+
+		o = element.ownerDocument.createElement('v:rect');
+		o.fillColor = 'none';
+		o.filled = false;
+		o.strokeColor = this.strokeStyle;
+		o.stroked = true;
+		o.weight = this.lineWidth;
+		o.style.position = 'absolute';
+		o.style.left = this._offsetX + x;
+		o.style.top = this._offsetY + y;
+		o.style.width = w;
+		o.style.height = h;
+
+		s = element.ownerDocument.createElement('v:fill');
+		s.opacity = this.globalAlpha;
+		o.appendChild(s);
+
+		element.appendChild(o);
+	};
+
+	IECanvasContext.prototype.clearRect = function(x, y, w, h) { };
+
+
+	IECanvasContext.prototype.fillRect = function(x, y, w, h) {
+		var o, f;
+		
+		if ((x == 0) && (y == 0) && (w == element.offsetWidth) && (h ==
element.offsetHeight) && (this._offsetX == 0) && (this._offsetY == 0) &&
(this.globalAlpha == 1)) {
+			while (element.firstChild) { element.removeChild(element.lastChild); }
+		}
+
+		o = element.ownerDocument.createElement('v:rect');
+		o.fillColor = this.fillStyle;
+		o.filled = true;
+		o.stroked = false;
+		o.weight = 0;
+		o.style.position = 'absolute';
+		o.style.left = this._offsetX + x;
+		o.style.top = this._offsetY + y;
+		o.style.width = w;
+		o.style.height = h;
+		o.style.antialias = 'false';
+
+		f = element.ownerDocument.createElement('v:fill');
+		f.opacity = this.globalAlpha;
+		o.appendChild(f);
+
+		element.appendChild(o);
+	};
+
+	IECanvasContext.prototype.addColorStop = function() { };
+	IECanvasContext.prototype.createLinearGradient = function() { };
+	IECanvasContext.prototype.createPattern = function() { };
+	IECanvasContext.prototype.createRadialGradient = function() { };
+
+	IECanvasContext.prototype.drawImage = function() { };
+	IECanvasContext.prototype.drawImageFromRect = function() { };
+
+</script>

Added: incubator/activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp?rev=397975&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp (added)
+++ incubator/activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp Fri Apr 28
11:14:51 2006
@@ -0,0 +1,55 @@
+<html>
+<head>
+<title>Queues</title>
+
+    <c:set var="disableJavaScript" value="true" scope="request"/>
+
+   <script src='<c:url value="/js/mochi/MochiKit.js"/>' type="text/javascript"></script>
+   <script src='<c:url value="/js/plotkit/Base.js"/>' type="text/javascript"></script>
+   <script src='<c:url value="/js/plotkit/Layout.js"/>' type="text/javascript"></script>
+   <script src='<c:url value="/js/plotkit/Canvas.js"/>' type="text/javascript"></script>
+   <script src='<c:url value="/js/plotkit/SweetCanvas.js"/>' type="text/javascript"></script>
+</head>
+<body>
+
+<script>
+function drawGraph() {
+    var layout = new PlotKit.Layout("bar", {});
+    
+    layout.addDataset(
+    	"Queue Sizes", 
+        [ <c:forEach items="${requestContext.brokerQuery.queues}" var="row" varStatus="status">
[${status.count}, 
+${row.queueSize}], </c:forEach> ] );
+    layout.evaluate();
+    
+var options = {
+   "IECanvasHTC": "<c:url value="/js/plotkit/iecanvas.htc"/>",
+   "colorScheme": PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),
+   "padding": {left: 0, right: 0, top: 10, bottom: 30},
+   "xTicks": [
+         <c:forEach items="${requestContext.brokerQuery.queues}" var="row" varStatus="status">
    {v:${status.count}, label:"${row.name}"},  </c:forEach>
+          ],
+   "drawYAxis": false
+};
+
+    var canvas = MochiKit.DOM.getElement("graph");
+    var plotter = new PlotKit.SweetCanvasRenderer(canvas, layout, options);
+    plotter.render();
+}
+MochiKit.DOM.addLoadEvent(drawGraph);
+</script>
+
+ <div><canvas id="graph" height="400" width="760"></canvas></div>
+ 
+<%---    
+Other values we can graph...
+
+<td>${row.consumerCount}</td>
+<td>${row.enqueueCount}</td>
+<td>${row.dequeueCount}</td>
+--%>
+
+
+</body>
+</html>
+	
\ No newline at end of file

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-web-console/src/main/webapp/queueGraph.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/activemq/trunk/activemq-web-console/src/main/webapp/queues.jsp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-web-console/src/main/webapp/queues.jsp?rev=397975&r1=397974&r2=397975&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-web-console/src/main/webapp/queues.jsp (original)
+++ incubator/activemq/trunk/activemq-web-console/src/main/webapp/queues.jsp Fri Apr 28 11:14:51
2006
@@ -17,6 +17,8 @@
 
 <h2>Queues</h2>
 
+<a href="queueGraph.jsp">Queue Graph</a>
+
 <table id="queues" class="sortable autostripe">
 <thead>
 <tr>



Mime
View raw message