You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2006/11/02 02:44:35 UTC
svn commit: r470201 - in /incubator/xap/trunk: WebContent/examples/widgets/
src/xap/widgets/dojo/
Author: jmargaris
Date: Wed Nov 1 18:44:34 2006
New Revision: 470201
URL: http://svn.apache.org/viewvc?view=rev&rev=470201
Log:
added gridPanel and samples
Added:
incubator/xap/trunk/WebContent/examples/widgets/gridPanel.html (with props)
incubator/xap/trunk/WebContent/examples/widgets/gridPanel.xal (with props)
incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.html (with props)
incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.xal (with props)
incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.html (with props)
incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.xal (with props)
incubator/xap/trunk/src/xap/widgets/dojo/GridPanel.js (with props)
Modified:
incubator/xap/trunk/WebContent/examples/widgets/borderPanel.html
incubator/xap/trunk/WebContent/examples/widgets/index.html
incubator/xap/trunk/src/xap/widgets/dojo/FreePanel.js
Modified: incubator/xap/trunk/WebContent/examples/widgets/borderPanel.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/borderPanel.html?view=diff&rev=470201&r1=470200&r2=470201
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/borderPanel.html (original)
+++ incubator/xap/trunk/WebContent/examples/widgets/borderPanel.html Wed Nov 1 18:44:34 2006
@@ -24,6 +24,6 @@
</head>
<body onload="Xap.createAllPredefinedSessions();">
- <div xapId="ButtonExample" xapSrc="borderPanel.xal" xapToolkit="dojo" xapContext="../../"></div>
+ <div style="width:100%; height:100%" xapId="ButtonExample" xapSrc="borderPanel.xal" xapToolkit="dojo" xapContext="../../"></div>
</body>
</html>
Added: incubator/xap/trunk/WebContent/examples/widgets/gridPanel.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/gridPanel.html?view=auto&rev=470201
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/gridPanel.html (added)
+++ incubator/xap/trunk/WebContent/examples/widgets/gridPanel.html Wed Nov 1 18:44:34 2006
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Button</title>
+
+ <style type="text/css">
+ <!--
+ @import url(../../css/xapDefault.css);
+ -->
+ </style>
+
+ <!-- Keep dojo from trying to scan this whole page for dojoType'd tags: -->
+ <script type="text/javascript">
+ djConfig = {
+ parseWidgets: false
+ };
+ </script>
+
+ <script language="JavaScript" type="text/javascript" src="../../xapcore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="AttributeTester.js"></script>
+
+ </head>
+
+ <body onload="Xap.createAllPredefinedSessions();">
+ <div style="width:100%; height:100%" xapId="ButtonExample" xapSrc="gridPanel.xal" xapToolkit="dojo" xapContext="../../"></div>
+</body>
+</html>
Propchange: incubator/xap/trunk/WebContent/examples/widgets/gridPanel.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/WebContent/examples/widgets/gridPanel.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/gridPanel.xal?view=auto&rev=470201
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/gridPanel.xal (added)
+++ incubator/xap/trunk/WebContent/examples/widgets/gridPanel.xal Wed Nov 1 18:44:34 2006
@@ -0,0 +1,56 @@
+<xal xmlns="http://www.openxal.org/xal" xmlns:xal="http://www.openxal.org/xal">
+
+
+ <mco:mco
+ xmlns:mco="http://www.openxal.org/mco"
+ id="attributeSetter"
+ src="AttributeTester"
+ />
+
+
+
+ <xm:modifications xmlns:xm="http://www.openxal.org/xmodify">
+ <xm:append select="/xal">
+ <xal:window title="One column">
+ <xal:gridPanel>
+ <xal:button text="B1" />
+ <xal:button text="Wide Button 2" />
+ <xal:button text="Button 3" />
+ <xal:button text="B4" />
+ <xal:button text="Button 5" />
+ </xal:gridPanel>
+ </xal:window>
+
+
+ <xal:window title="Two columns">
+ <xal:gridPanel columns="2">
+ <xal:button text="B1" />
+ <xal:button text="Wide Button 2" />
+ <xal:button text="Button 3" />
+ <xal:button text="B4" />
+ <xal:button text="Button 5" />
+ </xal:gridPanel>
+ </xal:window>
+
+ <xal:window title="Three columns">
+ <xal:gridPanel columns="3">
+ <xal:button text="B1" />
+ <xal:button text="Wide Button 2" />
+ <xal:button text="Button 3" />
+ <xal:button text="B4" />
+ <xal:button text="Button 5" />
+ </xal:gridPanel>
+ </xal:window>
+
+ <xal:window title="Three columns, evenlySpaced">
+ <xal:gridPanel columns="3" evenlySpace="true">
+ <xal:button text="B1" />
+ <xal:button text="Wide Button 2" />
+ <xal:button text="Button 3" />
+ <xal:button text="B4" />
+ <xal:button text="Button 5" />
+ </xal:gridPanel>
+ </xal:window>
+ </xm:append>
+ </xm:modifications>
+</xal>
Propchange: incubator/xap/trunk/WebContent/examples/widgets/gridPanel.xal
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.html?view=auto&rev=470201
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.html (added)
+++ incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.html Wed Nov 1 18:44:34 2006
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Button</title>
+
+ <style type="text/css">
+ <!--
+ @import url(../../css/xapDefault.css);
+ -->
+ </style>
+
+ <!-- Keep dojo from trying to scan this whole page for dojoType'd tags: -->
+ <script type="text/javascript">
+ djConfig = {
+ parseWidgets: false
+ };
+ </script>
+
+ <script language="JavaScript" type="text/javascript" src="../../xapcore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="AttributeTester.js"></script>
+
+ </head>
+
+ <body onload="Xap.createAllPredefinedSessions();">
+ <div style="width:100%; height:100%" xapId="ButtonExample" xapSrc="gridPanel3.xal" xapToolkit="dojo" xapContext="../../"></div>
+</body>
+</html>
Propchange: incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.xal?view=auto&rev=470201
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.xal (added)
+++ incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.xal Wed Nov 1 18:44:34 2006
@@ -0,0 +1,47 @@
+<xal xmlns="http://www.openxal.org/xal" xmlns:xal="http://www.openxal.org/xal">
+
+
+ <mco:mco
+ xmlns:mco="http://www.openxal.org/mco"
+ id="attributeSetter"
+ src="AttributeTester"
+ />
+
+
+
+ <xm:modifications xmlns:xm="http://www.openxal.org/xmodify">
+ <xm:append select="/xal">
+
+ <xal:window>
+ <xal:gridPanel columns="3">
+ <xal:button text="B1" />
+ <xal:button text="Wide Button 2" />
+ <xal:button text="Button 3" />
+ <xal:button text="B4" />
+ <xal:button text="Colspan2, hAlign fill" columnSpan="2" hAlign="fill" />
+ </xal:gridPanel>
+ </xal:window>
+
+ <xal:window>
+ <xal:gridPanel columns="3">
+ <xal:button text="B1" />
+ <xal:button text="Colspan2, hAlign fill" columnSpan="2" hAlign="fill" />
+ <xal:button text="Button 3" />
+ <xal:button text="B4" />
+ <xal:button text="Button 5" />
+ </xal:gridPanel>
+ </xal:window>
+
+ <xal:window>
+ <xal:gridPanel columns="3">
+ <xal:button text="B1" />
+ <xal:button text="Wide Button 2" />
+ <xal:button text="rowspan2, vAlign fill" rowSpan="2" vAlign="fill" />
+ <xal:button text="B4" />
+ <xal:button text="Button 5" />
+ </xal:gridPanel>
+ </window>
+
+ </xm:append>
+ </xm:modifications>
+</xal>
Propchange: incubator/xap/trunk/WebContent/examples/widgets/gridPanel3.xal
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.html?view=auto&rev=470201
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.html (added)
+++ incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.html Wed Nov 1 18:44:34 2006
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Button</title>
+
+ <style type="text/css">
+ <!--
+ @import url(../../css/xapDefault.css);
+ -->
+ </style>
+
+ <!-- Keep dojo from trying to scan this whole page for dojoType'd tags: -->
+ <script type="text/javascript">
+ djConfig = {
+ parseWidgets: false
+ };
+ </script>
+
+ <script language="JavaScript" type="text/javascript" src="../../xapcore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="AttributeTester.js"></script>
+
+ </head>
+
+ <body onload="Xap.createAllPredefinedSessions();">
+ <div style="width:100%; height:100%" xapId="ButtonExample" xapSrc="gridPanel5.xal" xapToolkit="dojo" xapContext="../../"></div>
+</body>
+</html>
Propchange: incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.xal?view=auto&rev=470201
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.xal (added)
+++ incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.xal Wed Nov 1 18:44:34 2006
@@ -0,0 +1,42 @@
+<xal xmlns="http://www.openxal.org/xal" xmlns:xal="http://www.openxal.org/xal">
+
+
+ <mco:mco
+ xmlns:mco="http://www.openxal.org/mco"
+ id="attributeSetter"
+ src="AttributeTester"
+ />
+
+
+
+ <xm:modifications xmlns:xm="http://www.openxal.org/xmodify">
+ <xm:append select="/xal">
+
+ <window xmlns="http://www.openxal.org/xal">
+ <gridPanel columns="3">
+ <label text="Dog's Name:" />
+ <textField columnSpan="2" hAlign="fill" />
+ <label text="Breed" />
+ <textField hAlign="fill" />
+ <label text="Categories" hAlign="center" />
+ <label text="Photo:" />
+ <label backgroundColor="red" vGrabSpace="true" hGrabSpace="true" vAlign="fill" hAlign="fill" rowSpan="3" />
+ <listBox rowSpan="4" vAlign="fill">
+ <listItem text="Loudest Bark" />
+ <listItem text="Best of Breed" />
+ </listBox>
+ <button text="Browse..." />
+ <button text="Delete" />
+ <gridPanel borderColor="black" columns="2" columnSpan="2" borderStyle="solid" borderWidth="1px" caption="Owner Info" hAlign="fill">
+ <label text="Name:" />
+ <textField hGrabSpace="true" hAlign="fill" />
+ <label text="Phone:" />
+ <textField hGrabSpace="true" hAlign="fill" />
+ </gridPanel>
+ <button text="Enter" columnSpan="3" hAlign="end" />
+ </gridPanel>
+ </window>
+
+ </xm:append>
+ </xm:modifications>
+</xal>
Propchange: incubator/xap/trunk/WebContent/examples/widgets/gridPanel5.xal
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/xap/trunk/WebContent/examples/widgets/index.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/index.html?view=diff&rev=470201&r1=470200&r2=470201
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/index.html (original)
+++ incubator/xap/trunk/WebContent/examples/widgets/index.html Wed Nov 1 18:44:34 2006
@@ -23,6 +23,17 @@
<li><a href="window.html"><window></a></li>
<li><a href="horizontalFlowPane.html"><horizontalFlowPane></a></li>
<li><a href="scrollPane.html"><scrollPane></a></li>
+<li><a href="desktopPane.html"><desktopPane></a></li>
+</ul>
+
+
+<h2>GridPanel</h2>
+<ul>
+<li><a href="gridPanel.html"><gridPanel></a></li>
+<li><a href="gridPanel2.html"><gridPanel2></a></li>
+<li><a href="gridPanel3.html"><gridPanel3></a></li>
+<li><a href="gridPanel4.html"><gridPanel4></a></li>
+<li><a href="gridPanel5.html"><gridPanel5></a></li>
</ul>
Modified: incubator/xap/trunk/src/xap/widgets/dojo/FreePanel.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/FreePanel.js?view=diff&rev=470201&r1=470200&r2=470201
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/FreePanel.js (original)
+++ incubator/xap/trunk/src/xap/widgets/dojo/FreePanel.js Wed Nov 1 18:44:34 2006
@@ -41,6 +41,9 @@
//If you set absolute position on a div then it creates a block in the box
//model but then the div is absolute which we don't want.
//so we put stuff in a table which DOES define a block in the box model
+ //TODO using minWidth and minHeight for the sizes of the td and div would be a lot better
+ //as it is because the positioning is abolute and sizes are 100% the preferred size calculation
+ //doesn't really work at all.
templateString: '<table cellPadding="0" cellSpacing="0" style="overflow:hidden"><tr><td style="width:100%; height:100%; overflow:hidden"><div dojoAttachPoint="containerNode" style="width: 100%; height: 100%; position:relative; overflow:hidden"></td></tr></table>',
templateCssPath: null ,
widgetType: "FreePanel",
Added: incubator/xap/trunk/src/xap/widgets/dojo/GridPanel.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/GridPanel.js?view=auto&rev=470201
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/GridPanel.js (added)
+++ incubator/xap/trunk/src/xap/widgets/dojo/GridPanel.js Wed Nov 1 18:44:34 2006
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+//IMPORTANT IN IE CLOSING THE
+//gridpanel samples will hang!!!
+
+Xap.provide("xap.widgets.dojo.GridPanel");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.HtmlWidget");
+dojo.require("dojo.dom");
+dojo.require("dojo.html");
+dojo.require("dojo.style");
+dojo.require("dojo.event");
+
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets.dojo");
+dojo.widget.tags.addParseTreeHandler("dojo:GridPanel");
+
+xap.widgets.dojo.GridPanel = function(){
+ dojo.widget.HtmlWidget.call(this);
+ this._columns = 1;
+ this._rows = [];
+ this._currentRow = 0;
+ this._currentColumn = 0;
+}
+
+
+dojo.inherits(xap.widgets.dojo.GridPanel, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.dojo.GridPanel, {
+ templateString: '<table cellPadding="0" cellSpacing="0"><tbody dojoAttachPoint="tbody">' +
+ '</tbody></table>',
+ templateCssPath: null ,
+ widgetType: "GridPanel",
+ isContainer: true,
+
+ setColumns: function( columns ){
+ this._columns = columns;
+ },
+
+ /**
+ * Mark a component as taking up the space starting at row/col
+ * and spanned by rowSpan/colSpan. We stick true into an
+ * array at those positions.
+ */
+ markComponentAt: function(row, col, rowSpan, colSpan){
+ //if the row span goes past what we currently have for rows,
+ //stick in some new ones
+ while(this._rows.length< row + rowSpan){
+ this._rows.push(new Array(this._columns));
+ var tableRow = document.createElement("tr");
+ this.tbody.appendChild(tableRow);
+ }
+
+ //then mark this square area as taken
+ for (var i = row; i<row+rowSpan; i++){
+ var spaces = this._rows[i];
+ for (var j = col; j<col+colSpan; j++){
+ spaces[j] = true;
+ }
+ }
+
+ },
+
+ /**
+ * Given where we last added an item, figure out where the next one should go.
+ * This may have to push to some subsequent row
+ */
+ getNextFreeCell: function (row, col){
+
+ //first look through the given row
+ var spaces = this._rows[row];
+ for (var i = col+1; i<spaces.length; i++){
+ if (!spaces[i]) return {"row":row,"col":i};
+ }
+
+ //then wrap to the next rows
+ for (var i = row+1; i<this._rows.length; i++){
+ spaces = this._rows[i];
+ for (var j = 0; j<spaces.length; j++){
+ if (!spaces[j]) return {"row":i,"col":i};
+ }
+ }
+
+ //add a new row if nothing else worked
+ if (row+1>=this._rows.length){
+ return {"row":row+1,"col":0};
+ }
+ return null;
+ },
+
+ //always append for now TODO allow insert to work better
+ addChild: function(child, constraints){
+ var rowSpan = constraints._rowSpan;
+ var columnSpan = constraints._columnSpan;
+
+ this.markComponentAt(this._currentRow,this._currentColumn, rowSpan, columnSpan);
+
+ var row = this.tbody.childNodes[this._currentRow];
+ var cell = document.createElement("td");
+ cell.rowSpan = rowSpan;
+ cell.colSpan = columnSpan;
+
+ cell.style.borderColor="red";
+ cell.style.borderStyle="solid";
+ cell.style.borderWidth="1px";
+
+ if (constraints._vAlign=='start'){
+ cell.vAlign = 'top'; //TODO should this be style based?
+ }
+
+ else if (constraints._vAlign=='end'){
+ cell.vAlign = 'bottom';
+ }
+
+ else if (constraints._vAlign=='fill'){
+ child.domNode.style.height="100%";
+ }
+
+ row.appendChild(cell);
+
+ var nextPlace = this.getNextFreeCell(this._currentRow, this._currentColumn);
+ this._currentRow = nextPlace.row;
+ this._currentColumn = nextPlace.col;
+
+ this.containerNode = cell;
+ xap.widgets.dojo.GridPanel.superclass.addChild.call(this,child);
+ },
+
+
+ removeChild: function(child) {
+ //TODO now what?
+ }
+}
+);
+
+
Propchange: incubator/xap/trunk/src/xap/widgets/dojo/GridPanel.js
------------------------------------------------------------------------------
svn:eol-style = native