Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 16579 invoked from network); 16 Jul 2009 19:15:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Jul 2009 19:15:45 -0000 Received: (qmail 43921 invoked by uid 500); 16 Jul 2009 19:16:51 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 43861 invoked by uid 500); 16 Jul 2009 19:16:51 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 43852 invoked by uid 99); 16 Jul 2009 19:16:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2009 19:16:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2009 19:16:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 48C5F23889E9; Thu, 16 Jul 2009 19:15:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r794787 [19/34] - in /geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src: ./ animation/ cal/ charting/ charting/svg/ charting/vml/ collections/ crypto/ data/ data/core/ data/old/ data/old/format/ data/old/provider/ date/ debug/... Date: Thu, 16 Jul 2009 19:14:56 -0000 To: scm@geronimo.apache.org From: djencks@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090716191517.48C5F23889E9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/AccordionContainer.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/AccordionContainer.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/AccordionContainer.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/AnimatedPng.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/AnimatedPng.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/AnimatedPng.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/AnimatedPng.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,47 @@ +/* + 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.widget.AnimatedPng"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.widget.HtmlWidget"); +dojo.widget.defineWidget("dojo.widget.AnimatedPng", dojo.widget.HtmlWidget, {isContainer:false, width:0, height:0, aniSrc:"", interval:100, _blankSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/blank.gif"), templateString:"", postCreate:function () { + this.cellWidth = this.width; + this.cellHeight = this.height; + var img = new Image(); + var self = this; + img.onload = function () { + self._initAni(img.width, img.height); + }; + img.src = this.aniSrc; +}, _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 + ")"; + this.domNode.style.backgroundRepeat = "no-repeat"; + this.aniCols = Math.floor(w / this.cellWidth); + this.aniRows = Math.floor(h / this.cellHeight); + this.aniCells = this.aniCols * this.aniRows; + this.aniFrame = 0; + window.setInterval(dojo.lang.hitch(this, "_tick"), this.interval); +}, _tick:function () { + this.aniFrame++; + if (this.aniFrame == this.aniCells) { + this.aniFrame = 0; + } + var col = this.aniFrame % this.aniCols; + var row = Math.floor(this.aniFrame / this.aniCols); + var bx = -1 * col * this.cellWidth; + var by = -1 * row * this.cellHeight; + this.domNode.style.backgroundPosition = bx + "px " + by + "px"; +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/AnimatedPng.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/AnimatedPng.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/AnimatedPng.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Button.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Button.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Button.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Button.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,259 @@ +/* + 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.widget.Button"); +dojo.require("dojo.lang.extras"); +dojo.require("dojo.html.*"); +dojo.require("dojo.html.selection"); +dojo.require("dojo.widget.*"); +dojo.widget.defineWidget("dojo.widget.Button", dojo.widget.HtmlWidget, {isContainer:true, caption:"", templateString:"
\n
\n \n \n \n
\n", templateCssString:"/* ---- button --- */\n.dojoButton {\n\tpadding: 0 0 0 0;\n\tfont-size: 8pt;\n\twhite-space: nowrap;\n\tcursor: pointer;\n\tfont-family: Myriad, Tahoma, Verdana, sans-serif;\n}\n\n.dojoButton .dojoButtonContents {\n\tpadding: 2px 2px 2px 2px;\n\ttext-align: center;\t \t/* if icon and label are split across two lines, center icon */\n\tcolor: white;\n}\n\n.dojoButtonLeftPart .dojoButtonContents {\n\tpadding-right: 8px;\n}\n\n.dojoButtonDisabled {\n\tcursor: url(\"images/no.gif\"), default;\n}\n\n\n.dojoButtonContents img {\n\tvertical-align: middle;\t/* if icon and label are on same line, center them */\n}\n\n/* -------- colors ------------ */\n\n.dojoButtonHover .dojoButtonContents {\n}\n\n.dojoButtonDepressed .dojoButtonContents {\n\tcolor: #293a4b;\n}\n\n.dojoButtonDisabled .dojoButtonContents {\n\tcolor: #aaa;\n}\n\n\n/* ---------- drop down button specific ---------- */\n\n/* border between label and arrow (for drop down buttons */\n.dojoButton .border {\n\twidth: 1px;\n\tbackground: gray;\n}\n\n/* button arrow */\n.dojoButton .downArrow {\n\tpadding-left: 10px;\n\ttext-align: center;\n}\n\n.dojoButton.disabled .downArrow {\n\tcursor : default;\n}\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/ButtonTemplate.css"), inactiveImg:"templates/images/soriaButton-", activeImg:"templates/images/soriaActive-", pressedImg:"templates/images/soriaPressed-", disabledImg:"templates/images/soriaDisabled-", width2height:1 / 3, fillInTemplate:function () { + if (this.caption) { + this.containerNode.appendChild(document.createTextNode(this.caption)); + } + dojo.html.disableSelection(this.containerNode); +}, postCreate:function () { + this._sizeMyself(); +}, _sizeMyself:function () { + if (this.domNode.parentNode) { + var placeHolder = document.createElement("span"); + dojo.html.insertBefore(placeHolder, this.domNode); + } + dojo.body().appendChild(this.domNode); + this._sizeMyselfHelper(); + if (placeHolder) { + dojo.html.insertBefore(this.domNode, placeHolder); + dojo.html.removeNode(placeHolder); + } +}, _sizeMyselfHelper:function () { + var mb = dojo.html.getMarginBox(this.containerNode); + this.height = mb.height; + this.containerWidth = mb.width; + var endWidth = this.height * this.width2height; + this.containerNode.style.left = endWidth + "px"; + this.leftImage.height = this.rightImage.height = this.centerImage.height = this.height; + this.leftImage.width = this.rightImage.width = endWidth + 1; + this.centerImage.width = this.containerWidth; + this.centerImage.style.left = endWidth + "px"; + this._setImage(this.disabled ? this.disabledImg : this.inactiveImg); + if (this.disabled) { + dojo.html.prependClass(this.domNode, "dojoButtonDisabled"); + this.domNode.removeAttribute("tabIndex"); + dojo.widget.wai.setAttr(this.domNode, "waiState", "disabled", true); + } else { + dojo.html.removeClass(this.domNode, "dojoButtonDisabled"); + this.domNode.setAttribute("tabIndex", "0"); + dojo.widget.wai.setAttr(this.domNode, "waiState", "disabled", false); + } + this.domNode.style.height = this.height + "px"; + this.domNode.style.width = (this.containerWidth + 2 * endWidth) + "px"; +}, onMouseOver:function (e) { + if (this.disabled) { + return; + } + if (!dojo.html.hasClass(this.buttonNode, "dojoButtonHover")) { + dojo.html.prependClass(this.buttonNode, "dojoButtonHover"); + } + this._setImage(this.activeImg); +}, onMouseDown:function (e) { + if (this.disabled) { + return; + } + dojo.html.prependClass(this.buttonNode, "dojoButtonDepressed"); + dojo.html.removeClass(this.buttonNode, "dojoButtonHover"); + this._setImage(this.pressedImg); +}, onMouseUp:function (e) { + if (this.disabled) { + return; + } + dojo.html.prependClass(this.buttonNode, "dojoButtonHover"); + dojo.html.removeClass(this.buttonNode, "dojoButtonDepressed"); + this._setImage(this.activeImg); +}, onMouseOut:function (e) { + if (this.disabled) { + return; + } + if (e.toElement && dojo.html.isDescendantOf(e.toElement, this.buttonNode)) { + return; + } + dojo.html.removeClass(this.buttonNode, "dojoButtonHover"); + dojo.html.removeClass(this.buttonNode, "dojoButtonDepressed"); + this._setImage(this.inactiveImg); +}, onKey:function (e) { + if (!e.key) { + return; + } + var menu = dojo.widget.getWidgetById(this.menuId); + if (e.key == e.KEY_ENTER || e.key == " ") { + this.onMouseDown(e); + this.buttonClick(e); + dojo.lang.setTimeout(this, "onMouseUp", 75, e); + dojo.event.browser.stopEvent(e); + } + if (menu && menu.isShowingNow && e.key == e.KEY_DOWN_ARROW) { + dojo.event.disconnect(this.domNode, "onblur", this, "onBlur"); + } +}, onFocus:function (e) { + var menu = dojo.widget.getWidgetById(this.menuId); + if (menu) { + dojo.event.connectOnce(this.domNode, "onblur", this, "onBlur"); + } +}, onBlur:function (e) { + var menu = dojo.widget.getWidgetById(this.menuId); + if (!menu) { + return; + } + if (menu.close && menu.isShowingNow) { + menu.close(); + } +}, buttonClick:function (e) { + if (!this.disabled) { + try { + this.domNode.focus(); + } + catch (e2) { + } + this.onClick(e); + } +}, onClick:function (e) { +}, _setImage:function (prefix) { + this.leftImage.src = dojo.uri.moduleUri("dojo.widget", prefix + "l.gif"); + this.centerImage.src = dojo.uri.moduleUri("dojo.widget", prefix + "c.gif"); + this.rightImage.src = dojo.uri.moduleUri("dojo.widget", prefix + "r.gif"); +}, _toggleMenu:function (menuId) { + var menu = dojo.widget.getWidgetById(menuId); + if (!menu) { + return; + } + if (menu.open && !menu.isShowingNow) { + var pos = dojo.html.getAbsolutePosition(this.domNode, false); + menu.open(pos.x, pos.y + this.height, this); + dojo.event.disconnect(this.domNode, "onblur", this, "onBlur"); + } else { + if (menu.close && menu.isShowingNow) { + menu.close(); + } else { + menu.toggle(); + } + } +}, setCaption:function (content) { + this.caption = content; + this.containerNode.innerHTML = content; + this._sizeMyself(); +}, setDisabled:function (disabled) { + this.disabled = disabled; + this._sizeMyself(); +}}); +dojo.widget.defineWidget("dojo.widget.DropDownButton", dojo.widget.Button, {menuId:"", downArrow:"templates/images/whiteDownArrow.gif", disabledDownArrow:"templates/images/whiteDownArrow.gif", fillInTemplate:function () { + dojo.widget.DropDownButton.superclass.fillInTemplate.apply(this, arguments); + this.arrow = document.createElement("img"); + dojo.html.setClass(this.arrow, "downArrow"); + dojo.widget.wai.setAttr(this.domNode, "waiState", "haspopup", this.menuId); +}, _sizeMyselfHelper:function () { + this.arrow.src = dojo.uri.moduleUri("dojo.widget", this.disabled ? this.disabledDownArrow : this.downArrow); + this.containerNode.appendChild(this.arrow); + dojo.widget.DropDownButton.superclass._sizeMyselfHelper.call(this); +}, onClick:function (e) { + this._toggleMenu(this.menuId); +}}); +dojo.widget.defineWidget("dojo.widget.ComboButton", dojo.widget.Button, {menuId:"", templateString:"
\n\n\t
\n\t\t
\n\t\t\n\t\t\n\t
\n\n\t
\n\t\t\n\t\t\n\t\t\n\t
\n\n
\n", splitWidth:2, arrowWidth:5, _sizeMyselfHelper:function (e) { + var mb = dojo.html.getMarginBox(this.containerNode); + this.height = mb.height; + this.containerWidth = mb.width; + var endWidth = this.height / 3; + if (this.disabled) { + dojo.widget.wai.setAttr(this.domNode, "waiState", "disabled", true); + this.domNode.removeAttribute("tabIndex"); + } else { + dojo.widget.wai.setAttr(this.domNode, "waiState", "disabled", false); + this.domNode.setAttribute("tabIndex", "0"); + } + this.leftImage.height = this.rightImage.height = this.centerImage.height = this.arrowBackgroundImage.height = this.height; + this.leftImage.width = endWidth + 1; + this.centerImage.width = this.containerWidth; + this.buttonNode.style.height = this.height + "px"; + this.buttonNode.style.width = endWidth + this.containerWidth + "px"; + this._setImage(this.disabled ? this.disabledImg : this.inactiveImg); + this.arrowBackgroundImage.width = this.arrowWidth; + this.rightImage.width = endWidth + 1; + this.rightPart.style.height = this.height + "px"; + this.rightPart.style.width = this.arrowWidth + endWidth + "px"; + this._setImageR(this.disabled ? this.disabledImg : this.inactiveImg); + this.domNode.style.height = this.height + "px"; + var totalWidth = this.containerWidth + this.splitWidth + this.arrowWidth + 2 * endWidth; + this.domNode.style.width = totalWidth + "px"; +}, _setImage:function (prefix) { + this.leftImage.src = dojo.uri.moduleUri("dojo.widget", prefix + "l.gif"); + this.centerImage.src = dojo.uri.moduleUri("dojo.widget", prefix + "c.gif"); +}, rightOver:function (e) { + if (this.disabled) { + return; + } + dojo.html.prependClass(this.rightPart, "dojoButtonHover"); + this._setImageR(this.activeImg); +}, rightDown:function (e) { + if (this.disabled) { + return; + } + dojo.html.prependClass(this.rightPart, "dojoButtonDepressed"); + dojo.html.removeClass(this.rightPart, "dojoButtonHover"); + this._setImageR(this.pressedImg); +}, rightUp:function (e) { + if (this.disabled) { + return; + } + dojo.html.prependClass(this.rightPart, "dojoButtonHover"); + dojo.html.removeClass(this.rightPart, "dojoButtonDepressed"); + this._setImageR(this.activeImg); +}, rightOut:function (e) { + if (this.disabled) { + return; + } + dojo.html.removeClass(this.rightPart, "dojoButtonHover"); + dojo.html.removeClass(this.rightPart, "dojoButtonDepressed"); + this._setImageR(this.inactiveImg); +}, rightClick:function (e) { + if (this.disabled) { + return; + } + try { + this.domNode.focus(); + } + catch (e2) { + } + this._toggleMenu(this.menuId); +}, _setImageR:function (prefix) { + this.arrowBackgroundImage.src = dojo.uri.moduleUri("dojo.widget", prefix + "c.gif"); + this.rightImage.src = dojo.uri.moduleUri("dojo.widget", prefix + "r.gif"); +}, onKey:function (e) { + if (!e.key) { + return; + } + var menu = dojo.widget.getWidgetById(this.menuId); + if (e.key == e.KEY_ENTER || e.key == " ") { + this.onMouseDown(e); + this.buttonClick(e); + dojo.lang.setTimeout(this, "onMouseUp", 75, e); + dojo.event.browser.stopEvent(e); + } else { + if (e.key == e.KEY_DOWN_ARROW && e.altKey) { + this.rightDown(e); + this.rightClick(e); + dojo.lang.setTimeout(this, "rightUp", 75, e); + dojo.event.browser.stopEvent(e); + } else { + if (menu && menu.isShowingNow && e.key == e.KEY_DOWN_ARROW) { + dojo.event.disconnect(this.domNode, "onblur", this, "onBlur"); + } + } + } +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Button.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Button.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Button.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Chart.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Chart.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Chart.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Chart.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,233 @@ +/* + 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.widget.Chart"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.gfx.color"); +dojo.require("dojo.gfx.color.hsl"); +dojo.declare("dojo.widget.Chart", null, function () { + this.series = []; +}, {isContainer:false, assignColors:function () { + var hue = 30; + var sat = 120; + var lum = 120; + var steps = Math.round(330 / this.series.length); + for (var i = 0; i < this.series.length; i++) { + var c = dojo.gfx.color.hsl2rgb(hue, sat, lum); + if (!this.series[i].color) { + this.series[i].color = dojo.gfx.color.rgb2hex(c[0], c[1], c[2]); + } + hue += steps; + } +}, parseData:function (table) { + var thead = table.getElementsByTagName("thead")[0]; + var tbody = table.getElementsByTagName("tbody")[0]; + if (!(thead && tbody)) { + dojo.raise("dojo.widget.Chart: supplied table must define a head and a body."); + } + var columns = thead.getElementsByTagName("tr")[0].getElementsByTagName("th"); + for (var i = 1; i < columns.length; i++) { + var key = "column" + i; + var label = columns[i].innerHTML; + var plotType = columns[i].getAttribute("plotType") || "line"; + var color = columns[i].getAttribute("color"); + var ds = new dojo.widget.Chart.DataSeries(key, label, plotType, color); + this.series.push(ds); + } + var rows = tbody.rows; + var xMin = Number.MAX_VALUE, xMax = Number.MIN_VALUE; + var yMin = Number.MAX_VALUE, yMax = Number.MIN_VALUE; + var ignore = ["accesskey", "align", "bgcolor", "class", "colspan", "height", "id", "nowrap", "rowspan", "style", "tabindex", "title", "valign", "width"]; + for (var i = 0; i < rows.length; i++) { + var row = rows[i]; + var cells = row.cells; + var x = Number.MIN_VALUE; + for (var j = 0; j < cells.length; j++) { + if (j == 0) { + x = parseFloat(cells[j].innerHTML); + xMin = Math.min(xMin, x); + xMax = Math.max(xMax, x); + } else { + var ds = this.series[j - 1]; + var y = parseFloat(cells[j].innerHTML); + yMin = Math.min(yMin, y); + yMax = Math.max(yMax, y); + var o = {x:x, value:y}; + var attrs = cells[j].attributes; + for (var k = 0; k < attrs.length; k++) { + var attr = attrs.item(k); + var bIgnore = false; + for (var l = 0; l < ignore.length; l++) { + if (attr.nodeName.toLowerCase() == ignore[l]) { + bIgnore = true; + break; + } + } + if (!bIgnore) { + o[attr.nodeName] = attr.nodeValue; + } + } + ds.add(o); + } + } + } + return {x:{min:xMin, max:xMax}, y:{min:yMin, max:yMax}}; +}}); +dojo.declare("dojo.widget.Chart.DataSeries", null, function (key, label, plotType, color) { + this.id = "DataSeries" + dojo.widget.Chart.DataSeries.count++; + this.key = key; + this.label = label || this.id; + this.plotType = plotType || "line"; + this.color = color; + this.values = []; +}, {add:function (v) { + if (v.x == null || v.value == null) { + dojo.raise("dojo.widget.Chart.DataSeries.add: v must have both an 'x' and 'value' property."); + } + this.values.push(v); +}, clear:function () { + this.values = []; +}, createRange:function (len) { + var idx = this.values.length - 1; + var length = (len || this.values.length); + return {"index":idx, "length":length, "start":Math.max(idx - length, 0)}; +}, getMean:function (len) { + var range = this.createRange(len); + if (range.index < 0) { + return 0; + } + var t = 0; + var c = 0; + for (var i = range.index; i >= range.start; i--) { + var n = parseFloat(this.values[i].value); + if (!isNaN(n)) { + t += n; + c++; + } + } + t /= Math.max(c, 1); + return t; +}, getMovingAverage:function (len) { + var range = this.createRange(len); + if (range.index < 0) { + return 0; + } + var t = 0; + var c = 0; + for (var i = range.index; i >= range.start; i--) { + var n = parseFloat(this.values[i].value); + if (!isNaN(n)) { + t += n; + c++; + } + } + t /= Math.max(c, 1); + return t; +}, getVariance:function (len) { + var range = this.createRange(len); + if (range.index < 0) { + return 0; + } + var t = 0; + var s = 0; + var c = 0; + for (var i = range.index; i >= range.start; i--) { + var n = parseFloat(this.values[i].value); + if (!isNaN(n)) { + t += n; + s += Math.pow(n, 2); + c++; + } + } + return (s / c) - Math.pow(t / c, 2); +}, getStandardDeviation:function (len) { + return Math.sqrt(this.getVariance(len)); +}, getMax:function (len) { + var range = this.createRange(len); + if (range.index < 0) { + return 0; + } + var t = 0; + for (var i = range.index; i >= range.start; i--) { + var n = parseFloat(this.values[i].value); + if (!isNaN(n)) { + t = Math.max(n, t); + } + } + return t; +}, getMin:function (len) { + var range = this.createRange(len); + if (range.index < 0) { + return 0; + } + var t = 0; + for (var i = range.index; i >= range.start; i--) { + var n = parseFloat(this.values[i].value); + if (!isNaN(n)) { + t = Math.min(n, t); + } + } + return t; +}, getMedian:function (len) { + var range = this.createRange(len); + if (range.index < 0) { + return 0; + } + var a = []; + for (var i = range.index; i >= range.start; i--) { + var n = parseFloat(this.values[i].value); + if (!isNaN(n)) { + var b = false; + for (var j = 0; j < a.length && !b; j++) { + if (n == a[j]) { + b = true; + } + } + if (!b) { + a.push(n); + } + } + } + a.sort(); + if (a.length > 0) { + return a[Math.ceil(a.length / 2)]; + } + return 0; +}, getMode:function (len) { + var range = this.createRange(len); + if (range.index < 0) { + return 0; + } + var o = {}; + var ret = 0; + var m = 0; + for (var i = range.index; i >= range.start; i--) { + var n = parseFloat(this.values[i].value); + if (!isNaN(n)) { + if (!o[this.values[i].value]) { + o[this.values[i].value] = 1; + } else { + o[this.values[i].value]++; + } + } + } + for (var p in o) { + if (m < o[p]) { + m = o[p]; + ret = p; + } + } + return parseFloat(ret); +}}); +dojo.requireIf(dojo.render.svg.capable, "dojo.widget.svg.Chart"); +dojo.requireIf(!dojo.render.svg.capable && dojo.render.vml.capable, "dojo.widget.vml.Chart"); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Chart.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Chart.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Chart.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Checkbox.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Checkbox.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Checkbox.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Checkbox.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,103 @@ +/* + 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.widget.Checkbox"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.widget.HtmlWidget"); +dojo.require("dojo.event.*"); +dojo.require("dojo.html.style"); +dojo.require("dojo.html.selection"); +dojo.widget.defineWidget("dojo.widget.Checkbox", dojo.widget.HtmlWidget, {templateString:"\n\t\"\"\n\t\n\n", templateCssString:".dojoHtmlCheckbox {\n\tborder: 0px;\n\twidth: 16px;\n\theight: 16px;\n\tmargin: 2px;\n\tvertical-align: middle;\n}\n\n.dojoHtmlCheckboxOn {\n\tbackground: url(check.gif) 0px 0px;\n}\n.dojoHtmlCheckboxOff {\n\tbackground: url(check.gif) -16px 0px;\n}\n.dojoHtmlCheckboxDisabledOn {\n\tbackground: url(check.gif) -32px 0px;\n}\n.dojoHtmlCheckboxDisabledOff {\n\tbackground: url(check.gif) -48px 0px;\n}\n.dojoHtmlCheckboxOnHover {\n\tbackground: url(check.gif) -64px 0px;\n}\n.dojoHtmlCheckbo xOffHover {\n\tbackground: url(check.gif) -80px 0px;\n}\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/Checkbox.css"), name:"", id:"", checked:false, tabIndex:"", value:"on", postMixInProperties:function () { + dojo.widget.Checkbox.superclass.postMixInProperties.apply(this, arguments); + if (!this.disabled && this.tabIndex == "") { + this.tabIndex = "0"; + } +}, fillInTemplate:function () { + this._setInfo(); +}, postCreate:function () { + var notcon = true; + this.id = this.id != "" ? this.id : this.widgetId; + if (this.id != "") { + var labels = document.getElementsByTagName("label"); + if (labels != null && labels.length > 0) { + for (var i = 0; i < labels.length; i++) { + if (labels[i].htmlFor == this.id) { + labels[i].id = (labels[i].htmlFor + "label"); + this._connectEvents(labels[i]); + dojo.widget.wai.setAttr(this.domNode, "waiState", "labelledby", labels[i].id); + break; + } + } + } + } + this._connectEvents(this.domNode); + this.inputNode.checked = this.checked; +}, _connectEvents:function (node) { + dojo.event.connect(node, "onmouseover", this, "mouseOver"); + dojo.event.connect(node, "onmouseout", this, "mouseOut"); + dojo.event.connect(node, "onkey", this, "onKey"); + dojo.event.connect(node, "onclick", this, "_onClick"); + dojo.html.disableSelection(node); +}, _onClick:function (e) { + if (this.disabled == false) { + this.checked = !this.checked; + this._setInfo(); + } + e.preventDefault(); + e.stopPropagation(); + this.onClick(); +}, setValue:function (bool) { + if (this.disabled == false) { + this.checked = bool; + this._setInfo(); + } +}, onClick:function () { +}, onKey:function (e) { + var k = dojo.event.browser.keys; + if (e.key == " ") { + this._onClick(e); + } +}, mouseOver:function (e) { + this._hover(e, true); +}, mouseOut:function (e) { + this._hover(e, false); +}, _hover:function (e, isOver) { + if (this.disabled == false) { + var state = this.checked ? "On" : "Off"; + var style = "dojoHtmlCheckbox" + state + "Hover"; + if (isOver) { + dojo.html.addClass(this.imageNode, style); + } else { + dojo.html.removeClass(this.imageNode, style); + } + } +}, _setInfo:function () { + var state = "dojoHtmlCheckbox" + (this.disabled ? "Disabled" : "") + (this.checked ? "On" : "Off"); + dojo.html.setClass(this.imageNode, "dojoHtmlCheckbox " + state); + this.inputNode.checked = this.checked; + if (this.disabled) { + this.inputNode.setAttribute("disabled", true); + } else { + this.inputNode.removeAttribute("disabled"); + } + dojo.widget.wai.setAttr(this.domNode, "waiState", "checked", this.checked); +}}); +dojo.widget.defineWidget("dojo.widget.a11y.Checkbox", dojo.widget.Checkbox, {templateString:"\n\t \n\n", fillInTemplate:function () { +}, postCreate:function (args, frag) { + this.inputNode.checked = this.checked; + if (this.disabled) { + this.inputNode.setAttribute("disabled", true); + } +}, _onClick:function () { + this.onClick(); +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Checkbox.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Checkbox.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Checkbox.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Clock.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Clock.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Clock.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Clock.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,142 @@ +/* + 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.widget.Clock"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.gfx.*"); +dojo.require("dojo.uri.Uri"); +dojo.require("dojo.lang.common"); +dojo.require("dojo.lang.timing.Timer"); +dojo.widget.defineWidget("dojo.widget.Clock", dojo.widget.HtmlWidget, function () { + var self = this; + this.timeZoneOffset = 0; + this.label = ""; + this.date = new Date(); + this.handColor = "#788598"; + this.handStroke = "#6f7b8c"; + this.secondHandColor = [201, 4, 5, 0.8]; + this.topLabelColor = "#efefef"; + this.labelColor = "#fff"; + this.timer = new dojo.lang.timing.Timer(1000); + this.center = {x:75, y:75}; + this.hands = {hour:null, minute:null, second:null}; + this.shadows = {hour:{shadow:null, shift:{dx:2, dy:2}}, minute:{shadow:null, shift:{dx:2, dy:3}}, second:{shadow:null, shift:{dx:4, dy:4}}}; + this.image = dojo.uri.moduleUri("dojo.widget", "templates/images/clock.png"); + this.surface = null; + this.labelNode = null; + this.topLabelNode = null; + this.draw = function () { + self.date = new Date(); + var h = (self.date.getHours() + self.timeZoneOffset) % 12; + var m = self.date.getMinutes(); + var s = self.date.getSeconds(); + self.placeHour(h, m, s); + self.placeMinute(m, s); + self.placeSecond(s); + self.topLabelNode.innerHTML = ((self.date.getHours() + self.timeZoneOffset) > 11) ? "PM" : "AM"; + }; + this.timer.onTick = self.draw; +}, {set:function (dt) { + this.date = dt; + if (!this.timer.isRunning) { + this.draw(); + } +}, start:function () { + this.timer.start(); +}, stop:function () { + this.timer.stop(); +}, _initPoly:function (parent, points) { + var path = parent.createPath(); + var first = true; + dojo.lang.forEach(points, function (c) { + if (first) { + path.moveTo(c.x, c.y); + first = false; + } else { + path.lineTo(c.x, c.y); + } + }); + return path; +}, _placeHand:function (shape, angle, shift) { + var move = {dx:this.center.x + (shift ? shift.dx : 0), dy:this.center.y + (shift ? shift.dy : 0)}; + return shape.setTransform([move, dojo.gfx.matrix.rotateg(-angle)]); +}, placeHour:function (h, m, s) { + var angle = 30 * (h + m / 60 + s / 3600); + this._placeHand(this.hands.hour, angle); + this._placeHand(this.shadows.hour.shadow, angle, this.shadows.hour.shift); +}, placeMinute:function (m, s) { + var angle = 6 * (m + s / 60); + this._placeHand(this.hands.minute, angle); + this._placeHand(this.shadows.minute.shadow, angle, this.shadows.minute.shift); +}, placeSecond:function (s) { + var angle = 6 * s; + this._placeHand(this.hands.second, angle); + this._placeHand(this.shadows.second.shadow, angle, this.shadows.second.shift); +}, init:function () { + if (this.domNode.style.position != "absolute") { + this.domNode.style.position = "relative"; + } + while (this.domNode.childNodes.length > 0) { + this.domNode.removeChild(this.domNode.childNodes[0]); + } + this.domNode.style.width = "150px"; + this.domNode.style.height = "150px"; + this.surface = dojo.gfx.createSurface(this.domNode, 150, 150); + this.surface.createRect({width:150, height:150}); + this.surface.createImage({width:150, height:150, src:this.image + ""}); + var hP = [{x:-3, y:-4}, {x:3, y:-4}, {x:1, y:-27}, {x:-1, y:-27}, {x:-3, y:-4}]; + var mP = [{x:-3, y:-4}, {x:3, y:-4}, {x:1, y:-38}, {x:-1, y:-38}, {x:-3, y:-4}]; + var sP = [{x:-2, y:-2}, {x:2, y:-2}, {x:1, y:-45}, {x:-1, y:-45}, {x:-2, y:-2}]; + this.shadows.hour.shadow = this._initPoly(this.surface, hP).setFill([0, 0, 0, 0.1]); + this.hands.hour = this._initPoly(this.surface, hP).setStroke({color:this.handStroke, width:1}).setFill({type:"linear", x1:0, y1:0, x2:0, y2:-27, colors:[{offset:0, color:"#fff"}, {offset:0.33, color:this.handColor}]}); + this.shadows.minute.shadow = this._initPoly(this.surface, mP).setFill([0, 0, 0, 0.1]); + this.hands.minute = this._initPoly(this.surface, mP).setStroke({color:this.handStroke, width:1}).setFill({type:"linear", x1:0, y1:0, x2:0, y2:-38, colors:[{offset:0, color:"#fff"}, {offset:0.33, color:this.handColor}]}); + this.surface.createCircle({r:6}).setStroke({color:this.handStroke, width:2}).setFill("#fff").setTransform({dx:75, dy:75}); + this.shadows.second.shadow = this._initPoly(this.surface, sP).setFill([0, 0, 0, 0.1]); + this.hands.second = this._initPoly(this.surface, sP).setFill(this.secondHandColor); + this.surface.createCircle({r:4}).setFill(this.secondHandColor).setTransform({dx:75, dy:75}); + this.topLabelNode = document.createElement("div"); + with (this.topLabelNode.style) { + position = "absolute"; + top = "3px"; + left = "0px"; + color = this.topLabelColor; + textAlign = "center"; + width = "150px"; + fontFamily = "sans-serif"; + fontSize = "11px"; + textTransform = "uppercase"; + fontWeight = "bold"; + } + this.topLabelNode.innerHTML = ((this.date.getHours() + this.timeZoneOffset) > 11) ? "PM" : "AM"; + this.domNode.appendChild(this.topLabelNode); + this.labelNode = document.createElement("div"); + with (this.labelNode.style) { + position = "absolute"; + top = "134px"; + left = "0px"; + color = this.labelColor; + textAlign = "center"; + width = "150px"; + fontFamily = "sans-serif"; + fontSize = "10px"; + textTransform = "uppercase"; + fontWeight = "bold"; + } + this.labelNode.innerHTML = this.label || " "; + this.domNode.appendChild(this.labelNode); + this.draw(); +}, postCreate:function () { + this.init(); + this.start(); +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Clock.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Clock.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/Clock.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ColorPalette.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ColorPalette.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ColorPalette.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ColorPalette.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,60 @@ +/* + 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.widget.ColorPalette"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.html.layout"); +dojo.require("dojo.html.display"); +dojo.require("dojo.html.selection"); +dojo.widget.defineWidget("dojo.widget.ColorPalette", dojo.widget.HtmlWidget, {palette:"7x10", _palettes:{"7x10":[["fff", "fcc", "fc9", "ff9", "ffc", "9f9", "9ff", "cff", "ccf", "fcf"], ["ccc", "f66", "f96", "ff6", "ff3", "6f9", "3ff", "6ff", "99f", "f9f"], ["c0c0c0", "f00", "f90", "fc6", "ff0", "3f3", "6cc", "3cf", "66c", "c6c"], ["999", "c00", "f60", "fc3", "fc0", "3c0", "0cc", "36f", "63f", "c3c"], ["666", "900", "c60", "c93", "990", "090", "399", "33f", "60c", "939"], ["333", "600", "930", "963", "660", "060", "366", "009", "339", "636"], ["000", "300", "630", "633", "330", "030", "033", "006", "309", "303"]], "3x4":[["ffffff", "00ff00", "008000", "0000ff"], ["c0c0c0", "ffff00", "ff00ff", "000080"], ["808080", "ff0000", "800080", "000000"]]}, buildRendering:function () { + this.domNode = document.createElement("table"); + dojo.html.disableSelection(this.domNode); + dojo.event.connect(this.domNode, "onmousedown", function (e) { + e.preventDefault(); + }); + with (this.domNode) { + cellPadding = "0"; + cellSpacing = "1"; + border = "1"; + style.backgroundColor = "white"; + } + var colors = this._palettes[this.palette]; + for (var i = 0; i < colors.length; i++) { + var tr = this.domNode.insertRow(-1); + for (var j = 0; j < colors[i].length; j++) { + if (colors[i][j].length == 3) { + colors[i][j] = colors[i][j].replace(/(.)(.)(.)/, "$1$1$2$2$3$3"); + } + var td = tr.insertCell(-1); + with (td.style) { + backgroundColor = "#" + colors[i][j]; + border = "1px solid gray"; + width = height = "15px"; + fontSize = "1px"; + } + td.color = "#" + colors[i][j]; + td.onmouseover = function (e) { + this.style.borderColor = "white"; + }; + td.onmouseout = function (e) { + this.style.borderColor = "gray"; + }; + dojo.event.connect(td, "onmousedown", this, "onClick"); + td.innerHTML = " "; + } + } +}, onClick:function (e) { + this.onColorSelect(e.currentTarget.color); + e.currentTarget.style.borderColor = "gray"; +}, onColorSelect:function (color) { +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ColorPalette.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ColorPalette.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ColorPalette.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ComboBox.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ComboBox.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ComboBox.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ComboBox.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,558 @@ +/* + 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.widget.ComboBox"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.event.*"); +dojo.require("dojo.io.*"); +dojo.require("dojo.html.*"); +dojo.require("dojo.string"); +dojo.require("dojo.widget.html.stabile"); +dojo.require("dojo.widget.PopupContainer"); +dojo.declare("dojo.widget.incrementalComboBoxDataProvider", null, function (options) { + this.searchUrl = options.dataUrl; + this._cache = {}; + this._inFlight = false; + this._lastRequest = null; + this.allowCache = false; +}, {_addToCache:function (keyword, data) { + if (this.allowCache) { + this._cache[keyword] = data; + } +}, startSearch:function (searchStr, callback) { + if (this._inFlight) { + } + var tss = encodeURIComponent(searchStr); + var realUrl = dojo.string.substituteParams(this.searchUrl, {"searchString":tss}); + var _this = this; + var request = this._lastRequest = dojo.io.bind({url:realUrl, method:"get", mimetype:"text/json", load:function (type, data, evt) { + _this._inFlight = false; + if (!dojo.lang.isArray(data)) { + var arrData = []; + for (var key in data) { + arrData.push([data[key], key]); + } + data = arrData; + } + _this._addToCache(searchStr, data); + if (request == _this._lastRequest) { + callback(data); + } + }}); + this._inFlight = true; +}}); +dojo.declare("dojo.widget.basicComboBoxDataProvider", null, function (options, node) { + this._data = []; + this.searchLimit = 30; + this.searchType = "STARTSTRING"; + this.caseSensitive = false; + if (!dj_undef("dataUrl", options) && !dojo.string.isBlank(options.dataUrl)) { + this._getData(options.dataUrl); + } else { + if ((node) && (node.nodeName.toLowerCase() == "select")) { + var opts = node.getElementsByTagName("option"); + var ol = opts.length; + var data = []; + for (var x = 0; x < ol; x++) { + var text = opts[x].textContent || opts[x].innerText || opts[x].innerHTML; + var keyValArr = [String(text), String(opts[x].value)]; + data.push(keyValArr); + if (opts[x].selected) { + options.setAllValues(keyValArr[0], keyValArr[1]); + } + } + this.setData(data); + } + } +}, {_getData:function (url) { + dojo.io.bind({url:url, load:dojo.lang.hitch(this, function (type, data, evt) { + if (!dojo.lang.isArray(data)) { + var arrData = []; + for (var key in data) { + arrData.push([data[key], key]); + } + data = arrData; + } + this.setData(data); + }), mimetype:"text/json"}); +}, startSearch:function (searchStr, callback) { + this._performSearch(searchStr, callback); +}, _performSearch:function (searchStr, callback) { + var st = this.searchType; + var ret = []; + if (!this.caseSensitive) { + searchStr = searchStr.toLowerCase(); + } + for (var x = 0; x < this._data.length; x++) { + if ((this.searchLimit > 0) && (ret.length >= this.searchLimit)) { + break; + } + var dataLabel = new String((!this.caseSensitive) ? this._data[x][0].toLowerCase() : this._data[x][0]); + if (dataLabel.length < searchStr.length) { + continue; + } + if (st == "STARTSTRING") { + if (searchStr == dataLabel.substr(0, searchStr.length)) { + ret.push(this._data[x]); + } + } else { + if (st == "SUBSTRING") { + if (dataLabel.indexOf(searchStr) >= 0) { + ret.push(this._data[x]); + } + } else { + if (st == "STARTWORD") { + var idx = dataLabel.indexOf(searchStr); + if (idx == 0) { + ret.push(this._data[x]); + } + if (idx <= 0) { + continue; + } + var matches = false; + while (idx != -1) { + if (" ,/(".indexOf(dataLabel.charAt(idx - 1)) != -1) { + matches = true; + break; + } + idx = dataLabel.indexOf(searchStr, idx + 1); + } + if (!matches) { + continue; + } else { + ret.push(this._data[x]); + } + } + } + } + } + callback(ret); +}, setData:function (pdata) { + this._data = pdata; +}}); +dojo.widget.defineWidget("dojo.widget.ComboBox", dojo.widget.HtmlWidget, {forceValidOption:false, searchType:"stringstart", dataProvider:null, autoComplete:true, searchDelay:100, dataUrl:"", fadeTime:200, maxListLength:8, mode:"local", selectedResult:null, dataProviderClass:"", buttonSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/combo_box_arrow.png"), dropdownToggle:"fade", templateString:"\n", templateCssString:".dojoComboBoxOuter {\n\tborder: 0px !important;\n\tmargin: 0px !important;\n\tpadding: 0px !important;\n\tbackground: transparent !important;\n\twhite-space: nowrap !important;\n}\n\n.dojoComboBox {\n\tborder: 1px inset #afafaf;\n\tmargin: 0px;\n\tpadding: 0px;\n\tvertical-align: middle !important;\n\tfloat: none !important;\n\tposition: static !important;\n\tdisplay: inline !important;\n}\n\n/* the input box */\ninput.dojoComboBox {\n\tborder-right-width: 0px !important; \n\tmargin-right: 0px !important;\n\tpadding-right: 0px !important;\n}\n\n/* the down arrow */\nimg.dojoComboBox {\n\tborder-left-width: 0px !important;\n\tpadding-left: 0px !important;\n\tmargin-left: 0px !important;\n}\n\n/* IE vertical-alignment calculations can be off by +-1 but these margins are collapsed away */\n.dj_ie img.dojoCom boBox {\n\tmargin-top: 1px; \n\tmargin-bottom: 1px; \n}\n\n/* the drop down */\n.dojoComboBoxOptions {\n\tfont-family: Verdana, Helvetica, Garamond, sans-serif;\n\t/* font-size: 0.7em; */\n\tbackground-color: white;\n\tborder: 1px solid #afafaf;\n\tposition: absolute;\n\tz-index: 1000; \n\toverflow: auto;\n\tcursor: default;\n}\n\n.dojoComboBoxItem {\n\tpadding-left: 2px;\n\tpadding-top: 2px;\n\tmargin: 0px;\n}\n\n.dojoComboBoxItemEven {\n\tbackground-color: #f4f4f4;\n}\n\n.dojoComboBoxItemOdd {\n\tbackground-color: white;\n}\n\n.dojoComboBoxItemHighlight {\n\tbackground-color: #63709A;\n\tcolor: white;\n}\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/ComboBox.css"), setValue:function (value) { + this.comboBoxValue.value = value; + if (this.textInputNode.value != value) { + this.textInputNode.value = value; + dojo.widget.html.stabile.setState(this.widgetId, this.getState(), true); + this.onValueChanged(value); + } +}, onValueChanged:function (value) { +}, getValue:function () { + return this.comboBoxValue.value; +}, getState:function () { + return {value:this.getValue()}; +}, setState:function (state) { + this.setValue(state.value); +}, enable:function () { + this.disabled = false; + this.textInputNode.removeAttribute("disabled"); +}, disable:function () { + this.disabled = true; + this.textInputNode.setAttribute("disabled", true); +}, _getCaretPos:function (element) { + if (dojo.lang.isNumber(element.selectionStart)) { + return element.selectionStart; + } else { + if (dojo.render.html.ie) { + var tr = document.selection.createRange().duplicate(); + var ntr = element.createTextRange(); + tr.move("character", 0); + ntr.move("character", 0); + try { + ntr.setEndPoint("EndToEnd", tr); + return String(ntr.text).replace(/\r/g, "").length; + } + catch (e) { + return 0; + } + } + } +}, _setCaretPos:function (element, location) { + location = parseInt(location); + this._setSelectedRange(element, location, location); +}, _setSelectedRange:function (element, start, end) { + if (!end) { + end = element.value.length; + } + if (element.setSelectionRange) { + element.focus(); + element.setSelectionRange(start, end); + } else { + if (element.createTextRange) { + var range = element.createTextRange(); + with (range) { + collapse(true); + moveEnd("character", end); + moveStart("character", start); + select(); + } + } else { + element.value = element.value; + element.blur(); + element.focus(); + var dist = parseInt(element.value.length) - end; + var tchar = String.fromCharCode(37); + var tcc = tchar.charCodeAt(0); + for (var x = 0; x < dist; x++) { + var te = document.createEvent("KeyEvents"); + te.initKeyEvent("keypress", true, true, null, false, false, false, false, tcc, tcc); + element.dispatchEvent(te); + } + } + } +}, _handleKeyEvents:function (evt) { + if (evt.ctrlKey || evt.altKey || !evt.key) { + return; + } + this._prev_key_backspace = false; + this._prev_key_esc = false; + var k = dojo.event.browser.keys; + var doSearch = true; + switch (evt.key) { + case k.KEY_DOWN_ARROW: + if (!this.popupWidget.isShowingNow) { + this._startSearchFromInput(); + } + this._highlightNextOption(); + dojo.event.browser.stopEvent(evt); + return; + case k.KEY_UP_ARROW: + this._highlightPrevOption(); + dojo.event.browser.stopEvent(evt); + return; + case k.KEY_TAB: + if (!this.autoComplete && this.popupWidget.isShowingNow && this._highlighted_option) { + dojo.event.browser.stopEvent(evt); + this._selectOption({"target":this._highlighted_option, "noHide":false}); + this._setSelectedRange(this.textInputNode, this.textInputNode.value.length, null); + } else { + this._selectOption(); + return; + } + break; + case k.KEY_ENTER: + if (this.popupWidget.isShowingNow) { + dojo.event.browser.stopEvent(evt); + } + if (this.autoComplete) { + this._selectOption(); + return; + } + case " ": + if (this.popupWidget.isShowingNow && this._highlighted_option) { + dojo.event.browser.stopEvent(evt); + this._selectOption(); + this._hideResultList(); + return; + } + break; + case k.KEY_ESCAPE: + this._hideResultList(); + this._prev_key_esc = true; + return; + case k.KEY_BACKSPACE: + this._prev_key_backspace = true; + if (!this.textInputNode.value.length) { + this.setAllValues("", ""); + this._hideResultList(); + doSearch = false; + } + break; + case k.KEY_RIGHT_ARROW: + case k.KEY_LEFT_ARROW: + doSearch = false; + break; + default: + if (evt.charCode == 0) { + doSearch = false; + } + } + if (this.searchTimer) { + clearTimeout(this.searchTimer); + } + if (doSearch) { + this._blurOptionNode(); + this.searchTimer = setTimeout(dojo.lang.hitch(this, this._startSearchFromInput), this.searchDelay); + } +}, compositionEnd:function (evt) { + evt.key = evt.keyCode; + this._handleKeyEvents(evt); +}, onKeyUp:function (evt) { + this.setValue(this.textInputNode.value); +}, setSelectedValue:function (value) { + this.comboBoxSelectionValue.value = value; +}, setAllValues:function (value1, value2) { + this.setSelectedValue(value2); + this.setValue(value1); +}, _focusOptionNode:function (node) { + if (this._highlighted_option != node) { + this._blurOptionNode(); + this._highlighted_option = node; + dojo.html.addClass(this._highlighted_option, "dojoComboBoxItemHighlight"); + } +}, _blurOptionNode:function () { + if (this._highlighted_option) { + dojo.html.removeClass(this._highlighted_option, "dojoComboBoxItemHighlight"); + this._highlighted_option = null; + } +}, _highlightNextOption:function () { + if ((!this._highlighted_option) || !this._highlighted_option.parentNode) { + this._focusOptionNode(this.optionsListNode.firstChild); + } else { + if (this._highlighted_option.nextSibling) { + this._focusOptionNode(this._highlighted_option.nextSibling); + } + } + dojo.html.scrollIntoView(this._highlighted_option); +}, _highlightPrevOption:function () { + if (this._highlighted_option && this._highlighted_option.previousSibling) { + this._focusOptionNode(this._highlighted_option.previousSibling); + } else { + this._highlighted_option = null; + this._hideResultList(); + return; + } + dojo.html.scrollIntoView(this._highlighted_option); +}, _itemMouseOver:function (evt) { + if (evt.target === this.optionsListNode) { + return; + } + this._focusOptionNode(evt.target); + dojo.html.addClass(this._highlighted_option, "dojoComboBoxItemHighlight"); +}, _itemMouseOut:function (evt) { + if (evt.target === this.optionsListNode) { + return; + } + this._blurOptionNode(); +}, onResize:function () { + var inputSize = dojo.html.getContentBox(this.textInputNode); + if (inputSize.height <= 0) { + dojo.lang.setTimeout(this, "onResize", 100); + return; + } + var buttonSize = {width:inputSize.height, height:inputSize.height}; + dojo.html.setContentBox(this.downArrowNode, buttonSize); +}, fillInTemplate:function (args, frag) { + dojo.html.applyBrowserClass(this.domNode); + var source = this.getFragNodeRef(frag); + if (!this.name && source.name) { + this.name = source.name; + } + this.comboBoxValue.name = this.name; + this.comboBoxSelectionValue.name = this.name + "_selected"; + dojo.html.copyStyle(this.domNode, source); + dojo.html.copyStyle(this.textInputNode, source); + dojo.html.copyStyle(this.downArrowNode, source); + with (this.downArrowNode.style) { + width = "0px"; + height = "0px"; + } + var dpClass; + if (this.dataProviderClass) { + if (typeof this.dataProviderClass == "string") { + dpClass = dojo.evalObjPath(this.dataProviderClass); + } else { + dpClass = this.dataProviderClass; + } + } else { + if (this.mode == "remote") { + dpClass = dojo.widget.incrementalComboBoxDataProvider; + } else { + dpClass = dojo.widget.basicComboBoxDataProvider; + } + } + this.dataProvider = new dpClass(this, this.getFragNodeRef(frag)); + this.popupWidget = new dojo.widget.createWidget("PopupContainer", {toggle:this.dropdownToggle, toggleDuration:this.toggleDuration}); + dojo.event.connect(this, "destroy", this.popupWidget, "destroy"); + this.optionsListNode = this.popupWidget.domNode; + this.domNode.appendChild(this.optionsListNode); + dojo.html.addClass(this.optionsListNode, "dojoComboBoxOptions"); + dojo.event.connect(this.optionsListNode, "onclick", this, "_selectOption"); + dojo.event.connect(this.optionsListNode, "onmouseover", this, "_onMouseOver"); + dojo.event.connect(this.optionsListNode, "onmouseout", this, "_onMouseOut"); + dojo.event.connect(this.optionsListNode, "onmouseover", this, "_itemMouseOver"); + dojo.event.connect(this.optionsListNode, "onmouseout", this, "_itemMouseOut"); +}, _openResultList:function (results) { + if (this.disabled) { + return; + } + this._clearResultList(); + if (!results.length) { + this._hideResultList(); + } + if ((this.autoComplete) && (results.length) && (!this._prev_key_backspace) && (this.textInputNode.value.length > 0)) { + var cpos = this._getCaretPos(this.textInputNode); + if ((cpos + 1) > this.textInputNode.value.length) { + this.textInputNode.value += results[0][0].substr(cpos); + this._setSelectedRange(this.textInputNode, cpos, this.textInputNode.value.length); + } + } + var even = true; + while (results.length) { + var tr = results.shift(); + if (tr) { + var td = document.createElement("div"); + td.appendChild(document.createTextNode(tr[0])); + td.setAttribute("resultName", tr[0]); + td.setAttribute("resultValue", tr[1]); + td.className = "dojoComboBoxItem " + ((even) ? "dojoComboBoxItemEven" : "dojoComboBoxItemOdd"); + even = (!even); + this.optionsListNode.appendChild(td); + } + } + this._showResultList(); +}, _onFocusInput:function () { + this._hasFocus = true; +}, _onBlurInput:function () { + this._hasFocus = false; + this._handleBlurTimer(true, 500); +}, _handleBlurTimer:function (clear, millisec) { + if (this.blurTimer && (clear || millisec)) { + clearTimeout(this.blurTimer); + } + if (millisec) { + this.blurTimer = dojo.lang.setTimeout(this, "_checkBlurred", millisec); + } +}, _onMouseOver:function (evt) { + if (!this._mouseover_list) { + this._handleBlurTimer(true, 0); + this._mouseover_list = true; + } +}, _onMouseOut:function (evt) { + var relTarget = evt.relatedTarget; + try { + if (!relTarget || relTarget.parentNode != this.optionsListNode) { + this._mouseover_list = false; + this._handleBlurTimer(true, 100); + this._tryFocus(); + } + } + catch (e) { + } +}, _isInputEqualToResult:function (result) { + var input = this.textInputNode.value; + if (!this.dataProvider.caseSensitive) { + input = input.toLowerCase(); + result = result.toLowerCase(); + } + return (input == result); +}, _isValidOption:function () { + var tgt = dojo.html.firstElement(this.optionsListNode); + var isValidOption = false; + while (!isValidOption && tgt) { + if (this._isInputEqualToResult(tgt.getAttribute("resultName"))) { + isValidOption = true; + } else { + tgt = dojo.html.nextElement(tgt); + } + } + return isValidOption; +}, _checkBlurred:function () { + if (!this._hasFocus && !this._mouseover_list) { + this._hideResultList(); + if (!this.textInputNode.value.length) { + this.setAllValues("", ""); + return; + } + var isValidOption = this._isValidOption(); + if (this.forceValidOption && !isValidOption) { + this.setAllValues("", ""); + return; + } + if (!isValidOption) { + this.setSelectedValue(""); + } + } +}, _selectOption:function (evt) { + var tgt = null; + if (!evt) { + evt = {target:this._highlighted_option}; + } + if (!dojo.html.isDescendantOf(evt.target, this.optionsListNode)) { + if (!this.textInputNode.value.length) { + return; + } + tgt = dojo.html.firstElement(this.optionsListNode); + if (!tgt || !this._isInputEqualToResult(tgt.getAttribute("resultName"))) { + return; + } + } else { + tgt = evt.target; + } + while ((tgt.nodeType != 1) || (!tgt.getAttribute("resultName"))) { + tgt = tgt.parentNode; + if (tgt === dojo.body()) { + return false; + } + } + this.selectedResult = [tgt.getAttribute("resultName"), tgt.getAttribute("resultValue")]; + this.setAllValues(tgt.getAttribute("resultName"), tgt.getAttribute("resultValue")); + if (!evt.noHide) { + this._hideResultList(); + this._setSelectedRange(this.textInputNode, 0, null); + } + this._tryFocus(); +}, _clearResultList:function () { + if (this.optionsListNode.innerHTML) { + this.optionsListNode.innerHTML = ""; + } +}, _hideResultList:function () { + this.popupWidget.close(); +}, _showResultList:function () { + var childs = this.optionsListNode.childNodes; + if (childs.length) { + var visibleCount = Math.min(childs.length, this.maxListLength); + with (this.optionsListNode.style) { + display = ""; + if (visibleCount == childs.length) { + height = ""; + } else { + height = visibleCount * dojo.html.getMarginBox(childs[0]).height + "px"; + } + width = (dojo.html.getMarginBox(this.domNode).width - 2) + "px"; + } + this.popupWidget.open(this.domNode, this, this.downArrowNode); + } else { + this._hideResultList(); + } +}, handleArrowClick:function () { + this._handleBlurTimer(true, 0); + this._tryFocus(); + if (this.popupWidget.isShowingNow) { + this._hideResultList(); + } else { + this._startSearch(""); + } +}, _tryFocus:function () { + try { + this.textInputNode.focus(); + } + catch (e) { + } +}, _startSearchFromInput:function () { + this._startSearch(this.textInputNode.value); +}, _startSearch:function (key) { + this.dataProvider.startSearch(key, dojo.lang.hitch(this, "_openResultList")); +}, postCreate:function () { + this.onResize(); + dojo.event.connect(this.textInputNode, "onblur", this, "_onBlurInput"); + dojo.event.connect(this.textInputNode, "onfocus", this, "_onFocusInput"); + if (this.disabled) { + this.disable(); + } + var s = dojo.widget.html.stabile.getState(this.widgetId); + if (s) { + this.setState(s); + } +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ComboBox.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ComboBox.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ComboBox.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ContentPane.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ContentPane.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ContentPane.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ContentPane.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,441 @@ +/* + 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.widget.ContentPane"); +dojo.require("dojo.widget.*"); +dojo.require("dojo.io.*"); +dojo.require("dojo.widget.HtmlWidget"); +dojo.require("dojo.string"); +dojo.require("dojo.string.extras"); +dojo.require("dojo.html.style"); +dojo.widget.defineWidget("dojo.widget.ContentPane", dojo.widget.HtmlWidget, function () { + this._styleNodes = []; + this._onLoadStack = []; + this._onUnloadStack = []; + this._callOnUnload = false; + this._ioBindObj; + this.scriptScope; + this.bindArgs = {}; +}, {isContainer:true, adjustPaths:true, href:"", extractContent:true, parseContent:true, cacheContent:true, preload:false, refreshOnShow:false, handler:"", executeScripts:false, scriptSeparation:true, loadingMessage:"Loading...", isLoaded:false, postCreate:function (args, frag, parentComp) { + if (this.handler !== "") { + this.setHandler(this.handler); + } + if (this.isShowing() || this.preload) { + this.loadContents(); + } +}, show:function () { + if (this.refreshOnShow) { + this.refresh(); + } else { + this.loadContents(); + } + dojo.widget.ContentPane.superclass.show.call(this); +}, refresh:function () { + this.isLoaded = false; + this.loadContents(); +}, loadContents:function () { + if (this.isLoaded) { + return; + } + if (dojo.lang.isFunction(this.handler)) { + this._runHandler(); + } else { + if (this.href != "") { + this._downloadExternalContent(this.href, this.cacheContent && !this.refreshOnShow); + } + } +}, setUrl:function (url) { + this.href = url; + this.isLoaded = false; + if (this.preload || this.isShowing()) { + this.loadContents(); + } +}, abort:function () { + var bind = this._ioBindObj; + if (!bind || !bind.abort) { + return; + } + bind.abort(); + delete this._ioBindObj; +}, _downloadExternalContent:function (url, useCache) { + this.abort(); + this._handleDefaults(this.loadingMessage, "onDownloadStart"); + var self = this; + this._ioBindObj = dojo.io.bind(this._cacheSetting({url:url, mimetype:"text/html", handler:function (type, data, xhr) { + delete self._ioBindObj; + if (type == "load") { + self.onDownloadEnd.call(self, url, data); + } else { + var e = {responseText:xhr.responseText, status:xhr.status, statusText:xhr.statusText, responseHeaders:xhr.getAllResponseHeaders(), text:"Error loading '" + url + "' (" + xhr.status + " " + xhr.statusText + ")"}; + self._handleDefaults.call(self, e, "onDownloadError"); + self.onLoad(); + } + }}, useCache)); +}, _cacheSetting:function (bindObj, useCache) { + for (var x in this.bindArgs) { + if (dojo.lang.isUndefined(bindObj[x])) { + bindObj[x] = this.bindArgs[x]; + } + } + if (dojo.lang.isUndefined(bindObj.useCache)) { + bindObj.useCache = useCache; + } + if (dojo.lang.isUndefined(bindObj.preventCache)) { + bindObj.preventCache = !useCache; + } + if (dojo.lang.isUndefined(bindObj.mimetype)) { + bindObj.mimetype = "text/html"; + } + return bindObj; +}, onLoad:function (e) { + this._runStack("_onLoadStack"); + this.isLoaded = true; +}, onUnLoad:function (e) { + dojo.deprecated(this.widgetType + ".onUnLoad, use .onUnload (lowercased load)", 0.5); +}, onUnload:function (e) { + this._runStack("_onUnloadStack"); + delete this.scriptScope; + if (this.onUnLoad !== dojo.widget.ContentPane.prototype.onUnLoad) { + this.onUnLoad.apply(this, arguments); + } +}, _runStack:function (stName) { + var st = this[stName]; + var err = ""; + var scope = this.scriptScope || window; + for (var i = 0; i < st.length; i++) { + try { + st[i].call(scope); + } + catch (e) { + err += "\n" + st[i] + " failed: " + e.description; + } + } + this[stName] = []; + if (err.length) { + var name = (stName == "_onLoadStack") ? "addOnLoad" : "addOnUnLoad"; + this._handleDefaults(name + " failure\n " + err, "onExecError", "debug"); + } +}, addOnLoad:function (obj, func) { + this._pushOnStack(this._onLoadStack, obj, func); +}, addOnUnload:function (obj, func) { + this._pushOnStack(this._onUnloadStack, obj, func); +}, addOnUnLoad:function () { + dojo.deprecated(this.widgetType + ".addOnUnLoad, use addOnUnload instead. (lowercased Load)", 0.5); + this.addOnUnload.apply(this, arguments); +}, _pushOnStack:function (stack, obj, func) { + if (typeof func == "undefined") { + stack.push(obj); + } else { + stack.push(function () { + obj[func](); + }); + } +}, destroy:function () { + this.onUnload(); + dojo.widget.ContentPane.superclass.destroy.call(this); +}, onExecError:function (e) { +}, onContentError:function (e) { +}, onDownloadError:function (e) { +}, onDownloadStart:function (e) { +}, onDownloadEnd:function (url, data) { + data = this.splitAndFixPaths(data, url); + this.setContent(data); +}, _handleDefaults:function (e, handler, messType) { + if (!handler) { + handler = "onContentError"; + } + if (dojo.lang.isString(e)) { + e = {text:e}; + } + if (!e.text) { + e.text = e.toString(); + } + e.toString = function () { + return this.text; + }; + if (typeof e.returnValue != "boolean") { + e.returnValue = true; + } + if (typeof e.preventDefault != "function") { + e.preventDefault = function () { + this.returnValue = false; + }; + } + this[handler](e); + if (e.returnValue) { + switch (messType) { + case true: + case "alert": + alert(e.toString()); + break; + case "debug": + dojo.debug(e.toString()); + break; + default: + if (this._callOnUnload) { + this.onUnload(); + } + this._callOnUnload = false; + if (arguments.callee._loopStop) { + dojo.debug(e.toString()); + } else { + arguments.callee._loopStop = true; + this._setContent(e.toString()); + } + } + } + arguments.callee._loopStop = false; +}, splitAndFixPaths:function (s, url) { + var titles = [], scripts = [], tmp = []; + var match = [], requires = [], attr = [], styles = []; + var str = "", path = "", fix = "", tagFix = "", tag = "", origPath = ""; + if (!url) { + url = "./"; + } + if (s) { + var regex = /]*>([\s\S]*?)<\/title>/i; + while (match = regex.exec(s)) { + titles.push(match[1]); + s = s.substring(0, match.index) + s.substr(match.index + match[0].length); + } + if (this.adjustPaths) { + var regexFindTag = /<[a-z][a-z0-9]*[^>]*\s(?:(?:src|href|style)=[^>])+[^>]*>/i; + var regexFindAttr = /\s(src|href|style)=(['"]?)([\w()\[\]\/.,\\'"-:;#=&?\s@]+?)\2/i; + var regexProtocols = /^(?:[#]|(?:(?:https?|ftps?|file|javascript|mailto|news):))/; + while (tag = regexFindTag.exec(s)) { + str += s.substring(0, tag.index); + s = s.substring((tag.index + tag[0].length), s.length); + tag = tag[0]; + tagFix = ""; + while (attr = regexFindAttr.exec(tag)) { + path = ""; + origPath = attr[3]; + switch (attr[1].toLowerCase()) { + case "src": + case "href": + if (regexProtocols.exec(origPath)) { + path = origPath; + } else { + path = (new dojo.uri.Uri(url, origPath).toString()); + } + break; + case "style": + path = dojo.html.fixPathsInCssText(origPath, url); + break; + default: + path = origPath; + } + fix = " " + attr[1] + "=" + attr[2] + path + attr[2]; + tagFix += tag.substring(0, attr.index) + fix; + tag = tag.substring((attr.index + attr[0].length), tag.length); + } + str += tagFix + tag; + } + s = str + s; + } + regex = /(?:<(style)[^>]*>([\s\S]*?)<\/style>|]*rel=['"]?stylesheet['"]?[^>]*)>)/i; + while (match = regex.exec(s)) { + if (match[1] && match[1].toLowerCase() == "style") { + styles.push(dojo.html.fixPathsInCssText(match[2], url)); + } else { + if (attr = match[3].match(/href=(['"]?)([^'">]*)\1/i)) { + styles.push({path:attr[2]}); + } + } + s = s.substring(0, match.index) + s.substr(match.index + match[0].length); + } + var regex = /]*)>([\s\S]*?)<\/script>/i; + var regexSrc = /src=(['"]?)([^"']*)\1/i; + var regexDojoJs = /.*(\bdojo\b\.js(?:\.uncompressed\.js)?)$/; + var regexInvalid = /(?:var )?\bdjConfig\b(?:[\s]*=[\s]*\{[^}]+\}|\.[\w]*[\s]*=[\s]*[^;\n]*)?;?|dojo\.hostenv\.writeIncludes\(\s*\);?/g; + var regexRequires = /dojo\.(?:(?:require(?:After)?(?:If)?)|(?:widget\.(?:manager\.)?registerWidgetPackage)|(?:(?:hostenv\.)?setModulePrefix|registerModulePath)|defineNamespace)\((['"]).*?\1\)\s*;?/; + while (match = regex.exec(s)) { + if (this.executeScripts && match[1]) { + if (attr = regexSrc.exec(match[1])) { + if (regexDojoJs.exec(attr[2])) { + dojo.debug("Security note! inhibit:" + attr[2] + " from being loaded again."); + } else { + scripts.push({path:attr[2]}); + } + } + } + if (match[2]) { + var sc = match[2].replace(regexInvalid, ""); + if (!sc) { + continue; + } + while (tmp = regexRequires.exec(sc)) { + requires.push(tmp[0]); + sc = sc.substring(0, tmp.index) + sc.substr(tmp.index + tmp[0].length); + } + if (this.executeScripts) { + scripts.push(sc); + } + } + s = s.substr(0, match.index) + s.substr(match.index + match[0].length); + } + if (this.extractContent) { + match = s.match(/]*>\s*([\s\S]+)\s*<\/body>/im); + if (match) { + s = match[1]; + } + } + if (this.executeScripts && this.scriptSeparation) { + var regex = /(<[a-zA-Z][a-zA-Z0-9]*\s[^>]*?\S=)((['"])[^>]*scriptScope[^>]*>)/; + var regexAttr = /([\s'";:\(])scriptScope(.*)/; + str = ""; + while (tag = regex.exec(s)) { + tmp = ((tag[3] == "'") ? "\"" : "'"); + fix = ""; + str += s.substring(0, tag.index) + tag[1]; + while (attr = regexAttr.exec(tag[2])) { + tag[2] = tag[2].substring(0, attr.index) + attr[1] + "dojo.widget.byId(" + tmp + this.widgetId + tmp + ").scriptScope" + attr[2]; + } + str += tag[2]; + s = s.substr(tag.index + tag[0].length); + } + s = str + s; + } + } + return {"xml":s, "styles":styles, "titles":titles, "requires":requires, "scripts":scripts, "url":url}; +}, _setContent:function (cont) { + this.destroyChildren(); + for (var i = 0; i < this._styleNodes.length; i++) { + if (this._styleNodes[i] && this._styleNodes[i].parentNode) { + this._styleNodes[i].parentNode.removeChild(this._styleNodes[i]); + } + } + this._styleNodes = []; + try { + var node = this.containerNode || this.domNode; + while (node.firstChild) { + dojo.html.destroyNode(node.firstChild); + } + if (typeof cont != "string") { + node.appendChild(cont); + } else { + node.innerHTML = cont; + } + } + catch (e) { + e.text = "Couldn't load content:" + e.description; + this._handleDefaults(e, "onContentError"); + } +}, setContent:function (data) { + this.abort(); + if (this._callOnUnload) { + this.onUnload(); + } + this._callOnUnload = true; + if (!data || dojo.html.isNode(data)) { + this._setContent(data); + this.onResized(); + this.onLoad(); + } else { + if (typeof data.xml != "string") { + this.href = ""; + data = this.splitAndFixPaths(data); + } + this._setContent(data.xml); + for (var i = 0; i < data.styles.length; i++) { + if (data.styles[i].path) { + this._styleNodes.push(dojo.html.insertCssFile(data.styles[i].path, dojo.doc(), false, true)); + } else { + this._styleNodes.push(dojo.html.insertCssText(data.styles[i])); + } + } + if (this.parseContent) { + for (var i = 0; i < data.requires.length; i++) { + try { + eval(data.requires[i]); + } + catch (e) { + e.text = "ContentPane: error in package loading calls, " + (e.description || e); + this._handleDefaults(e, "onContentError", "debug"); + } + } + } + var _self = this; + function asyncParse() { + if (_self.executeScripts) { + _self._executeScripts(data.scripts); + } + if (_self.parseContent) { + var node = _self.containerNode || _self.domNode; + var parser = new dojo.xml.Parse(); + var frag = parser.parseElement(node, null, true); + dojo.widget.getParser().createSubComponents(frag, _self); + } + _self.onResized(); + _self.onLoad(); + } + if (dojo.hostenv.isXDomain && data.requires.length) { + dojo.addOnLoad(asyncParse); + } else { + asyncParse(); + } + } +}, setHandler:function (handler) { + var fcn = dojo.lang.isFunction(handler) ? handler : window[handler]; + if (!dojo.lang.isFunction(fcn)) { + this._handleDefaults("Unable to set handler, '" + handler + "' not a function.", "onExecError", true); + return; + } + this.handler = function () { + return fcn.apply(this, arguments); + }; +}, _runHandler:function () { + var ret = true; + if (dojo.lang.isFunction(this.handler)) { + this.handler(this, this.domNode); + ret = false; + } + this.onLoad(); + return ret; +}, _executeScripts:function (scripts) { + var self = this; + var tmp = "", code = ""; + for (var i = 0; i < scripts.length; i++) { + if (scripts[i].path) { + dojo.io.bind(this._cacheSetting({"url":scripts[i].path, "load":function (type, scriptStr) { + dojo.lang.hitch(self, tmp = ";" + scriptStr); + }, "error":function (type, error) { + error.text = type + " downloading remote script"; + self._handleDefaults.call(self, error, "onExecError", "debug"); + }, "mimetype":"text/plain", "sync":true}, this.cacheContent)); + code += tmp; + } else { + code += scripts[i]; + } + } + try { + if (this.scriptSeparation) { + delete this.scriptScope; + this.scriptScope = new (new Function("_container_", code + "; return this;"))(self); + } else { + var djg = dojo.global(); + if (djg.execScript) { + djg.execScript(code); + } else { + var djd = dojo.doc(); + var sc = djd.createElement("script"); + sc.appendChild(djd.createTextNode(code)); + (this.containerNode || this.domNode).appendChild(sc); + } + } + } + catch (e) { + e.text = "Error running scripts from content:\n" + e.description; + this._handleDefaults(e, "onExecError", "debug"); + } +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ContentPane.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ContentPane.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/ContentPane.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/CurrencyTextbox.js URL: http://svn.apache.org/viewvc/geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/CurrencyTextbox.js?rev=794787&view=auto ============================================================================== --- geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/CurrencyTextbox.js (added) +++ geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/CurrencyTextbox.js Thu Jul 16 19:14:41 2009 @@ -0,0 +1,40 @@ +/* + 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.widget.CurrencyTextbox"); +dojo.require("dojo.widget.IntegerTextbox"); +dojo.require("dojo.validate.common"); +dojo.widget.defineWidget("dojo.widget.CurrencyTextbox", dojo.widget.IntegerTextbox, {mixInProperties:function (localProperties, frag) { + dojo.widget.CurrencyTextbox.superclass.mixInProperties.apply(this, arguments); + if (localProperties.fractional) { + this.flags.fractional = (localProperties.fractional == "true"); + } else { + if (localProperties.cents) { + dojo.deprecated("dojo.widget.IntegerTextbox", "use fractional attr instead of cents", "0.5"); + this.flags.fractional = (localProperties.cents == "true"); + } + } + if (localProperties.symbol) { + this.flags.symbol = localProperties.symbol; + } + if (localProperties.min) { + this.flags.min = parseFloat(localProperties.min); + } + if (localProperties.max) { + this.flags.max = parseFloat(localProperties.max); + } +}, isValid:function () { + return dojo.validate.isCurrency(this.textbox.value, this.flags); +}, isInRange:function () { + return dojo.validate.isInRange(this.textbox.value, this.flags); +}}); + Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/CurrencyTextbox.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/CurrencyTextbox.js ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/external/trunk/geronimo-dojo-0.4.3/src/main/webapp/src/widget/CurrencyTextbox.js ------------------------------------------------------------------------------ svn:mime-type = text/plain