From: Matti Tahvonen Date: Thu, 27 Sep 2007 08:33:52 +0000 (+0000) Subject: some changes to width calculation X-Git-Tag: 6.7.0.beta1~5953 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=71515370dd600b8ead68e7d76edc809c3f5f0fc2;p=vaadin-framework.git some changes to width calculation svn changeset:2380/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java index edcc9e916e..48f30ea55c 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java @@ -488,7 +488,8 @@ public class IScrollTable extends Composite implements Table, ScrollListener { tHead.setWidth(width); this.setWidth(width); } else if (width.indexOf("%") > 0) { - this.setWidth(width); + if(!width.equals("100%")) + this.setWidth(width); // contained blocks are relative to parents bodyContainer.setWidth("100%"); tHead.setWidth("100%"); @@ -497,7 +498,10 @@ public class IScrollTable extends Composite implements Table, ScrollListener { } int availW = tBody.getAvailableWidth(); + // Hey IE, are you really sure about this? + availW = tBody.getAvailableWidth(); + if (availW > total) { // natural size is smaller than available space int extraSpace = availW - total; @@ -1094,8 +1098,8 @@ public class IScrollTable extends Composite implements Table, ScrollListener { DOM.appendChild(headerTableBody, tr); DOM.appendChild(hTableContainer, table); DOM.appendChild(hTableWrapper, hTableContainer); - DOM.appendChild(div, columnSelector); DOM.appendChild(div, hTableWrapper); + DOM.appendChild(div, columnSelector); setElement(div); setStyleName(CLASSNAME + "-header-wrap"); @@ -1147,43 +1151,6 @@ public class IScrollTable extends Composite implements Table, ScrollListener { DOM.setElementPropertyInt(hTableWrapper, "scrollLeft", scrollLeft); } - public void setWidth(int width) { - DOM.setStyleAttribute(hTableWrapper, "width", - (width - getColumnSelectorWidth()) + "px"); - super.setWidth(width + "px"); - } - - public void setWidth(String width) { - if (width.indexOf("px") > 0) { - int w = Integer.parseInt(width - .substring(0, width.indexOf("px"))); - setWidth(w); - } else { - // this is an IE6 hack, would need a generator to isolate from - // others - if (Util.isIE6()) { - DOM.setStyleAttribute(hTableWrapper, "width", (0) + "px"); - super.setWidth(width); - int hTableWrappersWidth = this.getOffsetWidth() - - getColumnSelectorWidth(); - DOM.setStyleAttribute(hTableWrapper, "width", - hTableWrappersWidth + "px"); - } else { - super.setWidth(width); - } - } - } - - private int getColumnSelectorWidth() { - int w = DOM.getElementPropertyInt(columnSelector, "offsetWidth") + 4; // some - // extra - // to - // survive - // with - // IE6 - return w > 0 ? w : 15; - } - public void setColumnCollapsingAllowed(boolean cc) { columnCollapsing = cc; if (cc) { diff --git a/src/com/itmill/toolkit/terminal/gwt/public/default/table/table.css b/src/com/itmill/toolkit/terminal/gwt/public/default/table/table.css index 2e35bec193..f7a0dca8cb 100644 --- a/src/com/itmill/toolkit/terminal/gwt/public/default/table/table.css +++ b/src/com/itmill/toolkit/terminal/gwt/public/default/table/table.css @@ -1,150 +1,153 @@ -.i-table { - border: 1px solid #29528a; - background: #fff; -} -.i-table:before { - display: block; - height: 2px; - overflow: hidden; - background: transparent url(../../panel/img/top-right-small.png) no-repeat right top; - content: url(../../panel/img/top-left-small.png); - margin: -1px -1px 0 -1px; -} -.i-table:after { - display: block; - height: 2px; - overflow: hidden; - background: transparent url(../../panel/img/bottom-right.png) no-repeat right top; - content: url(../../panel/img/bottom-left.png); - margin: 0 -1px -1px -1px; -} - -.i-table-header-wrap { - height: 26px; - background: #e7edf3 url(../img/header-bg.png) repeat-x; - border-bottom: 1px solid #6082b0; - margin-top: -1px; -} - -.i-table-header { -} - -.i-table-header table, -.i-table-table { - border-collapse: collapse; - margin: 0; - padding: 0; - border: 0; -} - -.i-table-header td, -.i-table-table td { - margin:0; - padding:0; - border:0; -} - -.i-table-header td { - cursor: pointer; -} - -.i-table-resizer { - display: block; - height: 26px; - float: right; - background: #aabdda url(../img/resizer-bg.png); - cursor: e-resize; -} - -.i-table-caption-container { - float: right; - overflow: hidden; - white-space: nowrap; - font-weight: bold; - color: #1c3e6e; - padding-top: 5px; -} - -/* disabled row in column selector */ -.i-off { - font-style: italic; -} - - - -.i-table-header-cell { -} -.i-table-header-cell-asc { - background: blue; -} -.i-table-header-cell-desc { - background: cyan; -} - -.i-table-body { - /*margin: 0 1px;*/ -} - -.i-table-row { - border: 0; - margin: 0; - padding: 3px 0 3px 0; - cursor: pointer; -} -.i-table-row:hover, -.i-table .i-odd:hover { - background-color: #d3dfee; -} -.i-table .i-odd { - background-color: #f1f5f9; -} -.i-table .i-selected { - background: #375f98 url(../img/selected-bg.png) repeat-x; - color: #fff; -} - -.i-table-row-spacer { - height: 10px; - overflow: hidden; /* IE hack to allow < one line height divs */ -} - -.i-table-cell-content { - white-space: nowrap; - overflow: hidden; - /*border-right: 1px solid #e4e8ef; - padding-left: 2px; - width: 98%;*/ -} - - - -.i-table-column-selector { - float: right; - background: transparent url(../img/colsel.png) no-repeat; +.i-table { + border: 1px solid green; + background: #fff; +} +.i-table:before { + display: block; + height: 2px; + overflow: hidden; + background: transparent url(../../panel/img/top-right-small.png) no-repeat right top; + content: url(../../panel/img/top-left-small.png); + margin: -1px -1px 0 -1px; +} +.i-table:after { + display: block; + height: 2px; + overflow: hidden; + background: transparent url(../../panel/img/bottom-right.png) no-repeat right top; + content: url(../../panel/img/bottom-left.png); + margin: 0 -1px -1px -1px; +} + +.i-table-header-wrap { + height: 26px; + background: #e7edf3 url(../img/header-bg.png) repeat-x; + border-bottom: 1px solid #6082b0; + margin-top: -1px; +} + +.i-table-header { + width: 100%; +} + +.i-table-header table, +.i-table-table { + border-collapse: collapse; + margin: 0; + padding: 0; + border: 0; +} + +.i-table-header td, +.i-table-table td { + margin:0; + padding:0; + border:0; +} + +.i-table-header td { + cursor: pointer; +} + +.i-table-resizer { + display: block; + height: 26px; + float: right; + background: #aabdda url(../img/resizer-bg.png); + cursor: e-resize; +} + +.i-table-caption-container { + float: right; + overflow: hidden; + white-space: nowrap; + font-weight: bold; + color: #1c3e6e; + padding-top: 5px; +} + +/* disabled row in column selector */ +.i-off { + font-style: italic; +} + + + +.i-table-header-cell { +} +.i-table-header-cell-asc { + background: blue; +} +.i-table-header-cell-desc { + background: cyan; +} + +.i-table-body { + /*margin: 0 1px;*/ +} + +.i-table-row { + border: 0; + margin: 0; + padding: 3px 0 3px 0; + cursor: pointer; +} +.i-table-row:hover, +.i-table .i-odd:hover { + background-color: #d3dfee; +} +.i-table .i-odd { + background-color: #f1f5f9; +} +.i-table .i-selected { + background: #375f98 url(../img/selected-bg.png) repeat-x; + color: #fff; +} + +.i-table-row-spacer { + height: 10px; + overflow: hidden; /* IE hack to allow < one line height divs */ +} + +.i-table-cell-content { + white-space: nowrap; + overflow: hidden; + /*border-right: 1px solid #e4e8ef; + padding-left: 2px; + width: 98%;*/ +} + + + +.i-table-column-selector { + float: right; + background: transparent url(../img/colsel.png) no-repeat; margin: 4px 0 0 0; height:15px; - width:15px; -} - -.i-table-focus-slot-left { - border-left: 2px solid #375f98; - margin-right: -2px; -} -.i-table-focus-slot-right { - border-right: 2px solid #375f98; - margin-left: -2px; -} - -.i-table-header-drag { - position: absolute; - background: #e7edf3 url(../img/header-bg.png) repeat-x; - border: 1px solid #375f98; - padding: 4px; - color: #1c3e6e; - font-weight: bold; - opacity: 0.5; - filter: alpha(opacity=50); -} + width:15px; + margin-top: -20px; + position:relative; +} + +.i-table-focus-slot-left { + border-left: 2px solid #375f98; + margin-right: -2px; +} +.i-table-focus-slot-right { + border-right: 2px solid #375f98; + margin-left: -2px; +} + +.i-table-header-drag { + position: absolute; + background: #e7edf3 url(../img/header-bg.png) repeat-x; + border: 1px solid #375f98; + padding: 4px; + color: #1c3e6e; + font-weight: bold; + opacity: 0.5; + filter: alpha(opacity=50); +} .i-table-scrollposition { display: none; @@ -153,12 +156,12 @@ padding: 4px; border: 1px solid black; background: yellow; -} - -/* IE specific styles */ -* html .i-table-header-wrap { - margin-top: 0; -} -*+html .i-table-header-wrap { - margin-top: 1px; +} + +/* IE specific styles */ +* html .i-table-header-wrap { + margin-top: 0; +} +*+html .i-table-header-wrap { + margin-top: 1px; } \ No newline at end of file