summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-06-25 11:47:49 +0000
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-06-25 11:47:49 +0000
commit556730ab5ae0daefbbc2e077463c68d2081eaec3 (patch)
tree33d0775e87bd04638cf5bbf7b2499665a04b5ae8 /src/com
parent1401003a10eb328995b92351e9f716fce705dfc8 (diff)
downloadvaadin-framework-556730ab5ae0daefbbc2e077463c68d2081eaec3.tar.gz
vaadin-framework-556730ab5ae0daefbbc2e077463c68d2081eaec3.zip
#8957 Ensure non-negative width
svn changeset:23973/svn branch:6.8
Diffstat (limited to 'src/com')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index 24097c0949..fa7621e512 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -3500,20 +3500,15 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
DOM.setStyleAttribute(captionContainer, "width", "");
setWidth("");
} else {
-
/*
* Reduce width with one pixel for the right border since the
* footers does not have any spacers between them.
*/
- int borderWidths = 1;
+ final int borderWidths = 1;
// Set the container width (check for negative value)
- if (w - borderWidths >= 0) {
- captionContainer.getStyle().setPropertyPx("width",
- w - borderWidths);
- } else {
- captionContainer.getStyle().setPropertyPx("width", 0);
- }
+ captionContainer.getStyle().setPropertyPx("width",
+ Math.max(w - borderWidths, 0));
/*
* if we already have tBody, set the header width properly, if
@@ -3521,21 +3516,16 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
* unless TD width is not explicitly set.
*/
if (scrollBody != null) {
- /*
- * Reduce with one since footer does not have any spacers,
- * instead a 1 pixel border.
- */
int tdWidth = width + scrollBody.getCellExtraWidth()
- borderWidths;
- setWidth(tdWidth + "px");
+ setWidth(Math.max(tdWidth, 0) + "px");
} else {
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
- int borderWidths = 1;
int tdWidth = width
+ scrollBody.getCellExtraWidth()
- borderWidths;
- setWidth(tdWidth + "px");
+ setWidth(Math.max(tdWidth, 0) + "px");
}
});
}