You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/01/23 02:24:57 UTC
svn commit: r371434 [6/21] - in /jakarta/tapestry/trunk: ./ config/
examples/Workbench/src/context/WEB-INF/
framework/src/java/org/apache/tapestry/html/
framework/src/java/org/apache/tapestry/services/impl/ framework/src/js/
framework/src/js/dojo/ fram...
Added: jakarta/tapestry/trunk/framework/src/js/dojo/src/dnd/TreeDragAndDrop.js
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/dojo/src/dnd/TreeDragAndDrop.js?rev=371434&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/dojo/src/dnd/TreeDragAndDrop.js (added)
+++ jakarta/tapestry/trunk/framework/src/js/dojo/src/dnd/TreeDragAndDrop.js Sun Jan 22 17:23:23 2006
@@ -0,0 +1,446 @@
+/*
+ Copyright (c) 2004-2005, 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
+*/
+
+/**
+ * TreeDrag* specialized on managing subtree drags
+ * It selects nodes and visualises what's going on,
+ * but delegates real actions upon tree to the controller
+ *
+ * This code is considered a part of controller
+*/
+
+dojo.provide("dojo.dnd.TreeDragAndDrop");
+dojo.provide("dojo.dnd.TreeDragSource");
+dojo.provide("dojo.dnd.TreeDropTarget");
+
+dojo.require("dojo.dnd.HtmlDragAndDrop");
+dojo.require("dojo.lang.func");
+dojo.require("dojo.lang.array");
+dojo.require("dojo.lang.extras");
+
+dojo.dnd.TreeDragSource = function(node, syncController, type, treeNode){
+ this.controller = syncController;
+ this.treeNode = treeNode;
+
+ dojo.dnd.HtmlDragSource.call(this, node, type);
+}
+
+dojo.inherits(dojo.dnd.TreeDragSource, dojo.dnd.HtmlDragSource);
+
+dojo.lang.extend(dojo.dnd.TreeDragSource, {
+ onDragStart: function(){
+ /* extend adds functions to prototype */
+ var dragObject = dojo.dnd.HtmlDragSource.prototype.onDragStart.call(this);
+ //dojo.debugShallow(dragObject)
+
+ dragObject.treeNode = this.treeNode;
+
+ dragObject.onDragStart = dojo.lang.hitch(dragObject, function(e) {
+
+ /* save selection */
+ this.savedSelectedNode = this.treeNode.tree.selector.selectedNode;
+ if (this.savedSelectedNode) {
+ this.savedSelectedNode.unMarkSelected();
+ }
+
+ var result = dojo.dnd.HtmlDragObject.prototype.onDragStart.apply(this, arguments);
+
+ /* remove background grid from cloned object */
+ dojo.lang.forEach(
+ this.dragClone.getElementsByTagName('img'),
+ function(elem) { elem.style.backgroundImage='' }
+ );
+
+ return result;
+
+
+ });
+
+ dragObject.onDragEnd = function(e) {
+
+ /* restore selection */
+ if (this.savedSelectedNode) {
+ this.savedSelectedNode.markSelected();
+ }
+ //dojo.debug(e.dragStatus);
+
+ return dojo.dnd.HtmlDragObject.prototype.onDragEnd.apply(this, arguments);
+ }
+ //dojo.debug(dragObject.domNode.outerHTML)
+
+
+ return dragObject;
+ },
+
+ onDragEnd: function(e){
+
+
+ var res = dojo.dnd.HtmlDragSource.prototype.onDragEnd.call(this, e);
+
+
+ return res;
+ }
+});
+
+// .......................................
+
+dojo.dnd.TreeDropTarget = function(node, syncController, type, treeNode){
+
+ this.treeNode = treeNode;
+ this.controller = syncController; // I will sync-ly process drops
+
+ dojo.dnd.HtmlDropTarget.apply(this, [node, type]);
+
+}
+
+dojo.inherits(dojo.dnd.TreeDropTarget, dojo.dnd.HtmlDropTarget);
+
+dojo.lang.extend(dojo.dnd.TreeDropTarget, {
+
+ autoExpandDelay: 1500,
+ autoExpandTimer: null,
+
+ /**
+ * Check if I can drop sourceTreeNode here
+ * only tree node targets are implemented ATM
+ */
+ onDragOver: function(e){
+
+ var accepts = dojo.dnd.HtmlDropTarget.prototype.onDragOver.apply(this, arguments);
+
+ //dojo.debug("TreeDropTarget.onDragOver accepts:"+accepts)
+
+ if (accepts && this.treeNode.isFolder && !this.treeNode.isExpanded) {
+ this.setAutoExpandTimer();
+ }
+
+ return accepts;
+ },
+
+
+ setAutoExpandTimer: function() {
+ // set up autoexpand timer
+ var _this = this;
+ var autoExpand = function () {
+ if (dojo.dnd.dragManager.currentDropTarget === _this) {
+ _this.controller.expand(_this.treeNode);
+ }
+ }
+
+ this.autoExpandTimer = dojo.lang.setTimeout(autoExpand, _this.autoExpandDelay);
+ },
+
+
+ accepts: function(dragObjects) {
+
+ var accepts = dojo.dnd.HtmlDropTarget.prototype.accepts.apply(this, arguments);
+
+ if (!accepts) return false;
+
+ var sourceTreeNode = dragObjects[0].treeNode;
+
+ if (dojo.lang.isUndefined(sourceTreeNode) || !sourceTreeNode || !sourceTreeNode.isTreeNode) {
+ dojo.raise("Source is not TreeNode or not found");
+ }
+
+ return true;
+ },
+
+
+ onDragOut: function(e) {
+ this.clearAutoExpandTimer();
+ },
+
+
+ clearAutoExpandTimer: function() {
+ if (this.autoExpandTimer) {
+ clearTimeout(this.autoExpandTimer);
+ delete this.autoExpandTimer;
+ this.autoExpandTimer = null;
+ }
+ },
+
+ onDragMove: function(e, dragObjects){
+ }
+
+
+});
+
+
+dojo.dnd.TreeDropOntoTarget = function(node, syncController, type, treeNode){
+ dojo.dnd.TreeDropTarget.apply(this, arguments);
+}
+
+
+dojo.inherits(dojo.dnd.TreeDropOntoTarget, dojo.dnd.TreeDropTarget);
+
+
+dojo.lang.extend(dojo.dnd.TreeDropOntoTarget, {
+
+
+ accepts: function(dragObjects) {
+ //dojo.debug("TreeDropOntoTarget.accepts")
+
+ var accepts = dojo.dnd.TreeDropTarget.prototype.accepts.apply(this, arguments);
+
+ if (!accepts) return false;
+
+ // checked by parent call
+ var sourceTreeNode = dragObjects[0].treeNode;
+
+ // can't drop parent to child etc
+ accepts = this.controller.canChangeParent(sourceTreeNode, this.treeNode);
+
+ if (!accepts) return false;
+
+ // can't drag to same parent in onto mode
+ if (sourceTreeNode.parent === this.treeNode) {
+ return false;
+ }
+
+
+
+ //dojo.debug("Check2 "+acceptable)
+
+
+ return true;
+
+ },
+
+ onDragOver: function(e) {
+
+ // perform common DnD actions and learn whether the drop acceptable
+ var accepts = dojo.dnd.TreeDropTarget.prototype.onDragOver.apply(this, arguments);
+
+ //dojo.debug("TreeDropOntoTarget.onDragOver accepts:"+accepts)
+
+ if (!accepts) return false;
+
+ // mark current node being dragged into
+ this.treeNode.markSelected();
+
+
+ return true;
+
+ },
+
+ // called for all targets
+ onDragOut: function(e) {
+
+ dojo.dnd.TreeDropTarget.prototype.onDragOut.apply(this, arguments);
+
+ this.treeNode.unMarkSelected();
+ },
+
+
+ // called for accepted objects only
+ onDrop: function(e) {
+
+ this.onDragOut(e);
+
+ var sourceTreeNode = e.dragObject.treeNode;
+
+ return this.controller.processDrop(sourceTreeNode, this.treeNode, 0);
+ }
+
+
+});
+
+
+// .......................................
+
+
+dojo.dnd.TreeDropBetweenTarget = function(node, syncController, type, treeNode){
+ dojo.dnd.TreeDropTarget.apply(this, arguments);
+}
+
+
+dojo.inherits(dojo.dnd.TreeDropBetweenTarget, dojo.dnd.TreeDropTarget);
+
+
+dojo.lang.extend(dojo.dnd.TreeDropBetweenTarget, {
+
+ indicatorPosition: null,
+
+ indicatorStyle: "2px black solid",
+ indicatorVisible: false,
+
+
+ showIndicator: function(position) {
+
+ // do not change style too often, cause of blinking possible
+ if (this.indicatorPosition == position && this.indicatorVisible) {
+ return;
+ }
+
+ //dojo.debug(position)
+
+ this.hideIndicator();
+
+ this.indicatorPosition = position;
+ this.indicatorVisible = true;
+
+ if (position == "before") {
+ this.treeNode.labelNode.style.borderTop = this.indicatorStyle;
+ } else if (position == "after") {
+ this.treeNode.labelNode.style.borderBottom = this.indicatorStyle;
+ }
+
+
+ },
+
+ hideIndicator: function() {
+ this.indicatorVisible = false;
+ this.treeNode.labelNode.style.borderBottom="";
+ this.treeNode.labelNode.style.borderTop="";
+ },
+
+
+
+ // is the target possibly ok ?
+ // This function is run on dragOver, but drop possibility is also determined by position over node
+ // that's why acceptsWithPosition is called
+ // doesnt take index into account ( can change while moving mouse w/o changing target )
+ accepts: function(dragObjects) {
+ //dojo.debug("TreeDropBetweenTarget.accepts")
+
+ var accepts = dojo.dnd.TreeDropTarget.prototype.accepts.apply(this, arguments);
+
+ if (!accepts) return false;
+
+ // checked by parent call
+ var sourceTreeNode = dragObjects[0].treeNode;
+
+ // can't drop parent to child etc
+ accepts = this.controller.canChangeParent(sourceTreeNode, this.treeNode.parent);
+
+ if (!accepts) return false;
+
+
+ //dojo.debug("Check2 "+acceptable)
+
+
+ return true;
+
+ },
+
+
+ acceptsWithPosition: function(sourceNode, position) {
+ return !this.isAdjacentNode(sourceNode, position);
+ },
+
+
+ isAdjacentNode: function(sourceNode, position) {
+
+ if (sourceNode === this.treeNode) return true;
+ if (sourceNode.getNextSibling() === this.treeNode && position=="before") return true;
+ if (sourceNode.getPreviousSibling() === this.treeNode && position=="after") return true;
+
+ return false;
+ },
+
+
+ /**
+ * Check if I can drop sourceTreeNode here
+ * only tree node targets are implemented ATM
+ *
+ * returns true for nodes different from current node even if they are siblings.
+ */
+ onDragOver: function(e){
+
+ // perform common DnD actions and learn whether the drop acceptable
+ var accepts = dojo.dnd.TreeDropTarget.prototype.onDragOver.apply(this, arguments);
+
+ if (!accepts) return false;
+
+ return true;
+
+ },
+
+ getPosition: function(e) {
+ if (dojo.html.gravity(this.treeNode.labelNode, e) & dojo.html.gravity.NORTH) {
+ var position = "before";
+ } else {
+ var position = "after";
+ }
+
+ return position;
+ },
+
+
+ // only called if drop acceptable
+ onDragMove: function(e, dragObjects){
+
+ //dojo.debugShallow(dragObjects);
+
+ var position = this.getPosition(e);
+
+ var sourceTreeNode = dragObjects[0].treeNode;
+
+ if (this.acceptsWithPosition(sourceTreeNode, position)) {
+ this.showIndicator(position);
+ }
+
+ },
+
+ onDragOut: function(e) {
+ //dojo.debug("Out");
+
+ dojo.dnd.TreeDropTarget.prototype.onDragOut.apply(this, arguments);
+
+ this.hideIndicator();
+
+ //return dojo.dnd.HtmlDropTarget.prototype.onDragOut.call(this, e);
+ },
+
+
+ getTargetParentIndex: function(sourceTreeNode, position) {
+
+ var index = position == "before" ? this.treeNode.getParentIndex() : this.treeNode.getParentIndex()+1;
+ if (this.treeNode.parent === sourceTreeNode.parent
+ && this.treeNode.getParentIndex() > sourceTreeNode.getParentIndex()) {
+ index--; // dragging a node is different for simple changeParent bacause of before-after issues
+ }
+
+ return index;
+ },
+
+
+ onDrop: function(e){
+ this.onDragOut(e);
+
+ //dojo.debug('drop');
+
+ var sourceTreeNode = e.dragObject.treeNode;
+
+ if (!dojo.lang.isObject(sourceTreeNode)) {
+ dojo.raise("TreeNode not found in dragObject")
+ }
+
+
+ if (!this.acceptsWithPosition(sourceTreeNode, this.indicatorPosition)) {
+ return false;
+ }
+
+ // I don't check that trees are same! Target/source system deals with it
+
+ //tree.changeParentRemote(sourceTreeNode, targetTreeNode);
+ var index = this.getTargetParentIndex(sourceTreeNode, this.indicatorPosition);
+
+ //dojo.debug('drop2');
+
+ return this.controller.processDrop(sourceTreeNode, this.treeNode.parent, index);
+
+ },
+
+ toString: function() {
+ return "[TreeDropBetweenTarget "+this.treeNode+"]";
+ }
+});
Added: jakarta/tapestry/trunk/framework/src/js/dojo/src/dnd/__package__.js
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/dojo/src/dnd/__package__.js?rev=371434&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/dojo/src/dnd/__package__.js (added)
+++ jakarta/tapestry/trunk/framework/src/js/dojo/src/dnd/__package__.js Sun Jan 22 17:23:23 2006
@@ -0,0 +1,15 @@
+/*
+ Copyright (c) 2004-2005, 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.hostenv.conditionalLoadModule({
+ common: ["dojo.dnd.DragAndDrop"],
+ browser: ["dojo.dnd.HtmlDragAndDrop"]
+});
+dojo.hostenv.moduleLoaded("dojo.dnd.*");
Added: jakarta/tapestry/trunk/framework/src/js/dojo/src/dom.js
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/dojo/src/dom.js?rev=371434&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/dojo/src/dom.js (added)
+++ jakarta/tapestry/trunk/framework/src/js/dojo/src/dom.js Sun Jan 22 17:23:23 2006
@@ -0,0 +1,464 @@
+/*
+ Copyright (c) 2004-2005, 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.dom");
+dojo.require("dojo.lang.array");
+
+dojo.dom.ELEMENT_NODE = 1;
+dojo.dom.ATTRIBUTE_NODE = 2;
+dojo.dom.TEXT_NODE = 3;
+dojo.dom.CDATA_SECTION_NODE = 4;
+dojo.dom.ENTITY_REFERENCE_NODE = 5;
+dojo.dom.ENTITY_NODE = 6;
+dojo.dom.PROCESSING_INSTRUCTION_NODE = 7;
+dojo.dom.COMMENT_NODE = 8;
+dojo.dom.DOCUMENT_NODE = 9;
+dojo.dom.DOCUMENT_TYPE_NODE = 10;
+dojo.dom.DOCUMENT_FRAGMENT_NODE = 11;
+dojo.dom.NOTATION_NODE = 12;
+
+dojo.dom.dojoml = "http://www.dojotoolkit.org/2004/dojoml";
+
+/**
+ * comprehensive list of XML namespaces
+**/
+dojo.dom.xmlns = {
+ svg : "http://www.w3.org/2000/svg",
+ smil : "http://www.w3.org/2001/SMIL20/",
+ mml : "http://www.w3.org/1998/Math/MathML",
+ cml : "http://www.xml-cml.org",
+ xlink : "http://www.w3.org/1999/xlink",
+ xhtml : "http://www.w3.org/1999/xhtml",
+ xul : "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
+ xbl : "http://www.mozilla.org/xbl",
+ fo : "http://www.w3.org/1999/XSL/Format",
+ xsl : "http://www.w3.org/1999/XSL/Transform",
+ xslt : "http://www.w3.org/1999/XSL/Transform",
+ xi : "http://www.w3.org/2001/XInclude",
+ xforms : "http://www.w3.org/2002/01/xforms",
+ saxon : "http://icl.com/saxon",
+ xalan : "http://xml.apache.org/xslt",
+ xsd : "http://www.w3.org/2001/XMLSchema",
+ dt: "http://www.w3.org/2001/XMLSchema-datatypes",
+ xsi : "http://www.w3.org/2001/XMLSchema-instance",
+ rdf : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+ rdfs : "http://www.w3.org/2000/01/rdf-schema#",
+ dc : "http://purl.org/dc/elements/1.1/",
+ dcq: "http://purl.org/dc/qualifiers/1.0",
+ "soap-env" : "http://schemas.xmlsoap.org/soap/envelope/",
+ wsdl : "http://schemas.xmlsoap.org/wsdl/",
+ AdobeExtensions : "http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+};
+
+dojo.dom.isNode = function(wh){
+ if(typeof Element == "object") {
+ try {
+ return wh instanceof Element;
+ } catch(E) {}
+ } else {
+ // best-guess
+ return wh && !isNaN(wh.nodeType);
+ }
+}
+
+dojo.dom.getTagName = function(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(this.dojoml,"type"))){
+ return "dojo:" + node.getAttributeNS(this.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();
+}
+
+dojo.dom.getUniqueId = function(){
+ do {
+ var id = "dj_unique_" + (++arguments.callee._idIncrement);
+ }while(document.getElementById(id));
+ return id;
+}
+dojo.dom.getUniqueId._idIncrement = 0;
+
+dojo.dom.firstElement = dojo.dom.getFirstChildElement = function(parentNode, tagName){
+ var node = parentNode.firstChild;
+ while(node && node.nodeType != dojo.dom.ELEMENT_NODE){
+ node = node.nextSibling;
+ }
+ if(tagName && node && node.tagName && node.tagName.toLowerCase() != tagName.toLowerCase()) {
+ node = dojo.dom.nextElement(node, tagName);
+ }
+ return node;
+}
+
+dojo.dom.lastElement = dojo.dom.getLastChildElement = function(parentNode, tagName){
+ var node = parentNode.lastChild;
+ while(node && node.nodeType != dojo.dom.ELEMENT_NODE) {
+ node = node.previousSibling;
+ }
+ if(tagName && node && node.tagName && node.tagName.toLowerCase() != tagName.toLowerCase()) {
+ node = dojo.dom.prevElement(node, tagName);
+ }
+ return node;
+}
+
+dojo.dom.nextElement = dojo.dom.getNextSiblingElement = function(node, tagName){
+ if(!node) { return null; }
+ do {
+ node = node.nextSibling;
+ } while(node && node.nodeType != dojo.dom.ELEMENT_NODE);
+
+ if(node && tagName && tagName.toLowerCase() != node.tagName.toLowerCase()) {
+ return dojo.dom.nextElement(node, tagName);
+ }
+ return node;
+}
+
+dojo.dom.prevElement = dojo.dom.getPreviousSiblingElement = function(node, tagName){
+ if(!node) { return null; }
+ if(tagName) { tagName = tagName.toLowerCase(); }
+ do {
+ node = node.previousSibling;
+ } while(node && node.nodeType != dojo.dom.ELEMENT_NODE);
+
+ if(node && tagName && tagName.toLowerCase() != node.tagName.toLowerCase()) {
+ return dojo.dom.prevElement(node, tagName);
+ }
+ return node;
+}
+
+// TODO: hmph
+/*this.forEachChildTag = function(node, unaryFunc) {
+ var child = this.getFirstChildTag(node);
+ while(child) {
+ if(unaryFunc(child) == "break") { break; }
+ child = this.getNextSiblingTag(child);
+ }
+}*/
+
+dojo.dom.moveChildren = function(srcNode, destNode, trim){
+ var count = 0;
+ if(trim) {
+ while(srcNode.hasChildNodes() &&
+ srcNode.firstChild.nodeType == dojo.dom.TEXT_NODE) {
+ srcNode.removeChild(srcNode.firstChild);
+ }
+ while(srcNode.hasChildNodes() &&
+ srcNode.lastChild.nodeType == dojo.dom.TEXT_NODE) {
+ srcNode.removeChild(srcNode.lastChild);
+ }
+ }
+ while(srcNode.hasChildNodes()){
+ destNode.appendChild(srcNode.firstChild);
+ count++;
+ }
+ return count;
+}
+
+dojo.dom.copyChildren = function(srcNode, destNode, trim){
+ var clonedNode = srcNode.cloneNode(true);
+ return this.moveChildren(clonedNode, destNode, trim);
+}
+
+dojo.dom.removeChildren = function(node){
+ var count = node.childNodes.length;
+ while(node.hasChildNodes()){ node.removeChild(node.firstChild); }
+ return count;
+}
+
+dojo.dom.replaceChildren = function(node, newChild){
+ // FIXME: what if newChild is an array-like object?
+ dojo.dom.removeChildren(node);
+ node.appendChild(newChild);
+}
+
+dojo.dom.removeNode = function(node){
+ if(node && node.parentNode){
+ // return a ref to the removed child
+ return node.parentNode.removeChild(node);
+ }
+}
+
+dojo.dom.getAncestors = function(node, filterFunction, returnFirstHit) {
+ var ancestors = [];
+ var isFunction = dojo.lang.isFunction(filterFunction);
+ while(node) {
+ if (!isFunction || filterFunction(node)) {
+ ancestors.push(node);
+ }
+ if (returnFirstHit && ancestors.length > 0) { return ancestors[0]; }
+
+ node = node.parentNode;
+ }
+ if (returnFirstHit) { return null; }
+ return ancestors;
+}
+
+dojo.dom.getAncestorsByTag = function(node, tag, returnFirstHit) {
+ tag = tag.toLowerCase();
+ return dojo.dom.getAncestors(node, function(el){
+ return ((el.tagName)&&(el.tagName.toLowerCase() == tag));
+ }, returnFirstHit);
+}
+
+dojo.dom.getFirstAncestorByTag = function(node, tag) {
+ return dojo.dom.getAncestorsByTag(node, tag, true);
+}
+
+dojo.dom.isDescendantOf = function(node, ancestor, guaranteeDescendant){
+ // guaranteeDescendant allows us to be a "true" isDescendantOf function
+ if(guaranteeDescendant && node) { node = node.parentNode; }
+ while(node) {
+ if(node == ancestor){ return true; }
+ node = node.parentNode;
+ }
+ return false;
+}
+
+dojo.dom.innerXML = function(node){
+ if(node.innerXML){
+ return node.innerXML;
+ }else if(typeof XMLSerializer != "undefined"){
+ return (new XMLSerializer()).serializeToString(node);
+ }
+}
+
+dojo.dom.createDocumentFromText = function(str, mimetype){
+ if(!mimetype) { mimetype = "text/xml"; }
+ if(typeof DOMParser != "undefined") {
+ var parser = new DOMParser();
+ return parser.parseFromString(str, mimetype);
+ }else if(typeof ActiveXObject != "undefined"){
+ var domDoc = new ActiveXObject("Microsoft.XMLDOM");
+ if(domDoc) {
+ domDoc.async = false;
+ domDoc.loadXML(str);
+ return domDoc;
+ }else{
+ dojo.debug("toXml didn't work?");
+ }
+ /*
+ }else if((dojo.render.html.capable)&&(dojo.render.html.safari)){
+ // FIXME: this doesn't appear to work!
+ // from: http://web-graphics.com/mtarchive/001606.php
+ // var xml = '<?xml version="1.0"?>'+str;
+ var mtype = "text/xml";
+ var xml = '<?xml version="1.0"?>'+str;
+ var url = "data:"+mtype+";charset=utf-8,"+encodeURIComponent(xml);
+ var req = new XMLHttpRequest();
+ req.open("GET", url, false);
+ req.overrideMimeType(mtype);
+ req.send(null);
+ return req.responseXML;
+ */
+ }else if(document.createElement){
+ // FIXME: this may change all tags to uppercase!
+ var tmp = document.createElement("xml");
+ tmp.innerHTML = str;
+ if(document.implementation && document.implementation.createDocument) {
+ var xmlDoc = document.implementation.createDocument("foo", "", null);
+ for(var i = 0; i < tmp.childNodes.length; i++) {
+ xmlDoc.importNode(tmp.childNodes.item(i), true);
+ }
+ return xmlDoc;
+ }
+ // FIXME: probably not a good idea to have to return an HTML fragment
+ // FIXME: the tmp.doc.firstChild is as tested from IE, so it may not
+ // work that way across the board
+ return tmp.document && tmp.document.firstChild ?
+ tmp.document.firstChild : tmp;
+ }
+ return null;
+}
+
+dojo.dom.prependChild = function(node, parent) {
+ if(parent.firstChild) {
+ parent.insertBefore(node, parent.firstChild);
+ } else {
+ parent.appendChild(node);
+ }
+ return true;
+}
+
+dojo.dom.insertBefore = function(node, ref, force){
+ if (force != true &&
+ (node === ref || node.nextSibling === ref)){ return false; }
+ var parent = ref.parentNode;
+ parent.insertBefore(node, ref);
+ return true;
+}
+
+dojo.dom.insertAfter = function(node, ref, force){
+ var pn = ref.parentNode;
+ if(ref == pn.lastChild){
+ if((force != true)&&(node === ref)){
+ return false;
+ }
+ pn.appendChild(node);
+ }else{
+ return this.insertBefore(node, ref.nextSibling, force);
+ }
+ return true;
+}
+
+dojo.dom.insertAtPosition = function(node, ref, position){
+ if((!node)||(!ref)||(!position)){ return false; }
+ switch(position.toLowerCase()){
+ case "before":
+ return dojo.dom.insertBefore(node, ref);
+ case "after":
+ return dojo.dom.insertAfter(node, ref);
+ case "first":
+ if(ref.firstChild){
+ return dojo.dom.insertBefore(node, ref.firstChild);
+ }else{
+ ref.appendChild(node);
+ return true;
+ }
+ break;
+ default: // aka: last
+ ref.appendChild(node);
+ return true;
+ }
+}
+
+dojo.dom.insertAtIndex = function(node, containingNode, insertionIndex){
+ var siblingNodes = containingNode.childNodes;
+
+ // if there aren't any kids yet, just add it to the beginning
+
+ if (!siblingNodes.length){
+ containingNode.appendChild(node);
+ return true;
+ }
+
+ // otherwise we need to walk the childNodes
+ // and find our spot
+
+ var after = null;
+
+ for(var i=0; i<siblingNodes.length; i++){
+
+ var sibling_index = siblingNodes.item(i)["getAttribute"] ? parseInt(siblingNodes.item(i).getAttribute("dojoinsertionindex")) : -1;
+
+ if (sibling_index < insertionIndex){
+ after = siblingNodes.item(i);
+ }
+ }
+
+ if (after){
+ // add it after the node in {after}
+
+ return dojo.dom.insertAfter(node, after);
+ }else{
+ // add it to the start
+
+ return dojo.dom.insertBefore(node, siblingNodes.item(0));
+ }
+}
+
+/**
+ * implementation of the DOM Level 3 attribute.
+ *
+ * @param node The node to scan for text
+ * @param text Optional, set the text to this value.
+ */
+dojo.dom.textContent = function(node, text){
+ if (text) {
+ dojo.dom.replaceChildren(node, document.createTextNode(text));
+ return text;
+ } else {
+ var _result = "";
+ if (node == null) { return _result; }
+ for (var i = 0; i < node.childNodes.length; i++) {
+ switch (node.childNodes[i].nodeType) {
+ case 1: // ELEMENT_NODE
+ case 5: // ENTITY_REFERENCE_NODE
+ _result += dojo.dom.textContent(node.childNodes[i]);
+ break;
+ case 3: // TEXT_NODE
+ case 2: // ATTRIBUTE_NODE
+ case 4: // CDATA_SECTION_NODE
+ _result += node.childNodes[i].nodeValue;
+ break;
+ default:
+ break;
+ }
+ }
+ return _result;
+ }
+}
+
+dojo.dom.collectionToArray = function(collection){
+ dojo.deprecated("dojo.dom.collectionToArray", "use dojo.lang.toArray instead");
+ return dojo.lang.toArray(collection);
+}
+
+dojo.dom.hasParent = function(node) {
+ if(!node || !node.parentNode || (node.parentNode && !node.parentNode.tagName)) {
+ return false;
+ }
+ return true;
+}
+
+/**
+ * Determines if node has any of the provided tag names and
+ * returns the tag name that matches, empty string otherwise.
+ *
+ * Examples:
+ *
+ * myFooNode = <foo />
+ * isTag(myFooNode, "foo"); // returns "foo"
+ * isTag(myFooNode, "bar"); // returns ""
+ * isTag(myFooNode, "FOO"); // returns ""
+ * isTag(myFooNode, "hey", "foo", "bar"); // returns "foo"
+**/
+dojo.dom.isTag = function(node /* ... */) {
+ if(node && node.tagName) {
+ var arr = dojo.lang.toArray(arguments, 1);
+ return arr[ dojo.lang.find(node.tagName, arr) ] || "";
+ }
+ return "";
+}
Added: jakarta/tapestry/trunk/framework/src/js/dojo/src/event.js
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/dojo/src/event.js?rev=371434&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/dojo/src/event.js (added)
+++ jakarta/tapestry/trunk/framework/src/js/dojo/src/event.js Sun Jan 22 17:23:23 2006
@@ -0,0 +1,501 @@
+/*
+ Copyright (c) 2004-2005, 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.event");
+
+dojo.require("dojo.lang.array");
+dojo.require("dojo.lang.extras");
+
+dojo.event = new function(){
+ this.canTimeout = dojo.lang.isFunction(dj_global["setTimeout"])||dojo.lang.isAlien(dj_global["setTimeout"]);
+
+ // FIXME: where should we put this method (not here!)?
+ function interpolateArgs(args){
+ var dl = dojo.lang;
+ var ao = {
+ srcObj: dj_global,
+ srcFunc: null,
+ adviceObj: dj_global,
+ adviceFunc: null,
+ aroundObj: null,
+ aroundFunc: null,
+ adviceType: (args.length>2) ? args[0] : "after",
+ precedence: "last",
+ once: false,
+ delay: null,
+ rate: 0,
+ adviceMsg: false
+ };
+
+ switch(args.length){
+ case 0: return;
+ case 1: return;
+ case 2:
+ ao.srcFunc = args[0];
+ ao.adviceFunc = args[1];
+ break;
+ case 3:
+ if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isString(args[2]))){
+ ao.adviceType = "after";
+ ao.srcObj = args[0];
+ ao.srcFunc = args[1];
+ ao.adviceFunc = args[2];
+ }else if((dl.isString(args[1]))&&(dl.isString(args[2]))){
+ ao.srcFunc = args[1];
+ ao.adviceFunc = args[2];
+ }else if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isFunction(args[2]))){
+ ao.adviceType = "after";
+ ao.srcObj = args[0];
+ ao.srcFunc = args[1];
+ var tmpName = dojo.lang.nameAnonFunc(args[2], ao.adviceObj);
+ ao.adviceFunc = tmpName;
+ }else if((dl.isFunction(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))){
+ ao.adviceType = "after";
+ ao.srcObj = dj_global;
+ var tmpName = dojo.lang.nameAnonFunc(args[0], ao.srcObj);
+ ao.srcFunc = tmpName;
+ ao.adviceObj = args[1];
+ ao.adviceFunc = args[2];
+ }
+ break;
+ case 4:
+ if((dl.isObject(args[0]))&&(dl.isObject(args[2]))){
+ // we can assume that we've got an old-style "connect" from
+ // the sigslot school of event attachment. We therefore
+ // assume after-advice.
+ ao.adviceType = "after";
+ ao.srcObj = args[0];
+ ao.srcFunc = args[1];
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else if((dl.isString(args[0]))&&(dl.isString(args[1]))&&(dl.isObject(args[2]))){
+ ao.adviceType = args[0];
+ ao.srcObj = dj_global;
+ ao.srcFunc = args[1];
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else if((dl.isString(args[0]))&&(dl.isFunction(args[1]))&&(dl.isObject(args[2]))){
+ ao.adviceType = args[0];
+ ao.srcObj = dj_global;
+ var tmpName = dojo.lang.nameAnonFunc(args[1], dj_global);
+ ao.srcFunc = tmpName;
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else if(dl.isObject(args[1])){
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ ao.adviceObj = dj_global;
+ ao.adviceFunc = args[3];
+ }else if(dl.isObject(args[2])){
+ ao.srcObj = dj_global;
+ ao.srcFunc = args[1];
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else{
+ ao.srcObj = ao.adviceObj = ao.aroundObj = dj_global;
+ ao.srcFunc = args[1];
+ ao.adviceFunc = args[2];
+ ao.aroundFunc = args[3];
+ }
+ break;
+ case 6:
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ ao.adviceObj = args[3]
+ ao.adviceFunc = args[4];
+ ao.aroundFunc = args[5];
+ ao.aroundObj = dj_global;
+ break;
+ default:
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ ao.adviceObj = args[3]
+ ao.adviceFunc = args[4];
+ ao.aroundObj = args[5];
+ ao.aroundFunc = args[6];
+ ao.once = args[7];
+ ao.delay = args[8];
+ ao.rate = args[9];
+ ao.adviceMsg = args[10];
+ break;
+ }
+
+ if((typeof ao.srcFunc).toLowerCase() != "string"){
+ ao.srcFunc = dojo.lang.getNameInObj(ao.srcObj, ao.srcFunc);
+ }
+
+ if((typeof ao.adviceFunc).toLowerCase() != "string"){
+ ao.adviceFunc = dojo.lang.getNameInObj(ao.adviceObj, ao.adviceFunc);
+ }
+
+ if((ao.aroundObj)&&((typeof ao.aroundFunc).toLowerCase() != "string")){
+ ao.aroundFunc = dojo.lang.getNameInObj(ao.aroundObj, ao.aroundFunc);
+ }
+
+ if(!ao.srcObj){
+ dojo.raise("bad srcObj for srcFunc: "+ao.srcFunc);
+ }
+ if(!ao.adviceObj){
+ dojo.raise("bad adviceObj for adviceFunc: "+ao.adviceFunc);
+ }
+ return ao;
+ }
+
+ this.connect = function(){
+ var ao = interpolateArgs(arguments);
+
+ // FIXME: just doing a "getForMethod()" seems to be enough to put this into infinite recursion!!
+ var mjp = dojo.event.MethodJoinPoint.getForMethod(ao.srcObj, ao.srcFunc);
+ if(ao.adviceFunc){
+ var mjp2 = dojo.event.MethodJoinPoint.getForMethod(ao.adviceObj, ao.adviceFunc);
+ }
+
+ mjp.kwAddAdvice(ao);
+
+ return mjp; // advanced users might want to fsck w/ the join point
+ // manually
+ }
+
+ this.connectBefore = function() {
+ var args = ["before"];
+ for(var i = 0; i < arguments.length; i++) { args.push(arguments[i]); }
+ return this.connect.apply(this, args);
+ }
+
+ this.connectAround = function() {
+ var args = ["around"];
+ for(var i = 0; i < arguments.length; i++) { args.push(arguments[i]); }
+ return this.connect.apply(this, args);
+ }
+
+ this._kwConnectImpl = function(kwArgs, disconnect){
+ var fn = (disconnect) ? "disconnect" : "connect";
+ if(typeof kwArgs["srcFunc"] == "function"){
+ kwArgs.srcObj = kwArgs["srcObj"]||dj_global;
+ var tmpName = dojo.lang.nameAnonFunc(kwArgs.srcFunc, kwArgs.srcObj);
+ kwArgs.srcFunc = tmpName;
+ }
+ if(typeof kwArgs["adviceFunc"] == "function"){
+ kwArgs.adviceObj = kwArgs["adviceObj"]||dj_global;
+ var tmpName = dojo.lang.nameAnonFunc(kwArgs.adviceFunc, kwArgs.adviceObj);
+ kwArgs.adviceFunc = tmpName;
+ }
+ return dojo.event[fn]( (kwArgs["type"]||kwArgs["adviceType"]||"after"),
+ kwArgs["srcObj"]||dj_global,
+ kwArgs["srcFunc"],
+ kwArgs["adviceObj"]||kwArgs["targetObj"]||dj_global,
+ kwArgs["adviceFunc"]||kwArgs["targetFunc"],
+ kwArgs["aroundObj"],
+ kwArgs["aroundFunc"],
+ kwArgs["once"],
+ kwArgs["delay"],
+ kwArgs["rate"],
+ kwArgs["adviceMsg"]||false );
+ }
+
+ this.kwConnect = function(kwArgs){
+ return this._kwConnectImpl(kwArgs, false);
+
+ }
+
+ this.disconnect = function(){
+ var ao = interpolateArgs(arguments);
+ if(!ao.adviceFunc){ return; } // nothing to disconnect
+ var mjp = dojo.event.MethodJoinPoint.getForMethod(ao.srcObj, ao.srcFunc);
+ return mjp.removeAdvice(ao.adviceObj, ao.adviceFunc, ao.adviceType, ao.once);
+ }
+
+ this.kwDisconnect = function(kwArgs){
+ return this._kwConnectImpl(kwArgs, true);
+ }
+}
+
+// exactly one of these is created whenever a method with a joint point is run,
+// if there is at least one 'around' advice.
+dojo.event.MethodInvocation = function(join_point, obj, args) {
+ this.jp_ = join_point;
+ this.object = obj;
+ this.args = [];
+ for(var x=0; x<args.length; x++){
+ this.args[x] = args[x];
+ }
+ // the index of the 'around' that is currently being executed.
+ this.around_index = -1;
+}
+
+dojo.event.MethodInvocation.prototype.proceed = function() {
+ this.around_index++;
+ if(this.around_index >= this.jp_.around.length){
+ return this.jp_.object[this.jp_.methodname].apply(this.jp_.object, this.args);
+ // return this.jp_.run_before_after(this.object, this.args);
+ }else{
+ var ti = this.jp_.around[this.around_index];
+ var mobj = ti[0]||dj_global;
+ var meth = ti[1];
+ return mobj[meth].call(mobj, this);
+ }
+}
+
+
+dojo.event.MethodJoinPoint = function(obj, methname){
+ this.object = obj||dj_global;
+ this.methodname = methname;
+ this.methodfunc = this.object[methname];
+ this.before = [];
+ this.after = [];
+ this.around = [];
+}
+
+dojo.event.MethodJoinPoint.getForMethod = function(obj, methname) {
+ // if(!(methname in obj)){
+ if(!obj){ obj = dj_global; }
+ if(!obj[methname]){
+ // supply a do-nothing method implementation
+ obj[methname] = function(){};
+ }else if((!dojo.lang.isFunction(obj[methname]))&&(!dojo.lang.isAlien(obj[methname]))){
+ return null; // FIXME: should we throw an exception here instead?
+ }
+ // we hide our joinpoint instance in obj[methname + '$joinpoint']
+ var jpname = methname + "$joinpoint";
+ var jpfuncname = methname + "$joinpoint$method";
+ var joinpoint = obj[jpname];
+ if(!joinpoint){
+ var isNode = false;
+ if(dojo.event["browser"]){
+ if( (obj["attachEvent"])||
+ (obj["nodeType"])||
+ (obj["addEventListener"]) ){
+ isNode = true;
+ dojo.event.browser.addClobberNodeAttrs(obj, [jpname, jpfuncname, methname]);
+ }
+ }
+ obj[jpfuncname] = obj[methname];
+ // joinpoint = obj[jpname] = new dojo.event.MethodJoinPoint(obj, methname);
+ joinpoint = obj[jpname] = new dojo.event.MethodJoinPoint(obj, jpfuncname);
+ obj[methname] = function(){
+ var args = [];
+
+ if((isNode)&&(!arguments.length)){
+ var evt = null;
+ try {
+ if(obj.ownerDocument) {
+ evt = obj.ownerDocument.parentWindow.event;
+ } else if(obj.documentElement) {
+ evt = obj.documentElement.ownerDocument.parentWindow.event;
+ } else {
+ evt = window.event;
+ }
+ } catch(E) {
+ evt = window.event;
+ }
+
+ if(evt) {
+ args.push(dojo.event.browser.fixEvent(evt));
+ }
+ }else{
+ for(var x=0; x<arguments.length; x++){
+ if((x==0)&&(isNode)&&(dojo.event.browser.isEvent(arguments[x]))){
+ args.push(dojo.event.browser.fixEvent(arguments[x]));
+ }else{
+ args.push(arguments[x]);
+ }
+ }
+ }
+ // return joinpoint.run.apply(joinpoint, arguments);
+ return joinpoint.run.apply(joinpoint, args);
+ }
+ }
+ return joinpoint;
+}
+
+dojo.lang.extend(dojo.event.MethodJoinPoint, {
+ unintercept: function() {
+ this.object[this.methodname] = this.methodfunc;
+ },
+
+ run: function() {
+ var obj = this.object||dj_global;
+ var args = arguments;
+
+ // optimization. We only compute once the array version of the arguments
+ // pseudo-arr in order to prevent building it each time advice is unrolled.
+ var aargs = [];
+ for(var x=0; x<args.length; x++){
+ aargs[x] = args[x];
+ }
+
+ var unrollAdvice = function(marr){
+ if(!marr){
+ dojo.debug("Null argument to unrollAdvice()");
+ return;
+ }
+
+ var callObj = marr[0]||dj_global;
+ var callFunc = marr[1];
+
+ if(!callObj[callFunc]){
+ dojo.raise("function \"" + callFunc + "\" does not exist on \"" + callObj + "\"");
+ }
+
+ var aroundObj = marr[2]||dj_global;
+ var aroundFunc = marr[3];
+ var msg = marr[6];
+ var undef;
+
+ var to = {
+ args: [],
+ jp_: this,
+ object: obj,
+ proceed: function(){
+ return callObj[callFunc].apply(callObj, to.args);
+ }
+ };
+ to.args = aargs;
+
+ var delay = parseInt(marr[4]);
+ var hasDelay = ((!isNaN(delay))&&(marr[4]!==null)&&(typeof marr[4] != "undefined"));
+ if(marr[5]){
+ var rate = parseInt(marr[5]);
+ var cur = new Date();
+ var timerSet = false;
+ if((marr["last"])&&((cur-marr.last)<=rate)){
+ if(dojo.event.canTimeout){
+ if(marr["delayTimer"]){
+ clearTimeout(marr.delayTimer);
+ }
+ var tod = parseInt(rate*2); // is rate*2 naive?
+ var mcpy = dojo.lang.shallowCopy(marr);
+ marr.delayTimer = setTimeout(function(){
+ // FIXME: on IE at least, event objects from the
+ // browser can go out of scope. How (or should?) we
+ // deal with it?
+ mcpy[5] = 0;
+ unrollAdvice(mcpy);
+ }, tod);
+ }
+ return;
+ }else{
+ marr.last = cur;
+ }
+ }
+
+ // FIXME: need to enforce rates for a connection here!
+
+ if(aroundFunc){
+ // NOTE: around advice can't delay since we might otherwise depend
+ // on execution order!
+ aroundObj[aroundFunc].call(aroundObj, to);
+ }else{
+ // var tmjp = dojo.event.MethodJoinPoint.getForMethod(obj, methname);
+ if((hasDelay)&&((dojo.render.html)||(dojo.render.svg))){ // FIXME: the render checks are grotty!
+ dj_global["setTimeout"](function(){
+ if(msg){
+ callObj[callFunc].call(callObj, to);
+ }else{
+ callObj[callFunc].apply(callObj, args);
+ }
+ }, delay);
+ }else{ // many environments can't support delay!
+ if(msg){
+ callObj[callFunc].call(callObj, to);
+ }else{
+ callObj[callFunc].apply(callObj, args);
+ }
+ }
+ }
+ }
+
+ if(this.before.length>0){
+ dojo.lang.forEach(this.before, unrollAdvice, true);
+ }
+
+ var result;
+ if(this.around.length>0){
+ var mi = new dojo.event.MethodInvocation(this, obj, args);
+ result = mi.proceed();
+ }else if(this.methodfunc){
+ result = this.object[this.methodname].apply(this.object, args);
+ }
+
+ if(this.after.length>0){
+ dojo.lang.forEach(this.after, unrollAdvice, true);
+ }
+
+ return (this.methodfunc) ? result : null;
+ },
+
+ getArr: function(kind){
+ var arr = this.after;
+ // FIXME: we should be able to do this through props or Array.in()
+ if((typeof kind == "string")&&(kind.indexOf("before")!=-1)){
+ arr = this.before;
+ }else if(kind=="around"){
+ arr = this.around;
+ }
+ return arr;
+ },
+
+ kwAddAdvice: function(args){
+ this.addAdvice( args["adviceObj"], args["adviceFunc"],
+ args["aroundObj"], args["aroundFunc"],
+ args["adviceType"], args["precedence"],
+ args["once"], args["delay"], args["rate"],
+ args["adviceMsg"]);
+ },
+
+ addAdvice: function( thisAdviceObj, thisAdvice,
+ thisAroundObj, thisAround,
+ advice_kind, precedence,
+ once, delay, rate, asMessage){
+ var arr = this.getArr(advice_kind);
+ if(!arr){
+ dojo.raise("bad this: " + this);
+ }
+
+ var ao = [thisAdviceObj, thisAdvice, thisAroundObj, thisAround, delay, rate, asMessage];
+
+ if(once){
+ if(this.hasAdvice(thisAdviceObj, thisAdvice, advice_kind, arr) >= 0){
+ return;
+ }
+ }
+
+ if(precedence == "first"){
+ arr.unshift(ao);
+ }else{
+ arr.push(ao);
+ }
+ },
+
+ hasAdvice: function(thisAdviceObj, thisAdvice, advice_kind, arr){
+ if(!arr){ arr = this.getArr(advice_kind); }
+ var ind = -1;
+ for(var x=0; x<arr.length; x++){
+ if((arr[x][0] == thisAdviceObj)&&(arr[x][1] == thisAdvice)){
+ ind = x;
+ }
+ }
+ return ind;
+ },
+
+ removeAdvice: function(thisAdviceObj, thisAdvice, advice_kind, once){
+ var arr = this.getArr(advice_kind);
+ var ind = this.hasAdvice(thisAdviceObj, thisAdvice, advice_kind, arr);
+ if(ind == -1){
+ return false;
+ }
+ while(ind != -1){
+ arr.splice(ind, 1);
+ if(once){ break; }
+ ind = this.hasAdvice(thisAdviceObj, thisAdvice, advice_kind, arr);
+ }
+ return true;
+ }
+});
Added: jakarta/tapestry/trunk/framework/src/js/dojo/src/event/__package__.js
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/dojo/src/event/__package__.js?rev=371434&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/dojo/src/event/__package__.js (added)
+++ jakarta/tapestry/trunk/framework/src/js/dojo/src/event/__package__.js Sun Jan 22 17:23:23 2006
@@ -0,0 +1,15 @@
+/*
+ Copyright (c) 2004-2005, 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.hostenv.conditionalLoadModule({
+ common: ["dojo.event", "dojo.event.topic"],
+ browser: ["dojo.event.browser"]
+});
+dojo.hostenv.moduleLoaded("dojo.event.*");
Added: jakarta/tapestry/trunk/framework/src/js/dojo/src/event/browser.js
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/dojo/src/event/browser.js?rev=371434&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/dojo/src/event/browser.js (added)
+++ jakarta/tapestry/trunk/framework/src/js/dojo/src/event/browser.js Sun Jan 22 17:23:23 2006
@@ -0,0 +1,266 @@
+/*
+ Copyright (c) 2004-2005, 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.event.browser");
+dojo.require("dojo.event");
+
+dojo_ie_clobber = new function(){
+ this.clobberNodes = [];
+
+ function nukeProp(node, prop){
+ // try{ node.removeAttribute(prop); }catch(e){ /* squelch */ }
+ try{ node[prop] = null; }catch(e){ /* squelch */ }
+ try{ delete node[prop]; }catch(e){ /* squelch */ }
+ // FIXME: JotLive needs this, but I'm not sure if it's too slow or not
+ try{ node.removeAttribute(prop); }catch(e){ /* squelch */ }
+ }
+
+ this.clobber = function(nodeRef){
+ var na;
+ var tna;
+ if(nodeRef){
+ tna = nodeRef.getElementsByTagName("*");
+ na = [nodeRef];
+ for(var x=0; x<tna.length; x++){
+ // if we're gonna be clobbering the thing, at least make sure
+ // we aren't trying to do it twice
+ if(tna[x]["__doClobber__"]){
+ na.push(tna[x]);
+ }
+ }
+ }else{
+ try{ window.onload = null; }catch(e){}
+ na = (this.clobberNodes.length) ? this.clobberNodes : document.all;
+ }
+ tna = null;
+ var basis = {};
+ for(var i = na.length-1; i>=0; i=i-1){
+ var el = na[i];
+ if(el["__clobberAttrs__"]){
+ for(var j=0; j<el.__clobberAttrs__.length; j++){
+ nukeProp(el, el.__clobberAttrs__[j]);
+ }
+ nukeProp(el, "__clobberAttrs__");
+ nukeProp(el, "__doClobber__");
+ }
+ }
+ na = null;
+ }
+}
+
+if(dojo.render.html.ie){
+ window.onunload = function(){
+ dojo_ie_clobber.clobber();
+ try{
+ if((dojo["widget"])&&(dojo.widget["manager"])){
+ dojo.widget.manager.destroyAll();
+ }
+ }catch(e){}
+ try{ window.onload = null; }catch(e){}
+ try{ window.onunload = null; }catch(e){}
+ dojo_ie_clobber.clobberNodes = [];
+ // CollectGarbage();
+ }
+}
+
+dojo.event.browser = new function(){
+
+ var clobberIdx = 0;
+
+ this.clean = function(node){
+ if(dojo.render.html.ie){
+ dojo_ie_clobber.clobber(node);
+ }
+ }
+
+ this.addClobberNode = function(node){
+ if(!node["__doClobber__"]){
+ node.__doClobber__ = true;
+ dojo_ie_clobber.clobberNodes.push(node);
+ // this might not be the most efficient thing to do, but it's
+ // much less error prone than other approaches which were
+ // previously tried and failed
+ node.__clobberAttrs__ = [];
+ }
+ }
+
+ this.addClobberNodeAttrs = function(node, props){
+ this.addClobberNode(node);
+ for(var x=0; x<props.length; x++){
+ node.__clobberAttrs__.push(props[x]);
+ }
+ }
+
+ this.removeListener = function(node, evtName, fp, capture){
+ if(!capture){ var capture = false; }
+ evtName = evtName.toLowerCase();
+ if(evtName.substr(0,2)=="on"){ evtName = evtName.substr(2); }
+ // FIXME: this is mostly a punt, we aren't actually doing anything on IE
+ if(node.removeEventListener){
+ node.removeEventListener(evtName, fp, capture);
+ }
+ }
+
+ this.addListener = function(node, evtName, fp, capture, dontFix){
+ if(!node){ return; } // FIXME: log and/or bail?
+ if(!capture){ var capture = false; }
+ evtName = evtName.toLowerCase();
+ if(evtName.substr(0,2)!="on"){ evtName = "on"+evtName; }
+
+ if(!dontFix){
+ // build yet another closure around fp in order to inject fixEvent
+ // around the resulting event
+ var newfp = function(evt){
+ if(!evt){ evt = window.event; }
+ var ret = fp(dojo.event.browser.fixEvent(evt));
+ if(capture){
+ dojo.event.browser.stopEvent(evt);
+ }
+ return ret;
+ }
+ }else{
+ newfp = fp;
+ }
+
+ if(node.addEventListener){
+ node.addEventListener(evtName.substr(2), newfp, capture);
+ return newfp;
+ }else{
+ if(typeof node[evtName] == "function" ){
+ var oldEvt = node[evtName];
+ node[evtName] = function(e){
+ oldEvt(e);
+ return newfp(e);
+ }
+ }else{
+ node[evtName]=newfp;
+ }
+ if(dojo.render.html.ie){
+ this.addClobberNodeAttrs(node, [evtName]);
+ }
+ return newfp;
+ }
+ }
+
+ this.isEvent = function(obj){
+ // FIXME: event detection hack ... could test for additional attributes
+ // if necessary
+ return (typeof obj != "undefined")&&(typeof Event != "undefined")&&(obj.eventPhase);
+ // Event does not support instanceof in Opera, otherwise:
+ //return (typeof Event != "undefined")&&(obj instanceof Event);
+ }
+
+ this.currentEvent = null;
+
+ this.callListener = function(listener, curTarget){
+ if(typeof listener != 'function'){
+ dojo.raise("listener not a function: " + listener);
+ }
+ dojo.event.browser.currentEvent.currentTarget = curTarget;
+ return listener.call(curTarget, dojo.event.browser.currentEvent);
+ }
+
+ this.stopPropagation = function(){
+ dojo.event.browser.currentEvent.cancelBubble = true;
+ }
+
+ this.preventDefault = function(){
+ dojo.event.browser.currentEvent.returnValue = false;
+ }
+
+ this.keys = {
+ KEY_BACKSPACE: 8,
+ KEY_TAB: 9,
+ KEY_ENTER: 13,
+ KEY_SHIFT: 16,
+ KEY_CTRL: 17,
+ KEY_ALT: 18,
+ KEY_PAUSE: 19,
+ KEY_CAPS_LOCK: 20,
+ KEY_ESCAPE: 27,
+ KEY_SPACE: 32,
+ KEY_PAGE_UP: 33,
+ KEY_PAGE_DOWN: 34,
+ KEY_END: 35,
+ KEY_HOME: 36,
+ KEY_LEFT_ARROW: 37,
+ KEY_UP_ARROW: 38,
+ KEY_RIGHT_ARROW: 39,
+ KEY_DOWN_ARROW: 40,
+ KEY_INSERT: 45,
+ KEY_DELETE: 46,
+ KEY_LEFT_WINDOW: 91,
+ KEY_RIGHT_WINDOW: 92,
+ KEY_SELECT: 93,
+ KEY_F1: 112,
+ KEY_F2: 113,
+ KEY_F3: 114,
+ KEY_F4: 115,
+ KEY_F5: 116,
+ KEY_F6: 117,
+ KEY_F7: 118,
+ KEY_F8: 119,
+ KEY_F9: 120,
+ KEY_F10: 121,
+ KEY_F11: 122,
+ KEY_F12: 123,
+ KEY_NUM_LOCK: 144,
+ KEY_SCROLL_LOCK: 145
+ };
+
+ // reverse lookup
+ this.revKeys = [];
+ for(var key in this.keys){
+ this.revKeys[this.keys[key]] = key;
+ }
+
+ this.fixEvent = function(evt){
+ if((!evt)&&(window["event"])){
+ var evt = window.event;
+ }
+
+ if((evt["type"])&&(evt["type"].indexOf("key") == 0)){ // key events
+ evt.keys = this.revKeys;
+ // FIXME: how can we eliminate this iteration?
+ for(var key in this.keys) {
+ evt[key] = this.keys[key];
+ }
+ if((dojo.render.html.ie)&&(evt["type"] == "keypress")){
+ evt.charCode = evt.keyCode;
+ }
+ }
+
+ if(dojo.render.html.ie){
+ if(!evt.target){ evt.target = evt.srcElement; }
+ if(!evt.currentTarget){ evt.currentTarget = evt.srcElement; }
+ if(!evt.layerX){ evt.layerX = evt.offsetX; }
+ if(!evt.layerY){ evt.layerY = evt.offsetY; }
+ // mouseover
+ if(evt.fromElement){ evt.relatedTarget = evt.fromElement; }
+ // mouseout
+ if(evt.toElement){ evt.relatedTarget = evt.toElement; }
+ this.currentEvent = evt;
+ evt.callListener = this.callListener;
+ evt.stopPropagation = this.stopPropagation;
+ evt.preventDefault = this.preventDefault;
+ }
+ return evt;
+ }
+
+ this.stopEvent = function(ev) {
+ if(window.event){
+ ev.returnValue = false;
+ ev.cancelBubble = true;
+ }else{
+ ev.preventDefault();
+ ev.stopPropagation();
+ }
+ }
+}
Added: jakarta/tapestry/trunk/framework/src/js/dojo/src/event/topic.js
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/dojo/src/event/topic.js?rev=371434&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/dojo/src/event/topic.js (added)
+++ jakarta/tapestry/trunk/framework/src/js/dojo/src/event/topic.js Sun Jan 22 17:23:23 2006
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2004-2005, 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.event");
+dojo.provide("dojo.event.topic");
+
+dojo.event.topic = new function(){
+ this.topics = {};
+
+ this.getTopic = function(topicName){
+ if(!this.topics[topicName]){
+ this.topics[topicName] = new this.TopicImpl(topicName);
+ }
+ return this.topics[topicName];
+ }
+
+ this.registerPublisher = function(topic, obj, funcName){
+ var topic = this.getTopic(topic);
+ topic.registerPublisher(obj, funcName);
+ }
+
+ this.subscribe = function(topic, obj, funcName){
+ var topic = this.getTopic(topic);
+ topic.subscribe(obj, funcName);
+ }
+
+ this.unsubscribe = function(topic, obj, funcName){
+ var topic = this.getTopic(topic);
+ topic.unsubscribe(obj, funcName);
+ }
+
+ this.publish = function(topic, message){
+ var topic = this.getTopic(topic);
+ // if message is an array, we treat it as a set of arguments,
+ // otherwise, we just pass on the arguments passed in as-is
+ var args = [];
+ if(arguments.length == 2 && (dojo.lang.isArray(message) || message.callee)){
+ args = message;
+ }else{
+ var args = [];
+ for(var x=1; x<arguments.length; x++){
+ args.push(arguments[x]);
+ }
+ }
+ topic.sendMessage.apply(topic, args);
+ }
+}
+
+dojo.event.topic.TopicImpl = function(topicName){
+ this.topicName = topicName;
+ var self = this;
+
+ self.subscribe = function(listenerObject, listenerMethod){
+ var tf = listenerMethod||listenerObject;
+ var to = (!listenerMethod) ? dj_global : listenerObject;
+ dojo.event.kwConnect({
+ srcObj: self,
+ srcFunc: "sendMessage",
+ adviceObj: to,
+ adviceFunc: tf
+ });
+ }
+
+ self.unsubscribe = function(listenerObject, listenerMethod){
+ var tf = (!listenerMethod) ? listenerObject : listenerMethod;
+ var to = (!listenerMethod) ? null : listenerObject;
+ dojo.event.kwDisconnect({
+ srcObj: self,
+ srcFunc: "sendMessage",
+ adviceObj: to,
+ adviceFunc: tf
+ });
+ }
+
+ self.registerPublisher = function(publisherObject, publisherMethod){
+ dojo.event.connect(publisherObject, publisherMethod, self, "sendMessage");
+ }
+
+ self.sendMessage = function(message){
+ // The message has been propagated
+ }
+}
+
Added: jakarta/tapestry/trunk/framework/src/js/dojo/src/flash.js
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/dojo/src/flash.js?rev=371434&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/dojo/src/flash.js (added)
+++ jakarta/tapestry/trunk/framework/src/js/dojo/src/flash.js Sun Jan 22 17:23:23 2006
@@ -0,0 +1,703 @@
+/*
+ Copyright (c) 2004-2005, 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.flash");
+
+dojo.require("dojo.string.*");
+dojo.require("dojo.uri.*");
+
+/**
+ Provides an easy object for interacting with the Flash plugin. This
+ object provides methods to determine the current version of the Flash
+ plugin (dojo.flash.info); execute Flash instance methods
+ independent of the Flash version
+ being used (dojo.flash.comm); write out the necessary markup to
+ dynamically insert a Flash object into the page (dojo.flash.Embed; and
+ do dynamic installation and upgrading of the current Flash plugin in
+ use (dojo.flash.Install).
+
+ To use dojo.flash, you must first wait until Flash is finished loading
+ and initializing before you attempt communication or interaction.
+ To know when Flash is finished use dojo.event:
+
+ dojo.event.bind(dojo.flash, "loaded", myInstance, "myCallback");
+
+ Then, while the page is still loading provide the file name
+ and the major version of Flash that will be used for Flash/JavaScript
+ communication (see "Flash Communication" below for information on the
+ different kinds of Flash/JavaScript communication supported and how they
+ depend on the version of Flash installed):
+
+ dojo.flash.setSwf({flash8: "src/storage/storage_flash8.swf"});
+
+ This will cause dojo.flash to load and initialize your
+ Flash file "src/storage/storage_flash8.swf, and use the Flash 8
+ ExternalInterface for Flash/JavaScript communication.
+
+ If you want to use Flash 6 features for communication between
+ Flash and JavaScript, use the following:
+
+ dojo.flash.setSwf({flash6: "src/storage/storage_flash6.swf"});
+
+ Flash 6 is currently the best way to do Flash/JavaScript communication
+ (see the section "Flash Communication" below for further
+ details), but doesn't work on all browers. If you want dojo.flash to
+ pick the best way of communicating
+ based on the platform, specify Flash files for both forms of
+ communication:
+
+ dojo.flash.setSwf({flash6: "src/storage/storage_flash6.swf",
+ flash8: "src/storage/storage_flash8.swf"});
+
+ If no SWF files are specified, then Flash is not initialized.
+
+ Your Flash must use DojoExternalInterface to expose Flash methods and
+ to call JavaScript; see "Flash Communication" below for details.
+
+ setSwf can take an optional 'visible' attribute to control whether
+ the Flash file is visible or not; the default is visible:
+
+ dojo.flash.setSwf({flash6: "src/storage/storage_flash6.swf",
+ flash8: "src/storage/storage_flash8.swf",
+ visible: false});
+
+ Once finished, you can query Flash version information:
+
+ dojo.flash.info.version
+
+ Or can communicate with Flash methods that were exposed:
+
+ var results = dojo.flash.comm.sayHello("Some Message");
+
+ Only string values are currently supported.
+
+ -------------------
+ Flash Communication
+ -------------------
+
+ dojo.flash allows Flash/JavaScript communication in
+ a way that can pass large amounts of data back and forth reliably,
+ very fast, and with synchronous method calls. The dojo.flash
+ framework encapsulates the specific way in which this communication occurs,
+ presenting a common interface to JavaScript irrespective of the underlying
+ Flash version.
+
+ There are currently three major ways to do Flash/JavaScript communication
+ in the Flash community:
+
+ 1) Flash 6+ - Uses Flash methods, such as SetVariable and TCallLabel,
+ and the fscommand handler to do communication. Strengths: Very fast,
+ mature, and can send extremely large amounts of data; can do
+ synchronous method calls. Problems: Does not work on Safari; works on
+ Firefox/Mac OS X only if Flash 8 plugin is installed; cryptic to work with.
+
+ 2) Flash 8+ - Uses ExternalInterface, which provides a way for Flash
+ methods to register themselves for callbacks from JavaScript, and a way
+ for Flash to call JavaScript. Strengths: Works on Safari; elegant to
+ work with; can do synchronous method calls. Problems: Extremely buggy
+ (fails if there are new lines in the data, for example); two orders of
+ magnitude slower than the Flash 6+ method; locks up the browser while
+ it is communicating.
+
+ 3) Flash 6+ - Uses two seperate Flash applets, one that we
+ create over and over, passing input data into it using the PARAM tag,
+ which then uses a Flash LocalConnection to pass the data to the main Flash
+ applet; communication back to Flash is accomplished using a getURL
+ call with a javascript protocol handler, such as "javascript:myMethod()".
+ Strengths: the most cross browser, cross platform pre-Flash 8 method
+ of Flash communication known; works on Safari. Problems: Timing issues;
+ clunky and complicated; slow; can only send very small amounts of
+ data (several K); all method calls are asynchronous.
+
+ dojo.flash.comm uses only the first two methods. This framework
+ was created primarily for dojo.storage, which needs to pass very large
+ amounts of data synchronously and reliably across the Flash/JavaScript
+ boundary. We use the first method, the Flash 6 method, on all platforms
+ that support it, while using the Flash 8 ExternalInterface method
+ only on Safari with some special code to help correct ExternalInterface's
+ bugs.
+
+ Since dojo.flash needs to have two versions of the Flash
+ file it wants to generate, a Flash 6 and a Flash 8 version to gain
+ true cross-browser compatibility, several tools are provided to ease
+ development on the Flash side.
+
+ In your Flash file, if you want to expose Flash methods that can be
+ called, use the DojoExternalInterface class to register methods. This
+ class is an exact API clone of the standard ExternalInterface class, but
+ can work in Flash 6+ browsers. Under the covers it uses the best
+ mechanism to do communication:
+
+ class HelloWorld{
+ function HelloWorld(){
+ // Initialize the DojoExternalInterface class
+ DojoExternalInterface.initialize();
+
+ // Expose your methods
+ DojoExternalInterface.addCallback("sayHello", this, this.sayHello);
+
+ // Tell JavaScript that you are ready to have method calls
+ DojoExternalInterface.loaded();
+
+ // Call some JavaScript
+ DojoExternalInterface.call("someJavaScriptMethod");
+ }
+
+ function sayHello(){ ... }
+
+ static main(){ ... }
+ }
+
+ DojoExternalInterface adds to new functions to the ExternalInterface
+ API: initialize() and loaded(). Initialize() must be called before
+ any addCallback() or call() methods are run, and loaded() must be
+ called after you are finished adding your callbacks. Calling loaded()
+ will fire the dojo.flash.loaded() event, so that JavaScript can know that
+ Flash has finished loading and adding its callbacks, and can begin to
+ interact with the Flash file.
+
+ To generate your SWF files, use the ant task
+ "buildFlash". You must have the open source Motion Twin ActionScript
+ compiler (mtasc) installed and in your path to use the "buildFlash"
+ ant task; download and install mtasc from http://www.mtasc.org/.
+
+ buildFlash usage:
+
+ ant buildFlash -Ddojo.flash.file=../tests/flash/HelloWorld.as
+
+ where "dojo.flash.file" is the relative path to your Flash
+ ActionScript file.
+
+ This will generate two SWF files, one ending in _flash6.swf and the other
+ ending in _flash8.swf in the same directory as your ActionScript method:
+
+ HelloWorld_flash6.swf
+ HelloWorld_flash8.swf
+
+ Initialize dojo.flash with the filename and Flash communication version to
+ use during page load; see the documentation for dojo.flash for details:
+
+ dojo.flash.setSwf({flash6: "tests/flash/HelloWorld_flash6.swf",
+ flash8: "tests/flash/HelloWorld_flash8.swf"});
+
+ Now, your Flash methods can be called from JavaScript as if they are native
+ Flash methods, mirrored exactly on the JavaScript side:
+
+ dojo.flash.comm.sayHello();
+
+ Only Strings are supported being passed back and forth currently.
+
+ -------------------
+ Notes
+ -------------------
+
+ If you have both Flash 6 and Flash 8 versions of your file:
+
+ dojo.flash.setSwf({flash6: "tests/flash/HelloWorld_flash6.swf",
+ flash8: "tests/flash/HelloWorld_flash8.swf"});
+
+ but want to force the browser to use a certain version of Flash for
+ all platforms (for testing, for example), use the djConfig
+ variable 'forceFlashComm' with the version number to force:
+
+ var djConfig = { forceFlashComm: 6 };
+
+ Two values are currently supported, 6 and 8, for the two styles of
+ communication described above.
+
+ Also note that dojo.flash can currently only work with one Flash applet
+ on the page; it and the API do not yet support multiple Flash applets on
+ the same page.
+
+ @author Brad Neuberg, bkn3@columbia.edu
+*/
+
+dojo.flash = {
+ flash6_version: null,
+ flash8_version: null,
+ _visible: true,
+
+ /** Sets the SWF files and versions we are using. */
+ setSwf: function(fileInfo){
+ if(fileInfo == null || dojo.lang.isUndefined(fileInfo)){
+ return;
+ }
+
+ if(fileInfo.flash6 != null && !dojo.lang.isUndefined(fileInfo.flash6)){
+ this.flash6_version = fileInfo.flash6;
+ }
+
+ if(fileInfo.flash8 != null && !dojo.lang.isUndefined(fileInfo.flash8)){
+ this.flash8_version = fileInfo.flash8;
+ }
+
+ if(fileInfo.visible){
+ this._visible = fileInfo.visible;
+ }
+
+ // now initialize ourselves
+ this._initialize();
+ },
+
+ /** Returns whether we are using Flash 6 for communication on this platform. */
+ useFlash6: function(){
+ if(this.flash6_version == null){
+ return false;
+ }else if (this.flash6_version != null && dojo.flash.info.commVersion == 6){
+ // if we have a flash 6 version of this SWF, and this browser supports
+ // communicating using Flash 6 features...
+ return true;
+ }else{
+ return false;
+ }
+ },
+
+ /** Returns whether we are using Flash 8 for communication on this platform. */
+ useFlash8: function(){
+ if(this.flash8_version == null){
+ return false;
+ }else if (this.flash8_version != null && dojo.flash.info.commVersion == 8){
+ // if we have a flash 8 version of this SWF, and this browser supports
+ // communicating using Flash 8 features...
+ return true;
+ }else{
+ return false;
+ }
+ },
+
+ /** Initializes dojo.flash. */
+ _initialize: function(){
+ // do nothing if no SWF files are defined
+ if(this.flash6_version == null && this.flash8_version == null){
+ this.info = new Object();
+ this.info.capable = false;
+ return;
+ }
+
+ // find out if Flash is installed
+ this.info = new dojo.flash.Info();
+
+ // if we are not installed, install Flash
+ if(this.info.capable == false){
+ var installer = new dojo.flash.Install();
+ installer.install();
+ }else if(this.info.capable == true){
+ // write the flash object into the page
+ dojo.flash.obj = new dojo.flash.Embed();
+ dojo.flash.obj.setVisible(this._visible);
+ dojo.flash.obj.write();
+
+ // initialize the way we do Flash/JavaScript communication
+ dojo.flash.comm = new dojo.flash.Communicator();
+ }
+ },
+
+ /**
+ A callback when the Flash subsystem is finished loading and can be
+ worked with. To be notified when Flash is finished loading, connect
+ your callback to this method using the following:
+
+ dojo.event.connect(dojo.flash, "loaded", myInstance, "myCallback");
+ */
+ loaded: function(){
+ }
+};
+
+
+/**
+ A class that helps us determine whether Flash is available,
+ it's major and minor versions, and what Flash version features should
+ be used for Flash/JavaScript communication. Parts of this code
+ are adapted from the automatic Flash plugin detection code autogenerated
+ by the Macromedia Flash 8 authoring environment.
+
+ An instance of this class can be accessed on dojo.flash.info after
+ the page is finished loading.
+
+ This constructor must be called before the page is finished loading.
+*/
+dojo.flash.Info = function(){
+ // Visual basic helper required to detect Flash Player ActiveX control
+ // version information on Internet Explorer
+ if(dojo.render.html.ie){
+ document.writeln('<script language="VBScript" type="text/vbscript"\>');
+ document.writeln('Function VBGetSwfVer(i)');
+ document.writeln(' on error resume next');
+ document.writeln(' Dim swControl, swVersion');
+ document.writeln(' swVersion = 0');
+ document.writeln(' set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))');
+ document.writeln(' if (IsObject(swControl)) then');
+ document.writeln(' swVersion = swControl.GetVariable("$version")');
+ document.writeln(' end if');
+ document.writeln(' VBGetSwfVer = swVersion');
+ document.writeln('End Function');
+ document.writeln('</script\>');
+ }
+
+ this._detectVersion();
+ this._detectCommunicationVersion();
+}
+
+dojo.flash.Info.prototype = {
+ /** The full version string, such as "8r22". */
+ version: -1,
+
+ /**
+ The major, minor, and revisions of the plugin. For example, if the
+ plugin is 8r22, then the major version is 8, the minor version is 0,
+ and the revision is 22.
+ */
+ versionMajor: -1,
+ versionMinor: -1,
+ versionRevision: -1,
+
+ /** Whether this platform has Flash already installed. */
+ capable: false,
+
+ /**
+ The major version number for how our Flash and JavaScript communicate.
+ This can currently be the following values:
+ 6 - We use a combination of the Flash plugin methods, such as SetVariable
+ and TCallLabel, along with fscommands, to do communication.
+ 8 - We use the ExternalInterface API.
+ -1 - For some reason neither method is supported, and no communication
+ is possible.
+ */
+ commVersion: 6,
+
+ /**
+ Asserts that this environment has the given major, minor, and revision
+ numbers for the Flash player. Returns true if the player is equal
+ or above the given version, false otherwise.
+
+ Example: To test for Flash Player 7r14:
+
+ dojo.flash.info.isVersionOrAbove(7, 0, 14)
+ */
+ isVersionOrAbove: function(reqMajorVer, reqMinorVer, reqVer){
+ // make the revision a decimal (i.e. transform revision 14 into
+ // 0.14
+ reqVer = parseFloat("." + reqVer);
+ if(this.versionMajor > reqMajorVer && this.version >= reqVer){
+ return true;
+ }else if(this.version >= reqVer && this.versionMinor >= reqMinorVer){
+ return true;
+ }else{
+ return false;
+ }
+ },
+
+ _detectVersion: function(){
+ var versionStr;
+
+ // loop backwards through the versions until we find the newest version
+ for(var testVersion = 25; testVersion > 0; testVersion--){
+ if(dojo.render.html.ie){
+ versionStr = VBGetSwfVer(testVersion);
+ }else{
+ versionStr = this._JSFlashInfo(testVersion);
+ }
+
+ if(versionStr == -1 ){
+ this.capable = false;
+ return;
+ }else if(versionStr != 0){
+ var versionArray;
+ if(dojo.render.html.ie){
+ var tempArray = versionStr.split(" ");
+ var tempString = tempArray[1];
+ versionArray = tempString.split(",");
+ }else{
+ versionArray = versionStr.split(".");
+ }
+
+ this.versionMajor = versionArray[0];
+ this.versionMinor = versionArray[1];
+ this.versionRevision = versionArray[2];
+
+ // 7.0r24 == 7.24
+ versionString = this.versionMajor + "." + this.versionRevision;
+ this.version = parseFloat(versionString);
+
+ this.capable = true;
+
+ break;
+ }
+ }
+ },
+
+ /**
+ JavaScript helper required to detect Flash Player PlugIn version
+ information. Internet Explorer uses a corresponding Visual Basic
+ version to interact with the Flash ActiveX control.
+ */
+ _JSFlashInfo: function(testVersion){
+ // NS/Opera version >= 3 check for Flash plugin in plugin array
+ if(navigator.plugins != null && navigator.plugins.length > 0){
+ if(navigator.plugins["Shockwave Flash 2.0"] ||
+ navigator.plugins["Shockwave Flash"]){
+ var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
+ var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
+ var descArray = flashDescription.split(" ");
+ var tempArrayMajor = descArray[2].split(".");
+ var versionMajor = tempArrayMajor[0];
+ var versionMinor = tempArrayMajor[1];
+ if(descArray[3] != ""){
+ tempArrayMinor = descArray[3].split("r");
+ }else{
+ tempArrayMinor = descArray[4].split("r");
+ }
+ var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
+ var version = versionMajor + "." + versionMinor + "."
+ + versionRevision;
+
+ return version;
+ }
+ }
+
+ return -1;
+ },
+
+ /**
+ Detects the mechanisms that should be used for Flash/JavaScript
+ communication, setting 'commVersion' to either 6 or 8. If the value is
+ 6, we use Flash Plugin 6+ features, such as GetVariable, TCallLabel,
+ and fscommand, to do Flash/JavaScript communication; if the value is
+ 8, we use the ExternalInterface API for communication.
+ */
+ _detectCommunicationVersion: function(){
+ // we prefer Flash 6 features over Flash 8, because they are much faster
+ // and much less buggy
+
+ // does the Flash plugin have some of the Flash methods?
+
+ // otherwise, is the ExternalInterface API present?
+ }
+};
+
+/** A class that is used to write out the Flash object into the page. */
+dojo.flash.Embed = function(){
+}
+
+dojo.flash.Embed.prototype = {
+ /**
+ The width of this Flash applet. The default is the minimal width
+ necessary to show the Flash settings dialog.
+ */
+ width: 215,
+
+ /**
+ The height of this Flash applet. The default is the minimal height
+ necessary to show the Flash settings dialog.
+ */
+ width: 138,
+
+ /** The id of the Flash object. */
+ id: "flashObject",
+
+ /** Controls whether this is a visible Flash applet or not. */
+ _visible: true,
+
+ /**
+ Writes the Flash into the page. This must be called before the page
+ is finished loading.
+ */
+ write: function(){
+ // determine our container div's styling
+ var containerStyle = new dojo.string.Builder();
+ containerStyle.append("width: " + this.width + "px; ");
+ containerStyle.append("height: " + this.height + "px; ");
+ if(this._visible == false){
+ containerStyle.append("position: absolute; ");
+ containerStyle.append("z-index: 100; ");
+ containerStyle.append("top: -1000px; ");
+ containerStyle.append("left: -1000px; ");
+ }
+ containerStyle = containerStyle.toString();
+
+ // Flash 6
+ if(dojo.flash.useFlash6()){
+ var swfloc = dojo.flash.flash6_version;
+
+ document.writeln('<div id="' + this.id + 'Div" style="' + containerStyle + '">');
+ document.writeln(' <embed id="' + this.id + '" src="' + swfloc + '" ');
+ document.writeln(' quality="high" bgcolor="#ffffff" ');
+ document.writeln(' width="' + this.width + '" height="' + this.height + '" name="' + this.id + '" ');
+ document.writeln(' align="middle" allowScriptAccess="sameDomain" ');
+ document.writeln(' type="application/x-shockwave-flash" swLiveConnect="true" ');
+ document.writeln(' pluginspage="http://www.macromedia.com/go/getflashplayer"> ');
+ document.writeln('</div>');
+ }
+ // Flash 8
+ else if (dojo.flash.useFlash8()){
+ var swfloc = dojo.uri.dojoUri(dojo.flash.flash8_version).toString();
+ }
+ },
+
+ /** Gets the Flash object DOM node. */
+ get: function(){
+ return (dojo.render.html.ie) ? window[this.id] : document[this.id];
+ },
+
+ /** Sets the visibility of this Flash object. */
+ setVisible: function(){
+ //FIXME: Dynamically make the movie visible or not
+ },
+
+ /** Centers the flash applet on the page. */
+ center: function(){
+ }
+};
+
+
+/**
+ A class that is used to communicate between Flash and JavaScript in
+ a way that can pass large amounts of data back and forth reliably,
+ very fast, and with synchronous method calls. This class encapsulates the
+ specific way in which this communication occurs,
+ presenting a common interface to JavaScript irrespective of the underlying
+ Flash version.
+*/
+dojo.flash.Communicator = function(){
+ if(dojo.flash.useFlash6()){
+ this._writeFlash6();
+ }else if (dojo.flash.useFlash8()){
+ this._writeFlash8();
+ }
+}
+
+dojo.flash.Communicator.prototype = {
+ _writeFlash6: function(){
+ var id = dojo.flash.obj.id;
+
+ // global function needed for Flash 6 callback;
+ // we write it out as a script tag because the VBScript hook for IE
+ // callbacks does not work properly if this function is evalled() from
+ // within the Dojo system
+ document.writeln('<script language="JavaScript">');
+ document.writeln(' function ' + id + '_DoFSCommand(command, args){ ');
+ document.writeln(' dojo.flash.comm._handleFSCommand(command, args); ');
+ document.writeln('}');
+ document.writeln('</script>');
+
+ // hook for Internet Explorer to receive FSCommands from Flash
+ if(dojo.render.html.ie){
+ document.writeln('<SCRIPT LANGUAGE=VBScript\> ');
+ document.writeln('on error resume next ');
+ document.writeln('Sub ' + id + '_FSCommand(ByVal command, ByVal args)');
+ document.writeln(' call ' + id + '_DoFSCommand(command, args)');
+ document.writeln('end sub');
+ document.writeln('</SCRIPT\> ');
+ }
+ },
+
+ _writeFlash8: function(){
+ // nothing needed for Flash 8 communication; happens automatically
+ },
+
+ /** Handles fscommand's from Flash to JavaScript. Flash 6 communication. */
+ _handleFSCommand: function(command, args){
+ if(command == "addCallback"){ // add Flash method for JavaScript callback
+ this._fscommandAddCallback(command, args);
+ }else if (command == "call"){ // Flash to JavaScript method call
+ this._fscommandCall(command, args);
+ }
+ },
+
+ _fscommandAddCallback: function(command, args){
+ var functionName = args;
+
+ // do a trick, where we link this function name to our wrapper
+ // function, _call, that does the actual JavaScript to Flash call
+ var callFunc = function(){
+ return dojo.flash.comm._call(functionName, arguments);
+ };
+ dojo.flash.comm[functionName] = callFunc;
+
+ // indicate that the call was successful
+ dojo.flash.obj.get().SetVariable("_succeeded", true);
+ },
+
+ _fscommandCall: function(command, args){
+ var plugin = dojo.flash.obj.get();
+ var functionName = args;
+
+ // get the number of arguments to this method call and build them up
+ var numArgs = parseInt(plugin.GetVariable("_numArgs"));
+ var flashArgs = new Array();
+ for(var i = 0; i < numArgs; i++){
+ var currentArg = plugin.GetVariable("_" + i);
+ flashArgs.push(currentArg);
+ }
+
+ // get the function instance; we technically support more capabilities
+ // than ExternalInterface, which can only call global functions; if
+ // the method name has a dot in it, such as "dojo.flash.loaded", we
+ // eval it so that the method gets run against an instance
+ var runMe;
+ if(functionName.indexOf(".") == -1){ // global function
+ runMe = window[functionName];
+ }else{
+ // instance function
+ runMe = eval(functionName);
+ }
+
+ // make the call and get the results
+ var results = null;
+ if(!dojo.lang.isUndefined(runMe) && runMe != null){
+ results = runMe.apply(null, flashArgs);
+ }
+
+ // return the results to flash
+ plugin.SetVariable("_returnResult", results);
+ },
+
+ /**
+ The actual function that will execute a JavaScript to Flash call; used
+ by the Flash 6 communication method.
+ */
+ _call: function(functionName, args){
+ // we do JavaScript to Flash method calls by setting a Flash variable
+ // "_functionName" with the function name; "_numArgs" with the number
+ // of arguments; and "_0", "_1", etc for each numbered argument. Flash
+ // reads these, executes the function call, and returns the result
+ // in "_returnResult"
+ var plugin = dojo.flash.obj.get();
+ plugin.SetVariable("_functionName", functionName);
+ plugin.SetVariable("_numArgs", args.length);
+ for(var i = 0; i < args.length; i++){
+ plugin.SetVariable("_" + i, args[i]);
+ }
+
+ // now tell Flash to execute this method using the Flash Runner
+ plugin.SetVariable("_execute", true);
+ plugin.Play();
+
+ // get the results
+ var results = plugin.GetVariable("_returnResult");
+ dojo.debug("inside, results="+results);
+
+ return results;
+ }
+}
+
+/**
+ Figures out the best way to automatically install the Flash plugin
+ for this browser and platform.
+*/
+dojo.flash.Install = function(){
+}
+
+dojo.flash.Install.prototype = {
+ install: function(){
+ }
+}
+
+// vim:ts=4:noet:tw=0:
Added: jakarta/tapestry/trunk/framework/src/js/dojo/src/flash/flash6/DojoExternalInterface.as
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/dojo/src/flash/flash6/DojoExternalInterface.as?rev=371434&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/dojo/src/flash/flash6/DojoExternalInterface.as (added)
+++ jakarta/tapestry/trunk/framework/src/js/dojo/src/flash/flash6/DojoExternalInterface.as Sun Jan 22 17:23:23 2006
@@ -0,0 +1,154 @@
+/**
+ An implementation of Flash 8's ExternalInterface that works with Flash 6
+ and which is source-compatible with Flash 8.
+
+ @author Brad Neuberg, bkn3@columbia.edu
+*/
+
+class DojoExternalInterface{
+ public static var available:Boolean;
+ private static var callbacks = new Object();
+
+ public static function initialize(){
+ // FIXME: Set available variable
+ // FIXME: do a test run to see if we can communicate from Flash to JavaScript
+ // and back again to make sure we can actually communicate (set 'available'
+ // variable)
+
+ initializeFlashRunner();
+ }
+
+ public static function addCallback(methodName:String, instance:Object,
+ method:Function) : Boolean{
+ // A variable that indicates whether the call below succeeded
+ _root._succeeded = null;
+
+ // Callbacks are registered with the JavaScript side as follows.
+ // On the Flash side, we maintain a lookup table that associates
+ // the methodName with the actual instance and method that are
+ // associated with this method.
+ // Using fscommand, we send over the action "addCallback", with the
+ // argument being the methodName to add, such as "foobar".
+ // The JavaScript takes these values and registers the existence of
+ // this callback point.
+
+ // precede the method name with a _ character in case it starts
+ // with a number
+ callbacks["_" + methodName] = {_instance: instance, _method: method};
+ fscommand("addCallback", methodName);
+
+ // The API for ExternalInterface says we have to make sure the call
+ // succeeded; check to see if there is a value
+ // for _succeeded, which is set by the JavaScript side
+ if(_root._succeeded == null){
+ return false;
+ }else{
+ return true;
+ }
+ }
+
+ public static function call(methodName:String) : Object{
+ // FIXME: support full JSON serialization
+
+ // First, we pack up all of the arguments to this call and set them
+ // as Flash variables, which the JavaScript side will unpack using
+ // plugin.GetVariable(). We set the number of arguments as "_numArgs",
+ // and add each argument as a variable, such as "_1", "_2", etc., starting
+ // from 0.
+ // We then execute an fscommand with the action "call" and the
+ // argument being the method name. JavaScript takes the method name,
+ // retrieves the arguments using GetVariable, executes the method,
+ // and then places the return result in a Flash variable
+ // named "_returnResult".
+ _root._numArgs = arguments.length - 1;
+ for(var i = 1; i < arguments.length; i++){
+ var argIndex = i - 1;
+ _root["_" + argIndex] = arguments[i];
+ }
+
+ _root._returnResult = undefined;
+ fscommand("call", methodName);
+ return _root.returnResult;
+ }
+
+ /**
+ Called by Flash to indicate to JavaScript that we are ready to have
+ our Flash functions called. Calling loaded()
+ will fire the dojo.flash.loaded() event, so that JavaScript can know that
+ Flash has finished loading and adding its callbacks, and can begin to
+ interact with the Flash file.
+ */
+ public static function loaded(){
+ call("dojo.flash.loaded");
+ }
+
+ /**
+ When JavaScript wants to communicate with Flash it simply sets
+ the Flash variable "_execute" to true; this method creates the
+ internal Movie Clip, called the Flash Runner, that makes this
+ magic happen.
+ */
+ private static function initializeFlashRunner(){
+ // create our Flash runner movie clip and instance, and attach it to
+ // the root stage
+ _root.createEmptyMovieClip("_flashRunner_mc");
+ _root.attachMovie("_flashRunner_mc", "_flashRunner");
+
+ // get the actual object instance of the Flash runner movie clip and
+ // make it invisible
+ var _flashRunner:MovieClip = _root._flashRunner;
+ _flashRunner._visible = false;
+
+ // ActionScript 2 has no way to dynamically add new script to a
+ // dynamic Movie Clip's keyframes or labels. Instead, we use the
+ // onEnterFrame handler, which is called invoked continually at the frame
+ // rate of the SWF file. When the JavaScript wants to tell the
+ // Flash Runner to execute, it simply sets the Flash variable
+ // "_execute" to true, and our onEnterFrame handler knows to execute
+ // a Flash method
+ _root._execute = "false";
+ _flashRunner.onEnterFrame = function(){
+ // SetVariable on the JavaScript side turns all values into strings,
+ // so this comes over as "true" not a Boolean true
+ if(_root._execute == "true"){
+ // reset the execution request
+ _root._execute = "false";
+
+ // handle and execute it
+ DojoExternalInterface._handleJSCall();
+ }
+ }
+ }
+
+ /**
+ Handles and executes a JavaScript to Flash method call. Used by
+ initializeFlashRunner.
+ */
+ public static function _handleJSCall(){
+ // get our parameters
+ var numArgs = parseInt(_root._numArgs);
+ var jsArgs = new Array();
+ for(var i = 0; i < numArgs; i++){
+ var currentValue = _root["_" + i];
+ jsArgs.push(currentValue);
+ }
+
+ // get our function name
+ var functionName = _root._functionName;
+
+ // now get the actual instance and method object to execute on,
+ // using our lookup table that was constructed by calls to
+ // addCallback on initialization
+ var instance = callbacks["_" + functionName]._instance;
+ var method = callbacks["_" + functionName]._method;
+
+ // execute it
+ var results = method.apply(instance, jsArgs);
+ getURL("javascript:dojo.debug('FLASH: result="+results+"')");
+
+ // return the results
+ _root._returnResult = results;
+ }
+}
+
+// vim:ts=4:noet:tw=0:
Added: jakarta/tapestry/trunk/framework/src/js/dojo/src/flash/flash8/DojoExternalInterface.as
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/dojo/src/flash/flash8/DojoExternalInterface.as?rev=371434&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/dojo/src/flash/flash8/DojoExternalInterface.as (added)
+++ jakarta/tapestry/trunk/framework/src/js/dojo/src/flash/flash8/DojoExternalInterface.as Sun Jan 22 17:23:23 2006
@@ -0,0 +1,44 @@
+/**
+ A wrapper around Flash 8's ExternalInterface; this is needed so that we
+ can do a Flash 6 implementation of ExternalInterface, and be able
+ to support having a single codebase that uses DojoExternalInterface
+ across Flash versions rather than having two seperate source bases,
+ where one uses ExternalInterface and the other uses DojoExternalInterface.
+
+ @author Brad Neuberg, bkn3@columbia.edu
+*/
+import flash.external.ExternalInterface;
+
+class DojoExternalInterface{
+ public static var available:Boolean;
+
+ public static function initialize(){
+ // set whether communication is available
+ DojoExternalInterface.available = ExternalInterface.available;
+ DojoExternalInterface.call("loaded");
+ }
+
+ public static function addCallback(methodName:String, instance:Object,
+ method:Function) : Boolean{
+ return ExternalInterface.addCallback(methodName, instance, method);
+ }
+
+ public static function call(methodName:String) : Object{
+ // we might have any number of optional arguments, so we have to
+ // pass them in dynamically
+ return ExternalInterface.call.apply(ExternalInterface, arguments);
+ }
+
+ /**
+ Called by Flash to indicate to JavaScript that we are ready to have
+ our Flash functions called. Calling loaded()
+ will fire the dojo.flash.loaded() event, so that JavaScript can know that
+ Flash has finished loading and adding its callbacks, and can begin to
+ interact with the Flash file.
+ */
+ public static function loaded(){
+ DojoExternalInterface.call("dojo.flash.loaded");
+ }
+}
+
+// vim:ts=4:noet:tw=0:
Added: jakarta/tapestry/trunk/framework/src/js/dojo/src/fx/__package__.js
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/js/dojo/src/fx/__package__.js?rev=371434&view=auto
==============================================================================
--- jakarta/tapestry/trunk/framework/src/js/dojo/src/fx/__package__.js (added)
+++ jakarta/tapestry/trunk/framework/src/js/dojo/src/fx/__package__.js Sun Jan 22 17:23:23 2006
@@ -0,0 +1,14 @@
+/*
+ Copyright (c) 2004-2005, 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.hostenv.conditionalLoadModule({
+ browser: ["dojo.fx.html"]
+});
+dojo.hostenv.moduleLoaded("dojo.fx.*");
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org