diff options
4 files changed, 79 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 6c241f1033..14e4c658ad 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -5392,6 +5392,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, private Map<TableCellElement, TooltipInfo> cellToolTips = new HashMap<TableCellElement, TooltipInfo>(); private boolean isDragging = false; private String rowStyle = null; + protected boolean applyZeroWidthFix = true; private VScrollTableRow(int rowKey) { this.rowKey = rowKey; @@ -5497,7 +5498,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * definition of zero width table cells. Instead, use 1px * and compensate with a negative margin. */ - if (width == 0) { + if (applyZeroWidthFix && width == 0) { wrapperWidth = 1; wrapperStyle.setMarginRight(-1, Unit.PX); } else { diff --git a/client/src/com/vaadin/client/ui/VTreeTable.java b/client/src/com/vaadin/client/ui/VTreeTable.java index 9b7e9702b2..9e5940a2f2 100644 --- a/client/src/com/vaadin/client/ui/VTreeTable.java +++ b/client/src/com/vaadin/client/ui/VTreeTable.java @@ -155,6 +155,8 @@ public class VTreeTable extends VScrollTable { public VTreeTableRow(UIDL uidl, char[] aligns2) { super(uidl, aligns2); + // this fix causes #15118 and doesn't work for treetable anyway + applyZeroWidthFix = false; } @Override diff --git a/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumns.java b/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumns.java new file mode 100644 index 0000000000..c4679f739b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumns.java @@ -0,0 +1,44 @@ +package com.vaadin.tests.components.treetable; + +import com.vaadin.annotations.Theme; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.TreeTable; + +@Theme("valo") +public class MinimalWidthColumns extends AbstractTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + TreeTable tt = new TreeTable(); + tt.addContainerProperty("Foo", String.class, ""); + tt.addContainerProperty("Bar", String.class, ""); + + Object item1 = tt.addItem(new Object[] { "f", "Bar" }, null); + Object item2 = tt.addItem(new Object[] { "Foo2", "Bar2" }, null); + + tt.setParent(item2, item1); + + tt.setColumnWidth("Foo", 0); + tt.setColumnWidth("Bar", 50); + tt.setWidth("300px"); + addComponent(tt); + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(15118); + } + + @Override + protected String getTestDescription() { + return "There should be no 1px discrepancy between vertical borders in headers and rows"; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumnsTest.java b/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumnsTest.java new file mode 100644 index 0000000000..46c2f397b6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/MinimalWidthColumnsTest.java @@ -0,0 +1,31 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * 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. + */ +package com.vaadin.tests.components.treetable; + +import org.junit.Test; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class MinimalWidthColumnsTest extends MultiBrowserTest { + + @Test + public void testFor1pxDifference() throws Exception { + openTestURL(); + sleep(500); + compareScreen("onepixdifference"); + } + +} |