]> source.dussan.org Git - vaadin-framework.git/commitdiff
some changes to width calculation
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 27 Sep 2007 08:33:52 +0000 (08:33 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 27 Sep 2007 08:33:52 +0000 (08:33 +0000)
svn changeset:2380/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java
src/com/itmill/toolkit/terminal/gwt/public/default/table/table.css

index edcc9e916edb0e8670666d0f86eccbd82e0a4a48..48f30ea55ca051e93ac3dee63a4de459123f5027 100644 (file)
@@ -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) {
index 2e35bec1936e9b869839abdb4486b10ff6b9606e..f7a0dca8cb55ff3dc9dfdf842ce50433a9b20c77 100644 (file)
-.i-table {\r
-       border: 1px solid #29528a;\r
-       background: #fff;\r
-}\r
-.i-table:before {\r
-       display: block;\r
-       height: 2px;\r
-       overflow: hidden;\r
-       background: transparent url(../../panel/img/top-right-small.png) no-repeat right top;\r
-       content: url(../../panel/img/top-left-small.png);\r
-       margin: -1px -1px 0 -1px;\r
-}\r
-.i-table:after {\r
-       display: block;\r
-       height: 2px;\r
-       overflow: hidden;\r
-       background: transparent url(../../panel/img/bottom-right.png) no-repeat right top;\r
-       content: url(../../panel/img/bottom-left.png);\r
-       margin: 0 -1px -1px -1px;\r
-}\r
-\r
-.i-table-header-wrap {\r
-       height: 26px;\r
-       background: #e7edf3 url(../img/header-bg.png) repeat-x;\r
-       border-bottom: 1px solid #6082b0;\r
-       margin-top: -1px;\r
-}\r
-\r
-.i-table-header {\r
-}\r
-\r
-.i-table-header table,\r
-.i-table-table {\r
-       border-collapse: collapse;\r
-       margin: 0;\r
-       padding: 0;\r
-       border: 0;\r
-}\r
-\r
-.i-table-header td,\r
-.i-table-table td {\r
-       margin:0;\r
-       padding:0;\r
-       border:0;\r
-}\r
-\r
-.i-table-header td {\r
-       cursor: pointer;\r
-}\r
-\r
-.i-table-resizer {\r
-       display: block;\r
-       height: 26px;\r
-       float: right;\r
-       background: #aabdda url(../img/resizer-bg.png);\r
-       cursor: e-resize;\r
-}\r
-\r
-.i-table-caption-container {\r
-       float: right;\r
-       overflow: hidden;\r
-       white-space: nowrap;\r
-       font-weight: bold;\r
-       color: #1c3e6e;\r
-       padding-top: 5px;\r
-}\r
-\r
-/* disabled row in column selector */\r
-.i-off {\r
-       font-style: italic;\r
-}\r
-\r
-\r
-\r
-.i-table-header-cell {\r
-}\r
-.i-table-header-cell-asc {\r
-       background: blue;\r
-}\r
-.i-table-header-cell-desc {\r
-       background: cyan;\r
-}\r
-\r
-.i-table-body {\r
-       /*margin: 0 1px;*/\r
-}\r
-\r
-.i-table-row {\r
-       border: 0;\r
-       margin: 0;\r
-       padding: 3px 0 3px 0;\r
-       cursor: pointer;\r
-}\r
-.i-table-row:hover,\r
-.i-table .i-odd:hover {\r
-       background-color: #d3dfee;\r
-}\r
-.i-table .i-odd {\r
-       background-color: #f1f5f9;\r
-}\r
-.i-table .i-selected {\r
-       background: #375f98 url(../img/selected-bg.png) repeat-x;\r
-       color: #fff;\r
-}\r
-\r
-.i-table-row-spacer {\r
-       height: 10px;\r
-       overflow: hidden; /* IE hack to allow < one line height divs */\r
-}\r
-\r
-.i-table-cell-content {\r
-       white-space: nowrap;\r
-       overflow: hidden;\r
-       /*border-right: 1px solid #e4e8ef;\r
-       padding-left: 2px;\r
-       width: 98%;*/\r
-}\r
-\r
-\r
-\r
-.i-table-column-selector {\r
-       float: right;\r
-       background: transparent url(../img/colsel.png) no-repeat;\r
+.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;\r
-}\r
-\r
-.i-table-focus-slot-left {\r
-       border-left: 2px solid #375f98;\r
-       margin-right: -2px;\r
-}\r
-.i-table-focus-slot-right {\r
-       border-right: 2px solid #375f98;\r
-       margin-left: -2px;\r
-}\r
-\r
-.i-table-header-drag {\r
-       position: absolute;\r
-       background: #e7edf3 url(../img/header-bg.png) repeat-x;\r
-       border: 1px solid #375f98;\r
-       padding: 4px;\r
-       color: #1c3e6e;\r
-       font-weight: bold;\r
-       opacity: 0.5;\r
-       filter: alpha(opacity=50);\r
-}\r
+       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;
        padding: 4px;
        border: 1px solid black;
        background: yellow;
-}\r
-\r
-/* IE specific styles */\r
-* html .i-table-header-wrap {\r
-       margin-top: 0;\r
-}\r
-*+html .i-table-header-wrap {\r
-       margin-top: 1px;\r
+}
+
+/* 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