tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkuhn...@apache.org
Subject svn commit: r413306 [12/17] - in /tapestry/tapestry4/trunk: examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/ framework/src/java/org/apache/tapestry/ framework/src/java/org/apache/tapestry/dojo/form/ framework/src/java/org/apache/tape...
Date Sat, 10 Jun 2006 14:27:54 GMT
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/DropdownContainer.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/DropdownContainer.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/DropdownContainer.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/DropdownContainer.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,118 @@
+/*
+	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.DropdownContainer");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.HtmlWidget");
+dojo.require("dojo.event.*");
+dojo.require("dojo.html");
+
+dojo.widget.defineWidget(
+	"dojo.widget.DropdownContainer",
+	dojo.widget.HtmlWidget,
+	{
+		initializer: function(){
+		},
+
+		inputWidth: "7em",
+		inputId: "",
+		inputName: "",
+		iconURL: dojo.uri.dojoUri("src/widget/templates/images/combo_box_arrow.png"),
+		iconAlt: "",
+
+		inputNode: null,
+		buttonNode: null,
+		containerNode: null,
+		subWidgetNode: null,
+
+		containerToggle: "plain",
+		containerToggleDuration: 150,
+		containerAnimInProgress: false,
+
+		templateString: '<div><span style="white-space:nowrap"><input type="text" value="" style="vertical-align:middle;" dojoAttachPoint="inputNode" autocomplete="off" /> <img src="${this.iconURL}" alt="${this.iconAlt}" dojoAttachPoint="buttonNode" dojoAttachEvent="onclick: onIconClick;" style="vertical-align:middle; cursor:pointer; cursor:hand;" /></span><br /><div dojoAttachPoint="containerNode" style="display:none;position:absolute;width:12em;background-color:#fff;"></div></div>',
+		templateCssPath: "",
+
+		fillInTemplate: function(args, frag){
+			var source = this.getFragNodeRef(frag);
+			
+			this.containerNode.style.left = "";
+			this.containerNode.style.top = "";
+
+			if(this.inputId){ this.inputNode.id = this.inputId; }
+			if(this.inputName){ this.inputNode.name = this.inputName; }
+			this.inputNode.style.width = this.inputWidth;
+
+			dojo.event.connect(this.inputNode, "onchange", this, "onInputChange");
+			
+			this.containerIframe = new dojo.html.BackgroundIframe(this.containerNode);
+			this.containerIframe.size([0,0,0,0]);
+		},
+
+		postMixInProperties: function(args, frag, parentComp){
+			// now that we know the setting for toggle, get toggle object
+			// (default to plain toggler if user specified toggler not present)
+			this.containerToggleObj =
+				dojo.lfx.toggle[this.containerToggle.toLowerCase()] || dojo.lfx.toggle.plain;
+			dojo.widget.DropdownContainer.superclass.postMixInProperties.call(this, args, frag, parentComp);
+		},
+
+		onIconClick: function(evt){
+			this.toggleContainerShow();
+		},
+
+		toggleContainerShow: function(){
+			if(dojo.html.isShowing(this.containerNode)){
+				this.hideContainer();
+			}else{
+				this.showContainer();
+			}
+		},
+		
+		showContainer: function(){
+			this.containerAnimInProgress=true;
+			this.containerToggleObj.show(this.containerNode, this.containerToggleDuration, null,
+				dojo.lang.hitch(this, this.onContainerShow), this.explodeSrc);
+			dojo.lang.setTimeout(this, this.sizeBackgroundIframe, this.containerToggleDuration);
+		},
+
+		onContainerShow: function(){
+			this.containerAnimInProgress=false;
+		},
+
+		hideContainer: function(){
+			this.containerAnimInProgress=true;
+			this.containerToggleObj.hide(this.containerNode, this.containerToggleDuration, null,
+				dojo.lang.hitch(this, this.onContainerHide), this.explodeSrc);
+			dojo.lang.setTimeout(this, this.sizeBackgroundIframe, this.containerToggleDuration);
+		},
+
+		onContainerHide: function(){
+			this.containerAnimInProgress=false;
+		},
+		
+		sizeBackgroundIframe: function(){
+			var w = dojo.style.getOuterWidth(this.containerNode);
+			var h = dojo.style.getOuterHeight(this.containerNode);
+			if(w==0||h==0){
+				// need more time to calculate size
+				dojo.lang.setTimeout(this, "sizeBackgroundIframe", 100);
+				return;
+			}
+			if(dojo.html.isShowing(this.containerNode)){
+				this.containerIframe.size([0,0,w,h]);
+			}
+		},
+
+		onInputChange: function(){}
+	},
+	"html"
+);
+
+dojo.widget.tags.addParseTreeHandler("dojo:dropdowncontainer");

Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/DropdownContainer.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/DropdownDatePicker.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/DropdownDatePicker.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/DropdownDatePicker.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/DropdownDatePicker.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,67 @@
+/*
+	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.DropdownDatePicker");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.DropdownContainer");
+dojo.require("dojo.widget.DatePicker");
+dojo.require("dojo.event.*");
+dojo.require("dojo.html");
+
+dojo.widget.defineWidget(
+	"dojo.widget.DropdownDatePicker",
+	dojo.widget.DropdownContainer,
+	{
+		iconURL: dojo.uri.dojoUri("src/widget/templates/images/dateIcon.gif"),
+		iconAlt: "Select a Date",
+		zIndex: "10",
+		datePicker: null,
+		
+		dateFormat: "%m/%d/%Y",
+		date: null,
+		
+		fillInTemplate: function(args, frag){
+			dojo.widget.DropdownDatePicker.superclass.fillInTemplate.call(this, args, frag);
+			var source = this.getFragNodeRef(frag);
+			
+			if(args.date){ this.date = new Date(args.date); }
+			
+			var dpNode = document.createElement("div");
+			this.containerNode.appendChild(dpNode);
+			
+			var dateProps = { widgetContainerId: this.widgetId };
+			if(this.date){
+				dateProps["date"] = this.date;
+				dateProps["storedDate"] = dojo.widget.DatePicker.util.toRfcDate(this.date);
+				this.inputNode.value = dojo.date.format(this.date, this.dateFormat);
+			}
+			this.datePicker = dojo.widget.createWidget("DatePicker", dateProps, dpNode);
+			dojo.event.connect(this.datePicker, "onSetDate", this, "onSetDate");
+			this.containerNode.style.zIndex = this.zIndex;
+			this.containerNode.style.backgroundColor = "transparent";
+		},
+		
+		onSetDate: function(){
+			this.inputNode.value = dojo.date.format(this.datePicker.date, this.dateFormat);
+			this.hideContainer();
+		},
+		
+		onInputChange: function(){
+			var tmp = new Date(this.inputNode.value);
+			this.datePicker.date = tmp;
+			this.datePicker.setDate(dojo.widget.DatePicker.util.toRfcDate(tmp));
+			this.datePicker.initData();
+			this.datePicker.initUI();
+		}
+	},
+	"html"
+);
+
+dojo.widget.tags.addParseTreeHandler("dojo:dropdowndatepicker");

Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/DropdownDatePicker.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Editor2.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Editor2.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Editor2.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Editor2.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,378 @@
+/*
+	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
+*/
+
+/* TODO:
+ * - font selector
+ * - test, bug fix, more features :)
+*/
+dojo.provide("dojo.widget.Editor2");
+dojo.provide("dojo.widget.html.Editor2");
+dojo.require("dojo.io.*");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.RichText");
+dojo.require("dojo.widget.Editor2Toolbar");
+// dojo.require("dojo.widget.ColorPalette");
+// dojo.require("dojo.string.extras");
+
+dojo.widget.defineWidget(
+	"dojo.widget.html.Editor2",
+	dojo.widget.html.RichText,
+	{
+		saveUrl: "",
+		saveMethod: "post",
+		saveArgName: "editorContent",
+		closeOnSave: false,
+		shareToolbar: false,
+		toolbarAlwaysVisible: false,
+		htmlEditing: false,
+		_inHtmlMode: false,
+		_htmlEditNode: null,
+
+		commandList: dojo.widget.html.Editor2Toolbar.prototype.commandList,
+		toolbarWidget: null,
+		scrollInterval: null,
+		
+
+		editorOnLoad: function(){
+			var toolbars = dojo.widget.byType("Editor2Toolbar");
+			if((!toolbars.length)||(!this.shareToolbar)){
+				var tbOpts = {};
+				tbOpts.templatePath = dojo.uri.dojoUri("src/widget/templates/HtmlEditorToolbarOneline.html");
+				this.toolbarWidget = dojo.widget.createWidget("Editor2Toolbar", 
+										tbOpts, this.domNode, "before");
+				dojo.event.connect(this, "destroy", this.toolbarWidget, "destroy");
+				this.toolbarWidget.hideUnusableButtons(this);
+
+				if(this.object){
+					this.tbBgIframe = new dojo.html.BackgroundIframe(this.toolbarWidget.domNode);
+					this.tbBgIframe.iframe.style.height = "30px";
+				}
+
+				// need to set position fixed to wherever this thing has landed
+				if(this.toolbarAlwaysVisible){
+					var src = document["documentElement"]||window;
+					this.scrollInterval = setInterval(dojo.lang.hitch(this, "globalOnScrollHandler"), 100);
+					// dojo.event.connect(src, "onscroll", this, "globalOnScrollHandler");
+					dojo.event.connect("before", this, "destroyRendering", this, "unhookScroller");
+				}
+			}else{
+				// FIXME: 	should we try harder to explicitly manage focus in
+				// 			order to prevent too many editors from all querying
+				// 			for button status concurrently?
+				// FIXME: 	selecting in one shared toolbar doesn't clobber
+				// 			selection in the others. This is problematic.
+				this.toolbarWidget = toolbars[0];
+			}
+			dojo.event.topic.registerPublisher("Editor2.clobberFocus", this.editNode, "onfocus");
+			// dojo.event.topic.registerPublisher("Editor2.clobberFocus", this.editNode, "onclick");
+			dojo.event.topic.subscribe("Editor2.clobberFocus", this, "setBlur");
+			dojo.event.connect(this.editNode, "onfocus", this, "setFocus");
+			dojo.event.connect(this.toolbarWidget.linkButton, "onclick", 
+				dojo.lang.hitch(this, function(){
+					var range;
+					if(this.document.selection){
+						range = this.document.selection.createRange().text;
+					}else if(dojo.render.html.mozilla){
+						range = this.window.getSelection().toString();
+					}
+					if(range.length){
+						this.toolbarWidget.exec("createlink", 
+							prompt("Please enter the URL of the link:", "http://"));
+					}else{
+						alert("Please select text to link");
+					}
+				})
+			);
+
+			var focusFunc = dojo.lang.hitch(this, function(){ 
+				if(dojo.render.html.ie){
+					this.editNode.focus();
+				}else{
+					this.window.focus(); 
+				}
+			});
+
+			dojo.event.connect(this.toolbarWidget, "formatSelectClick", focusFunc);
+			dojo.event.connect(this, "execCommand", focusFunc);
+
+			if(this.htmlEditing){
+				var tb = this.toolbarWidget.htmltoggleButton;
+				if(tb){
+					tb.style.display = "";
+					dojo.event.connect(this.toolbarWidget, "htmltoggleClick",
+										this, "toggleHtmlEditing");
+				}
+			}
+		},
+
+		toggleHtmlEditing: function(){
+			if(!this._inHtmlMode){
+				this._inHtmlMode = true;
+				this.toolbarWidget.highlightButton("htmltoggle");
+				if(!this._htmlEditNode){
+					this._htmlEditNode = document.createElement("textarea");
+					dojo.html.insertBefore(this._htmlEditNode, this.domNode);
+				}
+				this._htmlEditNode.style.display = "";
+				this._htmlEditNode.style.width = "100%";
+				this._htmlEditNode.style.height = dojo.style.getInnerHeight(this.editNode)+"px";
+				this._htmlEditNode.value = this.editNode.innerHTML;
+				this.domNode.style.display = "none";
+			}else{
+				this._inHtmlMode = false;
+				this.domNode.style.display = "";
+				this.toolbarWidget.unhighlightButton("htmltoggle");
+				dojo.lang.setTimeout(this, "replaceEditorContent", 1, this._htmlEditNode.value);
+				this._htmlEditNode.style.display = "none";
+				this.editNode.focus();
+			}
+		},
+
+		setFocus: function(){
+			// dojo.debug("setFocus:", this);
+			dojo.event.connect(this.toolbarWidget, "exec", this, "execCommand");
+		},
+
+		setBlur: function(){
+			// dojo.debug("setBlur:", this);
+			dojo.event.disconnect(this.toolbarWidget, "exec", this, "execCommand");
+		},
+
+		_scrollSetUp: false,
+		_fixEnabled: false,
+		_scrollThreshold: false,
+		_handleScroll: true,
+		globalOnScrollHandler: function(){
+			var isIE = dojo.render.html.ie;
+			if(!this._handleScroll){ return; }
+			var ds = dojo.style;
+			var tdn = this.toolbarWidget.domNode;
+			var db = document["body"];
+			var totalHeight = ds.getOuterHeight(tdn);
+			if(!this._scrollSetUp){
+				this._scrollSetUp = true;
+				var editorWidth =  ds.getOuterWidth(this.domNode); 
+				this._scrollThreshold = ds.abs(tdn, false).y;
+				// dojo.debug("threshold:", this._scrollThreshold);
+				if((isIE)&&(db)&&(ds.getStyle(db, "background-image")=="none")){
+					with(db.style){
+						backgroundImage = "url(" + dojo.uri.dojoUri("src/widget/templates/images/blank.gif") + ")";
+						backgroundAttachment = "fixed";
+					}
+				}
+			}
+
+			var scrollPos = (window["pageYOffset"]) ? window["pageYOffset"] : (document["documentElement"]||document["body"]).scrollTop;
+
+			// FIXME: need to have top and bottom thresholds so toolbar doesn't keep scrolling past the bottom
+			if(scrollPos > this._scrollThreshold){
+				// dojo.debug(scrollPos);
+				if(!this._fixEnabled){
+					this.domNode.style.marginTop = totalHeight+"px";
+					if(isIE){
+						// FIXME: should we just use setBehvior() here instead?
+						var cl = dojo.style.abs(tdn).x;
+						document.body.appendChild(tdn);
+						tdn.style.left = cl+dojo.style.getPixelValue(document.body, "margin-left")+"px";
+						dojo.html.addClass(tdn, "IEFixedToolbar");
+						if(this.object){
+							dojo.html.addClass(this.tbBgIframe, "IEFixedToolbar");
+						}
+						
+					}else{
+						with(tdn.style){
+							position = "fixed";
+							top = "0px";
+						}
+					}
+					tdn.style.zIndex = 1000;
+					this._fixEnabled = true;
+				}
+			}else if(this._fixEnabled){
+				this.domNode.style.marginTop = null;
+				with(tdn.style){
+					position = "";
+					top = "";
+					zIndex = "";
+					if(isIE){
+						marginTop = "";
+					}
+				}
+				if(isIE){
+					dojo.html.removeClass(tdn, "IEFixedToolbar");
+					dojo.html.insertBefore(tdn, this._htmlEditNode||this.domNode);
+				}
+				this._fixEnabled = false;
+			}
+		},
+
+		unhookScroller: function(){
+			this._handleScroll = false;
+			clearInterval(this.scrollInterval);
+			// var src = document["documentElement"]||window;
+			// dojo.event.disconnect(src, "onscroll", this, "globalOnScrollHandler");
+			if(dojo.render.html.ie){
+				dojo.html.removeClass(this.toolbarWidget.domNode, "IEFixedToolbar");
+			}
+		},
+
+		_updateToolbarLastRan: null,
+		_updateToolbarTimer: null,
+		_updateToolbarFrequency: 500,
+
+		updateToolbar: function(force){
+			if((!this.isLoaded)||(!this.toolbarWidget)){ return; }
+
+			// keeps the toolbar from updating too frequently
+			// TODO: generalize this functionality?
+			var diff = new Date() - this._updateToolbarLastRan;
+			if( (!force)&&(this._updateToolbarLastRan)&&
+				((diff < this._updateToolbarFrequency)) ){
+
+				clearTimeout(this._updateToolbarTimer);
+				var _this = this;
+				this._updateToolbarTimer = setTimeout(function() {
+					_this.updateToolbar();
+				}, this._updateToolbarFrequency/2);
+				return;
+
+			}else{
+				this._updateToolbarLastRan = new Date();
+			}
+			// end frequency checker
+
+			dojo.lang.forEach(this.commandList, function(cmd){
+					if(cmd == "inserthtml"){ return; }
+					try{
+						if(this.queryCommandEnabled(cmd)){
+							if(this.queryCommandState(cmd)){
+								this.toolbarWidget.highlightButton(cmd);
+							}else{
+								this.toolbarWidget.unhighlightButton(cmd);
+							}
+						}
+					}catch(e){
+						// alert(cmd+":"+e);
+					}
+				}, this);
+
+			var h = dojo.render.html;
+			
+			// safari f's us for selection primitives
+			if(h.safari){ return; }
+
+			var selectedNode = (h.ie) ? this.document.selection.createRange().parentElement() : this.window.getSelection().anchorNode;
+			// make sure we actuall have an element
+			while((selectedNode)&&(selectedNode.nodeType != 1)){
+				selectedNode = selectedNode.parentNode;
+			}
+			if(!selectedNode){ return; }
+
+			var formats = ["p", "pre", "h1", "h2", "h3", "h4"];
+			// gotta run some specialized updates for the various
+			// formatting options
+			var type = formats[dojo.lang.find(formats, selectedNode.nodeName.toLowerCase())];
+			while((selectedNode)&&(selectedNode!=this.editNode)&&(!type)){
+				selectedNode = selectedNode.parentNode;
+				type = formats[dojo.lang.find(formats, selectedNode.nodeName.toLowerCase())];
+			}
+			if(!type){
+				type = "";
+			}else{
+				if(type.charAt(0)=="h"){
+					this.toolbarWidget.unhighlightButton("bold");
+				}
+			}
+			this.toolbarWidget.selectFormat(type);
+		},
+
+		updateItem: function(item) {
+			try {
+				var cmd = item._name;
+				var enabled = this._richText.queryCommandEnabled(cmd);
+				item.setEnabled(enabled, false, true);
+
+				var active = this._richText.queryCommandState(cmd);
+				if(active && cmd == "underline") {
+					// don't activate underlining if we are on a link
+					active = !this._richText.queryCommandEnabled("unlink");
+				}
+				item.setSelected(active, false, true);
+				return true;
+			} catch(err) {
+				return false;
+			}
+		},
+
+
+		_save: function(e){
+			// FIXME: how should this behave when there's a larger form in play?
+			if(!this.isClosed){
+				if(this.saveUrl.length){
+					var content = {};
+					content[this.saveArgName] = this.getHtml();
+					dojo.io.bind({
+						method: this.saveMethod,
+						url: this.saveUrl,
+						content: content
+					});
+				}else{
+					dojo.debug("please set a saveUrl for the editor");
+				}
+				if(this.closeOnSave){
+					this.close(e.getName().toLowerCase() == "save");
+				}
+			}
+		},
+
+		wireUpOnLoad: function(){
+			if(!dojo.render.html.ie){
+				/*
+				dojo.event.kwConnect({
+					srcObj:		this.document,
+					srcFunc:	"click", 
+					targetObj:	this.toolbarWidget,
+					targetFunc:	"hideAllDropDowns",
+					once:		true
+				});
+				*/
+			}
+		}
+	},
+	"html",
+	function(){
+		var cp = dojo.widget.html.Editor2.prototype;
+		if(!cp._wrappersSet){
+			cp._wrappersSet = true;
+			cp.fillInTemplate = (function(fit){
+				return function(){
+					fit.call(this);
+					this.editorOnLoad();
+				};
+			})(cp.fillInTemplate);
+		
+			cp.onDisplayChanged = (function(odc){
+				return function(){
+					try{
+						odc.call(this);
+						this.updateToolbar();
+					}catch(e){}
+				};
+			})(cp.onDisplayChanged);
+
+			cp.onLoad = (function(ol){
+				return function(){
+					ol.call(this);
+					this.wireUpOnLoad();
+				};
+			})(cp.onLoad);
+		}
+	}
+);

Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Editor2.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/FloatingPane.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/FloatingPane.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/FloatingPane.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/FloatingPane.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,305 @@
+/*
+	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.FloatingPane");
+dojo.provide("dojo.widget.html.FloatingPane");
+
+//
+// this widget provides a window-like floating pane
+//
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.Manager");
+dojo.require("dojo.html");
+dojo.require("dojo.html.shadow");
+dojo.require("dojo.style");
+dojo.require("dojo.dom");
+dojo.require("dojo.html.layout");
+dojo.require("dojo.widget.ContentPane");
+dojo.require("dojo.dnd.HtmlDragMove");
+dojo.require("dojo.dnd.HtmlDragMoveSource");
+dojo.require("dojo.dnd.HtmlDragMoveObject");
+dojo.require("dojo.widget.ResizeHandle");
+
+dojo.widget.html.FloatingPane = function(){
+	dojo.widget.html.ContentPane.call(this);
+}
+
+dojo.inherits(dojo.widget.html.FloatingPane, dojo.widget.html.ContentPane);
+
+dojo.lang.extend(dojo.widget.html.FloatingPane, {
+	widgetType: "FloatingPane",
+
+	// Constructor arguments
+	title: '',
+	iconSrc: '',
+	hasShadow: false,
+	constrainToContainer: false,
+	taskBarId: "",
+	resizable: true,
+	titleBarDisplay: "fancy",
+
+	windowState: "normal",
+	displayCloseAction: false,
+	displayMinimizeAction: false,
+	displayMaximizeAction: false,
+
+	maxTaskBarConnectAttempts: 5,
+	taskBarConnectAttempts: 0,
+
+	templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlFloatingPane.html"),
+	templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlFloatingPane.css"),
+
+	drag: null,
+
+	fillInTemplate: function(args, frag){
+		// Copy style info from input node to output node
+		var source = this.getFragNodeRef(frag);
+		dojo.html.copyStyle(this.domNode, source);
+
+		// necessary for safari, khtml (for computing width/height)
+		document.body.appendChild(this.domNode);
+
+		// if display:none then state=minimized, otherwise state=normal
+		if(!this.isShowing()){
+			this.windowState="minimized";
+		}
+
+		// <img src=""> can hang IE!  better get rid of it
+		if(this.iconSrc==""){
+			dojo.dom.removeNode(this.titleBarIcon);
+		}else{
+			this.titleBarIcon.src = this.iconSrc.toString();// dojo.uri.Uri obj req. toString()
+		}
+
+		if(this.titleBarDisplay!="none"){	
+			this.titleBar.style.display="";
+			dojo.html.disableSelection(this.titleBar);
+
+			this.titleBarIcon.style.display = (this.iconSrc=="" ? "none" : "");
+
+			this.minimizeAction.style.display = (this.displayMinimizeAction ? "" : "none");
+			this.maximizeAction.style.display= 
+				(this.displayMaximizeAction && this.windowState!="maximized" ? "" : "none");
+			this.restoreAction.style.display= 
+				(this.displayMaximizeAction && this.windowState=="maximized" ? "" : "none");
+			this.closeAction.style.display= (this.displayCloseAction ? "" : "none");
+
+			this.drag = new dojo.dnd.HtmlDragMoveSource(this.domNode);	
+			if (this.constrainToContainer) {
+				this.drag.constrainTo();
+			}
+			this.drag.setDragHandle(this.titleBar);
+
+			var self = this;
+
+			dojo.event.topic.subscribe("dragMove",
+				function (info){
+					if (info.source.domNode == self.domNode){
+						dojo.event.topic.publish('floatingPaneMove', { source: self } );
+					}
+				}
+			);
+
+		}
+
+		if(this.resizable){
+			this.resizeBar.style.display="";
+			var rh = dojo.widget.createWidget("ResizeHandle", {targetElmId: this.widgetId, id:this.widgetId+"_resize"});
+			this.resizeBar.appendChild(rh.domNode);
+		}
+
+		// add a drop shadow
+		if(this.hasShadow){
+			this.shadow=new dojo.html.shadow(this.domNode);
+		}
+
+		// Prevent IE bleed-through problem
+		this.bgIframe = new dojo.html.BackgroundIframe(this.domNode);
+
+		if( this.taskBarId ){
+			this.taskBarSetup();
+		}
+
+		if (dojo.hostenv.post_load_) {
+			this.setInitialWindowState();
+		} else {
+			dojo.addOnLoad(this, "setInitialWindowState");
+		}
+
+		// counteract body.appendChild above
+		document.body.removeChild(this.domNode);
+
+		dojo.widget.html.FloatingPane.superclass.fillInTemplate.call(this, args, frag);
+	},
+
+	postCreate: function(){
+		if(this.isShowing()){
+			this.width=-1;	// force resize
+			this.resizeTo(dojo.style.getOuterWidth(this.domNode), dojo.style.getOuterHeight(this.domNode));
+		}
+	},
+
+	maximizeWindow: function(evt) {
+		this.previous={
+			width: dojo.style.getOuterWidth(this.domNode) || this.width,
+			height: dojo.style.getOuterHeight(this.domNode) || this.height,
+			left: this.domNode.style.left,
+			top: this.domNode.style.top,
+			bottom: this.domNode.style.bottom,
+			right: this.domNode.style.right
+		};
+		this.domNode.style.left =
+			dojo.style.getPixelValue(this.domNode.parentNode, "padding-left", true) + "px";
+		this.domNode.style.top =
+			dojo.style.getPixelValue(this.domNode.parentNode, "padding-top", true) + "px";
+
+		if ((this.domNode.parentNode.nodeName.toLowerCase() == 'body')) {
+			this.resizeTo(
+				dojo.html.getViewportWidth()-dojo.style.getPaddingWidth(document.body),
+				dojo.html.getViewportHeight()-dojo.style.getPaddingHeight(document.body)
+			);
+		} else {
+			this.resizeTo(
+				dojo.style.getContentWidth(this.domNode.parentNode),
+				dojo.style.getContentHeight(this.domNode.parentNode)
+			);
+		}
+		this.maximizeAction.style.display="none";
+		this.restoreAction.style.display="";
+		this.windowState="maximized";
+	},
+
+	minimizeWindow: function(evt) {
+		this.hide();
+		this.windowState = "minimized";
+	},
+
+	restoreWindow: function(evt) {
+		if (this.windowState=="minimized") {
+			this.show() 
+		} else {
+			for(var attr in this.previous){
+				this.domNode.style[attr] = this.previous[attr];
+			}
+			this.resizeTo(this.previous.width, this.previous.height);
+			this.previous=null;
+
+			this.restoreAction.style.display="none";
+			this.maximizeAction.style.display=this.displayMaximizeAction ? "" : "none";
+		}
+
+		this.windowState="normal";
+	},
+
+	closeWindow: function(evt) {
+		dojo.dom.removeNode(this.domNode);
+		this.destroy();
+	},
+
+	onMouseDown: function(evt) {
+		this.bringToTop();
+	},
+
+	bringToTop: function() {
+		var floatingPanes= dojo.widget.manager.getWidgetsByType(this.widgetType);
+		var windows = [];
+		for (var x=0; x<floatingPanes.length; x++) {
+			if (this.widgetId != floatingPanes[x].widgetId) {
+					windows.push(floatingPanes[x]);
+			}
+		}
+
+		windows.sort(function(a,b) {
+			return a.domNode.style.zIndex - b.domNode.style.zIndex;
+		});
+		
+		windows.push(this);
+
+		var floatingPaneStartingZ = 100;
+		for (x=0; x<windows.length;x++) {
+			windows[x].domNode.style.zIndex = floatingPaneStartingZ + x;
+		}
+	},
+
+	setInitialWindowState: function() {
+		if (this.windowState == "maximized") {
+			this.maximizeWindow();
+			this.show();
+			return;
+		}
+
+		if (this.windowState=="normal") {
+			this.show();
+			return;
+		}
+
+		if (this.windowState=="minimized") {
+			this.hide();
+			return;
+		}
+
+		this.windowState="minimized";
+	},
+
+	// add icon to task bar, connected to me
+	taskBarSetup: function() {
+		var taskbar = dojo.widget.getWidgetById(this.taskBarId);
+		if (!taskbar){
+			if (this.taskBarConnectAttempts <  this.maxTaskBarConnectAttempts) {
+				dojo.lang.setTimeout(this, this.taskBarSetup, 50);
+				this.taskBarConnectAttempts++;
+			} else {
+				dojo.debug("Unable to connect to the taskBar");
+			}
+			return;
+		}
+		taskbar.addChild(this);
+	},
+
+	show: function(){
+		dojo.widget.html.FloatingPane.superclass.show.apply(this, arguments);
+		this.bringToTop();
+	},
+
+	onShow: function(){
+		dojo.widget.html.FloatingPane.superclass.onShow.call(this);
+		this.resizeTo(dojo.style.getOuterWidth(this.domNode), dojo.style.getOuterHeight(this.domNode));
+	},
+
+	// This is called when the user adjusts the size of the floating pane
+	resizeTo: function(w, h){
+		dojo.style.setOuterWidth(this.domNode, w);
+		dojo.style.setOuterHeight(this.domNode, h);
+
+		dojo.html.layout(this.domNode,
+			[
+			  {domNode: this.titleBar, layoutAlign: "top"},
+			  {domNode: this.resizeBar, layoutAlign: "bottom"},
+			  {domNode: this.containerNode, layoutAlign: "client"}
+			] );
+
+		// If any of the children have layoutAlign specified, obey it
+		dojo.html.layout(this.containerNode, this.children, "top-bottom");
+		
+		this.bgIframe.onResized();
+		if(this.shadow){ this.shadow.size(w, h); }
+		this.onResized();
+	},
+
+	checkSize: function() {
+		// checkSize() is called when the user has resized the browser window,
+		// but that doesn't affect this widget (or this widget's children)
+		// so it can be safely ignored...
+		// TODO: unless we are maximized.  then we should resize ourself.
+	}
+});
+
+dojo.widget.tags.addParseTreeHandler("dojo:FloatingPane");

Modified: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/GoogleMap.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/GoogleMap.js?rev=413306&r1=413305&r2=413306&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/GoogleMap.js (original)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/GoogleMap.js Sat Jun 10 07:27:44 2006
@@ -8,37 +8,37 @@
 		http://dojotoolkit.org/community/licensing.shtml
 */
 
