public Label(String text, ContentMode contentMode) {
setValue(text);
setContentMode(contentMode);
- setWidth("100%");
}
@Override
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);
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);
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);
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."));
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);
+ " 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
+ " 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
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);
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 {
+ "<p><a href=\"http://vaadin.com/download\">Download "
+ "Vaadin</a></p>",
ContentMode.HTML);
+ description.setWidth("100%");
description.addStyleName("description");
split.addComponent(description);
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;
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;
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);
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
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
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");
@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);
}
}));
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
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;
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;
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);