summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-08-26 16:57:12 +0300
committerVaadin Code Review <review@vaadin.com>2016-08-29 06:51:57 +0000
commit28482d1ae9ade91557d4e3d7c0912a5b355ac0c3 (patch)
treee10eecfd4a1228b56623ba4d6679f0d4ca1d7f23
parent653a24fa08eccd4606282355c7e36d979a9d0bca (diff)
downloadvaadin-framework-28482d1ae9ade91557d4e3d7c0912a5b355ac0c3.tar.gz
vaadin-framework-28482d1ae9ade91557d4e3d7c0912a5b355ac0c3.zip
Change Label default width to undefined to match other components
Change-Id: Ia4e6bbe0673c20e96bdda240570247ff9b1f6d93
-rw-r--r--server/src/main/java/com/vaadin/ui/Label.java1
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/AbstractOrderedLayoutWithCaptions.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java6
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/label/LabelTooltip.java10
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/uitest/components/LabelsCssTest.java1
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdate.java7
-rw-r--r--uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveUI.java3
-rw-r--r--uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java20
-rw-r--r--uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMove.java10
12 files changed, 49 insertions, 20 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Label.java b/server/src/main/java/com/vaadin/ui/Label.java
index 161d4ddc73..8042f3b865 100644
--- a/server/src/main/java/com/vaadin/ui/Label.java
+++ b/server/src/main/java/com/vaadin/ui/Label.java
@@ -65,7 +65,6 @@ public class Label extends AbstractComponent {
public Label(String text, ContentMode contentMode) {
setValue(text);
setContentMode(contentMode);
- setWidth("100%");
}
@Override
diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractOrderedLayoutWithCaptions.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractOrderedLayoutWithCaptions.java
index 6b67405bdb..c3e7f214cd 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/AbstractOrderedLayoutWithCaptions.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractOrderedLayoutWithCaptions.java
@@ -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);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java
index 0f74e57f3f..1de7f1627a 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragStartModes.java
@@ -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);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/label/LabelTooltip.java b/uitest/src/main/java/com/vaadin/tests/components/label/LabelTooltip.java
index cb96c1282c..9512edc4b7 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/label/LabelTooltip.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/label/LabelTooltip.java
@@ -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."));
diff --git a/uitest/src/main/java/com/vaadin/tests/components/uitest/components/LabelsCssTest.java b/uitest/src/main/java/com/vaadin/tests/components/uitest/components/LabelsCssTest.java
index 2413dfaaf3..a7655d15a0 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/uitest/components/LabelsCssTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/uitest/components/LabelsCssTest.java
@@ -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);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java b/uitest/src/main/java/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
index 1d9861fce3..7f15c7c12b 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java
@@ -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
diff --git a/uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdate.java b/uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdate.java
index 4f6e898b39..25df840dc8 100644
--- a/uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdate.java
+++ b/uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdate.java
@@ -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);
diff --git a/uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveUI.java b/uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveUI.java
index 22e9e3b730..a3d97e2278 100644
--- a/uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveUI.java
+++ b/uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveUI.java
@@ -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);
diff --git a/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java b/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java
index 1f348b0cd2..6959b1a852 100644
--- a/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java
+++ b/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java
@@ -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
diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java b/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java
index ffb7d4e80e..f2d6240d0e 100644
--- a/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java
+++ b/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridLayoutMoveComponent.java
@@ -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);
}
}));
diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java b/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java
index 221e402158..c9cdb38662 100644
--- a/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java
+++ b/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridSpanEmptyColumns.java
@@ -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
diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMove.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMove.java
index 713fb91656..a35b958bd5 100644
--- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMove.java
+++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMove.java
@@ -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);