]> source.dussan.org Git - vaadin-framework.git/commitdiff
Change Label default width to undefined to match other components
authorArtur Signell <artur@vaadin.com>
Fri, 26 Aug 2016 13:57:12 +0000 (16:57 +0300)
committerVaadin Code Review <review@vaadin.com>
Mon, 29 Aug 2016 06:51:57 +0000 (06:51 +0000)
Change-Id: Ia4e6bbe0673c20e96bdda240570247ff9b1f6d93

12 files changed:
server/src/main/java/com/vaadin/ui/Label.java
uitest/src/main/java/com/vaadin/tests/components/AbstractOrderedLayoutWithCaptions.java
uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java
uitest/src/main/java/com/vaadin/tests/components/label/LabelTooltip.java
uitest/src/main/java/com/vaadin/tests/components/uitest/components/LabelsCssTest.java
uitest/src/main/java/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdate.java
uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveUI.java
uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java
uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java
uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java
uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMove.java

index 161d4ddc73f4ff6db0e44f0e97d7ed06b7f646df..8042f3b8653600fa9218e1b361ce60ca79d73f17 100644 (file)
@@ -65,7 +65,6 @@ public class Label extends AbstractComponent {
     public Label(String text, ContentMode contentMode) {
         setValue(text);
         setContentMode(contentMode);
-        setWidth("100%");
     }
 
     @Override
index 6b67405bdb305bb49a055d448dd6f72d53a39384..c3e7f214cd6039688578f0e70148312f66fa3d4b 100644 (file)
@@ -37,6 +37,8 @@ public class AbstractOrderedLayoutWithCaptions extends AbstractTestUI {
         TextField textField = new TextField("Input Text:");
         Label label1 = new Label("LABEL 1");
         Label label2 = new Label("LABEL 2");
+        label1.setWidth("100%"); // Only to make test backwards compatible
+        label2.setWidth("100%"); // Only to make test backwards compatible
 
         layout.addComponent(textField);
 
index 0f74e57f3fe4c1f6654848bc629c498a78d6bbe7..1de7f1627a538329ce45358b548e3a7e444c2c6a 100644 (file)
@@ -32,7 +32,10 @@ public class DragStartModes extends TestBase {
         parent.setSpacing(true);
 
         CssLayout header = new CssLayout();
-        header.addComponent(new Label("Drag start mode : COMPONENT_OTHER"));
+        Label dragStartModeLabel = new Label(
+                "Drag start mode : COMPONENT_OTHER");
+        dragStartModeLabel.setWidth("100%");
+        header.addComponent(dragStartModeLabel);
         header.setSizeUndefined();
 
         DragAndDropWrapper wrapper = new DragAndDropWrapper(header);
@@ -43,6 +46,7 @@ public class DragStartModes extends TestBase {
 
         Label extra = new Label(
                 "Extra label that is not part of the wrapper. This should be dragged along with COMPONENT_OTHER.");
+        extra.setWidth("100%");
         extra.addStyleName("extra");
         parent.addComponent(extra);
 
index cb96c1282c14f926963455a5ab391c64f79e9f9e..9512edc4b7f9c31ae324b2c5fb89a0b39f86e500 100644 (file)
@@ -21,15 +21,17 @@ public class LabelTooltip extends TestBase {
         layout.setWidth("400px");
         layout.setColumnExpandRatio(0, 1);
 
-        layout.addComponent(new Label("Default"));
+        Label defaultLabel = new Label("Default");
+        defaultLabel.setWidth("100%");
+        layout.addComponent(defaultLabel);
         Label tooltip = new Label("Hover over me to see the tooltip");
-        tooltip.setSizeUndefined();
         tooltip.setDescription("Default tooltip content");
         layout.addComponent(tooltip);
 
-        layout.addComponent(new Label("Default /w error"));
+        Label defaultWithError = new Label("Default /w error");
+        defaultWithError.setWidth("100%");
+        layout.addComponent(defaultWithError);
         tooltip = new Label("Hover over me to see the tooltip");
-        tooltip.setSizeUndefined();
         tooltip.setDescription("Default tooltip content");
         tooltip.setComponentError(new UserError(
                 "Error inside tooltip together with the regular tooltip message."));
index 2413dfaaf326eb23aa63683f3a7ffdab91dc80ab..a7655d15a02383ed87cfa6d79f64bb940d398efb 100644 (file)
@@ -53,6 +53,7 @@ public class LabelsCssTest extends GridLayout {
             String primaryStyleName, String iconUrl) {
 
         Label l = new Label();
+        l.setWidth("100%"); // Only to make test backwards compatible
         l.setId("label" + debugIdCounter++);
         if (caption != null) {
             l.setCaption(caption);
index 1d9861fce35a555ad9d132825c4c99eae5edd539..7f15c7c12b0c50e43c780d31c6842d7803e9beca 100644 (file)
@@ -41,6 +41,7 @@ public class TestTooSmallSubwindowSize extends AbstractTestUI {
                 + " disabled for this window. Additionally, this text label"
                 + " is intentionally too large to fit the window. You can"
                 + " use the scrollbars to view different parts of the window content.");
+        desc.setWidth("100%");
         layout.addComponent(desc);
 
         // Set window position
@@ -94,6 +95,7 @@ public class TestTooSmallSubwindowSize extends AbstractTestUI {
                 + " disabled for this window. Additionally, this text label"
                 + " is intentionally too large to fit the window. You can resize or"
                 + " use the scrollbars to view different parts of the window content.");
+        desc.setWidth("100%");
         layout.addComponent(desc);
 
         // Set window position
index 4f6e898b39719f24499472a73de2711236afb2ee..25df840dc8e49277a198ef0a328a408c1ad4bb80 100644 (file)
@@ -38,12 +38,13 @@ public class ResponsiveLayoutUpdate extends AbstractTestUI {
         Label label = new Label(
                 "This label changes its size between the breakpoints, allowing more space for the adjacent component.");
         label.addStyleName("change-width");
-        label.setSizeUndefined();
         layout.addComponent(label);
 
         Panel panel = new Panel("Panel");
-        panel.setContent(new Label(
-                "This Panel should be maximized in both breakpoints."));
+        Label label2 = new Label(
+                "This Panel should be maximized in both breakpoints.");
+        label2.setWidth("100%");
+        panel.setContent(label2);
         panel.setSizeFull();
         layout.addComponent(panel);
         layout.setExpandRatio(panel, 1);
index 22e9e3b7302614cd3529aea881ae19d8a29e3ea0..a3d97e2278c5f803677588ca417ea43bb336f991 100644 (file)
@@ -19,11 +19,11 @@ package com.vaadin.tests.extensions;
 import com.vaadin.annotations.Theme;
 import com.vaadin.server.Responsive;
 import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.CssLayout;
 import com.vaadin.ui.HorizontalSplitPanel;
 import com.vaadin.ui.Label;
-import com.vaadin.shared.ui.label.ContentMode;
 
 @Theme("tests-responsive")
 public class ResponsiveUI extends AbstractTestUI {
@@ -53,6 +53,7 @@ public class ResponsiveUI extends AbstractTestUI {
                         + "<p><a href=\"http://vaadin.com/download\">Download "
                         + "Vaadin</a></p>",
                 ContentMode.HTML);
+        description.setWidth("100%");
         description.addStyleName("description");
         split.addComponent(description);
 
index 1f348b0cd2a0c85bb172aea3643c2f3df152b061..6959b1a852a65904324c272e437cee45449c0eb7 100644 (file)
@@ -24,6 +24,7 @@ import com.vaadin.server.Resource;
 import com.vaadin.server.ThemeResource;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.shared.Position;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Accordion;
 import com.vaadin.ui.Button;
@@ -44,7 +45,6 @@ import com.vaadin.ui.TabSheet;
 import com.vaadin.ui.TextField;
 import com.vaadin.ui.Upload;
 import com.vaadin.ui.VerticalLayout;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.AbstractSelect;
 import com.vaadin.v7.ui.ComboBox;
 import com.vaadin.v7.ui.ListSelect;
@@ -131,8 +131,8 @@ public class FontIcons extends AbstractTestUI {
         tabs.setCaption("TabSheet");
         tabs.setIcon(icon);
         tabs.addStyleName("myTabs");
-        tabs.addTab(new Label("Content 1"), "Tab 1", icon);
-        tabs.addTab(new Label("Content 2"), "Tab 2", icon);
+        tabs.addTab(createLabel("Content 1"), "Tab 1", icon);
+        tabs.addTab(createLabel("Content 2"), "Tab 2", icon);
         tabs.setWidth("150px");
         gl.addComponent(tabs);
 
@@ -140,8 +140,8 @@ public class FontIcons extends AbstractTestUI {
         Accordion acc = new Accordion();
         acc.setCaption("Accordion");
         acc.setIcon(icon);
-        acc.addTab(new Label(), "Section 1", icon);
-        acc.addTab(new Label(), "Section 2", icon);
+        acc.addTab(createLabel(""), "Section 1", icon);
+        acc.addTab(createLabel(""), "Section 2", icon);
         gl.addComponent(acc);
 
         // Table, caption + column + row + action icons
@@ -205,7 +205,15 @@ public class FontIcons extends AbstractTestUI {
         for (FontIcon ic : FontAwesome.values()) {
             allIcons += ic.getHtml() + " ";
         }
-        layout.addComponent(new Label(allIcons, ContentMode.HTML));
+        Label label = new Label(allIcons, ContentMode.HTML);
+        label.setWidth("100%");
+        layout.addComponent(label);
+    }
+
+    private Label createLabel(String caption) {
+        Label label = new Label(caption);
+        label.setWidth("100%");
+        return label;
     }
 
     @Override
index ffb7d4e80e59e8f05f86c65d9671843faee6bc95..f2d6240d0eae0c9a2e8785bad0fd49c7952081b7 100644 (file)
@@ -19,6 +19,7 @@ public class GridLayoutMoveComponent extends AbstractTestUI {
         addComponent(grid);
 
         final Label l = new Label("100% label");
+        l.setWidth("100%");
         final Button b = new Button("100px button");
         b.setWidth("100px");
         final TextField tf = new TextField("Undef textfield");
@@ -52,7 +53,9 @@ public class GridLayoutMoveComponent extends AbstractTestUI {
                     @Override
                     public void buttonClick(ClickEvent event) {
                         grid.removeComponent(tf);
-                        grid.addComponent(new Label("I'm on left"), 0, 2);
+                        Label label = new Label("I'm on left");
+                        label.setWidth("100%");
+                        grid.addComponent(label, 0, 2);
                         grid.addComponent(tf, 1, 2);
                     }
                 }));
index 221e402158dade98f5f9b5cb11444d12dd1a8b01..c9cdb386621dbeac41397cc7080bc0bcc8990b20 100644 (file)
@@ -34,8 +34,10 @@ public class GridSpanEmptyColumns extends AbstractTestUI {
 
         Label bigCell = new Label("big cell");
         bigCell.setId("bigCell");
+        bigCell.setWidth("100%"); // Only to make test backwards compatible
         Label smallCell = new Label("small cell");
         smallCell.setId("smallCell");
+        smallCell.setWidth("100%"); // Only to make test backwards compatible
         gridLayout.addComponent(bigCell, 0, 0, 1, 0); // spans first two columns
         gridLayout.addComponent(smallCell, 2, 0, 2, 0); // last column only
 
index 713fb9165653473bb61d53f7f1f382565ef454d0..a35b958bd5fb400294b6033a4f60df1af89af2f1 100644 (file)
@@ -16,6 +16,7 @@
 package com.vaadin.tests.layouts.layouttester;
 
 import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.AbstractComponent;
 import com.vaadin.ui.AbstractLayout;
 import com.vaadin.ui.Button;
@@ -23,7 +24,6 @@ import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Button.ClickListener;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 import com.vaadin.v7.ui.TextField;
 
@@ -53,8 +53,12 @@ public class BaseAddReplaceMove extends BaseLayoutTestUI {
         l2.setHeight(null);
         // extra layout from which components will be moved
         final HorizontalLayout source = new HorizontalLayout();
-        source.addComponent(new Label("OTHER LABEL 1"));
-        source.addComponent(new Label("OTHER LABEL 2"));
+        Label label1 = new Label("OTHER LABEL 1");
+        label1.setWidth("100%"); // Only to make test backwards compatible
+        source.addComponent(label1);
+        Label label2 = new Label("OTHER LABEL 2");
+        label2.setWidth("100%"); // Only to make test backwards compatible
+        source.addComponent(label2);
 
         final AbstractComponent c1 = new Label("<b>LABEL</b>",
                 ContentMode.HTML);