summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebContent/ITMILL/themes/tests-tickets/styles.css14
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java23
-rw-r--r--src/com/itmill/toolkit/tests/components/table/TableRowHeight2.java4
-rw-r--r--src/com/itmill/toolkit/tests/components/table/TableRowHeight3.java61
4 files changed, 94 insertions, 8 deletions
diff --git a/WebContent/ITMILL/themes/tests-tickets/styles.css b/WebContent/ITMILL/themes/tests-tickets/styles.css
index 0cdad264dd..225bbd6d1d 100644
--- a/WebContent/ITMILL/themes/tests-tickets/styles.css
+++ b/WebContent/ITMILL/themes/tests-tickets/styles.css
@@ -1,5 +1,7 @@
@import url(../default/styles.css);
+/* DO NOT ADD GENERIC RULES LIKE .i-table IN THIS FILE */
+
/*****************************************************************************/
/* Ticket 1904 */
/*****************************************************************************/
@@ -442,10 +444,12 @@ padding:2px;
.i-table-row:hover, .i-table-row-odd:hover {
background: #c8def9;
}
+/*
.i-table-header-wrap {
background: #d4e7fe url(img/table/column_header_bg.png) top left repeat-x;
height: 25px;
}
+*/
.i-table-header-cell:hover,
.i-table-header-cell-asc:hover,
.i-table-header-cell-desc:hover {
@@ -456,7 +460,7 @@ padding:2px;
border-right: 1px solid #e3e7f0;
margin: 0;
padding: 2px 2px 2px 3px;
- height: 20px;
+/* height: 20px;*/
}
.i-table-header-cell-asc .i-table-caption-container {
background: url(img/table/order_asc.png) right 50% no-repeat;
@@ -1266,4 +1270,10 @@ padding:2px;
/* #2434 */
.i-table-bordered .i-table-body td {
border-bottom: 1px solid red;
-} \ No newline at end of file
+}
+
+/* #2747 */
+.i-button-nowraplink span {
+ white-space: normal;
+}
+
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 7470662828..bd832749fa 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java
@@ -574,7 +574,8 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener {
boolean verticalScrollbarVisible = (pageLength < totalRows);
if (verticalScrollbarVisible) {
- // There will be a vertical scrollbar and its width is not included in availW
+ // There will be a vertical scrollbar and its width is not included
+ // in availW
availW -= Util.getNativeScrollbarSize();
}
@@ -651,8 +652,17 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener {
* We must force an update of the row height as this point as it
* might have been (incorrectly) calculated earlier
*/
- int bodyHeight = (tBody.getRowHeight(true) * pageLength);
- bodyContainer.setHeight(bodyHeight + "px");
+ if (pageLength == totalRows) {
+ /*
+ * We want to show all rows so the bodyHeight should be equal to
+ * the table height
+ */
+ int bodyHeight = tBody.getTableHeight();
+ bodyContainer.setHeight(bodyHeight + "px");
+ } else {
+ int bodyHeight = (tBody.getRowHeight(true) * pageLength);
+ bodyContainer.setHeight(bodyHeight + "px");
+ }
}
isNewBody = false;
@@ -1935,8 +1945,7 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener {
return rowHeight;
} else {
if (DOM.getChildCount(tBody) > 0) {
- rowHeight = tBody.getParentElement().getOffsetHeight()
- / DOM.getChildCount(tBody);
+ rowHeight = getTableHeight() / DOM.getChildCount(tBody);
} else {
return DEFAULT_ROW_HEIGHT;
}
@@ -1945,6 +1954,10 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener {
}
}
+ public int getTableHeight() {
+ return table.getOffsetHeight();
+ }
+
public int getColWidth(int i) {
if (initDone) {
final Element e = DOM.getChild(DOM.getChild(tBody, 0), i);
diff --git a/src/com/itmill/toolkit/tests/components/table/TableRowHeight2.java b/src/com/itmill/toolkit/tests/components/table/TableRowHeight2.java
index 39f6a51c49..f02a110bab 100644
--- a/src/com/itmill/toolkit/tests/components/table/TableRowHeight2.java
+++ b/src/com/itmill/toolkit/tests/components/table/TableRowHeight2.java
@@ -35,11 +35,13 @@ public class TableRowHeight2 extends TestBase {
Item item = table.addItem(new Object());
Button b = new Button();
+ b.setWidth("100%");
+ b.setStyleName(Button.STYLE_LINK);
+ b.addStyleName("nowraplink");
b
.setCaption("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper, elit quis elementum iaculis, dui est rutrum risus, at cursus sem leo eget arcu. Proin vel eros ut tortor luctus pretium. Nulla facilisi. Donec in dui. Proin ac diam vitae massa tempus faucibus. Fusce eu risus. Nunc ac risus. Cras libero.");
- b.setStyleName(Button.STYLE_LINK);
item.getItemProperty("title").setValue(b);
Button c = new Button("test");
diff --git a/src/com/itmill/toolkit/tests/components/table/TableRowHeight3.java b/src/com/itmill/toolkit/tests/components/table/TableRowHeight3.java
new file mode 100644
index 0000000000..56f4289605
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/components/table/TableRowHeight3.java
@@ -0,0 +1,61 @@
+package com.itmill.toolkit.tests.components.table;
+
+import com.itmill.toolkit.data.Item;
+import com.itmill.toolkit.tests.components.TestBase;
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.HorizontalLayout;
+import com.itmill.toolkit.ui.Table;
+
+public class TableRowHeight3 extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "All rows should be visible and the table height should match the height of the rows (no vertical scrollbar)";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2747;
+ }
+
+ @Override
+ protected void setup() {
+ setTheme("tests-tickets");
+ HorizontalLayout vl = new HorizontalLayout();
+ vl.setSizeFull();
+
+ Table table = new Table();
+ table.setWidth("320px");
+ table.setPageLength(0);
+ table.setColumnWidth("title", 200);
+ table.setColumnWidth("test", 98);
+ table.addContainerProperty("title", Button.class, "");
+ table.addContainerProperty("test", Button.class, "");
+ for (int i = 0; i < 6; i++) {
+ Item item = table.addItem(new Object());
+
+ Button b = new Button();
+ b.setWidth("100%");
+ b.setStyleName(Button.STYLE_LINK);
+ b.addStyleName("nowraplink");
+ if (i < 2) {
+ b
+ .setCaption("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper, elit quis elementum iaculis, dui est rutrum risus, at cursus sem leo eget arcu. Proin vel eros ut tortor luctus pretium. Nulla facilisi. Donec in dui. Proin ac diam vitae massa tempus faucibus. Fusce eu risus. Nunc ac risus. Cras libero.");
+ } else if (2 <= i && i < 4) {
+ b.setCaption("One line");
+ } else {
+ b.setCaption("This button caption should use up two lines");
+ }
+ item.getItemProperty("title").setValue(b);
+
+ Button c = new Button("test");
+ item.getItemProperty("test").setValue(c);
+ }
+
+ vl.addComponent(table);
+
+ addComponent(vl);
+
+ }
+
+}