-dojo.provide("dojo.widget.GoogleMap");
-dojo.provide("dojo.widget.GoogleMap.Controls");
-dojo.require("dojo.widget.*");
-dojo.widget.tags.addParseTreeHandler("dojo:googlemap");
-
-dojo.widget.GoogleMap=function(){
-	//	summary
-	//	base class for the Google Map widget
-	dojo.widget.Widget.call(this);
-	this.widgetType="GoogleMap";
-	this.isContainer=false;
-}
-dojo.inherits(dojo.widget.GoogleMap, dojo.widget.Widget);
-
-dojo.widget.GoogleMap.Controls={
-	LargeMap:"largemap",
-	SmallMap:"smallmap",
-	SmallZoom:"smallzoom",
-	Scale:"scale",
-	MapType:"maptype",
-	Overview:"overview",
-	get:function(s){
-		for(var p in this){
-			if(typeof(this[p])=="string"
-				&& this[p]==s
-			){
-				return p;
-			}
-		}
-		return null;
-	}
-};
-
+dojo.provide("dojo.widget.GoogleMap");
+dojo.provide("dojo.widget.GoogleMap.Controls");
+dojo.require("dojo.widget.*");
+dojo.widget.tags.addParseTreeHandler("dojo:googlemap");
+
+dojo.widget.GoogleMap=function(){
+	//	summary
+	//	base class for the Google Map widget
+	dojo.widget.Widget.call(this);
+	this.widgetType="GoogleMap";
+	this.isContainer=false;
+}
+dojo.inherits(dojo.widget.GoogleMap, dojo.widget.Widget);
+
+dojo.widget.GoogleMap.Controls={
+	LargeMap:"largemap",
+	SmallMap:"smallmap",
+	SmallZoom:"smallzoom",
+	Scale:"scale",
+	MapType:"maptype",
+	Overview:"overview",
+	get:function(s){
+		for(var p in this){
+			if(typeof(this[p])=="string"
+				&& this[p]==s
+			){
+				return p;
+			}
+		}
+		return null;
+	}
+};
+
 dojo.requireAfterIf("html", "dojo.widget.html.GoogleMap");

Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/HslColorPicker.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/HslColorPicker.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/HslColorPicker.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/HslColorPicker.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,25 @@
+/*
+	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.HslColorPicker");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.Widget");
+dojo.require("dojo.graphics.color");
+dojo.widget.tags.addParseTreeHandler("dojo:hslcolorpicker");
+
+dojo.requireAfterIf(dojo.render.svg.support.builtin, "dojo.widget.svg.HslColorPicker");
+
+dojo.widget.HslColorPicker=function(){
+	dojo.widget.Widget.call(this);
+	this.widgetType = "HslColorPicker";
+	this.isContainer = false;
+}
+dojo.inherits(dojo.widget.HslColorPicker, dojo.widget.Widget);

Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/HslColorPicker.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/HtmlWidget.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/HtmlWidget.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/HtmlWidget.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/HtmlWidget.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,163 @@
+/*
+	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.HtmlWidget");
+dojo.require("dojo.widget.DomWidget");
+dojo.require("dojo.html");
+dojo.require("dojo.html.extras");
+dojo.require("dojo.lang.extras");
+dojo.require("dojo.lang.func");
+dojo.require("dojo.lfx.toggle");
+
+dojo.declare("dojo.widget.HtmlWidget", dojo.widget.DomWidget, {								 
+	widgetType: "HtmlWidget",
+
+	templateCssPath: null,
+	templatePath: null,
+
+	// for displaying/hiding widget
+	toggle: "plain",
+	toggleDuration: 150,
+
+	animationInProgress: false,
+
+	initialize: function(args, frag){
+	},
+
+	postMixInProperties: function(args, frag){
+		// now that we know the setting for toggle, get toggle object
+		// (default to plain toggler if user specified toggler not present)
+		this.toggleObj =
+			dojo.lfx.toggle[this.toggle.toLowerCase()] || dojo.lfx.toggle.plain;
+	},
+
+	getContainerHeight: function(){
+		// NOTE: container height must be returned as the INNER height
+		dojo.unimplemented("dojo.widget.HtmlWidget.getContainerHeight");
+	},
+
+	getContainerWidth: function(){
+		return this.parent.domNode.offsetWidth;
+	},
+
+	setNativeHeight: function(height){
+		var ch = this.getContainerHeight();
+	},
+
+	createNodesFromText: function(txt, wrap){
+		return dojo.html.createNodesFromText(txt, wrap);
+	},
+
+	destroyRendering: function(finalize){
+		try{
+			if(!finalize){
+				dojo.event.browser.clean(this.domNode);
+			}
+			this.domNode.parentNode.removeChild(this.domNode);
+			delete this.domNode;
+		}catch(e){ /* squelch! */ }
+	},
+
+	/////////////////////////////////////////////////////////
+	// Displaying/hiding the widget
+	/////////////////////////////////////////////////////////
+	isShowing: function(){
+		return dojo.style.isShowing(this.domNode);
+	},
+
+	toggleShowing: function(){
+		// dojo.style.toggleShowing(this.domNode);
+		if(this.isHidden){
+			this.show();
+		}else{
+			this.hide();
+		}
+	},
+
+	show: function(){
+		this.animationInProgress=true;
+		this.isHidden = false;
+		this.toggleObj.show(this.domNode, this.toggleDuration, null,
+			dojo.lang.hitch(this, this.onShow), this.explodeSrc);
+	},
+
+	// called after the show() animation has completed
+	onShow: function(){
+		this.animationInProgress=false;
+		this.checkSize();
+	},
+
+	hide: function(){
+		this.animationInProgress = true;
+		this.isHidden = true;
+		this.toggleObj.hide(this.domNode, this.toggleDuration, null,
+			dojo.lang.hitch(this, this.onHide), this.explodeSrc);
+	},
+
+	// called after the hide() animation has completed
+	onHide: function(){
+		this.animationInProgress=false;
+	},
+
+	//////////////////////////////////////////////////////////////////////////////
+	// Sizing related methods
+	//  If the parent changes size then for each child it should call either
+	//   - resizeTo(): size the child explicitly
+	//   - or checkSize(): notify the child the the parent has changed size
+	//////////////////////////////////////////////////////////////////////////////
+
+	// Test if my size has changed.
+	// If width & height are specified then that's my new size; otherwise,
+	// query outerWidth/outerHeight of my domNode
+	_isResized: function(w, h){
+		// If I'm not being displayed then disregard (show() must
+		// check if the size has changed)
+		if(!this.isShowing()){ return false; }
+
+		// If my parent has been resized and I have style="height: 100%"
+		// or something similar then my size has changed too.
+		w=w||dojo.style.getOuterWidth(this.domNode);
+		h=h||dojo.style.getOuterHeight(this.domNode);
+		if(this.width == w && this.height == h){ return false; }
+
+		this.width=w;
+		this.height=h;
+		return true;
+	},
+
+	// Called when my parent has changed size, but my parent won't call resizeTo().
+	// This is useful if my size is height:100% or something similar.
+	// Also called whenever I am shown, because the first time I am shown I may need
+	// to do size calculations.
+	checkSize: function(){
+		if(!this._isResized()){ return; }
+		this.onResized();
+	},
+
+	// Explicitly set this widget's size (in pixels).
+	resizeTo: function(w, h){
+		if(!this._isResized(w,h)){ return; }
+		dojo.style.setOuterWidth(this.domNode, w);
+		dojo.style.setOuterHeight(this.domNode, h);
+		this.onResized();
+	},
+
+	resizeSoon: function(){
+		if(this.isShowing()){
+			dojo.lang.setTimeout(this, this.onResized, 0);
+		}
+	},
+
+	// Called when my size has changed.
+	// Must notify children if their size has (possibly) changed
+	onResized: function(){
+		dojo.lang.forEach(this.children, function(child){ child.checkSize(); });
+	}
+});

Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/HtmlWidget.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/LayoutContainer.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/LayoutContainer.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/LayoutContainer.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/LayoutContainer.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,70 @@
+/*
+	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
+*/
+
+//
+// this widget provides Delphi-style panel layout semantics
+//
+
+dojo.provide("dojo.widget.LayoutContainer");
+dojo.provide("dojo.widget.html.LayoutContainer");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.html.layout");
+
+dojo.widget.html.LayoutContainer = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+
+dojo.inherits(dojo.widget.html.LayoutContainer, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.html.LayoutContainer, {
+	widgetType: "LayoutContainer",
+	isContainer: true,
+
+	layoutChildPriority: 'top-bottom',
+
+	postCreate: function(){
+		dojo.html.layout(this.domNode, this.children, this.layoutChildPriority);
+	},
+
+	addChild: function(child, overrideContainerNode, pos, ref, insertIndex){
+		dojo.widget.html.LayoutContainer.superclass.addChild.call(this, child, overrideContainerNode, pos, ref, insertIndex);
+		dojo.html.layout(this.domNode, this.children, this.layoutChildPriority);
+	},
+
+	removeChild: function(pane){
+		dojo.widget.html.LayoutContainer.superclass.removeChild.call(this,pane);
+		dojo.html.layout(this.domNode, this.children, this.layoutChildPriority);
+	},
+
+	onResized: function(){
+		dojo.html.layout(this.domNode, this.children, this.layoutChildPriority);
+	},
+
+	show: function(){
+		// If this node was created while display=="none" then it
+		// hasn't been laid out yet.  Do that now.
+		this.domNode.style.display="";
+		this.checkSize();
+		this.domNode.style.display="none";
+		this.domNode.style.visibility="";
+
+		dojo.widget.html.LayoutContainer.superclass.show.call(this);
+	}
+});
+
+// This argument can be specified for the children of a LayoutContainer.
+// Since any widget can be specified as a LayoutContainer child, mix it
+// into the base widget class.  (This is a hack, but it's effective.)
+dojo.lang.extend(dojo.widget.Widget, {
+	layoutAlign: 'none'
+});
+
+dojo.widget.tags.addParseTreeHandler("dojo:LayoutContainer");

Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/LayoutContainer.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Menu.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Menu.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Menu.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Menu.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,59 @@
+/*
+	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.Menu");
+dojo.provide("dojo.widget.DomMenu");
+
+dojo.deprecated("dojo.widget.Menu, dojo.widget.DomMenu",  "use dojo.widget.Menu2", "0.4");
+
+dojo.require("dojo.widget.*");
+
+dojo.widget.tags.addParseTreeHandler("dojo:menu");
+
+/* Menu
+ *******/
+
+dojo.widget.Menu = function () {
+	dojo.widget.Menu.superclass.constructor.call(this);
+}
+dojo.inherits(dojo.widget.Menu, dojo.widget.Widget);
+
+dojo.lang.extend(dojo.widget.Menu, {
+	widgetType: "Menu",
+	isContainer: true,
+	
+	items: [],
+	push: function(item){
+		dojo.connect.event(item, "onSelect", this, "onSelect");
+		this.items.push(item);
+	},
+	onSelect: function(){}
+});
+
+
+/* DomMenu
+ **********/
+
+dojo.widget.DomMenu = function(){
+	dojo.widget.DomMenu.superclass.constructor.call(this);
+}
+dojo.inherits(dojo.widget.DomMenu, dojo.widget.DomWidget);
+
+dojo.lang.extend(dojo.widget.DomMenu, {
+	widgetType: "Menu",
+	isContainer: true,
+
+	push: function (item) {
+		dojo.widget.Menu.call(this, item);
+		this.domNode.appendChild(item.domNode);
+	}
+});
+
+dojo.requireAfterIf("html", "dojo.widget.html.Menu");

Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Menu.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Menu2.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Menu2.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Menu2.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Menu2.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,1190 @@
+/*
+	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.Menu2");
+dojo.provide("dojo.widget.html.Menu2");
+dojo.provide("dojo.widget.PopupMenu2");
+dojo.provide("dojo.widget.MenuItem2");
+dojo.provide("dojo.widget.MenuBar2");
+
+dojo.require("dojo.html");
+dojo.require("dojo.style");
+dojo.require("dojo.event.*");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.HtmlWidget");
+
+
+dojo.widget.PopupMenu2 = function(){
+	dojo.widget.HtmlWidget.call(this);
+	this.items = [];	// unused???
+	this.targetNodeIds = []; // fill this with nodeIds upon widget creation and it becomes context menu for those nodes
+	this.queueOnAnimationFinish = [];
+
+	this.eventNames =  {
+		open: ""
+	};
+
+}
+
+dojo.inherits(dojo.widget.PopupMenu2, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.PopupMenu2, {
+	widgetType: "PopupMenu2",
+	isContainer: true,
+
+	snarfChildDomOutput: true,
+
+	currentSubmenu: null,
+	currentSubmenuTrigger: null,
+	parentMenu: null,
+	parentMenuBar: null,
+	isShowingNow: false,
+	menuX: 0,
+	menuY: 0,
+	menuWidth: 0,
+	menuHeight: 0,
+	menuIndex: 0,
+
+	domNode: null,
+	containerNode: null,
+
+	eventNaming: "default",
+
+
+	templateString: '<div class="dojoPopupMenu2" style="left:-9999px; top:-9999px; display: none;"><div dojoAttachPoint="containerNode" class="dojoPopupMenu2Client"></div></div>',
+	templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlMenu2.css"),
+
+	itemHeight: 18,
+	iconGap: 1,
+	accelGap: 10,
+	submenuGap: 2,
+	finalGap: 5,
+	submenuIconSize: 4,
+	separatorHeight: 9,
+	submenuDelay: 500,
+	submenuOverlap: 5,
+	contextMenuForWindow: false,
+	openEvent: null,
+
+	submenuIconSrc: dojo.uri.dojoUri("src/widget/templates/images/submenu_off.gif").toString(),
+	submenuIconOnSrc: dojo.uri.dojoUri("src/widget/templates/images/submenu_on.gif").toString(),
+
+	initialize: function(args, frag) {
+
+		if (this.eventNaming == "default") {
+			for (var eventName in this.eventNames) {
+				this.eventNames[eventName] = this.widgetId+"/"+eventName;
+			}
+		}
+
+	},
+
+	postCreate: function(){
+		if (this.domNode.style.display=="none"){
+			this.domNode.style.display = "";
+		}
+		this.domNode.style.left = '-9999px'
+		this.domNode.style.top = '-9999px'
+
+		// attach menu to document body if it's not already there
+		if (this.domNode.parentNode != document.body){
+			document.body.appendChild(this.domNode);
+		}
+
+
+		if (this.contextMenuForWindow){
+			var doc = document.documentElement  || document.body;
+			dojo.widget.Menu2.OperaAndKonqFixer.fixNode(doc);
+			dojo.event.connect(doc, "oncontextmenu", this, "onOpen");
+		} else if ( this.targetNodeIds.length > 0 ){
+			for(var i=0; i<this.targetNodeIds.length; i++){
+				this.bindDomNode(this.targetNodeIds[i]);
+			}
+		}
+
+		this.subscribeSubitemsOnOpen();
+
+		this.layoutMenuSoon();
+	},
+
+	subscribeSubitemsOnOpen: function() {
+		var subItems = this.getChildrenOfType(dojo.widget.MenuItem2);
+
+		//dojo.debug(subItems)
+
+		for(var i=0; i<subItems.length; i++) {
+			//dojo.debug(subItems[i]);
+			dojo.event.topic.subscribe(this.eventNames.open, subItems[i], "menuOpen")
+		}
+	},
+
+	// get open event for current menu
+	getTopOpenEvent: function() {
+		var menu = this;
+		while (menu.parent){ menu = menu.parent; }
+		return menu.openEvent;
+	},
+
+	// attach menu to given node
+	bindDomNode: function(nodeName){
+		var node = dojo.byId(nodeName);
+
+		// fixes node so that it supports oncontextmenu if not natively supported, Konqueror, Opera more?
+		dojo.widget.Menu2.OperaAndKonqFixer.fixNode(node);
+
+		dojo.event.kwConnect({
+			srcObj:     node,
+			srcFunc:    "oncontextmenu",
+			targetObj:  this,
+			targetFunc: "onOpen",
+			once:       true
+		});
+	},
+
+	// detach menu from given node
+	unBindDomNode: function(nodeName){
+		var node = dojo.byId(nodeName);
+		dojo.event.kwDisconnect({
+			srcObj:     node,
+			srcFunc:    "oncontextmenu",
+			targetObj:  this,
+			targetFunc: "onOpen",
+			once:       true
+		});
+
+		// cleans a fixed node, konqueror and opera
+		dojo.widget.Menu2.OperaAndKonqFixer.cleanNode(node);
+	},
+
+	layoutMenuSoon: function(){
+		dojo.lang.setTimeout(this, "layoutMenu", 0);
+	},
+
+	layoutMenu: function(){
+
+        // menu must be attached to DOM for size calculations to work
+		// even though we attached to document.body in postCreate(), here
+		// we seem to be attached to a #document-fragment.  Don't understand why.
+        document.body.appendChild(this.domNode);
+
+        // determine menu width
+		var max_label_w = 0;
+		var max_accel_w = 0;
+
+		for(var i=0; i<this.children.length; i++){
+			if (this.children[i].getLabelWidth){
+				max_label_w = Math.max(max_label_w, this.children[i].getLabelWidth());
+			}
+
+			if (dojo.lang.isFunction(this.children[i].getAccelWidth)){
+				max_accel_w = Math.max(max_accel_w, this.children[i].getAccelWidth());
+			}
+		}
+
+		if( isNaN(max_label_w) || isNaN(max_accel_w) ){
+			// Browser needs some more time to calculate sizes
+			this.layoutMenuSoon();
+			return;
+		}
+
+		var clientLeft = dojo.style.getPixelValue(this.domNode, "padding-left", true) + dojo.style.getPixelValue(this.containerNode, "padding-left", true);
+		var clientTop  = dojo.style.getPixelValue(this.domNode, "padding-top", true)  + dojo.style.getPixelValue(this.containerNode, "padding-top", true);
+
+		if( isNaN(clientLeft) || isNaN(clientTop) ){
+			// Browser needs some more time to calculate sizes
+			this.layoutMenuSoon();
+			return;
+		}
+
+		var y = clientTop;
+		var max_item_width = 0;
+
+		for(var i=0; i<this.children.length; i++){
+
+			var ch = this.children[i];
+
+			ch.layoutItem(max_label_w, max_accel_w);
+
+			ch.topPosition = y;
+
+			y += dojo.style.getOuterHeight(ch.domNode);
+			max_item_width = Math.max(max_item_width, dojo.style.getOuterWidth(ch.domNode));
+		}
+
+		dojo.style.setContentWidth(this.containerNode, max_item_width);
+		dojo.style.setContentHeight(this.containerNode, y-clientTop);
+
+		dojo.style.setContentWidth(this.domNode, dojo.style.getOuterWidth(this.containerNode));
+		dojo.style.setContentHeight(this.domNode, dojo.style.getOuterHeight(this.containerNode));
+
+		this.menuWidth = dojo.style.getOuterWidth(this.domNode);
+		this.menuHeight = dojo.style.getOuterHeight(this.domNode);
+	},
+
+	/**
+	 * Open the menu at position (x,y), relative to the viewport
+	 * (usually positions are relative to the document; why is this different??)
+	 */
+	open: function(x, y, parent, explodeSrc){
+
+		// if explodeSrc isn't specified then explode from my parent widget
+		explodeSrc = explodeSrc || parent["domNode"] || [];
+
+		if (this.isShowingNow){ return; }
+
+		var parentMenu = (parent && parent.widgetType=="PopupMenu2") ? parent : null;
+
+		if ( !parentMenu ) {
+			// record whenever a top level menu is opened
+			// explodeSrc may or may not be a node - it may also be an [x,y] position array
+			var button = explodeSrc instanceof Array ? null : explodeSrc;
+			dojo.widget.html.Menu2Manager.opened(this, button);
+		}
+
+		//dojo.debug("open called for animation "+this.animationInProgress)
+
+		// if I click  right button and menu is opened, then it gets 2 commands: close -> open
+		// so close enables animation and next "open" is put to queue to occur at new location
+		if(this.animationInProgress){
+			this.queueOnAnimationFinish.push(this.open, arguments);
+			return;
+		}
+
+		var viewport = dojo.html.getViewportSize();
+		var scrolloffset = dojo.html.getScrollOffset();
+
+		var clientRect = {
+			'left'  : scrolloffset[0],
+			'right' : scrolloffset[0] + viewport[0],
+			'top'   : scrolloffset[1],
+			'bottom': scrolloffset[1] + viewport[1]
+		};
+
+		if (parentMenu){
+			// submenu is opening
+
+			if (x + this.menuWidth > clientRect.right){ x = x - (this.menuWidth + parentMenu.menuWidth - (2 * this.submenuOverlap)); }
+
+			if (y + this.menuHeight > clientRect.bottom){ y = y -
+			(this.menuHeight - (this.itemHeight + 5)); } // TODO: why 5?
+
+		}else{
+			// top level menu is opening
+			x+=scrolloffset[0];
+			y+=scrolloffset[1];
+			explodeSrc[0] += scrolloffset[0];
+			explodeSrc[1] += scrolloffset[1];
+
+			if (x < clientRect.left){ x = clientRect.left; }
+			if (x + this.menuWidth > clientRect.right){ x = x - this.menuWidth; }
+
+			if (y < clientRect.top){ y = clientRect.top; }
+			if (y + this.menuHeight > clientRect.bottom){ y = y - this.menuHeight; }
+		}
+
+		this.parentMenu = parentMenu;
+		this.explodeSrc = explodeSrc;
+		this.menuIndex = parentMenu ? parentMenu.menuIndex + 1 : 1;
+
+		this.menuX = x;
+		this.menuY = y;
+
+		// move the menu into position but make it invisible
+		// (because when menus are initially constructed they are visible but off-screen)
+		this.domNode.style.zIndex = 200 + this.menuIndex;
+		this.domNode.style.left = x + 'px';
+		this.domNode.style.top = y + 'px';
+		this.domNode.style.display='none';
+		this.domNode.style.position='absolute';
+
+		// then use the user defined method to display it
+		this.show();
+
+		this.isShowingNow = true;
+	},
+
+	close: function(){
+		// If we are in the process of opening the menu and we are asked to close it,
+		// we should really cancel the current animation, but for simplicity we will
+		// just ignore the request
+		if(this.animationInProgress){
+			this.queueOnAnimationFinish.push(this.close, []);
+			return;
+		}
+
+		this.closeSubmenu();
+		this.hide();
+		this.isShowingNow = false;
+		dojo.widget.html.Menu2Manager.closed(this);
+
+		if (this.parentMenuBar){
+			this.parentMenuBar.closedMenu(this);
+		}
+	},
+
+	onShow: function() {
+		dojo.widget.HtmlWidget.prototype.onShow.call(this);
+		this.processQueue();
+	},
+
+	// do events from queue
+	processQueue: function() {
+		if (!this.queueOnAnimationFinish.length) return;
+
+		var func = this.queueOnAnimationFinish.shift();
+		var args = this.queueOnAnimationFinish.shift();
+
+		func.apply(this, args);
+	},
+
+	onHide: function() {
+		dojo.widget.HtmlWidget.prototype.onHide.call(this);
+
+		this.processQueue();
+	},
+
+
+	closeAll: function(){
+		if (this.parentMenu){
+			this.parentMenu.closeAll();
+		}else{
+			this.close();
+		}
+	},
+
+	closeSubmenu: function(){
+		if (this.currentSubmenu == null){ return; }
+
+		this.currentSubmenu.close();
+		this.currentSubmenu = null;
+
+		this.currentSubmenuTrigger.is_open = false;
+		this.currentSubmenuTrigger.closedSubmenu();
+		this.currentSubmenuTrigger = null;
+	},
+
+	openSubmenu: function(submenu, from_item){
+
+		var our_x = dojo.style.getPixelValue(this.domNode, 'left');
+		var our_y = dojo.style.getPixelValue(this.domNode, 'top');
+		var our_w = dojo.style.getOuterWidth(this.domNode);
+		var item_y = from_item.topPosition;
+
+		var x = our_x + our_w - this.submenuOverlap;
+		var y = our_y + item_y;
+
+		this.currentSubmenu = submenu;
+		this.currentSubmenu.open(x, y, this, from_item.domNode);
+
+		this.currentSubmenuTrigger = from_item;
+		this.currentSubmenuTrigger.is_open = true;
+	},
+
+	onOpen: function(e){
+		this.openEvent = e;
+
+		//dojo.debugShallow(e);
+		this.open(e.clientX, e.clientY, null, [e.clientX, e.clientY]);
+
+		if(e["preventDefault"]){
+			e.preventDefault();
+		}
+	},
+
+	isPointInMenu: function(x, y){
+
+		if (x < this.menuX){ return false; }
+		if (x > this.menuX + this.menuWidth){ return false; }
+
+		if (y < this.menuY){ return false; }
+		if (y > this.menuY + this.menuHeight){ return false; }
+
+		return true;
+	}
+});
+
+
+dojo.widget.MenuItem2 = function(){
+	dojo.widget.HtmlWidget.call(this);
+
+	this.eventNames = {
+		engage: ""
+	};
+}
+
+dojo.inherits(dojo.widget.MenuItem2, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.MenuItem2, {
+	widgetType: "MenuItem2",
+	templateString:
+			 '<div class="dojoMenuItem2">'
+			+'<div dojoAttachPoint="iconNode" class="dojoMenuItem2Icon"></div>'
+			+'<span dojoAttachPoint="labelNode" class="dojoMenuItem2Label"><span><span></span></span></span>'
+			+'<span dojoAttachPoint="accelNode" class="dojoMenuItem2Accel"><span><span></span></span></span>'
+			+'<div dojoAttachPoint="submenuNode" class="dojoMenuItem2Submenu"></div>'
+			+'<div dojoAttachPoint="targetNode" class="dojoMenuItem2Target" dojoAttachEvent="onMouseOver: onHover; onMouseOut: onUnhover; onClick: _onClick;">&nbsp;</div>'
+			+'</div>',
+
+	//
+	// nodes
+	//
+
+	domNode: null,
+	iconNode: null,
+	labelNode: null,
+	accelNode: null,
+	submenuNode: null,
+	targetNode: null,
+
+	//
+	// internal settings
+	//
+
+	is_hovering: false,
+	hover_timer: null,
+	is_open: false,
+	topPosition: 0,
+
+	//
+	// options
+	//
+
+	caption: 'Untitled',
+	accelKey: '',
+	iconSrc: '',
+	submenuId: '',
+	disabled: false,
+	eventNaming: "default",
+
+
+	postCreate: function(){
+
+		dojo.html.disableSelection(this.domNode);
+
+		if (this.disabled){
+			this.setDisabled(true);
+		}
+
+		this.labelNode.childNodes[0].appendChild(document.createTextNode(this.caption));
+		this.accelNode.childNodes[0].appendChild(document.createTextNode(this.accelKey));
+
+		this.labelShadowNode = this.labelNode.childNodes[0].childNodes[0];
+		this.accelShadowNode = this.accelNode.childNodes[0].childNodes[0];
+
+		this.labelShadowNode.appendChild(document.createTextNode(this.caption));
+		this.accelShadowNode.appendChild(document.createTextNode(this.accelKey));
+
+		if (this.eventNaming == "default") {
+			for (var eventName in this.eventNames) {
+				this.eventNames[eventName] = this.widgetId+"/"+eventName;
+			}
+		}
+	},
+
+	layoutItem: function(label_w, accel_w){
+
+		var x_label = this.parent.itemHeight + this.parent.iconGap;
+		var x_accel = x_label + label_w + this.parent.accelGap;
+		var x_submu = x_accel + accel_w + this.parent.submenuGap;
+		var total_w = x_submu + this.parent.submenuIconSize + this.parent.finalGap;
+
+
+		this.iconNode.style.left = '0px';
+		this.iconNode.style.top = '0px';
+
+
+		if (this.iconSrc){
+
+			if ((this.iconSrc.toLowerCase().substring(this.iconSrc.length-4) == ".png") && (dojo.render.html.ie)){
+
+				this.iconNode.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.iconSrc+"', sizingMethod='image')";
+				this.iconNode.style.backgroundImage = '';
+			}else{
+				this.iconNode.style.backgroundImage = 'url('+this.iconSrc+')';
+			}
+		}else{
+			this.iconNode.style.backgroundImage = '';
+		}
+
+		dojo.style.setOuterWidth(this.iconNode, this.parent.itemHeight);
+		dojo.style.setOuterHeight(this.iconNode, this.parent.itemHeight);
+
+		dojo.style.setOuterHeight(this.labelNode, this.parent.itemHeight);
+		dojo.style.setOuterHeight(this.accelNode, this.parent.itemHeight);
+
+		dojo.style.setContentWidth(this.domNode, total_w);
+		dojo.style.setContentHeight(this.domNode, this.parent.itemHeight);
+
+		this.labelNode.style.left = x_label + 'px';
+		this.accelNode.style.left = x_accel + 'px';
+		this.submenuNode.style.left = x_submu + 'px';
+
+		dojo.style.setOuterWidth(this.submenuNode, this.parent.submenuIconSize);
+		dojo.style.setOuterHeight(this.submenuNode, this.parent.itemHeight);
+
+		this.submenuNode.style.display = this.submenuId ? 'block' : 'none';
+		this.submenuNode.style.backgroundImage = 'url('+this.parent.submenuIconSrc+')';
+
+		dojo.style.setOuterWidth(this.targetNode, total_w);
+		dojo.style.setOuterHeight(this.targetNode, this.parent.itemHeight);
+	},
+
+	onHover: function(){
+
+		if (this.is_hovering){ return; }
+		if (this.is_open){ return; }
+
+		this.parent.closeSubmenu();
+		this.highlightItem();
+
+		if (this.is_hovering){ this.stopSubmenuTimer(); }
+		this.is_hovering = true;
+		this.startSubmenuTimer();
+	},
+
+	onUnhover: function(){
+		if (!this.is_open){ this.unhighlightItem(); }
+
+		this.is_hovering = false;
+		this.stopSubmenuTimer();
+	},
+
+	// Internal function for clicks
+	_onClick: function(){
+		if (this.disabled){ return; }
+
+		if (this.submenuId){
+			if (!this.is_open){
+				this.stopSubmenuTimer();
+				this.openSubmenu();
+			}
+		}else{
+			this.parent.closeAll();
+		}
+
+		// for some browsers the onMouseOut doesn't get called (?), so call it manually
+		this.onUnhover();
+
+		// user defined handler for click
+		this.onClick();
+
+		dojo.event.topic.publish(this.eventNames.engage, this);
+	},
+
+	// User defined function to handle clicks
+	onClick: function() { },
+
+	highlightItem: function(){
+		dojo.html.addClass(this.domNode, 'dojoMenuItem2Hover');
+		this.submenuNode.style.backgroundImage = 'url('+this.parent.submenuIconOnSrc+')';
+	},
+
+	unhighlightItem: function(){
+		dojo.html.removeClass(this.domNode, 'dojoMenuItem2Hover');
+		this.submenuNode.style.backgroundImage = 'url('+this.parent.submenuIconSrc+')';
+	},
+
+	startSubmenuTimer: function(){
+		this.stopSubmenuTimer();
+
+		if (this.disabled){ return; }
+
+		var self = this;
+		var closure = function(){ return function(){ self.openSubmenu(); } }();
+
+		this.hover_timer = window.setTimeout(closure, this.parent.submenuDelay);
+	},
+
+	stopSubmenuTimer: function(){
+		if (this.hover_timer){
+			window.clearTimeout(this.hover_timer);
+			this.hover_timer = null;
+		}
+	},
+
+	openSubmenu: function(){
+		// first close any other open submenu
+		this.parent.closeSubmenu();
+
+		var submenu = dojo.widget.getWidgetById(this.submenuId);
+		if (submenu){
+
+			this.parent.openSubmenu(submenu, this);
+		}
+
+		//dojo.debug('open submenu for item '+this.widgetId);
+	},
+
+	closedSubmenu: function(){
+
+		this.onUnhover();
+	},
+
+	setDisabled: function(value){
+		this.disabled = value;
+
+		if (this.disabled){
+			dojo.html.addClass(this.domNode, 'dojoMenuItem2Disabled');
+		}else{
+			dojo.html.removeClass(this.domNode, 'dojoMenuItem2Disabled');
+		}
+	},
+
+	getLabelWidth: function(){
+
+		var node = this.labelNode.childNodes[0];
+
+		return dojo.style.getOuterWidth(node);
+	},
+
+	getAccelWidth: function(){
+
+		var node = this.accelNode.childNodes[0];
+
+		return dojo.style.getOuterWidth(node);
+	},
+
+	menuOpen: function(message) {
+	}
+
+});
+
+
+dojo.widget.MenuSeparator2 = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+
+dojo.inherits(dojo.widget.MenuSeparator2, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.MenuSeparator2, {
+	widgetType: "MenuSeparator2",
+
+	domNode: null,
+	topNode: null,
+	bottomNode: null,
+
+	templateString: '<div class="dojoMenuSeparator2">'
+			+'<div dojoAttachPoint="topNode" class="dojoMenuSeparator2Top"></div>'
+			+'<div dojoAttachPoint="bottomNode" class="dojoMenuSeparator2Bottom"></div>'
+			+'</div>',
+
+	postCreate: function(){
+		dojo.html.disableSelection(this.domNode);
+		this.layoutItem();
+	},
+
+	layoutItem: function(label_w, accel_w){
+
+		var full_width = this.parent.itemHeight
+				+ this.parent.iconGap
+				+ label_w
+				+ this.parent.accelGap
+				+ accel_w
+				+ this.parent.submenuGap
+				+ this.parent.submenuIconSize
+				+ this.parent.finalGap;
+
+		if (isNaN(full_width)){ return; }
+
+		dojo.style.setContentHeight(this.domNode, this.parent.separatorHeight);
+		dojo.style.setContentWidth(this.domNode, full_width);
+	}
+});
+
+//
+// the menu manager makes sure we don't have several menus
+// open at once. the root menu in an opening sequence calls
+// opened(). when a root menu closes it calls closed(). then
+// everything works. lovely.
+//
+
+dojo.widget.html.Menu2Manager = new function(){
+
+	this.currentMenu = null;
+	this.currentButton = null;		// button that opened current menu (if any)
+	this.focusNode = null;
+
+	dojo.event.connect(document, 'onmousedown', this, 'onClick');
+	dojo.event.connect(window, "onscroll", this, "onClick");
+
+	this.closed = function(menu){
+		if (this.currentMenu == menu){
+			this.currentMenu = null;
+			this.currentButton = null;
+		}
+	};
+
+	this.opened = function(menu, button){
+		if (menu == this.currentMenu){ return; }
+
+		if (this.currentMenu){
+			this.currentMenu.close();
+		}
+
+		this.currentMenu = menu;
+		this.currentButton = button;
+	};
+
+	this.onClick = function(e){
+
+		if (!this.currentMenu){ return; }
+
+		var scrolloffset = dojo.html.getScrollOffset();
+
+		var x = e.clientX + scrolloffset[0];
+		var y = e.clientY + scrolloffset[1];
+
+		var m = this.currentMenu;
+
+		// starting from the base menu, perform a hit test
+		// and exit when one succeeds
+
+		while (m){
+
+			if (m.isPointInMenu(x, y)){
+
+				return;
+			}
+
+			m = m.currentSubmenu;
+		}
+
+		// Also, if user clicked the button that opened this menu, then
+		// that button will send the menu a close() command, so this code
+		// shouldn't try to close the menu.  Closing twice messes up animation.
+		if (this.currentButton && dojo.html.overElement(this.currentButton, e)){
+			return;
+		}
+
+		// the click didn't fall within the open menu tree
+		// so close it
+
+		this.currentMenu.close();
+	};
+}
+
+// ************************** make contextmenu work in konqueror and opera *********************
+dojo.widget.Menu2.OperaAndKonqFixer = new function(){
+ 	var implement = true;
+ 	var delfunc = false;
+
+ 	/** 	dom event check
+ 	*
+ 	*	make a event and dispatch it and se if it calls function below,
+ 	*	if it does its supported and we dont need to implement our own
+ 	*/
+
+ 	// gets called if we have support for oncontextmenu
+ 	if (!dojo.lang.isFunction(document.oncontextmenu)){
+ 		document.oncontextmenu = function(){
+ 			implement = false;
+ 			delfunc = true;
+ 		}
+ 	}
+
+ 	if (document.createEvent){ // moz, safari has contextmenu event, need to do livecheck on this env.
+ 		try {
+ 			var e = document.createEvent("MouseEvents");
+ 			e.initMouseEvent("contextmenu", 1, 1, window, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, null);
+ 			document.dispatchEvent(e);
+ 		} catch (e) {/* assume not supported */}
+ 	} else {
+ 		// IE no need to implement custom contextmenu
+ 		implement = false;
+ 	}
+
+ 	// clear this one if it wasn't there before
+ 	if (delfunc){
+ 		delete document.oncontextmenu;
+ 	}
+ 	/***** end dom event check *****/
+
+
+ 	/**
+ 	*	this fixes a dom node by attaching a custom oncontextmenu function that gets called when apropriate
+ 	*	@param	node	a dom node
+ 	*
+ 	*	no returns
+ 	*/
+ 	this.fixNode = function(node){
+ 		if (implement){
+ 			// attach stub oncontextmenu function
+ 			if (!dojo.lang.isFunction(node.oncontextmenu)){
+ 				node.oncontextmenu = function(e){/*stub*/}
+ 			}
+
+ 			// attach control function for oncontextmenu
+ 			if (window.opera){
+ 				// opera
+ 				// listen to ctrl-click events
+ 				node._menufixer_opera = function(e){
+ 					if (e.ctrlKey){
+ 						this.oncontextmenu(e);
+ 					}
+ 				};
+
+ 				dojo.event.connect(node, "onclick", node, "_menufixer_opera");
+
+ 			} else {
+ 				// konqueror
+ 				// rightclick, listen to mousedown events
+ 				node._menufixer_konq = function(e){
+ 					if (e.button==2 ){
+ 						e.preventDefault(); // need to prevent browsers menu
+ 						this.oncontextmenu(e);
+ 					}
+ 				};
+
+ 				dojo.event.connect(node, "onmousedown", node, "_menufixer_konq");
+ 			}
+ 		}
+ 	}
+
+ 	/**
+ 	*	this cleans up a fixed node, prevent memoryleak?
+ 	*	@param node	node to clean
+ 	*
+ 	*	no returns
+ 	*/
+ 	this.cleanNode = function(node){
+ 		if (implement){
+ 			// checks needed if we gets a non fixed node
+ 			if (node._menufixer_opera){
+ 				dojo.event.disconnect(node, "onclick", node, "_menufixer_opera");
+ 				delete node._menufixer_opera;
+ 			} else if(node._menufixer_konq){
+ 				dojo.event.disconnect(node, "onmousedown", node, "_menufixer_konq");
+ 				delete node._menufixer_konq;
+ 			}
+ 			if (node.oncontextmenu){
+ 				delete node.oncontextmenu;
+ 			}
+ 		}
+ 	}
+};
+
+
+dojo.widget.MenuBar2 = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+
+dojo.inherits(dojo.widget.MenuBar2, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.MenuBar2, {
+	widgetType: "MenuBar2",
+	isContainer: true,
+
+	snarfChildDomOutput: true,
+
+	currentItem: null,
+	isExpanded: false,
+
+	currentSubmenu: null,
+	currentSubmenuTrigger: null,
+
+	domNode: null,
+	containerNode: null,
+
+	templateString: '<div class="dojoMenuBar2"><div dojoAttachPoint="containerNode" class="dojoMenuBar2Client"></div></div>',
+	templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlMenu2.css"),
+
+	itemHeight: 18,
+	openEvent: null,
+
+
+	postCreate: function(){
+
+		// do something here
+
+		this.layoutMenuSoon();
+	},
+
+	layoutMenuSoon: function(){
+		dojo.lang.setTimeout(this, "layoutMenu", 0);
+	},
+
+	layoutMenu: function(){
+
+		// menu must be attached to DOM for size calculations to work
+
+		var parent = this.domNode.parentNode;
+		if (! parent || parent == undefined) {
+			document.body.appendChild(this.domNode);
+		}
+
+
+		// determine menu height
+
+		var max_label_h = 0;
+
+		for(var i=0; i<this.children.length; i++){
+
+			if (this.children[i].getLabelHeight){
+
+				max_label_h = Math.max(max_label_h, this.children[i].getLabelHeight());
+			}
+		}
+
+		if (isNaN(max_label_h)){
+			// Browser needs some more time to calculate sizes
+			this.layoutMenuSoon();
+			return;
+		}
+
+		var clientLeft = dojo.style.getPixelValue(this.domNode, "padding-left", true)
+				+ dojo.style.getPixelValue(this.containerNode, "margin-left", true)
+				+ dojo.style.getPixelValue(this.containerNode, "padding-left", true);
+		var clientTop  = dojo.style.getPixelValue(this.domNode, "padding-top", true)
+				+ dojo.style.getPixelValue(this.containerNode, "padding-top", true);
+
+		if (isNaN(clientLeft) || isNaN(clientTop)){
+			// Browser needs some more time to calculate sizes
+			this.layoutMenuSoon();
+			return;
+		}
+
+		var max_item_height = 0;
+		var x = clientLeft;
+
+		for (var i=0; i<this.children.length; i++){
+
+			var ch = this.children[i];
+
+			ch.layoutItem(max_label_h);
+
+			ch.leftPosition = x;
+			ch.domNode.style.left = x + 'px';
+
+			x += dojo.style.getOuterWidth(ch.domNode);
+			max_item_height = Math.max(max_item_height, dojo.style.getOuterHeight(ch.domNode));
+		}
+
+		dojo.style.setContentHeight(this.containerNode, max_item_height);
+		dojo.style.setContentHeight(this.domNode, dojo.style.getOuterHeight(this.containerNode));
+	},
+
+	openSubmenu: function(submenu, from_item){
+
+		var our_pos = dojo.style.getAbsolutePosition(this.domNode, false);
+
+		var our_h = dojo.style.getOuterHeight(this.domNode);
+		var item_x = from_item.leftPosition;
+
+		var x = our_pos.x + item_x;
+		var y = our_pos.y + our_h;
+
+		this.currentSubmenu = submenu;
+		this.currentSubmenu.open(x, y, this, from_item.domNode);
+		this.currentSubmenu.parentMenuBar = this;
+	},
+
+	closeSubmenu: function(){
+
+		if (this.currentSubmenu == null){ return; }
+
+		var menu = this.currentSubmenu;
+		this.currentSubmenu = null;
+		menu.close();
+	},
+
+	itemHover: function(item){
+
+		if (item == this.currentItem) return;
+
+		if (this.currentItem){
+			this.currentItem.unhighlightItem();
+
+			if (this.isExpanded){
+				this.closeSubmenu();
+			}
+		}
+
+		this.currentItem = item;
+		this.currentItem.highlightItem();
+
+		if (this.isExpanded){
+			this.currentItem.expandMenu();
+		}
+	},
+
+	itemUnhover: function(item){
+
+		if (item != this.currentItem) return;
+
+		if (this.currentItem && !this.isExpanded){
+			this.currentItem.unhighlightItem();
+			this.currentItem = null;
+		}
+	},
+
+	itemClick: function(item){
+
+		if (item != this.currentItem){
+
+			this.itemHover(item);
+		}
+
+		if (this.isExpanded){
+
+			this.isExpanded = false;
+			this.closeSubmenu();
+
+		}else{
+
+			this.isExpanded = true;
+			this.currentItem.expandMenu();
+		}
+	},
+
+	closedMenu: function(menu){
+
+		if (this.currentSubmenu == menu){
+
+			this.isExpanded = false;
+			this.itemUnhover(this.currentItem);
+		}
+	}
+});
+
+
+dojo.widget.MenuBarItem2 = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+
+dojo.inherits(dojo.widget.MenuBarItem2, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.MenuBarItem2, {
+
+	widgetType: "MenuBarItem2",
+	templateString:
+			 '<div class="dojoMenuBarItem2">'
+			+'<span dojoAttachPoint="labelNode" class="dojoMenuBarItem2Label"><span><span></span></span></span>'
+			+'<div dojoAttachPoint="targetNode" class="dojoMenuBarItem2Target" dojoAttachEvent="onMouseOver: onHover; onMouseOut: onUnhover; onClick: _onClick;">&nbsp;</div>'
+			+'</div>',
+
+	//
+	// nodes
+	//
+
+	domNode: null,
+	labelNode: null,
+	targetNode: null,
+
+	//
+	// internal settings
+	//
+
+	is_hovering: false,
+	hover_timer: null,
+	is_open: false,
+
+	//
+	// options
+	//
+
+	caption: 'Untitled',
+	accelKey: '',
+	iconSrc: '',
+	submenuId: '',
+	disabled: false,
+	eventNaming: "default",
+
+
+	postCreate: function(){
+
+		dojo.html.disableSelection(this.domNode);
+
+		if (this.disabled){
+			this.setDisabled(true);
+		}
+
+		this.labelNode.childNodes[0].appendChild(document.createTextNode(this.caption));
+
+		this.labelShadowNode = this.labelNode.childNodes[0].childNodes[0];
+		this.labelShadowNode.appendChild(document.createTextNode(this.caption));
+
+		if (this.eventNaming == "default") {
+			for (var eventName in this.eventNames) {
+				this.eventNames[eventName] = this.widgetId+"/"+eventName;
+			}
+		}
+	},
+
+	layoutItem: function(item_h){
+
+		var label_w = dojo.style.getOuterWidth(this.labelNode);
+
+		var clientLeft = dojo.style.getPixelValue(this.domNode, "padding-left", true);
+		var clientTop  = dojo.style.getPixelValue(this.domNode, "padding-top", true);
+
+		this.labelNode.style.left = clientLeft + 'px';
+
+		dojo.style.setOuterHeight(this.labelNode, item_h);
+		dojo.style.setContentWidth(this.domNode, label_w);
+		dojo.style.setContentHeight(this.domNode, item_h);
+
+		this.labelNode.style.left = '0px';
+
+		dojo.style.setOuterWidth(this.targetNode, label_w);
+		dojo.style.setOuterHeight(this.targetNode, item_h);
+	},
+
+	getLabelHeight: function(){
+
+		return dojo.style.getOuterHeight(this.labelNode);
+	},
+
+	onHover: function(){
+		this.parent.itemHover(this);
+	},
+
+	onUnhover: function(){
+		this.parent.itemUnhover(this);
+	},
+
+	_onClick: function(){
+		this.parent.itemClick(this);
+	},
+
+	highlightItem: function(){
+		dojo.html.addClass(this.domNode, 'dojoMenuBarItem2Hover');
+	},
+
+	unhighlightItem: function(){
+		dojo.html.removeClass(this.domNode, 'dojoMenuBarItem2Hover');
+	},
+
+	expandMenu: function(){
+
+		var submenu = dojo.widget.getWidgetById(this.submenuId);
+		if (submenu){
+
+			this.parent.openSubmenu(submenu, this);
+		}
+	},
+
+	setDisabled: function(value){
+		this.disabled = value;
+
+		if (this.disabled){
+			dojo.html.addClass(this.domNode, 'dojoMenuBarItem2Disabled');
+		}else{
+			dojo.html.removeClass(this.domNode, 'dojoMenuBarItem2Disabled');
+		}
+	}
+});
+
+// make it a tag
+dojo.widget.tags.addParseTreeHandler("dojo:MenuBar2");
+dojo.widget.tags.addParseTreeHandler("dojo:MenuBarItem2");
+dojo.widget.tags.addParseTreeHandler("dojo:PopupMenu2");
+dojo.widget.tags.addParseTreeHandler("dojo:MenuItem2");
+dojo.widget.tags.addParseTreeHandler("dojo:MenuSeparator2");
+

Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Menu2.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/PopUpButton.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/PopUpButton.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/PopUpButton.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/PopUpButton.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,192 @@
+/*
+	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.PopUpButton");
+dojo.provide("dojo.widget.DomPopUpButton");
+dojo.provide("dojo.widget.HtmlPopUpButton");
+
+dojo.deprecated("dojo.widget.PopUpButton, dojo.widget.DomPopUpButton, dojo.widget.HtmlPopUpButton",  "use dojo.widget.DropDownButton", "0.4");
+
+//dojo.require("dojo.widget.Button");
+//dojo.require("dojo.widget.HtmlButton");
+
+dojo.require("dojo.widget.Menu");
+dojo.require("dojo.widget.MenuItem");
+
+dojo.require("dojo.html");
+
+dojo.widget.tags.addParseTreeHandler("dojo:PopUpButton");
+
+/* PopUpButton
+ **************/
+ 
+dojo.widget.PopUpButton = function () {
+	dojo.widget.PopUpButton.superclass.constructor.call(this);
+}
+dojo.inherits(dojo.widget.PopUpButton, dojo.widget.Widget);
+
+dojo.lang.extend(dojo.widget.PopUpButton, {
+	widgetType: "PopUpButton",
+	
+	label: ""
+});
+
+
+/* DomPopUpButton
+ *****************/
+dojo.widget.DomPopUpButton = function(){
+	dojo.widget.DomPopUpButton.superclass.constructor.call(this);
+}
+dojo.inherits(dojo.widget.DomPopUpButton, dojo.widget.DomWidget);
+
+dojo.lang.extend(dojo.widget.DomPopUpButton, {
+	widgetType: dojo.widget.PopUpButton.prototype.widgetType
+});
+
+
+/* HtmlPopUpButton
+ ******************/
+
+dojo.widget.HtmlPopUpButton = function () {
+	dojo.widget.HtmlPopUpButton.superclass.constructor.call(this);
+}
+dojo.inherits(dojo.widget.HtmlPopUpButton, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.HtmlPopUpButton, {
+	widgetType: dojo.widget.PopUpButton.prototype.widgetType,
+	templateString: null,
+	templateCssPath: dojo.uri.dojoUri("src/widget/templates/PopUpButton.css"),
+	
+	buildRendering: function (args, frag) {
+		dojo.style.insertCssFile(this.templateCssPath, null, true);
+	
+		this.domNode = document.createElement("a");
+		this.domNode.className = "PopUpButton";
+		dojo.event.connect(this.domNode, "onmousedown", this, "onMouseDown");
+		
+		// draw the arrow
+		var arrow = document.createElement("img");
+		arrow.src = dojo.uri.dojoUri("src/widget/templates/images/dropdownButtonsArrow.gif");
+		dojo.html.setClass(arrow, "downArrow");
+		this.domNode.appendChild(arrow);
+
+		this.menu = dojo.widget.fromScript("Menu");
+		dojo.html.addClass(this.menu.domNode, "PopUpButtonMenu");
+		dojo.event.connect(this.menu, "onSelect", this, "onSelect");
+		
+		if (frag["dojo:" + this.widgetType.toLowerCase()].nodeRef) {
+			var node = frag["dojo:" + this.widgetType.toLowerCase()].nodeRef;
+			var options = node.getElementsByTagName("option");
+			for (var i = 0; i < options.length; i++) {
+				var properties = {
+					title: dojo.dom.textContent(options[i]),
+					value: options[i].value
+				}
+				this.addItem(dojo.widget.fromScript("MenuItem", properties));
+			}
+		}
+	},
+
+	addItem: function (item) {
+		// TODO: should be dojo.widget.MenuItem
+		if (item instanceof dojo.widget.html.MenuItem) {
+			this.menu.push(item);
+		} else {
+			// TODO: create one
+			var menuItem = dojo.widget.fromScript("MenuItem", {title: item});
+			this.menu.push(menuItem);
+		}
+	},
+	
+	
+/* Enabled utility methods
+ **************************/
+	
+	_enabled: true,
+	
+	isEnabled: function() { return this._enabled; },
+	
+	setEnabled: function(enabled, force, preventEvent) {
+		enabled = Boolean(enabled);
+		if (force || this._enabled != enabled) {
+			this._enabled = enabled;
+			if (!preventEvent) {
+				this._fireEvent(this._enabled ? "onEnable" : "onDisable");
+				this._fireEvent("onChangeEnabled");
+			}
+		}
+		
+		dojo.html[(this._enabled ? "add" : "remove")
+			+ "Class"](this.domNode, "disabled");
+		
+		return this._enabled;
+	},
+	
+	enable: function(force, preventEvent) {
+		return this.setEnabled(true, force, preventEvent);
+	},
+	
+	disable: function(force, preventEvent) {
+		return this.setEnabled(false, force, preventEvent);
+	},
+	
+	toggleEnabled: function(force, preventEvent) {
+		return this.setEnabled(!this._enabled, force, preventEvent);
+	},
+
+
+/* Select utility methods
+ **************************/
+
+	onSelect: function (item, e) {
+		this.domNode.firstChild.nodeValue = item.title;
+	},
+	
+	onMouseDown: function (e) {
+		if (!this._menuVisible) {
+			this._showMenu(e);
+			dojo.lang.setTimeout(dojo.event.connect, 1, document, "onmousedown", this, "_hideMenu");
+		}
+	},
+	
+	
+	_fireEvent: function(evt) {
+		if(typeof this[evt] == "function") {
+			var args = [this];
+			for(var i = 1; i < arguments.length; i++) {
+				args.push(arguments[i]);
+			}
+			this[evt].apply(this, args);
+		}
+	},
+
+	
+	_showMenu: function (e) {
+		if (!this._enabled) { return; }
+		this._menuVisible = true;
+		with (dojo.html) {
+			var y = getAbsoluteY(this.domNode) + getInnerHeight(this.domNode);
+			var x = getAbsoluteX(this.domNode);
+		}
+	
+		document.body.appendChild(this.menu.domNode);
+		with (this.menu.domNode.style) {
+			top = y + "px";
+			left = x + "px";
+		}
+	},
+	
+	_hideMenu: function (e) {
+		this.menu.domNode.parentNode.removeChild(this.menu.domNode);
+		dojo.event.disconnect(document, "onmousedown", this, "_hideMenu");
+		this._menuVisible = false;
+	}
+
+});

Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/PopUpButton.js
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Select.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Select.js?rev=413306&r1=413305&r2=413306&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Select.js (original)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/Select.js Sat Jun 10 07:27:44 2006
@@ -8,69 +8,69 @@
 		http://dojotoolkit.org/community/licensing.shtml
 */
 
