From xap-commits-return-1434-apmail-incubator-xap-commits-archive=incubator.apache.org@incubator.apache.org Thu Jun 14 16:18:56 2007 Return-Path: Delivered-To: apmail-incubator-xap-commits-archive@locus.apache.org Received: (qmail 30812 invoked from network); 14 Jun 2007 16:18:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Jun 2007 16:18:55 -0000 Received: (qmail 73823 invoked by uid 500); 14 Jun 2007 16:18:59 -0000 Delivered-To: apmail-incubator-xap-commits-archive@incubator.apache.org Received: (qmail 73806 invoked by uid 500); 14 Jun 2007 16:18:59 -0000 Mailing-List: contact xap-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: xap-dev@incubator.apache.org Delivered-To: mailing list xap-commits@incubator.apache.org Received: (qmail 73797 invoked by uid 99); 14 Jun 2007 16:18:59 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jun 2007 09:18:59 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jun 2007 09:18:55 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 08A501A981A; Thu, 14 Jun 2007 09:18:34 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r547291 - in /incubator/xap/trunk/codebase: css/xapDefault.css src/xap/bridges/dojo/ColumnBridge.js src/xap/widgets/dojo/TreeTable.js Date: Thu, 14 Jun 2007 16:18:33 -0000 To: xap-commits@incubator.apache.org From: mturyn@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070614161834.08A501A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mturyn Date: Thu Jun 14 09:18:33 2007 New Revision: 547291 URL: http://svn.apache.org/viewvc?view=rev&rev=547291 Log: (From M. Mikhaylov:) Return of column sizing, still buggy under FF when cell content's width excceeds the column's. Modified: incubator/xap/trunk/codebase/css/xapDefault.css incubator/xap/trunk/codebase/src/xap/bridges/dojo/ColumnBridge.js incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js Modified: incubator/xap/trunk/codebase/css/xapDefault.css URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/css/xapDefault.css?view=diff&rev=547291&r1=547290&r2=547291 ============================================================================== --- incubator/xap/trunk/codebase/css/xapDefault.css (original) +++ incubator/xap/trunk/codebase/css/xapDefault.css Thu Jun 14 09:18:33 2007 @@ -215,6 +215,10 @@ background-repeat: repeat-x; } +.xapHeaderContents{ + overflow: hidden; +} + .xapHeaderMouseOver{ background-image: url(./xap_header_hover.gif); } Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/ColumnBridge.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/ColumnBridge.js?view=diff&rev=547291&r1=547290&r2=547291 ============================================================================== --- incubator/xap/trunk/codebase/src/xap/bridges/dojo/ColumnBridge.js (original) +++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/ColumnBridge.js Thu Jun 14 09:18:33 2007 @@ -61,7 +61,7 @@ this.getPeer()._dataType = value; } - +//TODO: Find out why this doesn't seem to get called. xap.bridges.dojo.ColumnBridge.prototype.setHorizontalAlignmentAttribute = function( value ){ this.getPeer()._horizontalAlignment = value; } @@ -77,7 +77,12 @@ /** * This seems the best place at which to cache the * XAL-derived width, if any: -**/ +**/ +//Old way of doing it, superseded by the set[Width|HorizontalAlignment]Attribute +// methods below; keep it around commented-out until we're sure that the newer +// way will work, e.g. that we're not missing a peer.header when we first parse +// this tag. +// xap.bridges.dojo.ColumnBridge.prototype.init = function(){ xap.bridges.dojo.ColumnBridge.superclass.init.call(this) ; var peer = this.getPeer() ; @@ -90,4 +95,37 @@ } } +/** + * Set explicit column width and resize a table + */ +xap.bridges.dojo.ColumnBridge.prototype.setWidthAttribute = function( value ){ + var peer = this.getPeer(); + if(peer) { + peer.setStatedWidth(value); + } + // Need this here if we resize a column after the + // table is built---use resizeTableLater + // because 1.) IE probably needs the delay, and + // 2.) the peer code keeps this from being run multiple + // times in succession---if there's already a resizeTableTask + // job in play, this won't add another one: + if(peer._table) { + peer._table._resizeTableLater(); + } +} + +/** + * Set column halignment---note that this is not sufficient to + * reset the alignment all over the table, that will come later. + */ +xap.bridges.dojo.ColumnBridge.prototype.setHorizontalAlignmentAttribute = function( value ){ + var peer = this.getPeer(); + if(peer.header && peer._horizontalAlignment){ + peer.header.setHorizontalAlignment(value) ; + // Code in table widget will look at this + // member to determing the alignment of + // newly-added cells: + peer._horizontalAlignment=value ; + } +} Modified: incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js?view=diff&rev=547291&r1=547290&r2=547291 ============================================================================== --- incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js (original) +++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js Thu Jun 14 09:18:33 2007 @@ -138,6 +138,7 @@ * the widths of columns and headers match up. */ _resizeTable: function(){ + var tableWidth = 0; //don't user tbody.childNodes[0] here because in the case @@ -199,62 +200,77 @@ } } - /* if the user explicitly set, we use those */ - if ( this._columns[i]._headerWidth ) { - var val = this._getSizeFromString (this._columns[i]._headerWidth); - if ( val ) setWidth = val; + /* if the user explicitly set the column width or + its header's width , we use those (preferring + as usual the last value parsed, that is, + the header's): + */ + + var setWidth = this._columns[i].getBestWidth() ; + + // We want to set the column width to the explicitly-given value + // if it should be available from the column or its header); if + // a value is not available so, we'll use the greater of the + // extant cell or column widths. Note that we need to look + // up the explicitly-set ones in case the table is hidden when created + var preferredColumnWidth = setWidth ; + if( !setWidth ){ + preferredColumnWidth = headerWidth>columnWidth ? headerWidth:columnWidth; + preferredColumnWidth += "px" ; } - - // For now, we'll settle for the greater of explicitly set, calculated column or calculated cell; note that we need to look up - // the explicitly set ones in case the table is hidden when created - var finalWidth = headerWidth>columnWidth ? headerWidth:columnWidth; - finalWidth = setWidth>finalWidth?setWidth:finalWidth; - this._columns[i]._calculatedWidth = finalWidth + "px"; - tableWidth += finalWidth; + var preferredColumnWidthPx = parseInt(preferredColumnWidth) ; + this._columns[i].setStatedWidth(preferredColumnWidth) ; + if(this.columnsSizer + && this.columnsSizer.children + && this.columnsSizer.children[i] + ){ + this.columnsSizer.children[i].sizeShare = preferredColumnWidthPx ; + } + tableWidth += preferredColumnWidthPx ; } //if we don't fix the width here then when we want the table //to scroll horizontally it doesn't work very well, sizes //too small + + this.headerTable.style.tableLayout = "auto"; + this.table.style.tableLayout = "auto"; + + this.table.style.width = tableWidth + "px"; this.headerTable.style.width = tableWidth + "px"; - this.headerTable.style.tableLayout = "fixed"; - this.table.style.tableLayout = "fixed"; - + this._fixColumnWidths(); + this.headerTable.style.tableLayout = "fixed"; + this.table.style.tableLayout = "fixed"; window.clearTimeout(this._resizeTableTask); this._resizeTableTask = null; }, - _fixColumnWidths : function(){ + _fixColumnWidths: function(){ var firstRow = this._rows.length>0?this._rows[0].domNode:null; +var arr = new Array(0) ; for (var i=0; i