You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/08/19 00:33:00 UTC
svn commit: r432754 [28/28] - in
/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource:
./ src/ src/animation/ src/collections/ src/compat/ src/crypto/ src/data/
src/data/format/ src/data/provider/ src/debug/ s...
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/vml/Chart.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/vml/Chart.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/vml/Chart.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/widget/vml/Chart.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,426 @@
+/*
+ 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.vml.Chart");
+
+dojo.require("dojo.widget.HtmlWidget");
+dojo.require("dojo.widget.Chart");
+dojo.require("dojo.math");
+dojo.require("dojo.html");
+//dojo.require("dojo.vml");
+dojo.require("dojo.graphics.color");
+
+dojo.widget.vml.Chart=function(){
+ dojo.widget.Chart.call(this);
+ dojo.widget.HtmlWidget.call(this);
+};
+dojo.inherits(dojo.widget.vml.Chart, dojo.widget.HtmlWidget);
+dojo.lang.extend(dojo.widget.vml.Chart, {
+ // widget props
+ templatePath:null,
+ templateCssPath:null,
+
+ // state
+ _isInitialized:false,
+ hasData:false,
+
+ // chart props
+ vectorNode:null,
+ plotArea:null,
+ dataGroup:null,
+ axisGroup:null,
+
+ properties:{
+ height:400, // defaults, will resize to the domNode.
+ width:600,
+ plotType:null,
+ padding:{
+ top:10,
+ bottom:2,
+ left:60,
+ right:30
+ },
+ axes:{
+ x:{
+ plotAt:0,
+ label:"",
+ unitLabel:"",
+ unitType:Number,
+ nUnitsToShow:10,
+ range:{
+ min:0,
+ max:200
+ }
+ },
+ y:{
+ plotAt:0,
+ label:"",
+ unitLabel:"",
+ unitType:Number,
+ nUnitsToShow:10,
+ range:{
+ min:0,
+ max:200
+ }
+ }
+ }
+ },
+
+ fillInTemplate:function(args,frag){
+ this.initialize();
+ this.render();
+ },
+ parseData:function(){
+ },
+ initialize:function(){
+ // parse the data first.
+ this.parseData();
+
+ // render the body of the chart, not the chart data.
+ if(this.vectorNode){ this.destroy(); }
+ this.vectorNode=document.createElement("div");
+ this.vectorNode.style.width=this.properties.width+"px";
+ this.vectorNode.style.height=this.properties.height+"px";
+ this.vectorNode.style.position="relative";
+ this.domNode.appendChild(this.vectorNode);
+
+ var plotWidth=this.properties.width-this.properties.padding.left-this.properties.padding.right;
+ var plotHeight=this.properties.height-this.properties.padding.top-this.properties.padding.bottom;
+
+ this.plotArea=document.createElement("div");
+ this.plotArea.style.position="absolute";
+ this.plotArea.style.backgroundColor="#fff";
+ this.plotArea.style.top=(this.properties.padding.top)-2+"px";
+ this.plotArea.style.left=(this.properties.padding.left-1)+"px";
+ this.plotArea.style.width=plotWidth+"px";
+ this.plotArea.style.height=plotHeight+"px";
+ this.vectorNode.appendChild(this.plotArea);
+
+ this.dataGroup=document.createElement("div");
+ this.dataGroup.style.position="relative";
+ this.plotArea.appendChild(this.dataGroup);
+
+ // clipping rects, what a fucking pain.
+ var bg=this.domNode.style.backgroundColor;
+ var r=document.createElement("v:rect");
+ r.setAttribute("fillcolor", bg);
+ r.setAttribute("stroked", "false");
+ r.style.position="absolute";
+ r.style.top=(-1*this.properties.padding.top)-1+"px";
+ r.style.left=(-1*this.properties.padding.left)+"px";
+ r.style.width=(this.properties.width-3)+"px";
+ r.style.height=(this.properties.padding.top)-2+"px";
+ this.vectorNode.appendChild(r);
+
+ r=document.createElement("v:rect");
+ r.setAttribute("fillcolor", bg);
+ r.setAttribute("stroked", "false");
+ r.style.position="absolute";
+ r.style.top=plotHeight-2+"px";
+ r.style.left=(-1*this.properties.padding.left)+"px";
+ r.style.width=(this.properties.width-3)+"px";
+ r.style.height=(this.properties.padding.bottom)-2+"px"; // fixme: check this.
+ this.vectorNode.appendChild(r);
+
+ r=document.createElement("v:rect");
+ r.setAttribute("fillcolor", bg);
+ r.setAttribute("stroked", "false");
+ r.style.position="absolute";
+ r.style.top="-2px";
+ r.style.left=(-1*this.properties.padding.left)+"px";
+ r.style.width=(this.properties.padding.left-1)+"px";
+ r.style.height=plotHeight+"px";
+ this.vectorNode.appendChild(r);
+
+ r=document.createElement("v:rect");
+ r.setAttribute("fillcolor", bg);
+ r.setAttribute("stroked", "false");
+ r.style.position="absolute";
+ r.style.top="-2px";
+ r.style.right=(-1*this.properties.padding.right)+1+"px";
+ r.style.width=(this.properties.padding.right-1)+"px";
+ r.style.height=plotHeight+"px";
+ this.vectorNode.appendChild(r);
+ // end clipping rects. god that sucks, i wish VML had clipping outside of that crap vmlframe...
+
+ this.axisGroup=document.createElement("div");
+ this.axisGroup.style.position="relative";
+ this.plotArea.appendChild(this.axisGroup);
+
+ var stroke=1;
+
+ // x axis
+ var line=document.createElement("v:line");
+ var y=dojo.widget.vml.Chart.Plotter.getY(this.properties.axes.x.plotAt, this);
+ line.setAttribute("from", this.properties.padding.left-stroke + "," + y);
+ line.setAttribute("to", plotWidth + "," + y);
+ line.style.position="absolute";
+ line.style.antialias="false";
+ line.setAttribute("strokecolor", "#666");
+ line.setAttribute("strokeweight", stroke*2+"px");
+ this.axisGroup.appendChild(line);
+
+ // y axis
+ var line=document.createElement("v:line");
+ var y=dojo.widget.vml.Chart.Plotter.getX(this.properties.axes.y.plotAt, this);
+ line.setAttribute("from", y+","+this.properties.padding.top);
+ line.setAttribute("to", y+","+this.properties.height-this.properties.padding.bottom);
+ line.style.position="absolute";
+ line.style.antialias="false";
+ line.setAttribute("strokecolor", "#666");
+ line.setAttribute("strokeweight", stroke*2+"px");
+ this.axisGroup.appendChild(line);
+
+ // labels
+ var size=10;
+
+ // x axis labels.
+ var t=document.createElement("div");
+ t.style.position="absolute";
+ t.style.top=(this.properties.height-this.properties.padding.bottom+size+2)+"px";
+ t.style.left=this.properties.padding.left+"px";
+ t.style.fontFamily="sans-serif";
+ t.style.fontSize=size+"px";
+ t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.x.range.min),2);
+ this.axisGroup.appendChild(t);
+
+ t=document.createElement("div");
+ t.style.position="absolute";
+ t.style.top=(this.properties.height-this.properties.padding.bottom+size+2)+"px";
+ t.style.left=(this.properties.width-this.properties.padding.right-(size/2))+"px";
+ t.style.fontFamily="sans-serif";
+ t.style.fontSize=size+"px";
+ t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.x.range.max),2);
+ this.axisGroup.appendChild(t);
+
+ // y axis labels.
+ t=document.createElement("div");
+ t.style.position="absolute";
+ t.style.top=-1*(size/2)+"px";
+ t.style.right=(plotWidth+4)+"px";
+ t.style.fontFamily="sans-serif";
+ t.style.fontSize=size+"px";
+ t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.y.range.max),2);
+ this.axisGroup.appendChild(t);
+
+ t=document.createElement("div");
+ t.style.position="absolute";
+ t.style.top=(this.properties.height-this.properties.padding.bottom)+"px";
+ t.style.right=(plotWidth+4)+"px";
+ t.style.fontFamily="sans-serif";
+ t.style.fontSize=size+"px";
+ t.innerHTML=dojo.math.round(parseFloat(this.properties.axes.y.range.min),2);
+ this.axisGroup.appendChild(t);
+
+ // this is last.
+ this.assignColors();
+ this._isInitialized=true;
+ },
+ destroy:function(){
+ while(this.domNode.childNodes.length>0){
+ this.domNode.removeChild(this.domNode.childNodes[0]);
+ }
+ this.vectorNode=this.plotArea=this.dataGroup=this.axisGroup=null;
+ },
+ render:function(){
+ if (this.dataGroup){
+ while(this.dataGroup.childNodes.length>0){
+ this.dataGroup.removeChild(this.dataGroup.childNodes[0]);
+ }
+ } else {
+ this.initialize();
+ }
+ for(var i=0; i<this.series.length; i++){
+ dojo.widget.vml.Chart.Plotter.plot(this.series[i], this);
+ }
+ }
+});
+
+dojo.widget.vml.Chart.Plotter=new function(){
+ var _this=this;
+ var plotters = {};
+ var types=dojo.widget.Chart.PlotTypes;
+
+ this.getX=function(value, chart){
+ var v=parseFloat(value);
+ var min=chart.properties.axes.x.range.min;
+ var max=chart.properties.axes.x.range.max;
+ var ofst=0-min;
+ min+=ofst; max+=ofst; v+=ofst;
+
+ var xmin=chart.properties.padding.left;
+ var xmax=chart.properties.width-chart.properties.padding.right;
+ var x=(v*((xmax-xmin)/max))+xmin;
+ return x;
+ };
+ this.getY=function(value, chart){
+ var v=parseFloat(value);
+ var max=chart.properties.axes.y.range.max;
+ var min=chart.properties.axes.y.range.min;
+ var ofst=0;
+ if(min<0)ofst+=Math.abs(min);
+ min+=ofst; max+=ofst; v+=ofst;
+
+ var ymin=chart.properties.height-chart.properties.padding.bottom;
+ var ymax=chart.properties.padding.top;
+ var y=(((ymin-ymax)/(max-min))*(max-v))+ymax;
+ return y;
+ };
+
+ this.addPlotter=function(name, func){
+ plotters[name]=func;
+ };
+ this.plot=function(series, chart){
+ if (series.values.length==0) return;
+ if (series.plotType && plotters[series.plotType]){
+ return plotters[series.plotType](series, chart);
+ }
+ else if (chart.plotType && plotters[chart.plotType]){
+ return plotters[chart.plotType](series, chart);
+ }
+ };
+
+ // plotting
+ plotters[types.Bar]=function(series, chart){
+ var space=1;
+ var lastW = 0;
+ for (var i=0; i<series.values.length; i++){
+ var x=_this.getX(series.values[i].x, chart);
+ var w;
+ if (i==series.values.length-1){
+ w=lastW;
+ } else{
+ w=_this.getX(series.values[i+1].x, chart)-x-space;
+ lastW=w;
+ }
+ x-=(w/2);
+
+ var yA=_this.getY(chart.properties.axes.x.plotAt, chart);
+ var y=_this.getY(series.values[i].value, chart);
+ var h=Math.abs(yA-y);
+ if (parseFloat(series.values[i].value)<chart.properties.axes.x.plotAt){
+ var oy=yA;
+ yA=y;
+ y=oy;
+ }
+
+ var bar=document.createElement("v:rect");
+ bar.style.position="absolute";
+ bar.style.top=x+"px";
+ bar.style.left=y+"px";
+ bar.style.width=w+"px";
+ bar.style.height=h+"px";
+ bar.setAttribute("fillColor", series.color);
+ bar.setAttribute("title", series.label + ": " + series.values[i].value);
+ bar.setAttribute("coordsize", chart.properties.width + "," + chart.properties.height);
+ var fill=document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.9");
+ bar.appendChild(fill);
+ chart.dataGroup.appendChild(bar);
+ }
+ };
+ plotters[types.Line]=function(series, chart){
+ var tension=3;
+
+ var line=document.createElement("v:shape");
+ line.setAttribute("strokeweight", "2px");
+ line.setAttribute("strokecolor", series.color);
+ line.setAttribute("fillcolor", "none");
+ line.setAttribute("filled", "false");
+ line.setAttribute("title", series.label);
+ line.setAttribute("coordsize", chart.properties.width + "," + chart.properties.height);
+ line.style.position="absolute";
+ line.style.top="0px";
+ line.style.left="0px";
+ line.style.width= chart.properties.width+"px";
+ line.style.height=chart.properties.height+"px";
+ var stroke=document.createElement("v:stroke");
+ stroke.setAttribute("opacity", "0.85");
+ line.appendChild(stroke);
+
+ var path = [];
+ for (var i=0; i<series.values.length; i++){
+ var x = _this.getX(series.values[i].x, chart)
+ var y = _this.getY(series.values[i].value, chart);
+
+ if (i==0){
+ path.push("m");
+ path.push(x+","+y);
+ }else{
+ var lastx=_this.getX(series.values[i-1].x, chart);
+ var lasty=_this.getY(series.values[i-1].value, chart);
+ var dx=x-lastx;
+
+ path.push("v");
+ var cx=x-(tension-1)*(dx/tension);
+ path.push(cx+",0");
+ cx=x-(dx/tension);
+ path.push(cx+","+y-lasty);
+ path.push(dx, y-lasty);
+ }
+ }
+ line.setAttribute("path", path.join(" ")+" e");
+ chart.dataGroup.appendChild(line);
+ };
+ plotters[types.Scatter]=function(series, chart){
+ var r=8;
+ for (var i=0; i<series.values.length; i++){
+ var x=_this.getX(series.values[i].x, chart);
+ var y=_this.getY(series.values[i].value, chart);
+ var mod=r/2;
+
+ var point=document.createElement("v:rect");
+ point.setAttribute("fillcolor", series.color);
+ point.setAttribute("strokecolor", series.color);
+ point.setAttribute("title", series.label + ": " + series.values[i].value);
+ point.style.position="absolute";
+ point.style.rotation="45";
+ point.style.top=(y-mod)+"px";
+ point.style.left=(x-mod)+"px";
+ point.style.width=r+"px";
+ point.style.height=r+"px";
+ var fill=document.createElement("v:fill");
+ fill.setAttribute("opacity", "0.5");
+ point.appendChild(fill);
+ chart.dataGroup.appendChild(point);
+ }
+ };
+ plotters[types.Bubble]=function(series, chart){
+ // added param for series[n].value: size
+ var minR=1;
+
+ // do this off the x axis?
+ var min=chart.properties.axes.x.range.min;
+ var max=chart.properties.axes.x.range.max;
+ var ofst=0-min;
+
+ min+=ofst; max+=ofst;
+ var xmin=chart.properties.padding.left;
+ var xmax=chart.properties.width-chart.properties.padding.right;
+ var factor=(max-min)/(xmax-xmin)*25;
+
+ for (var i=0; i<series.values.length; i++){
+ var size = series.values[i].size;
+ if (isNaN(parseFloat(size))) size=minR;
+ var mod=(parseFloat(size)*factor)/2;
+
+ var point=document.createElement("v:oval");
+ point.setAttribute("strokecolor", series.color);
+ point.setAttribute("fillcolor", series.color);
+ point.setAttribute("title", series.label + ": " + series.values[i].value + " (" + size + ")");
+ point.style.position="absolute";
+ point.style.top=(_this.getY(series.values[i].value, chart)-mod) + "px";
+ point.style.left=(_this.getX(series.values[i].x, chart)-mod) + "px";
+ point.style.width=mod+"px";
+ point.style.height=mod+"px";
+ chart.dataGroup.appendChild(point);
+ }
+ };
+}();
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/Parse.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/Parse.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/Parse.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/Parse.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,188 @@
+/*
+ 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.xml.Parse");
+
+dojo.require("dojo.dom");
+
+//TODO: determine dependencies
+// currently has dependency on dojo.xml.DomUtil nodeTypes constants...
+
+/* generic method for taking a node and parsing it into an object
+
+TODO: WARNING: This comment is wrong!
+
+For example, the following xml fragment
+
+<foo bar="bar">
+ <baz xyzzy="xyzzy"/>
+</foo>
+
+can be described as:
+
+dojo.???.foo = {}
+dojo.???.foo.bar = {}
+dojo.???.foo.bar.value = "bar";
+dojo.???.foo.baz = {}
+dojo.???.foo.baz.xyzzy = {}
+dojo.???.foo.baz.xyzzy.value = "xyzzy"
+
+*/
+// using documentFragment nomenclature to generalize in case we don't want to require passing a collection of nodes with a single parent
+dojo.xml.Parse = function(){
+
+ function getDojoTagName (node) {
+ var tagName = node.tagName;
+ if (tagName.substr(0,5).toLowerCase() != "dojo:") {
+
+ if (tagName.substr(0,4).toLowerCase() == "dojo") {
+ // FIXME: this assuumes tag names are always lower case
+ return "dojo:" + tagName.substring(4).toLowerCase();
+ }
+
+ // allow lower-casing
+ var djt = node.getAttribute("dojoType") || node.getAttribute("dojotype");
+ if (djt) { return "dojo:" + djt.toLowerCase(); }
+
+ if (node.getAttributeNS && node.getAttributeNS(dojo.dom.dojoml,"type")) {
+ return "dojo:" + node.getAttributeNS(dojo.dom.dojoml,"type").toLowerCase();
+ }
+ try {
+ // FIXME: IE really really doesn't like this, so we squelch
+ // errors for it
+ djt = node.getAttribute("dojo:type");
+ } catch (e) { /* FIXME: log? */ }
+
+ if (djt) { return "dojo:"+djt.toLowerCase(); }
+
+ if (!dj_global["djConfig"] || !djConfig["ignoreClassNames"]) {
+ // FIXME: should we make this optionally enabled via djConfig?
+ var classes = node.className||node.getAttribute("class");
+ // FIXME: following line, without check for existence of classes.indexOf
+ // breaks firefox 1.5's svg widgets
+ if (classes && classes.indexOf && classes.indexOf("dojo-") != -1) {
+ var aclasses = classes.split(" ");
+ for(var x=0; x<aclasses.length; x++){
+ if (aclasses[x].length > 5 && aclasses[x].indexOf("dojo-") >= 0) {
+ return "dojo:"+aclasses[x].substr(5).toLowerCase();
+ }
+ }
+ }
+ }
+
+ }
+ return tagName.toLowerCase();
+ }
+
+ this.parseElement = function(node, hasParentNodeSet, optimizeForDojoML, thisIdx){
+
+ // if parseWidgets="false" don't search inside this node for widgets
+ if (node.getAttribute("parseWidgets") == "false") {
+ return {};
+ }
+
+ // TODO: make this namespace aware
+ var parsedNodeSet = {};
+
+ var tagName = getDojoTagName(node);
+ parsedNodeSet[tagName] = [];
+ if((!optimizeForDojoML)||(tagName.substr(0,4).toLowerCase()=="dojo")){
+ var attributeSet = parseAttributes(node);
+ for(var attr in attributeSet){
+ if((!parsedNodeSet[tagName][attr])||(typeof parsedNodeSet[tagName][attr] != "array")){
+ parsedNodeSet[tagName][attr] = [];
+ }
+ parsedNodeSet[tagName][attr].push(attributeSet[attr]);
+ }
+
+ // FIXME: we might want to make this optional or provide cloning instead of
+ // referencing, but for now, we include a node reference to allow
+ // instantiated components to figure out their "roots"
+ parsedNodeSet[tagName].nodeRef = node;
+ parsedNodeSet.tagName = tagName;
+ parsedNodeSet.index = thisIdx||0;
+ }
+
+ var count = 0;
+ var tcn, i = 0, nodes = node.childNodes;
+ while(tcn = nodes[i++]){
+ switch(tcn.nodeType){
+ case dojo.dom.ELEMENT_NODE: // element nodes, call this function recursively
+ count++;
+ var ctn = getDojoTagName(tcn);
+ if(!parsedNodeSet[ctn]){
+ parsedNodeSet[ctn] = [];
+ }
+ parsedNodeSet[ctn].push(this.parseElement(tcn, true, optimizeForDojoML, count));
+ if( (tcn.childNodes.length == 1)&&
+ (tcn.childNodes.item(0).nodeType == dojo.dom.TEXT_NODE)){
+ parsedNodeSet[ctn][parsedNodeSet[ctn].length-1].value = tcn.childNodes.item(0).nodeValue;
+ }
+ break;
+ case dojo.dom.TEXT_NODE: // if a single text node is the child, treat it as an attribute
+ if(node.childNodes.length == 1) {
+ parsedNodeSet[tagName].push({ value: node.childNodes.item(0).nodeValue });
+ }
+ break;
+ default: break;
+ /*
+ case dojo.dom.ATTRIBUTE_NODE: // attribute node... not meaningful here
+ break;
+ case dojo.dom.CDATA_SECTION_NODE: // cdata section... not sure if this would ever be meaningful... might be...
+ break;
+ case dojo.dom.ENTITY_REFERENCE_NODE: // entity reference node... not meaningful here
+ break;
+ case dojo.dom.ENTITY_NODE: // entity node... not sure if this would ever be meaningful
+ break;
+ case dojo.dom.PROCESSING_INSTRUCTION_NODE: // processing instruction node... not meaningful here
+ break;
+ case dojo.dom.COMMENT_NODE: // comment node... not not sure if this would ever be meaningful
+ break;
+ case dojo.dom.DOCUMENT_NODE: // document node... not sure if this would ever be meaningful
+ break;
+ case dojo.dom.DOCUMENT_TYPE_NODE: // document type node... not meaningful here
+ break;
+ case dojo.dom.DOCUMENT_FRAGMENT_NODE: // document fragment node... not meaningful here
+ break;
+ case dojo.dom.NOTATION_NODE:// notation node... not meaningful here
+ break;
+ */
+ }
+ }
+ //return (hasParentNodeSet) ? parsedNodeSet[node.tagName] : parsedNodeSet;
+ return parsedNodeSet;
+ }
+
+ /* parses a set of attributes on a node into an object tree */
+ function parseAttributes(node) {
+ // TODO: make this namespace aware
+ var parsedAttributeSet = {};
+ var atts = node.attributes;
+ // TODO: should we allow for duplicate attributes at this point...
+ // would any of the relevant dom implementations even allow this?
+ var attnode, i=0;
+ while(attnode=atts[i++]) {
+ if((dojo.render.html.capable)&&(dojo.render.html.ie)){
+ if(!attnode){ continue; }
+ if( (typeof attnode == "object")&&
+ (typeof attnode.nodeValue == 'undefined')||
+ (attnode.nodeValue == null)||
+ (attnode.nodeValue == '')){
+ continue;
+ }
+ }
+ var nn = (attnode.nodeName.indexOf("dojo:") == -1) ? attnode.nodeName : attnode.nodeName.split("dojo:")[1];
+ parsedAttributeSet[nn] = {
+ value: attnode.nodeValue
+ };
+ }
+ return parsedAttributeSet;
+ }
+}
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/__package__.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/__package__.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/__package__.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/__package__.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,18 @@
+/*
+ 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.require("dojo.xml.Parse");
+dojo.kwCompoundRequire({
+ common: ["dojo.xml.domUtil"],
+ browser: ["dojo.xml.htmlUtil"],
+ dashboard: ["dojo.xml.htmlUtil"],
+ svg: ["dojo.xml.svgUtil"]
+});
+dojo.provide("dojo.xml.*");
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/domUtil.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/domUtil.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/domUtil.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/domUtil.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,84 @@
+/*
+ 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.xml.domUtil");
+dojo.require("dojo.graphics.color");
+dojo.require("dojo.dom");
+dojo.require("dojo.style");
+
+dojo.deprecated("dojo.xml.domUtil", "use dojo.dom instead", "0.4");
+
+// for loading script:
+dojo.xml.domUtil = new function(){
+ this.nodeTypes = {
+ ELEMENT_NODE : 1,
+ ATTRIBUTE_NODE : 2,
+ TEXT_NODE : 3,
+ CDATA_SECTION_NODE : 4,
+ ENTITY_REFERENCE_NODE : 5,
+ ENTITY_NODE : 6,
+ PROCESSING_INSTRUCTION_NODE : 7,
+ COMMENT_NODE : 8,
+ DOCUMENT_NODE : 9,
+ DOCUMENT_TYPE_NODE : 10,
+ DOCUMENT_FRAGMENT_NODE : 11,
+ NOTATION_NODE : 12
+ }
+
+ this.dojoml = "http://www.dojotoolkit.org/2004/dojoml";
+ this.idIncrement = 0;
+
+ this.getTagName = function(){return dojo.dom.getTagName.apply(dojo.dom, arguments);}
+ this.getUniqueId = function(){return dojo.dom.getUniqueId.apply(dojo.dom, arguments);}
+ this.getFirstChildTag = function() {return dojo.dom.getFirstChildElement.apply(dojo.dom, arguments);}
+ this.getLastChildTag = function() {return dojo.dom.getLastChildElement.apply(dojo.dom, arguments);}
+ this.getNextSiblingTag = function() {return dojo.dom.getNextSiblingElement.apply(dojo.dom, arguments);}
+ this.getPreviousSiblingTag = function() {return dojo.dom.getPreviousSiblingElement.apply(dojo.dom, arguments);}
+
+ this.forEachChildTag = function(node, unaryFunc) {
+ var child = this.getFirstChildTag(node);
+ while(child) {
+ if(unaryFunc(child) == "break") { break; }
+ child = this.getNextSiblingTag(child);
+ }
+ }
+
+ this.moveChildren = function() {return dojo.dom.moveChildren.apply(dojo.dom, arguments);}
+ this.copyChildren = function() {return dojo.dom.copyChildren.apply(dojo.dom, arguments);}
+ this.clearChildren = function() {return dojo.dom.removeChildren.apply(dojo.dom, arguments);}
+ this.replaceChildren = function() {return dojo.dom.replaceChildren.apply(dojo.dom, arguments);}
+
+ this.getStyle = function() {return dojo.style.getStyle.apply(dojo.style, arguments);}
+ this.toCamelCase = function() {return dojo.style.toCamelCase.apply(dojo.style, arguments);}
+ this.toSelectorCase = function() {return dojo.style.toSelectorCase.apply(dojo.style, arguments);}
+
+ this.getAncestors = function(){return dojo.dom.getAncestors.apply(dojo.dom, arguments);}
+ this.isChildOf = function() {return dojo.dom.isDescendantOf.apply(dojo.dom, arguments);}
+ this.createDocumentFromText = function() {return dojo.dom.createDocumentFromText.apply(dojo.dom, arguments);}
+
+ if(dojo.render.html.capable || dojo.render.svg.capable) {
+ this.createNodesFromText = function(txt, wrap){return dojo.dom.createNodesFromText.apply(dojo.dom, arguments);}
+ }
+
+ this.extractRGB = function(color) { return dojo.graphics.color.extractRGB(color); }
+ this.hex2rgb = function(hex) { return dojo.graphics.color.hex2rgb(hex); }
+ this.rgb2hex = function(r, g, b) { return dojo.graphics.color.rgb2hex(r, g, b); }
+
+ this.insertBefore = function() {return dojo.dom.insertBefore.apply(dojo.dom, arguments);}
+ this.before = this.insertBefore;
+ this.insertAfter = function() {return dojo.dom.insertAfter.apply(dojo.dom, arguments);}
+ this.after = this.insertAfter
+ this.insert = function(){return dojo.dom.insertAtPosition.apply(dojo.dom, arguments);}
+ this.insertAtIndex = function(){return dojo.dom.insertAtIndex.apply(dojo.dom, arguments);}
+ this.textContent = function () {return dojo.dom.textContent.apply(dojo.dom, arguments);}
+ this.renderedTextContent = function () {return dojo.dom.renderedTextContent.apply(dojo.dom, arguments);}
+ this.remove = function (node) {return dojo.dom.removeNode.apply(dojo.dom, arguments);}
+}
+
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/htmlUtil.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/htmlUtil.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/htmlUtil.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/htmlUtil.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,121 @@
+/*
+ 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.xml.htmlUtil");
+dojo.require("dojo.html");
+dojo.require("dojo.style");
+dojo.require("dojo.dom");
+
+dojo.deprecated("dojo.xml.htmlUtil", "use dojo.html instead", "0.4");
+
+dojo.xml.htmlUtil = new function(){
+ this.styleSheet = dojo.style.styleSheet;
+
+ this._clobberSelection = function(){return dojo.html.clearSelection.apply(dojo.html, arguments);}
+ this.disableSelect = function(){return dojo.html.disableSelection.apply(dojo.html, arguments);}
+ this.enableSelect = function(){return dojo.html.enableSelection.apply(dojo.html, arguments);}
+
+ this.getInnerWidth = function(){return dojo.style.getInnerWidth.apply(dojo.style, arguments);}
+
+ this.getOuterWidth = function(node){
+ dojo.unimplemented("dojo.xml.htmlUtil.getOuterWidth");
+ }
+
+ this.getInnerHeight = function(){return dojo.style.getInnerHeight.apply(dojo.style, arguments);}
+
+ this.getOuterHeight = function(node){
+ dojo.unimplemented("dojo.xml.htmlUtil.getOuterHeight");
+ }
+
+ this.getTotalOffset = function(){return dojo.style.getTotalOffset.apply(dojo.style, arguments);}
+ this.totalOffsetLeft = function(){return dojo.style.totalOffsetLeft.apply(dojo.style, arguments);}
+
+ this.getAbsoluteX = this.totalOffsetLeft;
+
+ this.totalOffsetTop = function(){return dojo.style.totalOffsetTop.apply(dojo.style, arguments);}
+
+ this.getAbsoluteY = this.totalOffsetTop;
+
+ this.getEventTarget = function(){return dojo.html.getEventTarget.apply(dojo.html, arguments);}
+ this.getScrollTop = function() {return dojo.html.getScrollTop.apply(dojo.html, arguments);}
+ this.getScrollLeft = function() {return dojo.html.getScrollLeft.apply(dojo.html, arguments);}
+
+ this.evtTgt = this.getEventTarget;
+
+ this.getParentOfType = function(){return dojo.html.getParentOfType.apply(dojo.html, arguments);}
+ this.getAttribute = function(){return dojo.html.getAttribute.apply(dojo.html, arguments);}
+ this.getAttr = function (node, attr) { // for backwards compat (may disappear!!!)
+ dojo.deprecated("dojo.xml.htmlUtil.getAttr", "use dojo.xml.htmlUtil.getAttribute instead", "0.4");
+ return dojo.xml.htmlUtil.getAttribute(node, attr);
+ }
+ this.hasAttribute = function(){return dojo.html.hasAttribute.apply(dojo.html, arguments);}
+
+ this.hasAttr = function (node, attr) { // for backwards compat (may disappear!!!)
+ dojo.deprecated("dojo.xml.htmlUtil.hasAttr", "use dojo.xml.htmlUtil.hasAttribute instead", "0.4");
+ return dojo.xml.htmlUtil.hasAttribute(node, attr);
+ }
+
+ this.getClass = function(){return dojo.html.getClass.apply(dojo.html, arguments)}
+ this.hasClass = function(){return dojo.html.hasClass.apply(dojo.html, arguments)}
+ this.prependClass = function(){return dojo.html.prependClass.apply(dojo.html, arguments)}
+ this.addClass = function(){return dojo.html.addClass.apply(dojo.html, arguments)}
+ this.setClass = function(){return dojo.html.setClass.apply(dojo.html, arguments)}
+ this.removeClass = function(){return dojo.html.removeClass.apply(dojo.html, arguments)}
+
+ // Enum type for getElementsByClass classMatchType arg:
+ this.classMatchType = {
+ ContainsAll : 0, // all of the classes are part of the node's class (default)
+ ContainsAny : 1, // any of the classes are part of the node's class
+ IsOnly : 2 // only all of the classes are part of the node's class
+ }
+
+ this.getElementsByClass = function() {return dojo.html.getElementsByClass.apply(dojo.html, arguments)}
+ this.getElementsByClassName = this.getElementsByClass;
+
+ this.setOpacity = function() {return dojo.style.setOpacity.apply(dojo.style, arguments)}
+ this.getOpacity = function() {return dojo.style.getOpacity.apply(dojo.style, arguments)}
+ this.clearOpacity = function() {return dojo.style.clearOpacity.apply(dojo.style, arguments)}
+
+ this.gravity = function(){return dojo.html.gravity.apply(dojo.html, arguments)}
+
+ this.gravity.NORTH = 1;
+ this.gravity.SOUTH = 1 << 1;
+ this.gravity.EAST = 1 << 2;
+ this.gravity.WEST = 1 << 3;
+
+ this.overElement = function(){return dojo.html.overElement.apply(dojo.html, arguments)}
+
+ this.insertCssRule = function(){return dojo.style.insertCssRule.apply(dojo.style, arguments)}
+
+ this.insertCSSRule = function(selector, declaration, index){
+ dojo.deprecated("dojo.xml.htmlUtil.insertCSSRule", "use dojo.style.insertCssRule instead", "0.4");
+ return dojo.xml.htmlUtil.insertCssRule(selector, declaration, index);
+ }
+
+ this.removeCssRule = function(){return dojo.style.removeCssRule.apply(dojo.style, arguments)}
+
+ this.removeCSSRule = function(index){
+ dojo.deprecated("dojo.xml.htmlUtil.removeCSSRule", "use dojo.xml.htmlUtil.removeCssRule instead", "0.4");
+ return dojo.xml.htmlUtil.removeCssRule(index);
+ }
+
+ this.insertCssFile = function(){return dojo.style.insertCssFile.apply(dojo.style, arguments)}
+
+ this.insertCSSFile = function(URI, doc, checkDuplicates){
+ dojo.deprecated("dojo.xml.htmlUtil.insertCSSFile", "use dojo.xml.htmlUtil.insertCssFile instead", "0.4");
+ return dojo.xml.htmlUtil.insertCssFile(URI, doc, checkDuplicates);
+ }
+
+ this.getBackgroundColor = function() {return dojo.style.getBackgroundColor.apply(dojo.style, arguments)}
+
+ this.getUniqueId = function() { return dojo.dom.getUniqueId(); }
+
+ this.getStyle = function() {return dojo.style.getStyle.apply(dojo.style, arguments)}
+}
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/svgUtil.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/svgUtil.js?rev=432754&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/svgUtil.js (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/dojo/resource/src/xml/svgUtil.js Fri Aug 18 15:32:37 2006
@@ -0,0 +1,32 @@
+/*
+ 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.xml.svgUtil");
+// FIXME: add imports for deps!
+
+dojo.xml.svgUtil = new function(){
+
+ this.getInnerWidth = function(node){
+ // FIXME: need to find out from dylan how to
+ }
+
+ this.getOuterWidth = function(node){
+
+ }
+
+ this.getInnerHeight = function(node){
+
+ }
+
+ this.getOuterHeight = function(node){
+
+ }
+
+}