-dojo.provide("dojo.widget.Select");
-dojo.provide("dojo.widget.html.Select");
-
-dojo.require("dojo.widget.html.ComboBox");
-dojo.require("dojo.widget.*");
-dojo.require("dojo.widget.html.stabile");
-
-/*
- * The Select widget is an enhanced version of HTML's <select> tag.
- *
- * Similar features:
- *   - There is a drop down list of possible values.
- *   - You can only enter a value from the drop down list.  (You can't enter an arbitrary value.)
- *   - The value submitted with the form is the hidden value (ex: CA),
-       not the displayed value a.k.a. label (ex: California)
- *
- * Enhancements over plain HTML version:
- *   - If you type in some text then it will filter down the list of possible values in the drop down list.
- *   - List can be specified either as a static list or via a javascript function (that can get the list from a server)
- */
-
-dojo.widget.defineWidget(
-	"dojo.widget.html.Select",
-	dojo.widget.html.ComboBox,
-	{
-		widgetType: "Select",
-		forceValidOption: true,
-
-		setValue: function(value) {
-			this.comboBoxValue.value = value;
-			dojo.widget.html.stabile.setState(this.widgetId, this.getState(), true);
-		},
-
-		setLabel: function(value){
-			// FIXME, not sure what to do here!
-			this.comboBoxSelectionValue.value = value;
-			if (this.textInputNode.value != value) { // prevent mucking up of selection
-				this.textInputNode.value = value;
-			}
-		},	  
-
-		getLabel: function(){
-			return this.comboBoxSelectionValue.value;
-		},
-
-		getState: function() {
-			return {
-				value: this.getValue(),
-				label: this.getLabel()
-			};
-		},
-
-		onKeyUp: function(evt){
-			this.setLabel(this.textInputNode.value);
-		},
-
-		setState: function(state) {
-			this.setValue(state.value);
-			this.setLabel(state.label);
-		},
-
-		setAllValues: function(value1, value2){
-			this.setValue(value2);
-			this.setLabel(value1);
-		}
-	});
+dojo.provide("dojo.widget.Select");
+dojo.provide("dojo.widget.html.Select");
+
+dojo.require("dojo.widget.html.ComboBox");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.html.stabile");
+
+/*
+ * The Select widget is an enhanced version of HTML's <select> tag.
+ *
+ * Similar features:
+ *   - There is a drop down list of possible values.
+ *   - You can only enter a value from the drop down list.  (You can't enter an arbitrary value.)
+ *   - The value submitted with the form is the hidden value (ex: CA),
+       not the displayed value a.k.a. label (ex: California)
+ *
+ * Enhancements over plain HTML version:
+ *   - If you type in some text then it will filter down the list of possible values in the drop down list.
+ *   - List can be specified either as a static list or via a javascript function (that can get the list from a server)
+ */
+
+dojo.widget.defineWidget(
+	"dojo.widget.html.Select",
+	dojo.widget.html.ComboBox,
+	{
+		widgetType: "Select",
+		forceValidOption: true,
+
+		setValue: function(value) {
+			this.comboBoxValue.value = value;
+			dojo.widget.html.stabile.setState(this.widgetId, this.getState(), true);
+		},
+
+		setLabel: function(value){
+			// FIXME, not sure what to do here!
+			this.comboBoxSelectionValue.value = value;
+			if (this.textInputNode.value != value) { // prevent mucking up of selection
+				this.textInputNode.value = value;
+			}
+		},	  
+
+		getLabel: function(){
+			return this.comboBoxSelectionValue.value;
+		},
+
+		getState: function() {
+			return {
+				value: this.getValue(),
+				label: this.getLabel()
+			};
+		},
+
+		onKeyUp: function(evt){
+			this.setLabel(this.textInputNode.value);
+		},
+
+		setState: function(state) {
+			this.setValue(state.value);
+			this.setLabel(state.label);
+		},
+
+		setAllValues: function(value1, value2){
+			this.setValue(value2);
+			this.setLabel(value1);
+		}
+	});

Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/ShowAction.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/ShowAction.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/ShowAction.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/ShowAction.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,26 @@
+/*
+	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.ShowAction");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.lang.common");
+
+dojo.widget.ShowAction = function(){}
+dojo.lang.extend(dojo.widget.ShowAction, {
+	on: "",
+	action: "",
+	duration: 0,
+	from: "",
+	to: "",
+	auto: "false"
+});
+
+dojo.requireAfterIf("html", "dojo.widget.html.ShowAction");

Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/widget/ShowAction.js
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message