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/09/08 02:20:42 UTC
svn commit: r441344 - in /incubator/xap/trunk/src/xap:
bridges/dojo/TableBridge.js taghandling/AbstractTagImpl.js
taghandling/plugin.xml widgets/dojo/TreeTable.js
Author: jmargaris
Date: Thu Sep 7 19:20:42 2006
New Revision: 441344
URL: http://svn.apache.org/viewvc?view=rev&rev=441344
Log:
first template for TreeTable (in progress)
Added:
incubator/xap/trunk/src/xap/bridges/dojo/TableBridge.js (with props)
incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js (with props)
Modified:
incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js
incubator/xap/trunk/src/xap/taghandling/plugin.xml
Added: incubator/xap/trunk/src/xap/bridges/dojo/TableBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/TableBridge.js?view=auto&rev=441344
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/TableBridge.js (added)
+++ incubator/xap/trunk/src/xap/bridges/dojo/TableBridge.js Thu Sep 7 19:20:42 2006
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ *
+ */
+
+ /**
+ * @fileoverview
+ *
+ * A bridge class that controls a dojo Table peer.
+ */
+
+Xap.provide("xap.bridges.dojo.TableBridge");
+
+Xap.require("xap.bridges.dojo.DojoWidgetBridge");
+Xap.require("xap.widgets.dojo.TreeTable");
+
+
+
+ /**
+ * @fileoverview
+ *
+ * A bridge class with dojo toolkit box panel peer.
+ */
+
+xap.bridges.dojo.TableBridge= function() {
+ xap.bridges.dojo.DojoWidgetBridge.call(this);
+}
+
+
+Xap.setupClassAsSubclassOf(
+ "xap.bridges.dojo.TableBridge",
+ "xap.bridges.dojo.DojoWidgetBridge"
+);
+
+
+
+xap.bridges.dojo.TableBridge.prototype.getPeerString = function(){
+ return "TreeTable" ;
+}
+
+
+/** XML attribute set method for "width" */
+xap.bridges.dojo.TableBridge.prototype.setWidthAttribute = function(value){
+ this.getRootDomNode().style.width = value ;
+ this.getPeer().onResized();
+}
+
+/** XML attribute set method for "height" */
+xap.bridges.dojo.TableBridge.prototype.setHeightAttribute = function(value){
+ this.getRootDomNode().style.height = value ;
+ this.getPeer().onResized();
+}
+
+
+
+
+/**
+ *
+ *
+ * Attribute definitions
+ *
+ */
+
+
+/**
+ * No new dynamic attributes
+ */
+xap.bridges.dojo.TableBridge.prototype.getNewAllowedAttributes = function(){
+ return [];
+}
+
+
Propchange: incubator/xap/trunk/src/xap/bridges/dojo/TableBridge.js
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js?view=diff&rev=441344&r1=441343&r2=441344
==============================================================================
--- incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js (original)
+++ incubator/xap/trunk/src/xap/taghandling/AbstractTagImpl.js Thu Sep 7 19:20:42 2006
@@ -241,6 +241,11 @@
var parentElement = this.getElement().parentNode;
var parentHandler = this.getUiContentHandler().getHandlerForElement( parentElement );
+ //IMPORTANT -1 doesn't work here for insert at, it does for all the nested children
+ //but not for adding to the original parent. We need to handle the non-tail
+ //recursion case better in general. The nested children when first parsed can always
+ //be handled like they are each appended to the end one at a time, but the root
+ //of the subtree needs to be added with the right index
var event = new xap.xml.dom.events.StructureChangeEvent( e, this.getElement(), -1 );
parentHandler.beforeChildAdded( event );
Modified: incubator/xap/trunk/src/xap/taghandling/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/taghandling/plugin.xml?view=diff&rev=441344&r1=441343&r2=441344
==============================================================================
--- incubator/xap/trunk/src/xap/taghandling/plugin.xml (original)
+++ incubator/xap/trunk/src/xap/taghandling/plugin.xml Thu Sep 7 19:20:42 2006
@@ -13,6 +13,7 @@
<mapping class="xap.bridges.xap.CheckboxBridge" name="checkBox"/>
<mapping class="xap.bridges.xap.RadioButtonBridge" name="radioButton"/>
+ <mapping class="xap.bridges.dojo.TableBridge" name="table"/>
<mapping class="xap.bridges.dojo.SplitPaneBridge" name="splitPane"/>
<mapping class="xap.bridges.dojo.TabPaneBridge" name="tabPane"/>
<mapping class="xap.bridges.dojo.TabBridge" name="tab"/>
Added: incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js?view=auto&rev=441344
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js (added)
+++ incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js Thu Sep 7 19:20:42 2006
@@ -0,0 +1,87 @@
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets.dojo");
+
+Xap.provide("xap.widgets.dojo.TreeTable");
+
+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");
+
+dojo.widget.tags.addParseTreeHandler("dojo:TreeTable");
+
+xap.widgets.dojo.TreeTable = function(){
+ dojo.widget.HtmlWidget.call(this);
+ this._revalidate();
+}
+
+dojo.inherits(xap.widgets.dojo.TreeTable,dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.dojo.TreeTable, {
+ templateString: '<table><thead dojoAttachPoint="thead"><tr></tr></thead>' +
+ '<tbody dojoAttachPoint="tbody"></tbody></table>',
+
+ templateCssPath: null ,
+ widgetType: "TreeTable",
+ isContainer: true,
+ columns : [],
+ rows : [],
+ validatePending : false,
+
+ _revalidate: function(){
+ if (!this.validatePending){
+ dojo.lang.setTimeout(this, this._createTable, 0);
+ this.validatePending = true;
+ }
+ },
+
+ _createTable: function(){
+ this.domNode.removeChild(this.thead);
+ this.domNode.removeChild(this.tbody);
+ this._rebuildHead();
+ this._rebuildBody();
+ this.validatePending = false;
+ },
+
+ _rebuildHead: function(){
+ this.thead = document.createElement("thead");
+ this.domNode.appendChild(this.thead);
+ var headerRow = document.createElement("tr");
+ this.thead.appendChild(headerRow);
+ for (var i = 0; i<this.columns.length; i++){
+ var header = document.createElement("th");
+ header.innerHTML = "Column " + i;
+ headerRow.appendChild(header);
+ }
+ },
+
+ _rebuildBody: function(){
+ this.tbody = document.createElement("tbody");
+ this.domNode.appendChild(this.tbody);
+ for (var i =0; i<this.rows.length; i++){
+ var rowElement = document.createElement("tr");
+ this.tbody.appendChild(rowElement);
+ for (var column = 0; column<this.columns.length; column++){
+ var cell = document.createElement("td");
+ cell.innerHTML = "Row:" + i + " Col:" + column;
+ rowElement.appendChild(cell);
+ }
+ }
+ },
+
+
+
+ insertColumn: function(column, index){
+ if (index&&index>=0){
+ this.columns.splice(index,0, column);
+ }
+ else{
+ this.columns.push(column);
+ }
+ this.revalidate();
+ }
+
+}
+);
\ No newline at end of file
Propchange: incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js
------------------------------------------------------------------------------
svn:eol-style = native