diff options
Diffstat (limited to 'uitest/src/com/vaadin/tests/tickets/Ticket1805.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/tickets/Ticket1805.java | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1805.java b/uitest/src/com/vaadin/tests/tickets/Ticket1805.java new file mode 100644 index 0000000000..7f5c684479 --- /dev/null +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1805.java @@ -0,0 +1,58 @@ +package com.vaadin.tests.tickets; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Layout.MarginHandler; +import com.vaadin.ui.UI.LegacyWindow; +import com.vaadin.ui.TextField; + +public class Ticket1805 extends com.vaadin.Application.LegacyApplication { + + @Override + public void init() { + final LegacyWindow main = new LegacyWindow(getClass().getName() + .substring(getClass().getName().lastIndexOf(".") + 1)); + setMainWindow(main); + ((MarginHandler) main.getContent()).setMargin(false); + + Label description = new Label( + "GridLayout with 100% (no height), is wanted to " + + "share all available width with columns " + + "relatively to their natural width. And it " + + "should still work with margins and spacings"); + main.addComponent(description); + + final GridLayout grid = new GridLayout(4, 1); + + final TextField size = new TextField("Grid width in css unit"); + size.addListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + String width = size.getValue().toString(); + if (width == null || width.equals("")) { + grid.setSizeUndefined(); + } else { + grid.setWidth(width); + } + } + }); + main.addComponent(size); + main.addComponent(new Button("set size")); + + grid.setMargin(true); + grid.setSpacing(true); + + grid.addComponent(new Label("WIDE")); + grid.addComponent(new Label("_I_")); + grid.addComponent(new Label("VEEEEEEEEEEERY_WIDE")); + Label label = new Label("|"); + grid.addComponent(label); + grid.setComponentAlignment(label, Alignment.TOP_RIGHT); + main.addComponent(grid); + } + +} |