You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2005/12/06 20:30:51 UTC

svn commit: r354516 [9/15] - in /portals/jetspeed-2/trunk: applications/j2-admin/src/java/org/apache/jetspeed/portlets/customizer/ applications/j2-admin/src/webapp/WEB-INF/ applications/j2-admin/src/webapp/WEB-INF/view/customizer/ applications/j2-admin...

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlColorPalette.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlColorPalette.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlColorPalette.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlColorPalette.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,171 @@
+dojo.provide("dojo.widget.HtmlColorPalette");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.Toolbar");
+dojo.require("dojo.html");
+
+dojo.widget.tags.addParseTreeHandler("dojo:ToolbarColorDialog");
+
+dojo.widget.HtmlToolbarColorDialog = function () {
+	dojo.widget.HTMLToolbarDialog.call(this);
+	
+	for (var method in this.constructor.prototype) {
+		this[method] = this.constructor.prototype[method];
+	}
+}
+
+dojo.inherits(dojo.widget.HtmlToolbarColorDialog, dojo.widget.HTMLToolbarDialog);
+
+dojo.lang.extend(dojo.widget.HtmlToolbarColorDialog, {
+
+	widgetType: "ToolbarColorDialog",
+
+	palette: "7x10",
+
+	fillInTemplate: function (args, frag) {
+		dojo.widget.HtmlToolbarColorDialog.superclass.fillInTemplate.call(this, args, frag);
+		this.dialog = dojo.widget.fromScript("ColorPalette", {palette: this.palette});
+		this.dialog.domNode.style.position = "absolute";
+
+		dojo.event.connect(this.dialog, "onColorSelect", this, "_setValue");
+	},
+
+	_setValue: function(color) {
+		this._value = color;
+		this._fireEvent("onSetValue", color);
+	},
+	
+	showDialog: function (e) {
+		dojo.widget.HtmlToolbarColorDialog.superclass.showDialog.call(this, e);
+		var x = dojo.html.getAbsoluteX(this.domNode);
+		var y = dojo.html.getAbsoluteY(this.domNode) + dojo.html.getInnerHeight(this.domNode);
+		this.dialog.showAt(x, y);
+	},
+	
+	hideDialog: function (e) {
+		dojo.widget.HtmlToolbarColorDialog.superclass.hideDialog.call(this, e);
+		this.dialog.hide();
+	}
+});
+
+
+
+dojo.widget.tags.addParseTreeHandler("dojo:colorpalette");
+
+dojo.widget.HtmlColorPalette = function () {
+	dojo.widget.HtmlWidget.call(this);
+}
+
+dojo.inherits(dojo.widget.HtmlColorPalette, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.HtmlColorPalette, {
+
+	widgetType: "colorpalette",
+	
+	palette: "7x10",
+
+	bgIframe: null,
+	
+	palettes: {
+		"7x10": [["fff", "fcc", "fc9", "ff9", "ffc", "9f9", "9ff", "cff", "ccf", "fcf"],
+			["ccc", "f66", "f96", "ff6", "ff3", "6f9", "3ff", "6ff", "99f", "f9f"],
+			["c0c0c0", "f00", "f90", "fc6", "ff0", "3f3", "6cc", "3cf", "66c", "c6c"],
+			["999", "c00", "f60", "fc3", "fc0", "3c0", "0cc", "36f", "63f", "c3c"],
+			["666", "900", "c60", "c93", "990", "090", "399", "33f", "60c", "939"],
+			["333", "600", "930", "963", "660", "060", "366", "009", "339", "636"],
+			["000", "300", "630", "633", "330", "030", "033", "006", "309", "303"]],
+	
+		"3x4": [["ffffff"/*white*/, "00ff00"/*lime*/, "008000"/*green*/, "0000ff"/*blue*/],
+			["c0c0c0"/*silver*/, "ffff00"/*yellow*/, "ff00ff"/*fuchsia*/, "000080"/*navy*/],
+			["808080"/*gray*/, "ff0000"/*red*/, "800080"/*purple*/, "000000"/*black*/]]
+			//["00ffff"/*aqua*/, "808000"/*olive*/, "800000"/*maroon*/, "008080"/*teal*/]];
+	},
+
+	buildRendering: function () {
+		
+		this.domNode = document.createElement("table");
+		dojo.html.disableSelection(this.domNode);
+		dojo.event.connect(this.domNode, "onmousedown", function (e) {
+			e.preventDefault();
+		});
+		with (this.domNode) { // set the table's properties
+			cellPadding = "0"; cellSpacing = "1"; border = "1";
+			style.backgroundColor = "white"; //style.position = "absolute";
+		}
+		var tbody = document.createElement("tbody");
+		this.domNode.appendChild(tbody);
+		var colors = this.palettes[this.palette];
+		for (var i = 0; i < colors.length; i++) {
+			var tr = document.createElement("tr");
+			for (var j = 0; j < colors[i].length; j++) {
+				if (colors[i][j].length == 3) {
+					colors[i][j] = colors[i][j].replace(/(.)(.)(.)/, "$1$1$2$2$3$3");
+				}
+	
+				var td = document.createElement("td");
+				with (td.style) {
+					backgroundColor = "#" + colors[i][j];
+					border = "1px solid gray";
+					width = height = "15px";
+					fontSize = "1px";
+				}
+	
+				td.color = "#" + colors[i][j];
+	
+				td.onmouseover = function (e) { this.style.borderColor = "white"; }
+				td.onmouseout = function (e) { this.style.borderColor = "gray"; }
+				dojo.event.connect(td, "onmousedown", this, "click");
+	
+				td.innerHTML = "&nbsp;";
+				tr.appendChild(td);
+			}
+			tbody.appendChild(tr);
+		}
+
+		if(dojo.render.html.ie){
+			this.bgIframe = document.createElement("<iframe frameborder='0' src='about:blank'>");
+			with(this.bgIframe.style){
+				position = "absolute";
+				left = top = "0px";
+				display = "none";
+			}
+			dojo.html.body().appendChild(this.bgIframe);
+			dojo.style.setOpacity(this.bgIframe, 0);
+		}
+	},
+
+	click: function (e) {
+		this.onColorSelect(e.currentTarget.color);
+		e.currentTarget.style.borderColor = "gray";
+	},
+
+	onColorSelect: function (color) { },
+
+	hide: function (){
+		this.domNode.parentNode.removeChild(this.domNode);
+		if(this.bgIframe){
+			this.bgIframe.style.display = "none";
+		}
+	},
+	
+	showAt: function (x, y) {
+		with(this.domNode.style){
+			top = y + "px";
+			left = x + "px";
+			zIndex = 999;
+		}
+		dojo.html.body().appendChild(this.domNode);
+		djConfig.isDebug = true;
+		if(this.bgIframe){
+			with(this.bgIframe.style){
+				display = "block";
+				top = y + "px";
+				left = x + "px";
+				zIndex = 998;
+				width = dojo.html.getOuterWidth(this.domNode) + "px";
+				height = dojo.html.getOuterHeight(this.domNode) + "px";
+			}
+
+		}
+	}
+
+});

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlContainer.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlContainer.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlContainer.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlContainer.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,37 @@
+dojo.provide("dojo.widget.Container");
+dojo.provide("dojo.widget.HtmlContainer");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.HtmlWidget");
+
+dojo.widget.HtmlContainer = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+
+dojo.inherits(dojo.widget.HtmlContainer, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.HtmlContainer, {
+	widgetType: "Container",
+
+	isContainer: true,
+	containerNode: null,
+	domNode: null,
+
+	onResized: function() {
+		// Clients should override this function to do special processing,
+		// then call this.notifyChildrenOfResize() to notify children of resize
+		this.notifyChildrenOfResize();
+	},
+	
+	notifyChildrenOfResize: function() {
+		for(var i=0; i<this.children.length; i++) {
+			var child = this.children[i];
+			//dojo.debug(this.widgetId + " resizing child " + child.widgetId);
+			if ( child.onResized ) {
+				child.onResized();
+			}
+		}
+	}
+});
+
+dojo.widget.tags.addParseTreeHandler("dojo:Container");

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlFisheyeList.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlFisheyeList.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlFisheyeList.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlFisheyeList.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,648 @@
+dojo.provide("dojo.widget.FisheyeList");
+dojo.provide("dojo.widget.HtmlFisheyeList");
+dojo.provide("dojo.widget.HtmlFisheyeListItem");
+
+//
+// TODO
+// fix SVG support, and turn it on only if the browser supports it
+// fix really long labels in vertical mode
+//
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.HtmlWidget");
+dojo.require("dojo.widget.HtmlContainer");
+dojo.require("dojo.dom");
+dojo.require("dojo.html");
+dojo.require("dojo.style");
+dojo.require("dojo.event");
+
+dojo.widget.HtmlFisheyeList = function(){
+	dojo.widget.HtmlContainer.call(this);
+}
+dojo.inherits(dojo.widget.HtmlFisheyeList, dojo.widget.HtmlContainer);
+
+dojo.lang.extend(dojo.widget.HtmlFisheyeList, {
+
+	templateString: '<div class="dojoHtmlFisheyeListBar"></div>',
+	templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlFisheyeList.css"),
+	widgetType: "FisheyeList",
+
+	EDGE: {
+		CENTER: 0,
+		LEFT: 1,
+		RIGHT: 2,
+		TOP: 3,
+		BOTTOM: 4
+	},
+
+	snarfChildDomOutput: true,
+
+	/////////////////////////////////////////////////////////////////
+	//
+	// i spy OPTIONS!!!!
+	//
+
+	itemWidth: 40,
+	itemHeight: 40,
+
+	itemMaxWidth: 150,
+	itemMaxHeight: 150,
+
+	orientation: 'horizontal',
+
+	effectUnits: 2,
+	itemPadding: 10,
+
+	attachEdge: 'center',
+	labelEdge: 'bottom',
+
+	enableCrappySvgSupport: false,
+
+	//
+	//
+	//
+	/////////////////////////////////////////////////////////////////
+
+	fillInTemplate: function(args, frag) {
+		//dojo.debug(this.orientation);
+
+		dojo.html.disableSelection(this.domNode);
+
+		this.isHorizontal = (this.orientation == 'horizontal') ? 1 : 0;
+		this.selectedNode = -1;
+
+		this.isOver = false;
+		this.hitX1 = -1;
+		this.hitY1 = -1;
+		this.hitX2 = -1;
+		this.hitY2 = -1;
+
+		//
+		// only some edges make sense...
+		//
+
+		this.anchorEdge = this.toEdge(this.attachEdge, this.EDGE.CENTER);
+		this.labelEdge  = this.toEdge(this.labelEdge,  this.EDGE.TOP);
+
+		if ( this.isHorizontal && (this.anchorEdge == this.EDGE.LEFT  )){ this.anchorEdge = this.EDGE.CENTER; }
+		if ( this.isHorizontal && (this.anchorEdge == this.EDGE.RIGHT )){ this.anchorEdge = this.EDGE.CENTER; }
+		if (!this.isHorizontal && (this.anchorEdge == this.EDGE.TOP   )){ this.anchorEdge = this.EDGE.CENTER; }
+		if (!this.isHorizontal && (this.anchorEdge == this.EDGE.BOTTOM)){ this.anchorEdge = this.EDGE.CENTER; }
+
+		if (this.labelEdge == this.EDGE.CENTER){ this.labelEdge = this.EDGE.TOP; }
+		if ( this.isHorizontal && (this.labelEdge == this.EDGE.LEFT  )){ this.labelEdge = this.EDGE.TOP; }
+		if ( this.isHorizontal && (this.labelEdge == this.EDGE.RIGHT )){ this.labelEdge = this.EDGE.TOP; }
+		if (!this.isHorizontal && (this.labelEdge == this.EDGE.TOP   )){ this.labelEdge = this.EDGE.LEFT; }
+		if (!this.isHorizontal && (this.labelEdge == this.EDGE.BOTTOM)){ this.labelEdge = this.EDGE.LEFT; }
+
+
+		//
+		// figure out the proximity size
+		//
+
+		this.proximityLeft   = this.itemWidth  * (this.effectUnits - 0.5);
+		this.proximityRight  = this.itemWidth  * (this.effectUnits - 0.5);
+		this.proximityTop    = this.itemHeight * (this.effectUnits - 0.5);
+		this.proximityBottom = this.itemHeight * (this.effectUnits - 0.5);
+
+		if (this.anchorEdge == this.EDGE.LEFT){
+			this.proximityLeft = 0;
+		}
+		if (this.anchorEdge == this.EDGE.RIGHT){
+			this.proximityRight = 0;
+		}
+		if (this.anchorEdge == this.EDGE.TOP){
+			this.proximityTop = 0;
+		}
+		if (this.anchorEdge == this.EDGE.BOTTOM){
+			this.proximityBottom = 0;
+		}
+		if (this.anchorEdge == this.EDGE.CENTER){
+			this.proximityLeft   /= 2;
+			this.proximityRight  /= 2;
+			this.proximityTop    /= 2;
+			this.proximityBottom /= 2;
+		}
+	},
+	
+	postCreate: function(args, frag) {
+
+		this.itemCount = this.children.length;
+
+		this.barWidth  = (this.isHorizontal ? this.itemCount : 1) * this.itemWidth;
+		this.barHeight = (this.isHorizontal ? 1 : this.itemCount) * this.itemHeight;
+
+		this.totalWidth  = this.proximityLeft + this.proximityRight  + this.barWidth;
+		this.totalHeight = this.proximityTop  + this.proximityBottom + this.barHeight;
+
+		//
+		// calculate effect ranges for each item
+		//
+
+		for (var i=0; i<this.children.length; i++){
+
+			this.children[i].posX = this.itemWidth  * (this.isHorizontal ? i : 0);
+			this.children[i].posY = this.itemHeight * (this.isHorizontal ? 0 : i);
+
+			this.children[i].cenX = this.children[i].posX + (this.itemWidth  / 2);
+			this.children[i].cenY = this.children[i].posY + (this.itemHeight / 2);
+
+			var isz = this.isHorizontal ? this.itemWidth : this.itemHeight;
+			var r = this.effectUnits * isz;
+			var c = this.isHorizontal ? this.children[i].cenX : this.children[i].cenY;
+			var lhs = this.isHorizontal ? this.proximityLeft : this.proximityTop;
+			var rhs = this.isHorizontal ? this.proximityRight : this.proximityBottom;
+			var siz = this.isHorizontal ? this.barWidth : this.barHeight;
+
+			var range_lhs = r;
+			var range_rhs = r;
+
+			if (range_lhs > c+lhs){ range_lhs = c+lhs; }
+			if (range_rhs > (siz-c+rhs)){ range_rhs = siz-c+rhs; }
+
+			this.children[i].effectRangeLeft = range_lhs / isz;
+			this.children[i].effectRangeRght = range_rhs / isz;
+
+			//dojo.debug('effect range for '+i+' is '+range_lhs+'/'+range_rhs);
+		}
+
+
+		//
+		// create the bar
+		//
+
+		this.domNode.style.width = this.barWidth + 'px';
+		this.domNode.style.height = this.barHeight + 'px';
+
+
+		//
+		// position the items
+		//
+		for (var i=0; i<this.children.length; i++){
+			var itm = this.children[i];
+			var elm = itm.domNode;
+			elm.style.left   = itm.posX + 'px';
+			elm.style.top    = itm.posY + 'px';
+			elm.style.width  = this.itemWidth + 'px';
+			elm.style.height = this.itemHeight + 'px';
+			
+			if ( itm.svgNode ) {
+				itm.svgNode.style.position = 'absolute';
+				itm.svgNode.style.left = this.itemPadding+'%';
+				itm.svgNode.style.top = this.itemPadding+'%';
+				itm.svgNode.style.width = (100 - 2 * this.itemPadding) + '%';
+				itm.svgNode.style.height = (100 - 2 * this.itemPadding) + '%';
+				itm.svgNode.style.zIndex = 1;
+	
+				itm.svgNode.setSize(this.itemWidth, this.itemHeight);
+			} else {
+				itm.imgNode.style.left = this.itemPadding+'%';
+				itm.imgNode.style.top = this.itemPadding+'%';
+				itm.imgNode.style.width = (100 - 2 * this.itemPadding) + '%';
+				itm.imgNode.style.height = (100 - 2 * this.itemPadding) + '%';
+			}
+		}
+
+		//
+		// calc the grid
+		//
+
+		this.calcHitGrid();
+
+		//
+		// connect the event proc
+		//
+		dojo.event.connect(document.documentElement, "onmousemove", this, "mouseHandler");
+	},
+
+	mouseHandler: function(e) {
+		var p = this.getCursorPos(e);
+
+		if ((p.x >= this.hitX1) && (p.x <= this.hitX2) &&
+			(p.y >= this.hitY1) && (p.y <= this.hitY2)){
+
+			this.isOver = true;
+			this.onGridMouseMove(p.x-this.hitX1, p.y-this.hitY1);
+		}else{
+			if (this.isOver){
+				this.isOver = false;
+				this.onGridMouseMove(-1, -1);
+			}
+		}
+	},
+
+	onResized: function() {
+		this.calcHitGrid();
+	},
+
+	onGridMouseMove: function(x, y){
+
+		//
+		// figure out our main index
+		//
+
+		var pos = this.isHorizontal ? x : y;
+		var prx = this.isHorizontal ? this.proximityLeft : this.proximityTop;
+		var siz = this.isHorizontal ? this.itemWidth : this.itemHeight;
+		var sim = this.isHorizontal ? this.itemMaxWidth : this.itemMaxHeight;
+
+		var cen = ((pos - prx) / siz) - 0.5;
+		var max_off_cen = (sim / siz) - 0.5;
+
+		if (max_off_cen > this.effectUnits){ max_off_cen = this.effectUnits; }
+
+
+		//
+		// figure out our off-axis weighting
+		//
+
+		var off_weight = 0;
+
+		if (this.anchorEdge == this.EDGE.BOTTOM){
+			var cen2 = (y - this.proximityTop) / this.itemHeight;
+			off_weight = (cen2 > 0.5) ? 1 : y / (this.proximityTop + (this.itemHeight / 2));
+		}
+		if (this.anchorEdge == this.EDGE.TOP){
+			var cen2 = (y - this.proximityTop) / this.itemHeight;
+			off_weight = (cen2 < 0.5) ? 1 : (this.totalHeight - y) / (this.proximityBottom + (this.itemHeight / 2));
+		}
+		if (this.anchorEdge == this.EDGE.RIGHT){
+			var cen2 = (x - this.proximityLeft) / this.itemWidth;
+			off_weight = (cen2 > 0.5) ? 1 : x / (this.proximityLeft + (this.itemWidth / 2));
+		}
+		if (this.anchorEdge == this.EDGE.LEFT){
+			var cen2 = (x - this.proximityLeft) / this.itemWidth;
+			off_weight = (cen2 < 0.5) ? 1 : (this.totalWidth - x) / (this.proximityRight + (this.itemWidth / 2));
+		}
+		if (this.anchorEdge == this.EDGE.CENTER){
+
+			if (this.isHorizontal){
+				off_weight = y / (this.totalHeight);
+			}else{
+				off_weight = x / (this.totalWidth);
+			}
+
+			if (off_weight > 0.5){
+				off_weight = 1 - off_weight;
+			}
+
+			off_weight *= 2;
+		}
+
+
+		//
+		// set the sizes
+		//
+
+		for(var i=0; i<this.itemCount; i++){
+
+			var weight = this.weightAt(cen, i);
+
+			if (weight < 0){weight = 0;}
+
+			this.setitemsize(i, weight * off_weight);
+		}
+
+		//
+		// set the positions
+		//
+
+		var main_p = Math.round(cen);
+		var offset = 0;
+
+		if (cen < 0){
+			main_p = 0;
+
+		}else if (cen > this.itemCount - 1){
+
+			main_p = this.itemCount -1;
+
+		}else{
+
+			offset = (cen - main_p) * ((this.isHorizontal ? this.itemWidth : this.itemHeight) - this.children[main_p].sizeMain);
+		}
+
+		this.positionElementsFrom(main_p, offset);
+	},
+
+	weightAt: function(cen, i){
+
+		var dist = Math.abs(cen - i);
+
+		var limit = ((cen - i) > 0) ? this.children[i].effectRangeRght : this.children[i].effectRangeLeft;
+
+		return (dist > limit) ? 0 : (1 - dist / limit);
+	},
+
+	positionFromNode: function(p, w){
+
+		//
+		// we need to grow all the nodes growing out from node 'i'
+		//
+
+		this.setitemsize(p, w);
+
+		var wx = w;
+		for(var i=p; i<this.itemCount; i++){
+			wx = 0.8 * wx;
+			this.setitemsize(i, wx);
+		}
+
+		var wx = w;
+		for(var i=p; i>=0; i--){
+			wx = 0.8 * wx;
+			this.setitemsize(i, wx);
+		}
+	},
+
+	setitemsize: function(p, scale){
+
+		var w = Math.round(this.itemWidth  + ((this.itemMaxWidth  - this.itemWidth ) * scale));
+		var h = Math.round(this.itemHeight + ((this.itemMaxHeight - this.itemHeight) * scale));
+
+		if (this.isHorizontal){
+
+			this.children[p].sizeW = w;
+			this.children[p].sizeH = h;
+
+			this.children[p].sizeMain = w;
+			this.children[p].sizeOff  = h;
+
+			var y = 0;
+
+			if (this.anchorEdge == this.EDGE.TOP){
+
+				y = (this.children[p].cenY - (this.itemHeight / 2));
+
+			}else if (this.anchorEdge == this.EDGE.BOTTOM){
+
+				y = (this.children[p].cenY - (h - (this.itemHeight / 2)));
+
+			}else{
+
+				y = (this.children[p].cenY - (h / 2));
+			}
+
+			this.children[p].usualX = Math.round(this.children[p].cenX - (w / 2));
+			this.children[p].domNode.style.top  = y + 'px';
+
+			this.children[p].domNode.style.left  = this.children[p].usualX + 'px';
+
+		}else{
+
+			this.children[p].sizeW = w;
+			this.children[p].sizeH = h;
+
+			this.children[p].sizeOff  = w;
+			this.children[p].sizeMain = h;
+
+			var x = 0;
+
+			if (this.anchorEdge == this.EDGE.LEFT){
+
+				x = this.children[p].cenX - (this.itemWidth / 2);
+
+			}else if (this.anchorEdge == this.EDGE.RIGHT){
+
+				x = this.children[p].cenX - (w - (this.itemWidth / 2));
+			}else{
+
+				x = this.children[p].cenX - (w / 2);
+			}
+
+			this.children[p].domNode.style.left = x + 'px';
+			this.children[p].usualY = Math.round(this.children[p].cenY - (h / 2));
+
+			this.children[p].domNode.style.top  = this.children[p].usualY + 'px';
+		}
+
+		this.children[p].domNode.style.width  = w + 'px';
+		this.children[p].domNode.style.height = h + 'px';
+
+		if (this.children[p].svgNode){
+			this.children[p].svgNode.setSize(w, h);
+		}
+	},
+
+	positionElementsFrom: function(p, offset){
+
+		var pos = 0;
+
+		if (this.isHorizontal){
+			pos = Math.round(this.children[p].usualX + offset);
+			this.children[p].domNode.style.left = pos + 'px';
+		}else{
+			pos = Math.round(this.children[p].usualY + offset);
+			this.children[p].domNode.style.top = pos + 'px';
+		}
+		this.positionLabel(this.children[p]);
+
+
+		//
+		// position before
+		//
+
+		var bpos = pos;
+
+		for(var i=p-1; i>=0; i--){
+
+			bpos -= this.children[i].sizeMain;
+
+			if (this.isHorizontal){
+				this.children[i].domNode.style.left = bpos + 'px';
+			}else{
+				this.children[i].domNode.style.top = bpos + 'px';
+			}
+			this.positionLabel(this.children[i]);
+		}
+
+		//
+		// position after
+		//
+
+		var apos = pos;
+
+		for(var i=p+1; i<this.itemCount; i++){
+
+			apos += this.children[i-1].sizeMain;
+
+			if (this.isHorizontal){
+				this.children[i].domNode.style.left = apos + 'px';
+			}else{
+				this.children[i].domNode.style.top = apos + 'px';
+			}
+			this.positionLabel(this.children[i]);
+		}
+
+	},
+
+	positionLabel: function(itm){
+
+		var x = 0;
+		var y = 0;
+		var labelW = dojo.style.getOuterWidth(itm.lblNode);
+		var labelH = dojo.style.getOuterHeight(itm.lblNode);
+
+		if (this.labelEdge == this.EDGE.TOP){
+			x = Math.round((itm.sizeW / 2) - (labelW / 2));
+			y = -labelH;
+		}
+
+		if (this.labelEdge == this.EDGE.BOTTOM){
+			x = Math.round((itm.sizeW / 2) - (labelW / 2));
+			y = itm.sizeH;
+		}
+
+		if (this.labelEdge == this.EDGE.LEFT){
+			x = -labelW;
+			y = Math.round((itm.sizeH / 2) - (labelH / 2));
+		}
+
+		if (this.labelEdge == this.EDGE.RIGHT){
+			x = itm.sizeW;
+			y = Math.round((itm.sizeH / 2) - (labelH / 2));
+		}
+
+		itm.lblNode.style.left = x + 'px';
+		itm.lblNode.style.top  = y + 'px';
+	},
+
+	getCursorPos: function(e){
+		return {
+			'x': e.pageX || e.clientX + dojo.html.body().scrollLeft,
+			'y': e.pageY || e.clientY + dojo.html.body().scrollTop
+			};
+	},
+
+	calcHitGrid: function(){
+
+		var pos = dojo.style.getAbsolutePosition(this.domNode);
+
+		this.hitX1 = pos.x - this.proximityLeft;
+		this.hitY1 = pos.y - this.proximityTop;
+		this.hitX2 = this.hitX1 + this.totalWidth;
+		this.hitY2 = this.hitY1 + this.totalHeight;
+
+		//dojo.debug(this.hitX1+','+this.hitY1+' // '+this.hitX2+','+this.hitY2);
+	},
+
+	toEdge: function(inp, def){
+		return this.EDGE[inp.toUpperCase()] || def;
+	}
+});
+
+dojo.widget.HtmlFisheyeListItem = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+dojo.inherits(dojo.widget.HtmlFisheyeListItem, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.HtmlFisheyeListItem, {
+	widgetType: "FisheyeListItem",
+	
+	// Constructor arguments
+	iconSrc: "",
+	svgSrc: "",
+	caption: "",
+
+	blankImgPath: dojo.uri.dojoUri("src/widget/templates/images/blank.gif"),
+
+	templateString:
+		'<div class="dojoHtmlFisheyeListItem">' +
+		'  <img class="dojoHtmlFisheyeListItemImage" dojoAttachPoint="imgNode" dojoAttachEvent="onMouseOver;onMouseOut;onClick">' +
+		'  <div class="dojoHtmlFisheyeListItemLabel" dojoAttachPoint="lblNode"></div>' +
+		'</div>',
+	
+	imgNode: null,
+
+	fillInTemplate: function() {
+		//
+		// set image
+		// TODO: turn on/off SVG support based on browser version.
+		// this.parent.enableCrappySvgSupport is not available to this function
+		//
+		if (this.svgSrc != ""){
+			this.svgNode = this.createSvgNode(this.svgSrc);
+			this.domNode.appendChild(this.svgNode);
+			this.imgNode.style.display = 'none';
+		} else if((this.iconSrc.toLowerCase().substring(this.iconSrc.length-4)==".png")&&(dojo.render.html.ie)){
+			this.imgNode.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.iconSrc+"', sizingMethod='scale')";
+			this.imgNode.src = this.blankImgPath.toString();
+		} else {
+			this.imgNode.src = this.iconSrc;
+		}
+
+		//
+		// Label
+		//
+		if ( this.lblNode ) {
+			this.lblNode.appendChild(document.createTextNode(this.caption));
+			this.lblNode.style.display = 'none';
+		}
+	},
+	
+	createSvgNode: function(src){
+
+		var elm = document.createElement('embed');
+		elm.src = src;
+		elm.type = 'image/svg+xml';
+		//elm.style.border = '1px solid black';
+		elm.style.width = '1px';
+		elm.style.height = '1px';
+		elm.loaded = 0;
+		elm.setSizeOnLoad = false;
+
+		elm.onload = function(){
+			this.svgRoot = this.getSVGDocument().rootElement;
+			this.svgDoc = this.getSVGDocument().documentElement;
+			this.zeroWidth = this.svgRoot.width.baseVal.value;
+			this.zeroHeight = this.svgRoot.height.baseVal.value;
+			this.loaded = true;
+
+			if (this.setSizeOnLoad){
+				this.setSize(this.setWidth, this.setHeight);
+			}
+		}
+
+		elm.setSize = function(w, h){
+			if (!this.loaded){
+				this.setWidth = w;
+				this.setHeight = h;
+				this.setSizeOnLoad = true;
+				return;
+			}
+
+			this.style.width = w+'px';
+			this.style.height = h+'px';
+			this.svgRoot.width.baseVal.value = w;
+			this.svgRoot.height.baseVal.value = h;
+
+			var scale_x = w / this.zeroWidth;
+			var scale_y = h / this.zeroHeight;
+
+			for(var i=0; i<this.svgDoc.childNodes.length; i++){
+				if (this.svgDoc.childNodes[i].setAttribute){
+					this.svgDoc.childNodes[i].setAttribute( "transform", "scale("+scale_x+","+scale_y+")" );
+				}
+			}
+		}
+
+		return elm;
+	},
+
+	onMouseOver: function() {
+		if ( this.caption != "" ) {
+			this.lblNode.style.display="block";
+			this.parent.positionLabel(this);
+		}
+	},
+	
+	onMouseOut: function() {
+		this.lblNode.style.display="none";
+	},
+
+	onClick: function() {
+	}
+});
+
+dojo.widget.tags.addParseTreeHandler("dojo:FisheyeList");
+dojo.widget.tags.addParseTreeHandler("dojo:FisheyeListItem");

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlFloatingPane.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlFloatingPane.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlFloatingPane.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlFloatingPane.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,239 @@
+dojo.provide("dojo.widget.FloatingPane");
+dojo.provide("dojo.widget.HtmlFloatingPane");
+
+//
+// this widget provides a window-like floating pane
+//
+// TODO: instead of custom drag code, use HtmlDragMove.js in
+// conjuction with DragHandle).  The only tricky part is the constraint 
+// stuff (to keep the box within the container's boundaries)
+//
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.html");
+dojo.require("dojo.style");
+dojo.require("dojo.dom");
+dojo.require("dojo.widget.HtmlLayoutPane");
+
+dojo.widget.HtmlFloatingPane = function(){
+	dojo.widget.HtmlLayoutPane.call(this);
+}
+
+dojo.inherits(dojo.widget.HtmlFloatingPane, dojo.widget.HtmlLayoutPane);
+
+dojo.lang.extend(dojo.widget.HtmlFloatingPane, {
+	widgetType: "FloatingPane",
+
+	// Constructor arguments
+	title: 'Untitled',
+	iconSrc: '',
+	hasShadow: false,
+	constrainToContainer: false,
+	taskBarId: "",
+	resizable: true,	// note: if specified, user must include HtmlResizeHandle
+	url: "inline",
+	extractContent: true,
+	parseContent: true,
+	resizable: false,
+	fancyTitleBar: true,
+
+	isContainer: true,
+	containerNode: null,
+	domNode: null,
+	clientPane: null,
+	dragBar: null,
+	dragOrigin: null,
+	posOrigin: null,
+	maxPosition: null,
+
+	templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlFloatingPane.css"),
+	titleBarBackground: dojo.uri.dojoUri("src/widget/templates/images/titlebar-bg.jpg"),
+	isDragging: false,
+
+	fillInTemplate: function(){
+
+		if (this.templateCssPath) {
+			dojo.style.insertCssFile(this.templateCssPath, null, true);
+		}
+
+		dojo.html.addClass(this.domNode, 'dojoFloatingPane');
+
+		var clientDiv = document.createElement('div');
+		dojo.dom.moveChildren(this.domNode, clientDiv, 0);
+		dojo.html.addClass(clientDiv, 'dojoFloatingPaneClient');
+
+		// this is our client area
+		this.clientPane = this.createPane(clientDiv, {layoutAlign: "client", url: this.url, id:this.widgetId+"_client"});
+		delete this.url;
+
+		// this is our chrome
+		var chromeDiv = document.createElement('div');
+		//chromeDiv.style.height="15px";
+		dojo.html.addClass(chromeDiv, 'dojoFloatingPaneDragbar');
+		this.dragBar = this.createPane(chromeDiv, {layoutAlign: 'top', id:this.widgetId+"_chrome"});
+		dojo.html.disableSelection(this.dragBar.domNode);
+
+		if( this.fancyTitleBar ){
+			// image background to get gradient
+			var img = document.createElement('img');
+			img.src = this.titleBarBackground,
+			dojo.html.addClass(img, 'dojoFloatingPaneDragbarBackground');
+			var backgroundPane = dojo.widget.fromScript("LayoutPane", {layoutAlign:"flood", id:this.widgetId+"_titleBackground"}, img);
+			this.dragBar.addPane(backgroundPane);
+		}
+		var title = document.createElement("div");
+		dojo.html.addClass(title, 'dojoFloatingPaneTitle');
+		dojo.html.disableSelection(title);
+		title.appendChild(document.createTextNode(this.title));
+		chromeDiv.appendChild(title);
+		
+		dojo.event.connect(this.dragBar.domNode, 'onmousedown', this, 'onMyDragStart');
+
+		if ( this.resizable ) {
+			// add the resize handle
+			var resizeDiv = document.createElement('div');
+			dojo.html.addClass(resizeDiv, "dojoFloatingPaneResizebar");
+			var rh = dojo.widget.fromScript("ResizeHandle", {targetElmId: this.widgetId, id:this.widgetId+"_resize"});
+			this.resizePane = this.createPane(resizeDiv, {layoutAlign: "bottom"});
+			this.resizePane.addChild(rh);
+		}
+
+		// add a drop shadow
+		if ( this.hasShadow ) {
+			this.shadow = document.createElement('div');
+			dojo.html.addClass(this.shadow, "dojoDropShadow");
+			this.shadow.style["z-index"]="-100";
+			dojo.style.setOpacity(this.shadow, 0.5);
+			this.domNode.appendChild(this.shadow);
+			dojo.html.disableSelection(this.shadow);
+			dojo.style.setOpacity(this.domNode, 1);
+		}
+
+		// and add a background div so the shadow doesn't seep through the margin of the title bar
+		var backgroundDiv = document.createElement('div');
+		dojo.html.addClass(backgroundDiv, 'dojoFloatingPaneBackground');
+		this.background = this.createPane(backgroundDiv, {layoutAlign: 'flood', id:this.widgetId+"_background"});
+	},
+
+	postCreate: function(args, fragment, parentComp){
+
+		// move our 'children' into the client pane
+		// we already moved the domnodes, but now we need to move the 'children'
+
+		var kids = this.children.concat();
+		this.children = [];
+
+		for(var i=0; i<kids.length; i++){
+			if (kids[i].ownerPane == this){
+				this.children.push(kids[i]);
+			}else{
+				this.clientPane.children.push(kids[i]);
+
+				if (kids[i].widgetType == 'LayoutPane'){
+					kids[i].domNode.style.position = 'absolute';
+				}
+			}
+		}
+
+		// add myself to the taskbar after the taskbar has been initialized
+		if( this.taskBarId != "" ){
+			dojo.addOnLoad(this, "taskBarSetup");
+		}
+	},
+
+	// add icon to task bar, connected to me
+	taskBarSetup: function() {
+		var taskbar = dojo.widget.getWidgetById(this.taskBarId);
+		if( !taskbar ){ return; }
+		var tbi = dojo.widget.fromScript("TaskBarItem",
+			{caption: this.title, iconSrc: this.iconSrc, task: this} );
+		taskbar.addChild(tbi);
+	},
+
+	onResized: function(){
+		if( !this.isVisible() ){ return; }
+
+		var newHeight = dojo.style.getOuterHeight(this.domNode);
+		var newWidth = dojo.style.getOuterWidth(this.domNode);
+		
+		//if ( newWidth != this.outerWidth || newHeight != this.outerHeight ) {
+			this.outerWidth = newWidth;
+			this.outerHeight = newHeight;
+			if ( this.shadow ) {
+				dojo.style.setOuterWidth(this.shadow, newWidth);
+				dojo.style.setOuterHeight(this.shadow, newHeight);
+			}
+			dojo.widget.HtmlFloatingPane.superclass.onResized.call(this);
+		//}
+	},
+
+	createPane: function(node, args){
+		var pane = dojo.widget.fromScript("LayoutPane", args, node);
+		this.addPane(pane);
+		pane.ownerPane=this;
+		return pane;
+	},
+
+	onMyDragStart: function(e){
+		if (this.isDragging){ return; }
+
+		this.dragOrigin = {'x': e.clientX, 'y': e.clientY};
+		
+		// this doesn't work if (as in the test file) the user hasn't set top
+		// 	this.posOrigin = {'x': dojo.style.getNumericStyle(this.domNode, 'left'), 'y': dojo.style.getNumericStyle(this.domNode, 'top')};
+		this.posOrigin = {'x': this.domNode.offsetLeft, 'y': this.domNode.offsetTop};
+
+		if (this.constrainToContainer){
+			// TODO: this doesn't work with scrolled pages
+
+			// get parent client size...
+
+			if (this.domNode.parentNode.nodeName.toLowerCase() == 'body'){
+				var parentClient = {
+					'w': dojo.html.getViewportWidth(),
+					'h': dojo.html.getViewportHeight()
+				};
+			}else{
+				var parentClient = {
+					'w': dojo.style.getInnerWidth(this.domNode.parentNode),
+					'h': dojo.style.getInnerHeight(this.domNode.parentNode)
+				};
+			}
+
+			this.maxPosition = {
+				'x': parentClient.w - dojo.style.getOuterWidth(this.domNode),
+				'y': parentClient.h - dojo.style.getOuterHeight(this.domNode)
+			};
+		}
+
+		dojo.event.connect(document, 'onmousemove', this, 'onMyDragMove');
+		dojo.event.connect(document, 'onmouseup', this, 'onMyDragEnd');
+
+		this.isDragging = true;
+	},
+
+	onMyDragMove: function(e){
+		var x = this.posOrigin.x + (e.clientX - this.dragOrigin.x);
+		var y = this.posOrigin.y + (e.clientY - this.dragOrigin.y);
+
+		if (this.constrainToContainer){
+			if (x < 0){ x = 0; }
+			if (y < 0){ y = 0; }
+			if (x > this.maxPosition.x){ x = this.maxPosition.x; }
+			if (y > this.maxPosition.y){ y = this.maxPosition.y; }
+		}
+
+		this.domNode.style.left = x + 'px';
+		this.domNode.style.top  = y + 'px';
+	},
+
+	onMyDragEnd: function(e){
+		dojo.event.disconnect(document, 'onmousemove', this, 'onMyDragMove');
+		dojo.event.disconnect(document, 'onmouseup', this, 'onMyDragEnd');
+
+		this.isDragging = false;
+	}
+	
+});
+
+dojo.widget.tags.addParseTreeHandler("dojo:FloatingPane");

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlInlineEditBox.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlInlineEditBox.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlInlineEditBox.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlInlineEditBox.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,185 @@
+dojo.provide("dojo.widget.InlineEditBox");
+dojo.provide("dojo.widget.HtmlInlineEditBox");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.fx.*");
+dojo.require("dojo.graphics.color");
+dojo.require("dojo.string");
+dojo.require("dojo.style");
+dojo.require("dojo.html");
+
+dojo.widget.HtmlInlineEditBox = function(){
+	dojo.widget.HtmlWidget.call(this);
+	// mutable objects need to be in constructor to give each instance its own copy
+	this.history = [];
+	this.storage = document.createElement("span");
+}
+
+dojo.inherits(dojo.widget.HtmlInlineEditBox, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.HtmlInlineEditBox, {
+	templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlInlineEditBox.html"),
+	templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlInlineEditBox.css"),
+	widgetType: "InlineEditBox",
+
+	form: null,
+	editBox: null,
+	edit: null,
+	text: null,
+	textarea: null,
+	submitButton: null,
+	cancelButton: null,
+	mode: "text",
+
+	minWidth: 100, //px. minimum width of edit box
+	minHeight: 200, //px. minimum width of edit box, if it's a TA
+
+	editing: false,
+	textValue: "",
+	defaultText: "",
+	doFade: false,
+
+	onSave: function(newValue, oldValue){},
+	onUndo: function(value){},
+
+	// overwrite buildRendering so we don't clobber our list
+	buildRendering: function(args, frag){
+		this.nodeRef = frag["dojo:"+this.widgetType.toLowerCase()]["nodeRef"];
+		var node = this.nodeRef;
+		if(node.normalize){ node.normalize(); }
+
+		dojo.widget.buildAndAttachTemplate(this);
+
+		this.editable = document.createElement("span");
+		// this.editable.appendChild(node.firstChild);
+		while(node.firstChild){
+			this.editable.appendChild(node.firstChild);
+		}
+		// this.textValue = this.editable.firstChild.nodeValue;
+		this.textValue = dojo.string.trim(this.editable.innerHTML);
+		if(dojo.string.trim(this.textValue).length == 0){
+			this.editable.innerHTML = this.defaultText;
+		}
+		/*
+		if(node.hasChildNodes()) {
+			node.insertBefore(this.editable, node.firstChild);
+		} else {
+		}
+		*/
+		node.appendChild(this.editable);
+
+		// delay to try and show up before stylesheet
+		var _this = this;
+		setTimeout(function(){
+			_this.editable.appendChild(_this.edit);
+		}, 30);
+
+		dojo.event.connect(this.editable, "onmouseover", this, "mouseover");
+		dojo.event.connect(this.editable, "onmouseout", this, "mouseout");
+		dojo.event.connect(this.editable, "onclick", this, "beginEdit");
+
+		this.fillInTemplate(args, frag);
+	},
+
+	mouseover: function(e){
+		if(!this.editing){
+			dojo.html.addClass(this.editable, "editableRegion");
+			if(this.mode == "textarea"){
+				dojo.html.addClass(this.editable, "editableTextareaRegion");
+			}
+		}
+	},
+
+	mouseout: function(e){
+		// if((e)&&(e.target != this.domNode)){ return; }
+		if(!this.editing){
+			dojo.html.removeClass(this.editable, "editableRegion");
+			dojo.html.removeClass(this.editable, "editableTextareaRegion");
+		}
+	},
+
+	beginEdit: function(e){
+		if(this.editing){ return; }
+		this.mouseout();
+		this.editing = true;
+
+		var ee = this[this.mode.toLowerCase()];
+
+		ee.style.display = "";
+		ee.value = dojo.string.trim(this.textValue);
+		ee.style.fontSize = dojo.style.getStyle(this.editable, "font-size");
+		ee.style.fontWeight = dojo.style.getStyle(this.editable, "font-weight");
+		ee.style.fontStyle = dojo.style.getStyle(this.editable, "font-style");
+		//this.text.style.fontFamily = dojo.dom.getStyle(this.editable, "font-family");
+
+		ee.style.width = Math.max(dojo.html.getInnerWidth(this.editable), this.minWidth) + "px";
+		// ee.style.width = "100%";
+
+		if(this.mode.toLowerCase()=="textarea"){
+			ee.style.display = "block";
+			ee.style.height = Math.max(dojo.html.getInnerHeight(this.editable), this.minHeight) + "px";
+		}
+		this.editable.style.display = "none";
+		this.nodeRef.appendChild(this.form);
+		ee.select();
+		this.submitButton.disabled = true;
+	},
+
+	saveEdit: function(e){
+		e.preventDefault();
+		e.stopPropagation();
+		var ee = this[this.mode.toLowerCase()];
+		if((this.textValue != ee.value)&&
+			(dojo.string.trim(ee.value) != "")){
+			this.doFade = true;
+			this.history.push(this.textValue);
+			this.onSave(ee.value, this.textValue);
+			this.textValue = ee.value;
+			this.editable.innerHTML = this.textValue;
+		}else{
+			this.doFade = false;
+		}
+		this.finishEdit(e);
+	},
+
+	cancelEdit: function(e){
+		if(!this.editing){ return false; }
+		this.editing = false;
+		this.nodeRef.removeChild(this.form);
+		this.editable.style.display = "";
+		return true;
+	},
+
+	finishEdit: function(e){
+		if(!this.cancelEdit(e)){ return; }
+		if(this.doFade) {
+			dojo.fx.highlight(this.editable, dojo.graphics.color.hex2rgb("#ffc"), 700, 300);
+		}
+		this.doFade = false;
+	},
+
+	setText: function(txt){
+		// sets the text without informing the server
+		var tt = dojo.string.trim(txt);
+		this.textValue = tt
+		this.editable.innerHTML = tt;
+	},
+
+	undo: function(){
+		if(this.history.length > 0){
+			var value = this.history.pop();
+			this.editable.innerHTML = value;
+			this.textValue = value;
+			this.onUndo(value);
+		}
+	},
+
+	checkForValueChange: function(){
+		var ee = this[this.mode.toLowerCase()];
+		if((this.textValue != ee.value)&&
+			(dojo.string.trim(ee.value) != "")){
+			this.submitButton.disabled = false;
+		}
+	}
+});
+dojo.widget.tags.addParseTreeHandler("dojo:inlineeditbox");

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlLayoutPane.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlLayoutPane.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlLayoutPane.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlLayoutPane.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,423 @@
+dojo.provide("dojo.widget.LayoutPane");
+dojo.provide("dojo.widget.HtmlLayoutPane");
+
+//
+// this widget provides Delphi-style panel layout semantics
+// this is a good place to stash layout logic, then derive components from it
+//
+// TODO: allow more edge priority orders (e.g. t,r,l,b)
+// TODO: allow percentage sizing stuff
+//
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.event.*");
+dojo.require("dojo.io.*");
+dojo.require("dojo.widget.HtmlContainer");
+dojo.require("dojo.html");
+dojo.require("dojo.style");
+dojo.require("dojo.dom");
+dojo.require("dojo.string");
+
+
+dojo.widget.HtmlLayoutPane = function(){
+	dojo.widget.HtmlContainer.call(this);
+}
+
+dojo.inherits(dojo.widget.HtmlLayoutPane, dojo.widget.HtmlContainer);
+
+dojo.lang.extend(dojo.widget.HtmlLayoutPane, {
+	widgetType: "LayoutPane",
+
+	isChild: false,
+
+	clientLeft: 0,
+	clientTop: 0,
+	clientRect: {'left':0, 'right':0, 'top':0, 'bottom':0},
+	clientWidth: 0,
+	clientHeight: 0,
+
+	layoutAlign: 'none',
+	layoutChildPriority: 'top-bottom',
+
+	cssPath: dojo.uri.dojoUri("src/widget/templates/HtmlLayoutPane.css"),
+
+	// If this pane's content is external then set the url here	
+	url: "inline",
+	extractContent: true,
+	parseContent: true,
+	
+	// To generate pane content from a java function
+	handler: "none",
+
+	minWidth: 0,
+	minHeight: 0,
+
+	fillInTemplate: function(){
+		this.filterAllowed('layoutAlign',         ['none', 'left', 'top', 'right', 'bottom', 'client', 'flood']);
+		this.filterAllowed('layoutChildPriority', ['left-right', 'top-bottom']);
+
+		// Need to include CSS manually because there is no template file/string
+		dojo.style.insertCssFile(this.cssPath, null, true);
+
+		this.domNode.style.position = 'relative';
+		dojo.html.addClass(this.domNode, "dojoLayoutPane");
+		dojo.html.addClass(this.domNode, "dojoAlign" + dojo.string.capitalize(this.layoutAlign));		
+	},
+
+	postCreate: function(args, fragment, parentComp){
+
+		for(var i=0; i<this.children.length; i++){
+			if (this.hasLayoutAlign(this.children[i])){
+				this.children[i].domNode.style.position = 'absolute';
+				this.children[i].isChild = true;	
+			}
+		}
+
+		if ( this.handler != "none" ){
+			this.setHandler(this.handler);
+		}
+		if ( this.isVisible() ){
+			this.loadContents();
+		}
+	},
+
+	// If the pane contents are external then load them
+	loadContents: function() {
+		if ( this.isLoaded ){
+			return;
+		}
+		if ( dojo.lang.isFunction(this.handler)) {
+			this._runHandler();
+		} else if ( this.url != "inline" ) {
+			this._downloadExternalContent(this.url, true);
+		}
+		this.isLoaded=true;
+	},
+
+	// Reset the (external defined) content of this pane
+	setUrl: function(url) {
+		this.url = url;
+		this.isLoaded = false;
+		if ( this.isVisible() ){
+			this.loadContents();
+		}
+	},
+
+	_downloadExternalContent: function(url, useCache) {
+		//dojo.debug(this.widgetId + " downloading " + url);
+		var node = this.containerNode || this.domNode;
+		node.innerHTML = "Loading...";
+
+		var extract = this.extractContent;
+		var parse = this.parseContent;
+		var self = this;
+
+		dojo.io.bind({
+			url: url,
+			useCache: useCache,
+			mimetype: "text/html",
+			handler: function(type, data, e) {
+				if(type == "load") {
+					if(extract) {
+						var matches = data.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);
+						if(matches) { data = matches[1]; }
+					}
+					node.innerHTML = data;
+					if(parse) {
+						var parser = new dojo.xml.Parse();
+						var frag = parser.parseElement(node, null, true);
+						dojo.widget.getParser().createComponents(frag);
+					}
+					self.onResized();
+				} else {
+					node.innerHTML = "Error loading '" + url + "' (" + e.status + " " + e.statusText + ")";
+				}
+			}
+		});
+	},
+
+	// Generate pane content from given java function
+	setHandler: function(handler) {
+		var fcn = dojo.lang.isFunction(handler) ? handler : window[handler];
+		if(!dojo.lang.isFunction(fcn)) {
+			throw new Error("Unable to set handler, '" + handler + "' not a function.");
+			return;
+		}
+		this.handler = function() {
+			return fcn.apply(this, arguments);
+		}
+	},
+
+	_runHandler: function() {
+		if(dojo.lang.isFunction(this.handler)) {
+			this.handler(this, this.domNode);
+			return false;
+		}
+		return true;
+		/*
+		// in case we want to honor the return value?
+		var ret = true;
+		if(dojo.lang.isFunction(this.handler) {
+			var val = this.handler(this, panel);
+			if(!dojo.lang.isUndefined(val)) {
+				ret = val;
+			}
+		}
+		return ret;
+		*/
+	},
+
+	filterAllowed: function(param, values){
+		if ( !dojo.lang.inArray(values, this[param]) ) {
+			this[param] = values[0];
+		}
+	},
+
+	layoutChildren: function(){
+		// find the children to arrange
+
+		var kids = {'left':[], 'right':[], 'top':[], 'bottom':[], 'client':[], 'flood':[]};
+		var hits = 0;
+
+		for(var i=0; i<this.children.length; i++){
+			if (this.hasLayoutAlign(this.children[i])){
+				kids[this.children[i].layoutAlign].push(this.children[i]);
+				hits++;
+			}
+		}
+
+		if (!hits){
+			return;
+		}
+
+		var container = this.containerNode || this.domNode;
+
+		// calc layout space
+
+		this.clientWidth  = dojo.style.getContentWidth(container);
+		this.clientHeight = dojo.style.getContentHeight(container);
+
+		this.clientRect['left']   = dojo.style.getPixelValue(container, "padding-left", true);
+		this.clientRect['right']  = dojo.style.getPixelValue(container, "padding-right", true);
+		this.clientRect['top']    = dojo.style.getPixelValue(container, "padding-top", true);
+		this.clientRect['bottom'] = dojo.style.getPixelValue(container, "padding-bottom", true);
+
+		// arrange them in order
+		this.layoutCenter(kids, "flood");
+		if (this.layoutChildPriority == 'top-bottom'){
+			this.layoutFloat(kids, "top");
+			this.layoutFloat(kids, "bottom");
+			this.layoutFloat(kids, "left");
+			this.layoutFloat(kids, "right");
+		}else{
+			this.layoutFloat(kids, "left");
+			this.layoutFloat(kids, "right");
+			this.layoutFloat(kids, "top");
+			this.layoutFloat(kids, "bottom");
+		}
+		this.layoutCenter(kids, "client");
+	},
+
+	// Position the left/right/top/bottom aligned elements
+	layoutFloat: function(kids, position){
+		var ary = kids[position];
+		
+		// figure out which two of the left/right/top/bottom properties to set
+		var lr = (position=="right")?"right":"left";
+		var tb = (position=="bottom")?"bottom":"top";
+
+		for(var i=0; i<ary.length; i++){
+			var elm=ary[i];
+			
+			// set two of left/right/top/bottom properties
+			elm.domNode.style[lr]=this.clientRect[lr] + "px";
+			elm.domNode.style[tb]=this.clientRect[tb] + "px";
+			
+			// adjust record of remaining space
+			if ( (position=="top")||(position=="bottom") ) {
+				dojo.style.setOuterWidth(elm.domNode, this.clientWidth);
+				var height = dojo.style.getOuterHeight(elm.domNode);
+				this.clientHeight -= height;
+				this.clientRect[position] += height;
+			} else {
+				dojo.style.setOuterHeight(elm.domNode, this.clientHeight);
+				var width = dojo.style.getOuterWidth(elm.domNode);
+				this.clientWidth -= width;
+				this.clientRect[position] += width;
+			}
+		}
+	},
+
+	// Position elements into the remaining space (in the center)
+	// If multiple elements are present they overlap each other
+	layoutCenter: function(kids, position){
+		var ary = kids[position];
+		for(var i=0; i<ary.length; i++){
+			var elm=ary[i];
+			elm.domNode.style.left=this.clientRect.left + "px";
+			elm.domNode.style.top=this.clientRect.top + "px";
+			dojo.style.setOuterWidth(elm.domNode, this.clientWidth);		
+			dojo.style.setOuterHeight(elm.domNode, this.clientHeight);
+		}
+
+	},
+
+	hasLayoutAlign: function(child){
+		return dojo.lang.inArray(['left','right','top','bottom','client', 'flood'], child.layoutAlign);
+	},
+
+	addPane: function(pane){
+
+		pane.domNode.style.position = 'absolute';
+		pane.isChild = true;
+
+		this.addChild(pane);
+
+		this.resizeSoon();
+	},
+
+	removePane: function(pane){
+
+		this.removeChild(pane);
+
+		dojo.dom.removeNode(pane.domNode);
+
+		this.resizeSoon();
+	},
+	
+	resizeSoon: function(){
+		if ( this.isVisible() ) {
+			dojo.lang.setTimeout(this, this.onResized, 0);
+		}
+	},
+
+	onResized: function(){
+		if ( !this.isVisible() ) {
+			return;
+		}
+
+		//dojo.debug(this.widgetId + ": resized");
+
+		// set position/size for my children
+		this.layoutChildren();
+
+		// notify children that they have been moved/resized
+		this.notifyChildrenOfResize();
+	},
+
+	resizeTo: function(w, h){
+
+		w = Math.max(w, this.getMinWidth());
+		h = Math.max(h, this.getMinHeight());
+
+		dojo.style.setOuterWidth(this.domNode, w);
+		dojo.style.setOuterHeight(this.domNode, h);
+		this.onResized();
+	},
+
+	show: function(){
+		// If this is the first time we are displaying this object,
+		// and the contents are external, then download them.
+		this.loadContents();
+
+		// If this node was created while display=="none" then it
+		// hasn't been laid out yet.  Do that now.
+		this.domNode.style.display="";
+		this.onResized();
+		this.domNode.style.display="none";
+		this.domNode.style.visibility="";
+
+		dojo.widget.HtmlLayoutPane.superclass.show.call(this);
+	},
+
+	getMinWidth: function(){
+
+		//
+		// we need to first get the cumulative width
+		//
+
+		var w = this.minWidth;
+
+		if ((this.layoutAlign == 'left') || (this.layoutAlign == 'right')){
+
+			w = dojo.style.getOuterWidth(this.domNode);
+		}
+
+		for(var i=0; i<this.children.length; i++){
+			var ch = this.children[i];
+			var a = ch.layoutAlign;
+
+			if ((a == 'left') || (a == 'right') || (a == 'client')){
+
+				if (dojo.lang.isFunction(ch.getMinWidth)){
+					w += ch.getMinWidth();
+				}
+			}
+		}
+
+		//
+		// but then we need to check to see if the top/bottom kids are larger
+		//
+
+		for(var i=0; i<this.children.length; i++){
+			var ch = this.children[i];
+			var a = ch.layoutAlign;
+
+			if ((a == 'top') || (a == 'bottom')){
+
+				if (dojo.lang.isFunction(ch.getMinWidth)){
+					w = Math.max(w, ch.getMinWidth());
+				}
+			}
+		}
+
+		return w;
+	},
+
+	getMinHeight: function(){
+
+		//
+		// we need to first get the cumulative height
+		//
+
+		var h = this.minHeight;
+
+		if ((this.layoutAlign == 'top') || (this.layoutAlign == 'bottom')){
+
+			h = dojo.style.getOuterHeight(this.domNode);
+		}
+
+		for(var i=0; i<this.children.length; i++){
+			var ch = this.children[i];
+			var a = ch.layoutAlign;
+
+			if ((a == 'top') || (a == 'bottom') || (a == 'client')){
+
+				if (dojo.lang.isFunction(ch.getMinHeight)){
+					h += ch.getMinHeight();
+				}
+			}
+		}
+
+		//
+		// but then we need to check to see if the left/right kids are larger
+		//
+
+		for(var i=0; i<this.children.length; i++){
+			var ch = this.children[i];
+			var a = ch.layoutAlign;
+
+			if ((a == 'left') || (a == 'right')){
+
+				if (dojo.lang.isFunction(ch.getMinHeight)){
+					h = Math.max(h, ch.getMinHeight());
+				}
+			}
+		}
+
+		return h;
+	}
+});
+
+dojo.widget.tags.addParseTreeHandler("dojo:LayoutPane");
+

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenu.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenu.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenu.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenu.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,3 @@
+dojo.require("dojo.widget.Menu");
+
+dj_deprecated("HtmlMenu.js is deprecated, include Menu.js");

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenu2.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenu2.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenu2.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenu2.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,592 @@
+dojo.provide("dojo.widget.HtmlMenu2");
+dojo.provide("dojo.widget.PopupMenu2");
+dojo.provide("dojo.widget.MenuItem2");
+
+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 = [];
+}
+
+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,
+	isShowing: false,
+	menuX: 0,
+	menuY: 0,
+	menuWidth: 0,
+	menuHeight: 0,
+	menuIndex: 0,
+
+	domNode: null,
+	containerNode: null,
+
+	templateString: '<div><div dojoAttachPoint="containerNode"></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,
+
+	submenuIconSrc: dojo.uri.dojoUri("src/widget/templates/images/submenu_off.gif").toString(),
+	submenuIconOnSrc: dojo.uri.dojoUri("src/widget/templates/images/submenu_on.gif").toString(),
+
+	postCreate: function(){
+
+		dojo.html.addClass(this.domNode, 'dojoPopupMenu2');
+		dojo.html.addClass(this.containerNode, 'dojoPopupMenu2Client');
+
+		this.domNode.style.left = '-9999px'
+		this.domNode.style.top = '-9999px'
+
+		if (this.contextMenuForWindow){
+
+			var eventType = "oncontextmenu"; 
+			var doc = document.documentElement  || dojo.html.body(); 
+			var func = "onShow";
+
+			dojo.event.connect(doc, eventType, this, func);
+		}
+
+		this.layoutMenuSoon();
+	},
+
+	layoutMenuSoon: function(){
+
+		var self = this;
+		var closure = function(){ return function(){ self.layoutMenu(); } }();
+
+		window.setTimeout(closure, 0);
+	},
+
+	layoutMenu: function(){
+
+		// 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());
+			}
+		}
+
+		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);
+
+		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: function(x, y, parentMenu, explodeSrc){
+
+		if (this.isShowing){ this.close(); }
+
+		if ( !parentMenu ) {
+			// record whenever a top level menu is opened
+			dojo.widget.HtmlMenu2Manager.opened(this);
+		}
+
+		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
+
+			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 = 10 + this.menuIndex;
+		this.domNode.style.left = x + 'px';
+		this.domNode.style.top = y + 'px';
+		this.domNode.style.display='none';
+		
+		// then use the user defined method to display it
+		this.show();
+
+		this.isShowing = true;
+	},
+
+	close: function(){
+		this.closeSubmenu();
+		this.hide();
+		this.isShowing = false;
+		dojo.widget.HtmlMenu2Manager.closed(this);
+	},
+
+	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;
+	},
+
+	onShow: function(e){
+
+		//dojo.debugShallow(e);
+		this.open(e.clientX, e.clientY, null, [e.clientX, e.clientY]);
+
+		e.preventDefault();
+	},
+
+	isPointInMenu: function(x, y){
+
+		if (x < this.menuX){ return 0; }
+		if (x > this.menuX + this.menuWidth){ return 0; }
+
+		if (y < this.menuY){ return 0; }
+		if (y > this.menuY + this.menuHeight){ return 0; }
+
+		return 1;
+	}
+});
+
+
+dojo.widget.MenuItem2 = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+
+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;">&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,
+	is_disabled: false,
+
+	//
+	// options
+	//
+
+	caption: 'Untitled',
+	accelKey: '',
+	iconSrc: '',
+	submenuId: '',
+	isDisabled: false,
+
+
+	postCreate: function(){
+
+		dojo.html.disableSelection(this.domNode);
+
+		if (this.isDisabled){
+			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));
+	},
+
+	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 = 1;
+		this.startSubmenuTimer();
+	},
+
+	onUnhover: function(){
+
+		if (!this.is_open){ this.unhighlightItem(); }
+
+		this.is_hovering = 0;
+		this.stopSubmenuTimer();
+	},
+
+	onClick: function(){
+
+		if (this.is_disabled){ return; }
+
+		if (this.submenuId){
+
+			if (!this.is_open){
+				this.stopSubmenuTimer();
+				this.openSubmenu();
+			}
+
+		}else{
+
+			this.parent.closeAll();
+		}
+	},
+
+	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.is_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){
+
+		if (value == this.is_disabled){ return; }
+
+		this.is_disabled = value;
+
+		if (this.is_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);
+	}
+});
+
+
+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>'
+			+'<div dojoAttachPoint="topNode"></div>'
+			+'<div dojoAttachPoint="bottomNode"></div>'
+			+'</div>',
+
+	postCreate: function(){
+
+		dojo.html.addClass(this.domNode, 'dojoMenuSeparator2');
+		dojo.html.addClass(this.topNode, 'dojoMenuSeparator2Top');
+		dojo.html.addClass(this.bottomNode, 'dojoMenuSeparator2Bottom');
+
+		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.HtmlMenu2Manager = new function(){
+
+	this.currentMenu = null;
+	this.focusNode = null;
+
+	dojo.event.connect(document, 'onmousedown', this, 'onClick');
+
+	this.closed = function(menu){
+		if (this.currentMenu == menu){
+			this.currentMenu = null;
+		}
+	};
+
+	this.opened = function(menu){
+		if (menu == this.currentMenu){ return; }
+
+		if (this.currentMenu){
+			this.currentMenu.close();
+		}
+
+		this.currentMenu = menu;
+	};
+
+	this.onClick = function(e){
+
+		if (!this.currentMenu){ return; }
+
+		var x = e.clientX;
+		var y = e.clientY;
+		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;
+		}
+
+		// the click didn't fall within the open menu tree
+		// so close it
+
+		this.currentMenu.close();
+	};
+}
+
+
+// make it a tag
+dojo.widget.tags.addParseTreeHandler("dojo:PopupMenu2");
+dojo.widget.tags.addParseTreeHandler("dojo:MenuItem2");
+dojo.widget.tags.addParseTreeHandler("dojo:MenuSeparator2");
+

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenuItem.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenuItem.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenuItem.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlMenuItem.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,3 @@
+dojo.require("dojo.widget.MenuItem");
+
+dj_deprecated("HtmlMenu.js is deprecated, include Menu.js");

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlResizableTextarea.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlResizableTextarea.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlResizableTextarea.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlResizableTextarea.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,55 @@
+dojo.provide("dojo.widget.HtmlResizableTextarea");
+dojo.require("dojo.widget.DomWidget");
+dojo.require("dojo.html");
+
+dojo.widget.tags.addParseTreeHandler("dojo:resizabletextarea");
+
+dojo.widget.HtmlResizableTextarea = function(){
+	dojo.widget.HtmlWidget.call(this);
+
+	this.templatePath = dojo.uri.dojoUri("src/widget/templates/HtmlResizableTextarea.html");
+	this.widgetType = "ResizableTextarea";
+	this.tagName = "dojo:resizabletextarea";
+	this.isContainer = false;
+	this.textAreaNode = null;
+	this.textAreaContainer = null;
+
+	this.fillInTemplate = function(args, frag){
+		this.textAreaNode = frag[this.tagName].nodeRef.cloneNode(true);
+		this.textAreaContainer.appendChild(this.textAreaNode);
+	}
+
+	this.fitToParent = function(){
+		with(this.textAreaNode.style){
+			width = "100%";
+			height = "100%";
+		}
+		var pn = this.textAreaNode.parentNode;
+
+		if(this.allowResizeX){
+			var iw = parseInt(this.textAreaNode.offsetWidth);
+			var cols = parseInt(dojo.html.getAttribute(this.textAreaNode, "cols"));
+			var pxpercol = (iw/cols);
+			var pnw = parseInt(dojo.html.getInnerWidth(pn));
+			this.textAreaNode.style.width = pnw+"px";
+		}
+
+		if(this.allowResizeY){
+			var ih = parseInt(dojo.html.getInnerHeight(this.textAreaNode));
+			var rows = parseInt(dojo.html.getAttribute(this.textAreaNode, "rows"));
+			var pxperrow = (ih/rows);
+			var pnh = parseInt(dojo.html.getInnerHeight(pn));
+			this.textAreaNode.rows = parseInt(pnh/pxperrow);
+		}
+	}
+
+	this.postDrag = function(){
+		this.textAreaNode.parentNode.style.overflow = "hidden";
+		this.textAreaNode.style.display = "";
+		this.fitToParent();
+	}
+
+	dojo.event.connect(this, "endResize", this, "fitToParent");
+}
+
+dojo.inherits(dojo.widget.HtmlResizableTextarea, dojo.widget.HtmlWidget);

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlResizeHandle.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlResizeHandle.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlResizeHandle.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlResizeHandle.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,83 @@
+dojo.provide("dojo.widget.ResizeHandle");
+dojo.provide("dojo.widget.HtmlResizeHandle");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.html");
+dojo.require("dojo.style");
+dojo.require("dojo.dom");
+dojo.require("dojo.event");
+
+dojo.widget.HtmlResizeHandle = function(){
+
+	dojo.widget.HtmlWidget.call(this);
+}
+
+dojo.inherits(dojo.widget.HtmlResizeHandle, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(dojo.widget.HtmlResizeHandle, {
+	widgetType: "ResizeHandle",
+
+	isSizing: false,
+	startPoint: null,
+	startSize: null,
+
+	grabImg: null,
+
+	targetElmId: '',
+	imgSrc: dojo.uri.dojoUri("src/widget/templates/grabCorner.gif"),
+
+	templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlResizeHandle.css"),
+	templateString: '<div dojoAttachPoint="domNode"><img dojoAttachPoint="grabImg" /></div>',
+
+	fillInTemplate: function(){
+
+		dojo.style.insertCssFile(this.templateCssPath);
+
+		dojo.html.addClass(this.domNode, 'dojoHtmlResizeHandle');
+		dojo.html.addClass(this.grabImg, 'dojoHtmlResizeHandleImage');
+
+		this.grabImg.src = this.imgSrc;
+	},
+
+	postCreate: function(){
+		dojo.event.connect(this.domNode, "onmousedown", this, "beginSizing");
+	},
+
+	beginSizing: function(e){
+		if (this.isSizing){ return false; }
+
+		this.targetElm = dojo.widget.getWidgetById(this.targetElmId);
+		if (!this.targetElm){ return; }
+
+		var screenX = window.event ? window.event.clientX : e.pageX;
+		var screenY = window.event ? window.event.clientY : e.pageY;
+
+		this.isSizing = true;
+		this.startPoint  = {'x':e.clientX, 'y':e.clientY};
+		this.startSize  = {'w':dojo.style.getOuterWidth(this.targetElm.domNode), 'h':dojo.style.getOuterHeight(this.targetElm.domNode)};
+
+		dojo.event.connect(document.documentElement, "onmousemove", this, "changeSizing");
+		dojo.event.connect(document.documentElement, "onmouseup", this, "endSizing");
+
+		e.preventDefault();
+	},
+
+	changeSizing: function(e){
+		var dx = this.startPoint.x - e.clientX;
+		var dy = this.startPoint.y - e.clientY;
+		this.targetElm.resizeTo(this.startSize.w - dx, this.startSize.h - dy);
+
+		e.preventDefault();
+	},
+
+	endSizing: function(e){
+		dojo.event.disconnect(document.documentElement, "onmousemove", this, "changeSizing");
+		dojo.event.disconnect(document.documentElement, "onmouseup", this, "endSizing");
+
+		this.isSizing = false;
+	}
+
+
+});
+
+dojo.widget.tags.addParseTreeHandler("dojo:ResizeHandle");

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlRichText.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlRichText.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlRichText.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlRichText.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,2 @@
+dojo.require("dojo.widget.RichText");
+dj_deprecated("HtmlRichText.js is deprecated, use RichText.js");

Added: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlSlideShow.js
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlSlideShow.js?rev=354516&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlSlideShow.js (added)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/dojo/src/widget/HtmlSlideShow.js Tue Dec  6 11:29:56 2005
@@ -0,0 +1,120 @@
+dojo.provide("dojo.widget.SlideShow");
+dojo.provide("dojo.widget.HtmlSlideShow");
+
+dojo.require("dojo.event.*");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.graphics.*");
+dojo.require("dojo.fx.html");
+dojo.require("dojo.style");
+
+dojo.widget.HtmlSlideShow = function(){
+	dojo.widget.HtmlWidget.call(this);
+
+	this.templatePath = dojo.uri.dojoUri("src/widget/templates/HtmlSlideShow.html");
+	this.templateCssPath = dojo.uri.dojoUri("src/widget/templates/HtmlSlideShow.css");
+
+	// over-ride some defaults
+	this.isContainer = false;
+	this.widgetType = "SlideShow";
+
+	// useful properties
+	this.imgUrls = [];		// the images we'll go through
+	this.imgUrlBase = "";
+	this.urlsIdx = 0;		// where in the images we are
+	this.delay = 4000; 		// give it 4 seconds
+	this.transitionInterval = 2000; // 2 seconds
+	this.imgWidth = 800;	// img width
+	this.imgHeight = 600;	// img height
+	this.background = "img2"; // what's in the bg
+	this.foreground = "img1"; // what's in the fg
+	this.stopped = false;	// should I stay or should I go?
+
+	// our DOM nodes:
+	this.imagesContainer = null;
+	this.startStopButton = null;
+	this.controlsContainer = null;
+	this.img1 = null;
+	this.img2 = null;
+
+	this.fillInTemplate = function(){
+		dojo.style.setOpacity(this.img1, 0.9999);
+		dojo.style.setOpacity(this.img2, 0.9999);
+		with(this.imagesContainer.style){
+			width = this.imgWidth+"px";
+			height = this.imgHeight+"px";
+		}
+		with(this.img1.style){
+			width = this.imgWidth+"px";
+			height = this.imgHeight+"px";
+		}
+		with(this.img2.style){
+			width = this.imgWidth+"px";
+			height = this.imgHeight+"px";
+		}
+		if(this.imgUrls.length>1){
+			this.img2.src = this.imgUrlBase+this.imgUrls[this.urlsIdx++];
+			this.endTransition();
+		}else{
+			this.img1.src = this.imgUrlBase+this.imgUrls[this.urlsIdx++];
+		}
+	}
+
+	this.togglePaused = function(){
+		if(this.stopped){
+			this.stopped = false;
+			this.endTransition();
+			this.startStopButton.value= "pause";
+		}else{
+			this.stopped = true;
+			this.startStopButton.value= "play";
+		}
+	}
+
+	this.backgroundImageLoaded = function(){
+		// start fading out the foreground image
+		if(this.stopped){ return; }
+		// closure magic for callback
+		var _this = this; 
+		var callback = function(){ _this.endTransition(); };
+
+		// actually start the fadeOut effect
+		// NOTE: if we wanted to use other transition types, we'd set them up
+		// 		 here as well
+		dojo.fx.html.fadeOut(this[this.foreground], 
+			this.transitionInterval, callback);
+	}
+
+	this.endTransition = function(){
+		// move the foreground image to the background 
+		with(this[this.background].style){ zIndex = parseInt(zIndex)+1; }
+		with(this[this.foreground].style){ zIndex = parseInt(zIndex)-1; }
+
+		// fg/bg book-keeping
+		var tmp = this.foreground;
+		this.foreground = this.background;
+		this.background = tmp;
+
+		// keep on truckin
+		this.loadNextImage();
+	}
+
+	this.loadNextImage = function(){
+		// load a new image in that container, and make sure it informs
+		// us when it finishes loading
+		dojo.event.kwConnect({
+			srcObj: this[this.background],
+			srcFunc: "onload",
+			adviceObj: this,
+			adviceFunc: "backgroundImageLoaded",
+			once: true, // make sure we only ever hear about it once
+			delay: this.delay
+		});
+		dojo.style.setOpacity(this[this.background], 1.0);
+		this[this.background].src = this.imgUrlBase+this.imgUrls[this.urlsIdx++];
+		if(this.urlsIdx>(this.imgUrls.length-1)){
+			this.urlsIdx = 0;
+		}
+	}
+}
+dojo.inherits(dojo.widget.HtmlSlideShow, dojo.widget.HtmlWidget);
+dojo.widget.tags.addParseTreeHandler("dojo:slideshow");



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org