From: Leif Åstrand
Date: Wed, 4 Jan 2012 12:37:31 +0000 (+0200)
Subject: #8019 Enum for Label.ContentMode
X-Git-Tag: 7.0.0.alpha2~541^2~9
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=63bf051247461cff44c9f23d19d2e1064266d55f;p=vaadin-framework.git
#8019 Enum for Label.ContentMode
---
diff --git a/src/com/vaadin/ui/Label.java b/src/com/vaadin/ui/Label.java
index e9ea0fd417..ace1df4f8c 100644
--- a/src/com/vaadin/ui/Label.java
+++ b/src/com/vaadin/ui/Label.java
@@ -16,8 +16,7 @@ import com.vaadin.ui.ClientWidget.LoadStyle;
/**
* Label component for showing non-editable short texts.
*
- * The label content can be set to the modes specified by the final members
- * CONTENT_*
+ * The label content can be set to the modes specified by {@link ContentMode}
*
*
* The contents of the label may contain simple formatting:
@@ -46,61 +45,159 @@ public class Label extends AbstractComponent implements Property,
Property.ValueChangeNotifier, Comparable {
/**
- * Content mode, where the label contains only plain text. The getValue()
- * result is coded to XML when painting.
+ * Content modes defining how the client should interpret a Label's value.
+ *
+ * @sine 7.0
*/
- public static final int CONTENT_TEXT = 0;
+ public enum ContentMode {
+ /**
+ * Content mode, where the label contains only plain text. The
+ * getValue() result is coded to XML when painting.
+ */
+ TEXT(null) {
+ @Override
+ public void paintText(String text, PaintTarget target)
+ throws PaintException {
+ target.addText(text);
+ }
+ },
+
+ /**
+ * Content mode, where the label contains preformatted text.
+ */
+ PREFORMATTED("pre") {
+ @Override
+ public void paintText(String text, PaintTarget target)
+ throws PaintException {
+ target.startTag("pre");
+ target.addText(text);
+ target.endTag("pre");
+ }
+ },
+
+ /**
+ * Content mode, where the label contains XHTML. Contents is then
+ * enclosed in DIV elements having namespace of
+ * "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".
+ */
+ XHTML("xhtml") {
+ @Override
+ public void paintText(String text, PaintTarget target)
+ throws PaintException {
+ target.startTag("data");
+ target.addXMLSection("div", text,
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
+ target.endTag("data");
+ }
+ },
+
+ /**
+ * Content mode, where the label contains well-formed or well-balanced
+ * XML. Each of the root elements must have their default namespace
+ * specified.
+ */
+ XML("xml") {
+ @Override
+ public void paintText(String text, PaintTarget target)
+ throws PaintException {
+ target.addXMLSection("data", text, null);
+ }
+ },
+
+ /**
+ * Content mode, where the label contains RAW output. Output is not
+ * required to comply to with XML. In Web Adapter output is inserted
+ * inside the resulting HTML document as-is. This is useful for some
+ * specific purposes where possibly broken HTML content needs to be
+ * shown, but in most cases XHTML mode should be preferred.
+ */
+ RAW("raw") {
+ @Override
+ public void paintText(String text, PaintTarget target)
+ throws PaintException {
+ target.startTag("data");
+ target.addAttribute("escape", false);
+ target.addText(text);
+ target.endTag("data");
+ }
+ };
+
+ private final String uidlName;
+
+ /**
+ * The default content mode is text
+ */
+ public static ContentMode DEFAULT = TEXT;
+
+ private ContentMode(String uidlName) {
+ this.uidlName = uidlName;
+ }
+
+ /**
+ * Gets the name representing this content mode in UIDL messages
+ *
+ * @return the UIDL name of this content mode
+ */
+ public String getUidlName() {
+ return uidlName;
+ }
+
+ /**
+ * Adds the text value to a {@link PaintTarget} according to this
+ * content mode
+ *
+ * @param text
+ * the text to add
+ * @param target
+ * the paint target to add the value to
+ * @throws PaintException
+ * if the paint operation failed
+ */
+ public abstract void paintText(String text, PaintTarget target)
+ throws PaintException;
+ }
/**
- * Content mode, where the label contains preformatted text.
+ * @deprecated From 7.0, use {@link ContentMode#TEXT} instead
*/
- public static final int CONTENT_PREFORMATTED = 1;
+ @Deprecated
+ public static final ContentMode CONTENT_TEXT = ContentMode.TEXT;
/**
- * Formatted content mode, where the contents is XML restricted to the UIDL
- * 1.0 formatting markups.
- *
- * @deprecated Use CONTENT_XML instead.
+ * @deprecated From 7.0, use {@link ContentMode#PREFORMATTED} instead
*/
@Deprecated
- public static final int CONTENT_UIDL = 2;
+ public static final ContentMode CONTENT_PREFORMATTED = ContentMode.PREFORMATTED;
/**
- * Content mode, where the label contains XHTML. Contents is then enclosed
- * in DIV elements having namespace of
- * "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".
+ * @deprecated From 7.0, use {@link ContentMode#XHTML} instead
*/
- public static final int CONTENT_XHTML = 3;
+ @Deprecated
+ public static final ContentMode CONTENT_XHTML = ContentMode.XHTML;
/**
- * Content mode, where the label contains well-formed or well-balanced XML.
- * Each of the root elements must have their default namespace specified.
+ * @deprecated From 7.0, use {@link ContentMode#XML} instead
*/
- public static final int CONTENT_XML = 4;
+ @Deprecated
+ public static final ContentMode CONTENT_XML = ContentMode.XML;
/**
- * Content mode, where the label contains RAW output. Output is not required
- * to comply to with XML. In Web Adapter output is inserted inside the
- * resulting HTML document as-is. This is useful for some specific purposes
- * where possibly broken HTML content needs to be shown, but in most cases
- * XHTML mode should be preferred.
+ * @deprecated From 7.0, use {@link ContentMode#RAW} instead
*/
- public static final int CONTENT_RAW = 5;
+ @Deprecated
+ public static final ContentMode CONTENT_RAW = ContentMode.RAW;
/**
- * The default content mode is plain text.
+ * @deprecated From 7.0, use {@link ContentMode#DEFAULT} instead
*/
- public static final int CONTENT_DEFAULT = CONTENT_TEXT;
-
- /** Array of content mode names that are rendered in UIDL as mode attribute. */
- private static final String[] CONTENT_MODE_NAME = { "text", "pre", "uidl",
- "xhtml", "xml", "raw" };
+ @Deprecated
+ public static final ContentMode CONTENT_DEFAULT = ContentMode.DEFAULT;
private static final String DATASOURCE_MUST_BE_SET = "Datasource must be set";
private Property dataSource;
- private int contentMode = CONTENT_DEFAULT;
+ private ContentMode contentMode = ContentMode.DEFAULT;
/**
* Creates an empty Label.
@@ -115,7 +212,7 @@ public class Label extends AbstractComponent implements Property,
* @param content
*/
public Label(String content) {
- this(content, CONTENT_DEFAULT);
+ this(content, ContentMode.DEFAULT);
}
/**
@@ -125,7 +222,7 @@ public class Label extends AbstractComponent implements Property,
* @param contentSource
*/
public Label(Property contentSource) {
- this(contentSource, CONTENT_DEFAULT);
+ this(contentSource, ContentMode.DEFAULT);
}
/**
@@ -134,7 +231,7 @@ public class Label extends AbstractComponent implements Property,
* @param content
* @param contentMode
*/
- public Label(String content, int contentMode) {
+ public Label(String content, ContentMode contentMode) {
this(new ObjectProperty(content, String.class), contentMode);
}
@@ -145,9 +242,9 @@ public class Label extends AbstractComponent implements Property,
* @param contentSource
* @param contentMode
*/
- public Label(Property contentSource, int contentMode) {
+ public Label(Property contentSource, ContentMode contentMode) {
setPropertyDataSource(contentSource);
- if (contentMode != CONTENT_DEFAULT) {
+ if (contentMode != ContentMode.DEFAULT) {
setContentMode(contentMode);
}
setWidth(100, UNITS_PERCENTAGE);
@@ -163,30 +260,11 @@ public class Label extends AbstractComponent implements Property,
*/
@Override
public void paintContent(PaintTarget target) throws PaintException {
- if (contentMode != CONTENT_TEXT) {
- target.addAttribute("mode", CONTENT_MODE_NAME[contentMode]);
- }
- if (contentMode == CONTENT_TEXT) {
- target.addText(getStringValue());
- } else if (contentMode == CONTENT_UIDL) {
- target.addUIDL(getStringValue());
- } else if (contentMode == CONTENT_XHTML) {
- target.startTag("data");
- target.addXMLSection("div", getStringValue(),
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
- target.endTag("data");
- } else if (contentMode == CONTENT_PREFORMATTED) {
- target.startTag("pre");
- target.addText(getStringValue());
- target.endTag("pre");
- } else if (contentMode == CONTENT_XML) {
- target.addXMLSection("data", getStringValue(), null);
- } else if (contentMode == CONTENT_RAW) {
- target.startTag("data");
- target.addAttribute("escape", false);
- target.addText(getStringValue());
- target.endTag("data");
+ String uidlName = contentMode.getUidlName();
+ if (uidlName != null) {
+ target.addAttribute("mode", uidlName);
}
+ contentMode.paintText(getStringValue(), target);
}
@@ -300,67 +378,27 @@ public class Label extends AbstractComponent implements Property,
/**
* Gets the content mode of the Label.
*
- *
- * Possible content modes include:
- *
- * CONTENT_TEXT Content mode, where the label contains only plain
- * text. The getValue() result is coded to XML when painting.
- * CONTENT_PREFORMATTED Content mode, where the label contains
- * preformatted text.
- * CONTENT_UIDL Formatted content mode, where the contents is XML
- * restricted to the UIDL 1.0 formatting markups.
- * CONTENT_XHTML Content mode, where the label contains XHTML.
- * Contents is then enclosed in DIV elements having namespace of
- * "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".
- * CONTENT_XML Content mode, where the label contains well-formed
- * or well-balanced XML. Each of the root elements must have their default
- * namespace specified.
- * CONTENT_RAW Content mode, where the label contains RAW output.
- * Output is not required to comply to with XML. In Web Adapter output is
- * inserted inside the resulting HTML document as-is. This is useful for
- * some specific purposes where possibly broken HTML content needs to be
- * shown, but in most cases XHTML mode should be preferred.
- *
- *
- *
* @return the Content mode of the label.
+ *
+ * @see ContentMode
*/
- public int getContentMode() {
+ public ContentMode getContentMode() {
return contentMode;
}
/**
* Sets the content mode of the Label.
*
- *
- * Possible content modes include:
- *
- * CONTENT_TEXT Content mode, where the label contains only plain
- * text. The getValue() result is coded to XML when painting.
- * CONTENT_PREFORMATTED Content mode, where the label contains
- * preformatted text.
- * CONTENT_UIDL Formatted content mode, where the contents is XML
- * restricted to the UIDL 1.0 formatting markups.
- * CONTENT_XHTML Content mode, where the label contains XHTML.
- * Contents is then enclosed in DIV elements having namespace of
- * "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd".
- * CONTENT_XML Content mode, where the label contains well-formed
- * or well-balanced XML. Each of the root elements must have their default
- * namespace specified.
- * CONTENT_RAW Content mode, where the label contains RAW output.
- * Output is not required to comply to with XML. In Web Adapter output is
- * inserted inside the resulting HTML document as-is. This is useful for
- * some specific purposes where possibly broken HTML content needs to be
- * shown, but in most cases XHTML mode should be preferred.
- *
- *
- *
* @param contentMode
* the New content mode of the label.
+ *
+ * @see ContentMode
*/
- public void setContentMode(int contentMode) {
- if (contentMode != this.contentMode && contentMode >= CONTENT_TEXT
- && contentMode <= CONTENT_RAW) {
+ public void setContentMode(ContentMode contentMode) {
+ if (contentMode == null) {
+ throw new IllegalArgumentException("Content mode can not be null");
+ }
+ if (contentMode != this.contentMode) {
this.contentMode = contentMode;
requestRepaint();
}
@@ -480,17 +518,15 @@ public class Label extends AbstractComponent implements Property,
String thisValue;
String otherValue;
- if (contentMode == CONTENT_XML || contentMode == CONTENT_UIDL
- || contentMode == CONTENT_XHTML) {
+ if (contentMode == ContentMode.XML || contentMode == ContentMode.XHTML) {
thisValue = stripTags(getStringValue());
} else {
thisValue = getStringValue();
}
if (other instanceof Label
- && (((Label) other).getContentMode() == CONTENT_XML
- || ((Label) other).getContentMode() == CONTENT_UIDL || ((Label) other)
- .getContentMode() == CONTENT_XHTML)) {
+ && (((Label) other).getContentMode() == ContentMode.XML || ((Label) other)
+ .getContentMode() == ContentMode.XHTML)) {
otherValue = stripTags(((Label) other).getStringValue());
} else {
// TODO not a good idea - and might assume that Field.toString()
diff --git a/tests/testbench/com/vaadin/tests/Components.java b/tests/testbench/com/vaadin/tests/Components.java
index ce5122a378..414c97c951 100644
--- a/tests/testbench/com/vaadin/tests/Components.java
+++ b/tests/testbench/com/vaadin/tests/Components.java
@@ -24,6 +24,7 @@ import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Tree;
import com.vaadin.ui.Tree.ItemStyleGenerator;
@@ -96,7 +97,7 @@ public class Components extends Application.LegacyApplication {
naviLayout
.addComponent(new Label(
"Click to open a test case. Right click to open test in a new window ",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
naviLayout.addComponent(createMenu());
naviLayout.addComponent(createMissingTestsList());
@@ -107,7 +108,7 @@ public class Components extends Application.LegacyApplication {
embeddingLayout
.addComponent(new Label(
"Do not use the embedded version for creating automated tests. Open the test in a new window before recording. ",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
applicationEmbedder.setSizeFull();
embeddingLayout.addComponent(applicationEmbedder);
embeddingLayout.setExpandRatio(applicationEmbedder, 1);
@@ -130,7 +131,7 @@ public class Components extends Application.LegacyApplication {
+ component.getSimpleName() + " ";
}
return new Label("Components without a test: "
- + missingTests, Label.CONTENT_XHTML);
+ + missingTests, ContentMode.XHTML);
}
private Component createMenu() {
diff --git a/tests/testbench/com/vaadin/tests/CustomLayoutDemo.java b/tests/testbench/com/vaadin/tests/CustomLayoutDemo.java
index 381d404f39..62340b7c9e 100644
--- a/tests/testbench/com/vaadin/tests/CustomLayoutDemo.java
+++ b/tests/testbench/com/vaadin/tests/CustomLayoutDemo.java
@@ -11,6 +11,7 @@ import com.vaadin.ui.Component.Listener;
import com.vaadin.ui.CustomLayout;
import com.vaadin.ui.Field;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.PasswordField;
import com.vaadin.ui.Root.LegacyWindow;
@@ -96,7 +97,7 @@ public class CustomLayoutDemo extends com.vaadin.Application.LegacyApplication
// Add heading label and custom layout panel to main window
mainWindow.addComponent(new Label("Custom layout demo ",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
mainWindow.addComponent(customLayoutPanel);
}
@@ -112,7 +113,7 @@ public class CustomLayoutDemo extends com.vaadin.Application.LegacyApplication
username.setValue("Anonymous");
}
mainLayout.replaceComponent(loginButton, new Label("Welcome user "
- + username.getValue() + " ", Label.CONTENT_XHTML));
+ + username.getValue() + "", ContentMode.XHTML));
}
/**
diff --git a/tests/testbench/com/vaadin/tests/LayoutDemo.java b/tests/testbench/com/vaadin/tests/LayoutDemo.java
index f230b8ca37..d88285468e 100644
--- a/tests/testbench/com/vaadin/tests/LayoutDemo.java
+++ b/tests/testbench/com/vaadin/tests/LayoutDemo.java
@@ -10,6 +10,7 @@ import com.vaadin.ui.Embedded;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
@@ -85,25 +86,23 @@ public class LayoutDemo extends com.vaadin.Application.LegacyApplication {
//
mainWindow.addComponent(new Label(
"Horizontal ordered layout Added four components.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
mainWindow.addComponent(layoutA);
mainWindow.addComponent(new Label(
"Vertical ordered layout Added four components.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
mainWindow.addComponent(layoutB);
mainWindow.addComponent(new Label(
"Grid Layout (4 x 4) Added 16 components.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
mainWindow.addComponent(layoutG);
- mainWindow
- .addComponent(new Label("Grid Layout (4 x 4) "
- + "Added four panels and four embedded components "
- + "diagonally with absolute coordinates.",
- Label.CONTENT_XHTML));
+ mainWindow.addComponent(new Label("Grid Layout (4 x 4) "
+ + "Added four panels and four embedded components "
+ + "diagonally with absolute coordinates.", ContentMode.XHTML));
mainWindow.addComponent(layoutG2);
mainWindow.addComponent(new Label(
"TabSheet Added above layouts as tabs.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
mainWindow.addComponent(tabsheet);
}
@@ -124,7 +123,7 @@ public class LayoutDemo extends com.vaadin.Application.LegacyApplication {
+ "extremities and may have a caption to clarify the nature of the contained components' purpose."
+ " Panel contains an layout where the actual contained components are added, "
+ "this layout may be switched on the fly.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
panel.setWidth("222px");
return panel;
}
diff --git a/tests/testbench/com/vaadin/tests/NativeWindowing.java b/tests/testbench/com/vaadin/tests/NativeWindowing.java
index 72ae78e7d0..1a22b5a4d2 100644
--- a/tests/testbench/com/vaadin/tests/NativeWindowing.java
+++ b/tests/testbench/com/vaadin/tests/NativeWindowing.java
@@ -11,6 +11,7 @@ import com.vaadin.Application;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Window;
@@ -69,7 +70,7 @@ public class NativeWindowing extends Application.LegacyApplication {
+ "Lorem ipsum dolor sit amet.
"
+ "Lorem ipsum dolor sit amet.
"
+ "Lorem ipsum dolor sit amet.
",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
}
}));
diff --git a/tests/testbench/com/vaadin/tests/PerformanceTestBasicComponentRendering.java b/tests/testbench/com/vaadin/tests/PerformanceTestBasicComponentRendering.java
index 00f98657b8..a0bd894ebe 100644
--- a/tests/testbench/com/vaadin/tests/PerformanceTestBasicComponentRendering.java
+++ b/tests/testbench/com/vaadin/tests/PerformanceTestBasicComponentRendering.java
@@ -13,6 +13,7 @@ import com.vaadin.ui.ComboBox;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.DateField;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
@@ -102,7 +103,7 @@ public class PerformanceTestBasicComponentRendering extends CustomComponent {
}
private void addInfo() {
- main.addComponent(new Label(DESCRIPTION, Label.CONTENT_XHTML));
+ main.addComponent(new Label(DESCRIPTION, ContentMode.XHTML));
}
}
diff --git a/tests/testbench/com/vaadin/tests/PerformanceTestLabelsAndOrderedLayouts.java b/tests/testbench/com/vaadin/tests/PerformanceTestLabelsAndOrderedLayouts.java
index 9e4aac05d4..93df046fa0 100644
--- a/tests/testbench/com/vaadin/tests/PerformanceTestLabelsAndOrderedLayouts.java
+++ b/tests/testbench/com/vaadin/tests/PerformanceTestLabelsAndOrderedLayouts.java
@@ -12,6 +12,7 @@ import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.VerticalLayout;
public class PerformanceTestLabelsAndOrderedLayouts extends CustomComponent {
@@ -73,7 +74,7 @@ public class PerformanceTestLabelsAndOrderedLayouts extends CustomComponent {
}
private void addInfo() {
- main.addComponent(new Label(DESCRIPTION, Label.CONTENT_XHTML));
+ main.addComponent(new Label(DESCRIPTION, ContentMode.XHTML));
}
}
diff --git a/tests/testbench/com/vaadin/tests/PerformanceTestSubTreeCaching.java b/tests/testbench/com/vaadin/tests/PerformanceTestSubTreeCaching.java
index 994e419384..40433fae84 100644
--- a/tests/testbench/com/vaadin/tests/PerformanceTestSubTreeCaching.java
+++ b/tests/testbench/com/vaadin/tests/PerformanceTestSubTreeCaching.java
@@ -10,6 +10,7 @@ import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
@@ -86,7 +87,7 @@ public class PerformanceTestSubTreeCaching extends CustomComponent {
}
private void addInfo() {
- main.addComponent(new Label(DESCRIPTION, Label.CONTENT_XHTML));
+ main.addComponent(new Label(DESCRIPTION, ContentMode.XHTML));
}
}
diff --git a/tests/testbench/com/vaadin/tests/TestCaptionWrapper.java b/tests/testbench/com/vaadin/tests/TestCaptionWrapper.java
index b0ccca2480..89822a9574 100644
--- a/tests/testbench/com/vaadin/tests/TestCaptionWrapper.java
+++ b/tests/testbench/com/vaadin/tests/TestCaptionWrapper.java
@@ -17,6 +17,7 @@ import com.vaadin.ui.DateField;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Link;
import com.vaadin.ui.NativeSelect;
@@ -161,7 +162,7 @@ public class TestCaptionWrapper extends CustomComponent implements Listener {
// Custom components
layout.addComponent(new Label("Below are few custom components ",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
final TestForUpload tfu = new TestForUpload();
layout.addComponent(tfu);
diff --git a/tests/testbench/com/vaadin/tests/TestForNativeWindowing.java b/tests/testbench/com/vaadin/tests/TestForNativeWindowing.java
index 1e13c6095d..91ade9b403 100644
--- a/tests/testbench/com/vaadin/tests/TestForNativeWindowing.java
+++ b/tests/testbench/com/vaadin/tests/TestForNativeWindowing.java
@@ -11,6 +11,7 @@ import com.vaadin.Application;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Window;
@@ -69,7 +70,7 @@ public class TestForNativeWindowing extends Application.LegacyApplication {
+ "Lorem ipsum dolor sit amet.
"
+ "Lorem ipsum dolor sit amet.
"
+ "Lorem ipsum dolor sit amet.
",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
}
}));
diff --git a/tests/testbench/com/vaadin/tests/TestForRichTextEditor.java b/tests/testbench/com/vaadin/tests/TestForRichTextEditor.java
index 95d8fea156..302d28af35 100644
--- a/tests/testbench/com/vaadin/tests/TestForRichTextEditor.java
+++ b/tests/testbench/com/vaadin/tests/TestForRichTextEditor.java
@@ -11,6 +11,7 @@ import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.VerticalLayout;
@@ -45,7 +46,7 @@ public class TestForRichTextEditor extends CustomComponent implements
main.addComponent(new Button("commit content to label below"));
- l = new Label("", Label.CONTENT_XHTML);
+ l = new Label("", ContentMode.XHTML);
main.addComponent(l);
CheckBox b = new CheckBox("enabled");
diff --git a/tests/testbench/com/vaadin/tests/TestForStyledUpload.java b/tests/testbench/com/vaadin/tests/TestForStyledUpload.java
index 96115d505e..3b1100bb66 100644
--- a/tests/testbench/com/vaadin/tests/TestForStyledUpload.java
+++ b/tests/testbench/com/vaadin/tests/TestForStyledUpload.java
@@ -19,6 +19,7 @@ import com.vaadin.terminal.StreamResource;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Link;
import com.vaadin.ui.Panel;
@@ -163,11 +164,11 @@ public class TestForStyledUpload extends Application.LegacyApplication
"Upload finished, but output buffer is null!!"));
} else {
status.addComponent(new Label(
- "Name: " + event.getFilename(), Label.CONTENT_XHTML));
+ "Name: " + event.getFilename(), ContentMode.XHTML));
status.addComponent(new Label("Mimetype: "
- + event.getMIMEType(), Label.CONTENT_XHTML));
+ + event.getMIMEType(), ContentMode.XHTML));
status.addComponent(new Label("Size: " + event.getLength()
- + " bytes.", Label.CONTENT_XHTML));
+ + " bytes.", ContentMode.XHTML));
status.addComponent(new Link("Download " + buffer.getFileName(),
new StreamResource(buffer, buffer.getFileName(), this)));
diff --git a/tests/testbench/com/vaadin/tests/TestForUpload.java b/tests/testbench/com/vaadin/tests/TestForUpload.java
index 61b1a62b2e..fdda4dfd2a 100644
--- a/tests/testbench/com/vaadin/tests/TestForUpload.java
+++ b/tests/testbench/com/vaadin/tests/TestForUpload.java
@@ -24,6 +24,7 @@ import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Link;
import com.vaadin.ui.Panel;
@@ -136,12 +137,11 @@ public class TestForUpload extends CustomComponent implements
"Upload finished, but output buffer is null"));
} else {
status.addComponent(new Label("Name: "
- + event.getFilename(), Label.CONTENT_XHTML));
+ + event.getFilename(), ContentMode.XHTML));
status.addComponent(new Label("Mimetype: "
- + event.getMIMEType(), Label.CONTENT_XHTML));
+ + event.getMIMEType(), ContentMode.XHTML));
status.addComponent(new Label("Size: "
- + event.getLength() + " bytes.",
- Label.CONTENT_XHTML));
+ + event.getLength() + " bytes.", ContentMode.XHTML));
status.addComponent(new Link("Download "
+ buffer.getFileName(), new StreamResource(buffer,
diff --git a/tests/testbench/com/vaadin/tests/TestIFrames.java b/tests/testbench/com/vaadin/tests/TestIFrames.java
index 5bbe58ee62..a8a9d1c2ca 100644
--- a/tests/testbench/com/vaadin/tests/TestIFrames.java
+++ b/tests/testbench/com/vaadin/tests/TestIFrames.java
@@ -6,6 +6,7 @@ package com.vaadin.tests;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.VerticalLayout;
public class TestIFrames extends CustomComponent {
@@ -31,7 +32,7 @@ public class TestIFrames extends CustomComponent {
final int height = 250;
final String iFrame = "";
- return new Label(iFrame, Label.CONTENT_XHTML);
+ return new Label(iFrame, ContentMode.XHTML);
}
}
diff --git a/tests/testbench/com/vaadin/tests/TreeFilesystem.java b/tests/testbench/com/vaadin/tests/TreeFilesystem.java
index 787a955a7e..28fb289af4 100644
--- a/tests/testbench/com/vaadin/tests/TreeFilesystem.java
+++ b/tests/testbench/com/vaadin/tests/TreeFilesystem.java
@@ -9,6 +9,7 @@ import java.io.File;
import com.vaadin.data.Item;
import com.vaadin.tests.util.SampleDirectory;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Tree;
@@ -37,7 +38,7 @@ public class TreeFilesystem extends com.vaadin.Application.LegacyApplication
setMainWindow(main);
// Main window contains heading and panel
- main.addComponent(new Label("Tree demo ", Label.CONTENT_XHTML));
+ main.addComponent(new Label("Tree demo ", ContentMode.XHTML));
// configure file structure panel
main.addComponent(explorerPanel);
diff --git a/tests/testbench/com/vaadin/tests/UsingObjectsInSelect.java b/tests/testbench/com/vaadin/tests/UsingObjectsInSelect.java
index b48f85f52d..780b7d94e1 100644
--- a/tests/testbench/com/vaadin/tests/UsingObjectsInSelect.java
+++ b/tests/testbench/com/vaadin/tests/UsingObjectsInSelect.java
@@ -10,6 +10,7 @@ import java.util.Random;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Select;
@@ -19,7 +20,7 @@ public class UsingObjectsInSelect extends
private final Select select = new Select();
private final Label selectedTask = new Label("Selected task",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
public LinkedList> exampleTasks = new LinkedList();
diff --git a/tests/testbench/com/vaadin/tests/application/ApplicationCloseTest.java b/tests/testbench/com/vaadin/tests/application/ApplicationCloseTest.java
index b10752d26c..159ba1c3e6 100644
--- a/tests/testbench/com/vaadin/tests/application/ApplicationCloseTest.java
+++ b/tests/testbench/com/vaadin/tests/application/ApplicationCloseTest.java
@@ -6,6 +6,7 @@ import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
public class ApplicationCloseTest extends TestBase {
@@ -14,7 +15,7 @@ public class ApplicationCloseTest extends TestBase {
@Override
protected void setup() {
Label applications = new Label("Applications in session: ",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
for (Application a : ((WebApplicationContext) getContext())
.getApplications()) {
applications.setValue(applications.getValue() + "App: " + a
@@ -50,7 +51,7 @@ public class ApplicationCloseTest extends TestBase {
/ 1000
/ 1000
+ "MiB memory for this application. Total memory usage reported as "
- + totalUsageString + " ", Label.CONTENT_XHTML);
+ + totalUsageString + " ", ContentMode.XHTML);
addComponent(thisApp);
addComponent(memoryUsage);
diff --git a/tests/testbench/com/vaadin/tests/components/AbstractTestRoot.java b/tests/testbench/com/vaadin/tests/components/AbstractTestRoot.java
index 3664a608ed..5866168474 100644
--- a/tests/testbench/com/vaadin/tests/components/AbstractTestRoot.java
+++ b/tests/testbench/com/vaadin/tests/components/AbstractTestRoot.java
@@ -7,6 +7,7 @@ import com.vaadin.terminal.gwt.server.AbstractWebApplicationContext;
import com.vaadin.terminal.gwt.server.WebBrowser;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root;
import com.vaadin.ui.VerticalLayout;
@@ -16,7 +17,7 @@ public abstract class AbstractTestRoot extends Root {
public void init(WrappedRequest request) {
setCaption(getClass().getName());
- Label label = new Label(getTestDescription(), Label.CONTENT_XHTML);
+ Label label = new Label(getTestDescription(), ContentMode.XHTML);
label.setWidth("100%");
layout = new VerticalLayout();
diff --git a/tests/testbench/com/vaadin/tests/components/TestBase.java b/tests/testbench/com/vaadin/tests/components/TestBase.java
index 7ddbf45263..da85fc579b 100644
--- a/tests/testbench/com/vaadin/tests/components/TestBase.java
+++ b/tests/testbench/com/vaadin/tests/components/TestBase.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.components;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.VerticalLayout;
@@ -13,7 +14,7 @@ public abstract class TestBase extends AbstractTestCase {
setMainWindow(window);
window.getContent().setSizeFull();
- Label label = new Label(getDescription(), Label.CONTENT_XHTML);
+ Label label = new Label(getDescription(), ContentMode.XHTML);
label.setWidth("100%");
window.getContent().addComponent(label);
diff --git a/tests/testbench/com/vaadin/tests/components/button/ButtonMouseDetails.java b/tests/testbench/com/vaadin/tests/components/button/ButtonMouseDetails.java
index 4dc3fcd0fb..deab87f8a2 100644
--- a/tests/testbench/com/vaadin/tests/components/button/ButtonMouseDetails.java
+++ b/tests/testbench/com/vaadin/tests/components/button/ButtonMouseDetails.java
@@ -4,10 +4,11 @@ import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
public class ButtonMouseDetails extends TestBase {
- private Label out = new Label("", Label.CONTENT_PREFORMATTED);
+ private Label out = new Label("", ContentMode.PREFORMATTED);
private int clickCounter = 1;
diff --git a/tests/testbench/com/vaadin/tests/components/caption/IconsInCaption.java b/tests/testbench/com/vaadin/tests/components/caption/IconsInCaption.java
index 926088ff48..428ebdb66b 100644
--- a/tests/testbench/com/vaadin/tests/components/caption/IconsInCaption.java
+++ b/tests/testbench/com/vaadin/tests/components/caption/IconsInCaption.java
@@ -10,6 +10,7 @@ import com.vaadin.ui.ComboBox;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.VerticalLayout;
public class IconsInCaption extends TestBase {
@@ -103,7 +104,7 @@ public class IconsInCaption extends TestBase {
ComponentContainer container = containerClass.newInstance();
for (String size : sizes) {
Label title = new Label("" + size + "x" + size + " ",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
container.addComponent(title);
for (String icon : icons) {
ThemeResource res = new ThemeResource("../runo/icons/" + size
diff --git a/tests/testbench/com/vaadin/tests/components/combobox/ComboFocusBlurEvents.java b/tests/testbench/com/vaadin/tests/components/combobox/ComboFocusBlurEvents.java
index 6681342ea6..027cf5fd24 100644
--- a/tests/testbench/com/vaadin/tests/components/combobox/ComboFocusBlurEvents.java
+++ b/tests/testbench/com/vaadin/tests/components/combobox/ComboFocusBlurEvents.java
@@ -10,6 +10,7 @@ import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.TextField;
public class ComboFocusBlurEvents extends TestBase {
@@ -18,18 +19,18 @@ public class ComboFocusBlurEvents extends TestBase {
@Override
protected void setup() {
-
+
List list = new ArrayList();
for (int i = 0; i < 100; i++) {
list.add("Item " + i);
}
-
+
ComboBox cb = new ComboBox("Combobox", list);
cb.setImmediate(true);
cb.setInputPrompt("Enter text");
cb.setDescription("Some Combobox");
addComponent(cb);
-
+
final ObjectProperty log = new ObjectProperty("");
cb.addListener(new FieldEvents.FocusListener() {
@@ -47,7 +48,7 @@ public class ComboFocusBlurEvents extends TestBase {
counter++;
}
});
-
+
TextField field = new TextField("Some textfield");
field.setImmediate(true);
addComponent(field);
@@ -55,7 +56,7 @@ public class ComboFocusBlurEvents extends TestBase {
Label output = new Label(log);
output.setCaption("Events:");
- output.setContentMode(Label.CONTENT_XHTML);
+ output.setContentMode(ContentMode.XHTML);
addComponent(output);
}
diff --git a/tests/testbench/com/vaadin/tests/components/customcomponent/ClipContent.java b/tests/testbench/com/vaadin/tests/components/customcomponent/ClipContent.java
index cc7320ad03..27a3b7a4f7 100644
--- a/tests/testbench/com/vaadin/tests/components/customcomponent/ClipContent.java
+++ b/tests/testbench/com/vaadin/tests/components/customcomponent/ClipContent.java
@@ -5,6 +5,7 @@ import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.TextField;
public class ClipContent extends TestBase {
@@ -14,7 +15,7 @@ public class ClipContent extends TestBase {
Label text = new Label(
"1_long_line_that_should_be_clipped 2_long_line_that_should_be_clipped 3_long_line_that_should_be_clipped 4_long_line_that_should_be_clipped ",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
final CustomComponent cc = new CustomComponent(text);
cc.setWidth("20px");
@@ -24,7 +25,7 @@ public class ClipContent extends TestBase {
w.setValue("20px");
w.addListener(new TextField.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- cc.setWidth((String) w.getValue());
+ cc.setWidth(w.getValue());
}
});
addComponent(w);
@@ -32,7 +33,7 @@ public class ClipContent extends TestBase {
h.setValue("20px");
h.addListener(new TextField.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- cc.setHeight((String) h.getValue());
+ cc.setHeight(h.getValue());
}
});
addComponent(h);
diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java b/tests/testbench/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java
index 53b1d253ab..daecb41ae9 100644
--- a/tests/testbench/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java
+++ b/tests/testbench/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java
@@ -14,6 +14,7 @@ import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.DateField;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.PopupDateField;
@SuppressWarnings("serial")
@@ -36,7 +37,7 @@ public class DateFieldEmptyValid extends TestBase {
@Override
protected void setup() {
- addComponent(new Label(" ", Label.CONTENT_XHTML));
+ addComponent(new Label(" ", ContentMode.XHTML));
log = new Log(8);
addComponent(log);
df = new MyDateField();
diff --git a/tests/testbench/com/vaadin/tests/components/datefield/ValueThroughProperty.java b/tests/testbench/com/vaadin/tests/components/datefield/ValueThroughProperty.java
index aa9791684d..12c9608d28 100644
--- a/tests/testbench/com/vaadin/tests/components/datefield/ValueThroughProperty.java
+++ b/tests/testbench/com/vaadin/tests/components/datefield/ValueThroughProperty.java
@@ -12,6 +12,7 @@ import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.DateField;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.PopupDateField;
public class ValueThroughProperty extends TestBase {
@@ -25,7 +26,7 @@ public class ValueThroughProperty extends TestBase {
+ "Then try to set DateField's value using the first button. It sets the value "
+ "correctly (as we can see from the Label) but the client-side is not updated. "
+ "Using second button updates value correctly on the client-side too.",
- Label.CONTENT_XML));
+ ContentMode.XML));
final PopupDateField df = new PopupDateField(dateProperty);
df.setLocale(new Locale("en", "US"));
diff --git a/tests/testbench/com/vaadin/tests/components/label/LabelModes.java b/tests/testbench/com/vaadin/tests/components/label/LabelModes.java
index 4b58794a87..00553ddf96 100644
--- a/tests/testbench/com/vaadin/tests/components/label/LabelModes.java
+++ b/tests/testbench/com/vaadin/tests/components/label/LabelModes.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.components.label;
import com.vaadin.tests.components.ComponentTestCase;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
public class LabelModes extends ComponentTestCase {
@@ -23,17 +24,17 @@ public class LabelModes extends ComponentTestCase {
addTestComponent(l);
l = createLabel("This label contains\nnewlines and spaces\nand is in\npreformatted mode");
- l.setContentMode(Label.CONTENT_PREFORMATTED);
+ l.setContentMode(ContentMode.PREFORMATTED);
l.setWidth(null);
addTestComponent(l);
l = createLabel("This label contains\nnewlines and spaces\nand is in\nhtml mode");
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
l.setWidth(null);
addTestComponent(l);
l = createLabel("This label contains\nnewlines and spaces\nand is in\nraw mode");
- l.setContentMode(Label.CONTENT_RAW);
+ l.setContentMode(ContentMode.RAW);
l.setWidth(null);
addTestComponent(l);
diff --git a/tests/testbench/com/vaadin/tests/components/label/LabelTest.java b/tests/testbench/com/vaadin/tests/components/label/LabelTest.java
index 38ced67f18..daaf4c0b98 100644
--- a/tests/testbench/com/vaadin/tests/components/label/LabelTest.java
+++ b/tests/testbench/com/vaadin/tests/components/label/LabelTest.java
@@ -7,6 +7,7 @@ import java.util.List;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.tests.components.AbstractComponentTest;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
public class LabelTest extends AbstractComponentTest implements
ValueChangeListener {
@@ -29,8 +30,8 @@ public class LabelTest extends AbstractComponentTest implements
}
};
- private Command contentModeCommand = new Command() {
- public void execute(Label c, Integer value, Object data) {
+ private Command contentModeCommand = new Command() {
+ public void execute(Label c, ContentMode value, Object data) {
c.setContentMode(value);
}
};
@@ -68,13 +69,14 @@ public class LabelTest extends AbstractComponentTest implements
@SuppressWarnings("deprecation")
private void createContentModeSelect(String category) {
- LinkedHashMap options = new LinkedHashMap();
- options.put("Text", Label.CONTENT_TEXT);
- options.put("Preformatted", Label.CONTENT_PREFORMATTED);
- options.put("Raw", Label.CONTENT_RAW);
- options.put("UIDL", Label.CONTENT_UIDL);
- options.put("XHTML", Label.CONTENT_XHTML);
- options.put("XML", Label.CONTENT_XML);
+ LinkedHashMap options = new LinkedHashMap();
+ options.put("Text", ContentMode.TEXT);
+ options.put("Preformatted", ContentMode.PREFORMATTED);
+ options.put("Raw", ContentMode.RAW);
+ options.put("UIDL", ContentMode.XML); // Deprecated UIDL mode still used
+ // to avoid breaking old tests
+ options.put("XHTML", ContentMode.XHTML);
+ options.put("XML", ContentMode.XML);
createSelectAction("Content mode", category, options, "Text",
contentModeCommand);
diff --git a/tests/testbench/com/vaadin/tests/components/label/Labels.java b/tests/testbench/com/vaadin/tests/components/label/Labels.java
index ad648e7404..bbd64375ef 100644
--- a/tests/testbench/com/vaadin/tests/components/label/Labels.java
+++ b/tests/testbench/com/vaadin/tests/components/label/Labels.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.label;
import com.vaadin.tests.components.ComponentTestCase;
import com.vaadin.tests.util.LoremIpsum;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
public class Labels extends ComponentTestCase {
@@ -37,13 +38,13 @@ public class Labels extends ComponentTestCase {
l = createLabel(
"Hello\n\n\n
I am a rich Label ",
"This is an XHTML label with rich content");
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
addTestComponent(l);
l = createLabel(
"",
"This is an XHTML label with fixed 200px width and rich content");
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
l.setWidth("200px");
addTestComponent(l);
diff --git a/tests/testbench/com/vaadin/tests/components/optiongroup/OptionGroupMultipleValueChange.java b/tests/testbench/com/vaadin/tests/components/optiongroup/OptionGroupMultipleValueChange.java
index 29a81720c7..9a4bb15272 100644
--- a/tests/testbench/com/vaadin/tests/components/optiongroup/OptionGroupMultipleValueChange.java
+++ b/tests/testbench/com/vaadin/tests/components/optiongroup/OptionGroupMultipleValueChange.java
@@ -4,6 +4,7 @@ import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.OptionGroup;
public class OptionGroupMultipleValueChange extends TestBase {
@@ -26,7 +27,7 @@ public class OptionGroupMultipleValueChange extends TestBase {
og.setImmediate(true);
addComponent(og);
- final Label events = new Label("", Label.CONTENT_PREFORMATTED);
+ final Label events = new Label("", ContentMode.PREFORMATTED);
events.setWidth(null);
addComponent(events);
diff --git a/tests/testbench/com/vaadin/tests/components/panel/PanelShouldNotScroll.java b/tests/testbench/com/vaadin/tests/components/panel/PanelShouldNotScroll.java
index 7c537fe710..b7047392e8 100644
--- a/tests/testbench/com/vaadin/tests/components/panel/PanelShouldNotScroll.java
+++ b/tests/testbench/com/vaadin/tests/components/panel/PanelShouldNotScroll.java
@@ -7,6 +7,7 @@ import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
@@ -39,7 +40,7 @@ public class PanelShouldNotScroll extends TestBase {
panel.addComponent(new Label(
"fooooooooo foo foo foo foo foo foo foo foo foo foo foo foo "
+ "foo foo foo foo foo foo foo foo foo foo foo foo foo ",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
return panel;
}
diff --git a/tests/testbench/com/vaadin/tests/components/popupview/PopupViewOffScreen.java b/tests/testbench/com/vaadin/tests/components/popupview/PopupViewOffScreen.java
index 7067281fa2..5cb0f073d6 100644
--- a/tests/testbench/com/vaadin/tests/components/popupview/PopupViewOffScreen.java
+++ b/tests/testbench/com/vaadin/tests/components/popupview/PopupViewOffScreen.java
@@ -11,6 +11,7 @@ import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.PopupView;
import com.vaadin.ui.VerticalLayout;
@@ -69,7 +70,7 @@ public class PopupViewOffScreen extends TestBase {
Label l = new Label(
"" + LoremIpsum.get(2000) + "
",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
l.setSizeFull();
p.addComponent(l);
PopupView pv = new PopupView("Click here to popup", p);
diff --git a/tests/testbench/com/vaadin/tests/components/table/EditableTableLeak.java b/tests/testbench/com/vaadin/tests/components/table/EditableTableLeak.java
index 26a8ab4020..08938c079a 100644
--- a/tests/testbench/com/vaadin/tests/components/table/EditableTableLeak.java
+++ b/tests/testbench/com/vaadin/tests/components/table/EditableTableLeak.java
@@ -19,13 +19,14 @@ import com.vaadin.ui.Component;
import com.vaadin.ui.DefaultFieldFactory;
import com.vaadin.ui.Field;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Table;
public class EditableTableLeak extends TestBase {
private final Table table = new Table("ISO-3166 Country Codes and flags");
private final CheckBox useFieldFactory = new CheckBox(
"Use a caching TableFieldFactory");
- private final Label sizeLabel = new Label("", Label.CONTENT_XHTML);
+ private final Label sizeLabel = new Label("", ContentMode.XHTML);
private long size = 0;
diff --git a/tests/testbench/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java b/tests/testbench/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java
index a54c3ce447..1cfb1ee5e5 100644
--- a/tests/testbench/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java
+++ b/tests/testbench/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java
@@ -8,6 +8,7 @@ import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Component;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Table;
public class LabelEmbeddedClickThroughForTable extends TestBase {
@@ -36,7 +37,7 @@ public class LabelEmbeddedClickThroughForTable extends TestBase {
item.getItemProperty("Column 1").setValue("String A");
item.getItemProperty("Column 2").setValue(new Label("Label A"));
item.getItemProperty("Column 3").setValue(
- new Label("Label A ", Label.CONTENT_XHTML));
+ new Label("Label A ", ContentMode.XHTML));
item.getItemProperty("Column 4").setValue(
new Embedded("An embedded image", new ThemeResource(
"../runo/icons/32/ok.png")));
@@ -48,7 +49,7 @@ public class LabelEmbeddedClickThroughForTable extends TestBase {
.setValue(
new Label(
"Label A ",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
item.getItemProperty("Column 4").setValue(
new Embedded("", new ThemeResource(
"../runo/icons/32/cancel.png")));
diff --git a/tests/testbench/com/vaadin/tests/components/table/Tables.java b/tests/testbench/com/vaadin/tests/components/table/Tables.java
index 7da5a590a1..afdf72bb83 100644
--- a/tests/testbench/com/vaadin/tests/components/table/Tables.java
+++ b/tests/testbench/com/vaadin/tests/components/table/Tables.java
@@ -13,6 +13,7 @@ import com.vaadin.tests.components.select.AbstractSelectTestCase;
import com.vaadin.ui.AbstractSelect.MultiSelectMode;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.CellStyleGenerator;
import com.vaadin.ui.Table.ColumnGenerator;
@@ -240,7 +241,7 @@ public class Tables extends AbstractSelectTestCase
l.setWidth(col.width);
if (col.html) {
l.setValue(value);
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
} else {
l.setValue(value);
}
diff --git a/tests/testbench/com/vaadin/tests/components/window/LazyWindowResize.java b/tests/testbench/com/vaadin/tests/components/window/LazyWindowResize.java
index d85ed1df60..2e6a386667 100644
--- a/tests/testbench/com/vaadin/tests/components/window/LazyWindowResize.java
+++ b/tests/testbench/com/vaadin/tests/components/window/LazyWindowResize.java
@@ -7,6 +7,7 @@ import com.vaadin.tests.util.Log;
import com.vaadin.tests.util.LoremIpsum;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.BrowserWindowResizeEvent;
import com.vaadin.ui.Root.BrowserWindowResizeListener;
import com.vaadin.ui.Root.LegacyWindow;
@@ -97,7 +98,7 @@ public class LazyWindowResize extends AbstractTestCase {
mainWindow.addComponent(resizeListenerCheckBox);
mainWindow.addComponent(immediateCheckBox);
mainWindow.addComponent(log);
- mainWindow.addComponent(new Label(" ", Label.CONTENT_XHTML));
+ mainWindow.addComponent(new Label(" ", ContentMode.XHTML));
mainWindow.addComponent(new Label(LoremIpsum.get(10000)));
setLazy(false);
diff --git a/tests/testbench/com/vaadin/tests/integration/JSR286PortletApplication.java b/tests/testbench/com/vaadin/tests/integration/JSR286PortletApplication.java
index 4661faf8ea..ecc7ea9647 100644
--- a/tests/testbench/com/vaadin/tests/integration/JSR286PortletApplication.java
+++ b/tests/testbench/com/vaadin/tests/integration/JSR286PortletApplication.java
@@ -22,6 +22,7 @@ import com.vaadin.terminal.gwt.server.PortletApplicationContext2;
import com.vaadin.terminal.gwt.server.PortletApplicationContext2.PortletListener;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Link;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Root;
@@ -54,7 +55,7 @@ public class JSR286PortletApplication extends Application.LegacyApplication {
main.addComponent(specialNameResourceTest);
userInfo.setCaption("User info");
- userInfo.setContentMode(Label.CONTENT_PREFORMATTED);
+ userInfo.setContentMode(ContentMode.PREFORMATTED);
main.addComponent(userInfo);
tf.setEnabled(false);
diff --git a/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java b/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java
index 671fa2bd40..91e9a4620c 100644
--- a/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java
+++ b/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java
@@ -26,6 +26,7 @@ import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.InlineDateField;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.ListSelect;
import com.vaadin.ui.MenuBar;
@@ -131,7 +132,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
l.setMargin(true);
l.setCaption("Labels");
- l.addComponent(new Label("Normal Label", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Normal Label", ContentMode.XHTML));
l.addComponent(new Label(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit."));
return l;
@@ -212,12 +213,12 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
l.setWidth("400px");
l.setColumnExpandRatio(0, 1);
- l.addComponent(new Label("Normal TextField", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Normal TextField", ContentMode.XHTML));
TextField tf = new TextField();
tf.setInputPrompt("Enter text");
l.addComponent(tf);
- l.addComponent(new Label("Normal TextArea", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Normal TextArea", ContentMode.XHTML));
TextArea ta = new TextArea();
ta.setHeight("5em");
@@ -338,7 +339,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
l.setColumnExpandRatio(0, 2);
l.setColumnExpandRatio(1, 5);
- l.addComponent(new Label("Normal Panel", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Normal Panel", ContentMode.XHTML));
Panel p = new Panel("Normal Panel");
p.setHeight("100px");
@@ -347,7 +348,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
l.addComponent(new Label(
"Light Style (LiferayTheme.PANEL_LIGHT
)",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
Panel p2 = new Panel("Light Style Panel");
p2.setStyleName(LiferayTheme.PANEL_LIGHT);
@@ -410,7 +411,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
w2.setPositionX(350);
w2.setPositionY(160);
w2.addComponent(new Label("Window.setResizable(false)
",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
tabs.addListener(new TabSheet.SelectedTabChangeListener() {
public void selectedTabChange(SelectedTabChangeEvent event) {
@@ -441,7 +442,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
l.addComponent(lockCheckBox, 1, 0);
l.newLine();
- Label label = new Label("Normal SplitPanel", Label.CONTENT_XHTML);
+ Label label = new Label("Normal SplitPanel", ContentMode.XHTML);
label.setWidth(null);
l.addComponent(label);
final HorizontalSplitPanel sp = new HorizontalSplitPanel();
@@ -454,7 +455,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
label = new Label(
"Small Style (LiferayTheme.SPLITPANEL_SMALL
)",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
label.setWidth(null);
l.addComponent(label);
@@ -514,7 +515,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
l.setWidth("400px");
l.setColumnExpandRatio(0, 1);
- l.addComponent(new Label("Horizontal Slider", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Horizontal Slider", ContentMode.XHTML));
Slider s = new Slider();
s.setWidth("200px");
try {
@@ -525,7 +526,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
}
l.addComponent(s);
- l.addComponent(new Label("Vertical Slider", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Vertical Slider", ContentMode.XHTML));
s = new Slider();
s.setOrientation(Slider.ORIENTATION_VERTICAL);
s.setHeight("200px");
@@ -587,10 +588,10 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
message.setValue("Jumped over the lazy dog.");
message.setWidth("15em");
- l.addComponent(new Label("Type ", Label.CONTENT_XHTML));
- l.addComponent(new Label("Preview ", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Type ", ContentMode.XHTML));
+ l.addComponent(new Label("Preview ", ContentMode.XHTML));
- l.addComponent(new Label("Humanized", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Humanized", ContentMode.XHTML));
Button show = new Button("Humanized Notification",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
@@ -603,7 +604,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
});
l.addComponent(show);
- l.addComponent(new Label("Warning", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Warning", ContentMode.XHTML));
show = new Button("Warning Notification", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
event.getButton()
@@ -615,7 +616,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
});
l.addComponent(show);
- l.addComponent(new Label("Error", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Error", ContentMode.XHTML));
show = new Button("Error Notification", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
event.getButton()
@@ -627,7 +628,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
});
l.addComponent(show);
- l.addComponent(new Label("Tray", Label.CONTENT_XHTML));
+ l.addComponent(new Label("Tray", ContentMode.XHTML));
show = new Button("Tray Notification", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
event.getButton()
diff --git a/tests/testbench/com/vaadin/tests/layouts/HiddenHorizontalLayout.java b/tests/testbench/com/vaadin/tests/layouts/HiddenHorizontalLayout.java
index 50cf41f095..0415a48041 100644
--- a/tests/testbench/com/vaadin/tests/layouts/HiddenHorizontalLayout.java
+++ b/tests/testbench/com/vaadin/tests/layouts/HiddenHorizontalLayout.java
@@ -5,6 +5,7 @@ import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.VerticalLayout;
public class HiddenHorizontalLayout extends TestBase {
@@ -41,7 +42,7 @@ public class HiddenHorizontalLayout extends TestBase {
+ "3. Click \"toggle layout visibility\" "
+ "4. Resize browser window to full "
+ "5. Click \"toggle layout visibility\" ",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
vl.addComponent(l);
Button b = new Button("toggle layout visibility",
new Button.ClickListener() {
diff --git a/tests/testbench/com/vaadin/tests/layouts/TestLayoutPerformance.java b/tests/testbench/com/vaadin/tests/layouts/TestLayoutPerformance.java
index 992c037611..c4581d52b4 100644
--- a/tests/testbench/com/vaadin/tests/layouts/TestLayoutPerformance.java
+++ b/tests/testbench/com/vaadin/tests/layouts/TestLayoutPerformance.java
@@ -9,6 +9,7 @@ import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.NativeSelect;
import com.vaadin.ui.TextField;
@@ -33,12 +34,12 @@ public class TestLayoutPerformance extends TestBase {
@Override
protected void setup() {
Label label = new Label("CssLayout performance test. ",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
getLayout().addComponent(label);
label = new Label(
"Hint . Use debug dialog to measure rendering times TODO: extend with size settings (to both layout and content).",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
getLayout().addComponent(label);
ns = new NativeSelect("Select component to test");
@@ -65,11 +66,11 @@ public class TestLayoutPerformance extends TestBase {
b.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
- int components = Integer.parseInt((String) n.getValue());
+ int components = Integer.parseInt(n.getValue());
Layout layout = getCurrentLayout();
for (int i = 0; i < components; i++) {
Component component = newTestComponent();
- if ((Boolean) cb.getValue()) {
+ if (cb.getValue()) {
component.setCaption("caption " + i);
}
layout.addComponent(component);
diff --git a/tests/testbench/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java b/tests/testbench/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java
index 3f7d9b9f6b..b28eb2ebd1 100644
--- a/tests/testbench/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java
+++ b/tests/testbench/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java
@@ -14,6 +14,7 @@ import com.vaadin.ui.CheckBox;
import com.vaadin.ui.DateField;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Link;
import com.vaadin.ui.Select;
@@ -114,7 +115,7 @@ public class HorizontalLayoutTests extends AbstractLayoutTests {
final AbstractComponent c1 = new Button("BUTTON");
final AbstractComponent c2 = new Label("LABEL ",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
final AbstractComponent c3 = new Table("TABLE");
c3.setHeight("100px");
c3.setWidth("100%");
diff --git a/tests/testbench/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java b/tests/testbench/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java
index ba29e1c476..c9110d1a1a 100644
--- a/tests/testbench/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java
+++ b/tests/testbench/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java
@@ -14,6 +14,7 @@ import com.vaadin.ui.CheckBox;
import com.vaadin.ui.DateField;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Link;
import com.vaadin.ui.NativeSelect;
@@ -46,7 +47,7 @@ public class VerticalLayoutTests extends AbstractLayoutTests {
((TextField) components[i]).setValue("FIELD " + i);
vlo.addComponent(components[i]);
vlo.setComponentAlignment(components[i], alignments[i]);
- vlo.addComponent(new Label(" ", Label.CONTENT_XHTML));
+ vlo.addComponent(new Label(" ", ContentMode.XHTML));
}
baseLayout.addComponent(vlo);
vlo = getTestLaytout();
@@ -55,7 +56,7 @@ public class VerticalLayoutTests extends AbstractLayoutTests {
((TextField) components[i]).setValue("FIELD " + i);
vlo.addComponent(components[i]);
vlo.setComponentAlignment(components[i], alignments[i]);
- vlo.addComponent(new Label(" ", Label.CONTENT_XHTML));
+ vlo.addComponent(new Label(" ", ContentMode.XHTML));
}
baseLayout.addComponent(vlo);
return baseLayout;
@@ -115,7 +116,7 @@ public class VerticalLayoutTests extends AbstractLayoutTests {
final AbstractComponent c1 = new Button("BUTTON");
final AbstractComponent c2 = new Label("LABEL ",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
final AbstractComponent c3 = new Table("TABLE");
c3.setHeight("100px");
c3.setWidth("100%");
@@ -268,7 +269,7 @@ public class VerticalLayoutTests extends AbstractLayoutTests {
button4.setEnabled(false);
vlo2.addComponent(c1);
- vlo2.addComponent(new Label(" ", Label.CONTENT_XHTML));
+ vlo2.addComponent(new Label(" ", ContentMode.XHTML));
vlo2.addComponent(c2);
vlo2.setExpandRatio(c1, 0.5f);
vlo2.setExpandRatio(c2, 0.5f);
@@ -453,7 +454,7 @@ public class VerticalLayoutTests extends AbstractLayoutTests {
final VerticalLayout vlo2 = getTestLaytout();
vlo2.addComponent(c1);
- vlo2.addComponent(new Label(" ", Label.CONTENT_XHTML));
+ vlo2.addComponent(new Label(" ", ContentMode.XHTML));
vlo2.addComponent(c2);
vlo2.setExpandRatio(c1, 0.5f);
vlo2.setExpandRatio(c2, 0.5f);
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1225.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1225.java
index 08baf3cd86..92a5e526d1 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket1225.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1225.java
@@ -4,6 +4,7 @@ import com.vaadin.Application;
import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Table;
@@ -45,7 +46,7 @@ public class Ticket1225 extends Application.LegacyApplication {
Label red = new Label(
"??
",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
// red.setCaption("cap");
// red.setSizeFull();
@@ -58,7 +59,7 @@ public class Ticket1225 extends Application.LegacyApplication {
ts.getTab(red).setCaption("REd tab");
Label l = new Label("sdf
",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
el.addComponent(l);
el.setComponentAlignment(l, Alignment.MIDDLE_RIGHT);
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket124.java b/tests/testbench/com/vaadin/tests/tickets/Ticket124.java
index 58e7041584..251a84f68c 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket124.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket124.java
@@ -6,6 +6,7 @@ import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TextField;
@@ -46,7 +47,7 @@ public class Ticket124 extends Application.LegacyApplication {
gl.addComponent(new Label("0,0-1,0"), 0, 0, 1, 0);
gl.addComponent(new Label("2,0-3,0"), 2, 0, 3, 0);
Label l = new Label("Large cell 0,1-2,2 yadayada lorem ipsum");
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
gl.addComponent(l, 0, 1, 2, 2);
gl.addComponent(new Label("3-1"), 3, 1);
gl.addComponent(new Label("3,2-3,3"), 3, 2, 3, 3);
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1444.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1444.java
index a77da6e059..5076e79996 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket1444.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1444.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.tickets;
import com.vaadin.Application;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.VerticalLayout;
@@ -20,7 +21,7 @@ public class Ticket1444 extends Application.LegacyApplication {
Label red = new Label(
"??
",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
red.setSizeFull();
ol.addComponent(red);
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1804.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1804.java
index af85779d1e..2e136c1c91 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket1804.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1804.java
@@ -10,6 +10,7 @@ import com.vaadin.ui.AbstractField;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Select;
import com.vaadin.ui.Window;
@@ -108,7 +109,7 @@ public class Ticket1804 extends com.vaadin.Application.LegacyApplication {
w.setModal(true);
w.setScrollable(true);
w.setHeight("80%");
- w.addComponent(new Label(msg.toString(), Label.CONTENT_XHTML));
+ w.addComponent(new Label(msg.toString(), ContentMode.XHTML));
main.addWindow(w);
}
});
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1811.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1811.java
index e61715cab8..be98d73ec4 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket1811.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1811.java
@@ -8,6 +8,7 @@ import com.vaadin.data.validator.StringLengthValidator;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Window;
@@ -70,7 +71,7 @@ public class Ticket1811 extends com.vaadin.Application.LegacyApplication {
}
Window w = new Window("Status of the fields");
w.setModal(true);
- w.addComponent(new Label(msg.toString(), Label.CONTENT_XHTML));
+ w.addComponent(new Label(msg.toString(), ContentMode.XHTML));
main.addWindow(w);
}
});
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1819.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1819.java
index 993396bdde..d757528c94 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket1819.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1819.java
@@ -7,6 +7,7 @@ import com.vaadin.ui.AbstractField;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Select;
import com.vaadin.ui.Window;
@@ -56,7 +57,7 @@ public class Ticket1819 extends com.vaadin.Application.LegacyApplication {
}
Window w = new Window("Status of the fields");
w.setModal(true);
- w.addComponent(new Label(msg.toString(), Label.CONTENT_XHTML));
+ w.addComponent(new Label(msg.toString(), ContentMode.XHTML));
main.addWindow(w);
}
});
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1970.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1970.java
index f826e1d1b7..beeda85c9f 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket1970.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1970.java
@@ -6,6 +6,7 @@ import com.vaadin.Application;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
public class Ticket1970 extends Application.LegacyApplication {
@@ -62,11 +63,11 @@ public class Ticket1970 extends Application.LegacyApplication {
}
}));
w.addComponent(new Label(""
- + getURL().toExternalForm() + " ", Label.CONTENT_XHTML));
+ + getURL().toExternalForm() + "", ContentMode.XHTML));
w.addComponent(new Label(
"How to reproduce Open the above link in another browser"
+ " window and then press the Show-button on this window.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
return w;
}
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2104.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2104.java
index 71d36f0d4c..4637b71fb4 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2104.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2104.java
@@ -10,6 +10,7 @@ import com.vaadin.terminal.ExternalResource;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Table;
import com.vaadin.ui.Tree;
@@ -18,7 +19,7 @@ public class Ticket2104 extends Application.LegacyApplication {
private static final Label info = new Label(
"Click event should _always_ come trough. Switching features on/off should immediatly affect the tree (verify w/ debug window)",
- Label.CONTENT_RAW);
+ ContentMode.RAW);
Tree tree = new Tree();
Table table = new Table();
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2117.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2117.java
index 1991f229b7..82241843df 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2117.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2117.java
@@ -6,6 +6,7 @@ import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
public class Ticket2117 extends Application.LegacyApplication {
@@ -54,7 +55,7 @@ public class Ticket2117 extends Application.LegacyApplication {
+ "'>"
+ getURL().toExternalForm()
+ " which opens new windows to this uri. They should end up having a separate Window and URL.",
- Label.CONTENT_XHTML));
+ ContentMode.XHTML));
return w;
}
}
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2119.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2119.java
index fefade2e29..b7dc84b8ab 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2119.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2119.java
@@ -6,6 +6,7 @@ import com.vaadin.data.util.ObjectProperty;
import com.vaadin.terminal.ExternalResource;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Select;
@@ -56,7 +57,7 @@ public class Ticket2119 extends Application.LegacyApplication {
+ " - Go to the second Window\n"
+ " - Click the arrow in the Select\n"
+ " --> The opened list correctly shows the new value but the old one is shown in the \"input\" part");
- label.setContentMode(Label.CONTENT_PREFORMATTED);
+ label.setContentMode(ContentMode.PREFORMATTED);
layout.addComponent(label);
final Select select = new Select("Test Select");
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2240.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2240.java
index 75bdc523ca..bf01475809 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2240.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2240.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.tickets;
import com.vaadin.Application;
import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TextField;
@@ -36,7 +37,7 @@ public class Ticket2240 extends Application.LegacyApplication {
layout.setStyleName("borders");
// layout.setSizeFull();
final Label l = new Label(txt);
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
// l.setWidth("100%");
TextField tf = new TextField("This is a textField");
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2279.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2279.java
index 294cfd95c2..1e39cd0b8c 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2279.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2279.java
@@ -10,6 +10,7 @@ import com.vaadin.terminal.gwt.client.ui.AlignmentInfo;
import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Layout.AlignmentHandler;
import com.vaadin.ui.Root.LegacyWindow;
@@ -75,7 +76,7 @@ public class Ticket2279 extends Application.LegacyApplication {
vl.setHeight("500px");
vl.setStyleName("borders");
label = new Label("Error messages follows: ",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
vl.addComponent(label);
layout.addComponent(vl);
@@ -86,7 +87,7 @@ public class Ticket2279 extends Application.LegacyApplication {
gl.setHeight("500px");
gl.setStyleName("borders");
label = new Label("Error messages follows: ",
- Label.CONTENT_XHTML);
+ ContentMode.XHTML);
gl.addComponent(label);
layout.addComponent(gl);
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2287.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2287.java
index 756a4d128c..29108fc90f 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2287.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2287.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.tickets;
import java.net.URL;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
public class Ticket2287 extends Ticket2292 {
@@ -17,13 +18,13 @@ public class Ticket2287 extends Ticket2292 {
"Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)."));
Label l = new Label();
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
l.setValue("This is a label with as slow image. ");
main.addComponent(l);
l = new Label();
- l.setContentMode(Label.CONTENT_XHTML);
+ l.setContentMode(ContentMode.XHTML);
l.setValue("This is a label with as slow image. ");
main.addComponent(l);
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2304.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2304.java
index 59e0a2beab..9484b4865f 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2304.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2304.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.tickets;
import com.vaadin.Application;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.themes.Reindeer;
@@ -21,7 +22,7 @@ public class Ticket2304 extends Application.LegacyApplication {
Label l = new Label(
"a\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\n");
- l.setContentMode(Label.CONTENT_PREFORMATTED);
+ l.setContentMode(ContentMode.PREFORMATTED);
p.addComponent(l);
main.addComponent(new Label(
"This text should be right below the panel, w/o spacing"));
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2426.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2426.java
index f132678190..a979b6711f 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2426.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2426.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.tickets;
import com.vaadin.Application;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
public class Ticket2426 extends Application.LegacyApplication {
@@ -14,14 +15,13 @@ public class Ticket2426 extends Application.LegacyApplication {
final String content = " ";
w.addComponent(new Label("CONTENT_DEFAULT: " + content,
- Label.CONTENT_DEFAULT));
+ ContentMode.DEFAULT));
w.addComponent(new Label("CONTENT_PREFORMATTED: " + content,
- Label.CONTENT_PREFORMATTED));
- w.addComponent(new Label("CONTENT_RAW: " + content, Label.CONTENT_RAW));
- w.addComponent(new Label("CONTENT_TEXT: " + content, Label.CONTENT_TEXT));
- w.addComponent(new Label("CONTENT_XML: " + content, Label.CONTENT_XML));
- w.addComponent(new Label("CONTENT_XHTML: " + content,
- Label.CONTENT_XHTML));
+ ContentMode.PREFORMATTED));
+ w.addComponent(new Label("CONTENT_RAW: " + content, ContentMode.RAW));
+ w.addComponent(new Label("CONTENT_TEXT: " + content, ContentMode.TEXT));
+ w.addComponent(new Label("CONTENT_XML: " + content, ContentMode.XML));
+ w.addComponent(new Label("CONTENT_XHTML: " + content, ContentMode.XHTML));
}
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket5952.java b/tests/testbench/com/vaadin/tests/tickets/Ticket5952.java
index 972f6f2901..6568446c89 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket5952.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket5952.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.tickets;
import com.vaadin.Application;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Root.LegacyWindow;
public class Ticket5952 extends Application.LegacyApplication {
@@ -23,7 +24,7 @@ public class Ticket5952 extends Application.LegacyApplication {
+ " 2 "
+ " "
+ " " + "";
- Label mathLabel = new Label(mathml, Label.CONTENT_XML);
+ Label mathLabel = new Label(mathml, ContentMode.XML);
mainWindow.addComponent(mathLabel);
}
}
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket677.java b/tests/testbench/com/vaadin/tests/tickets/Ticket677.java
index 2b48ab2dc3..2e96a2718c 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket677.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket677.java
@@ -15,6 +15,7 @@ import com.vaadin.ui.Form;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Table;
@@ -30,7 +31,7 @@ public class Ticket677 extends Application.LegacyApplication {
+ " focusing should fail (try tabbing as well) [worked previousy]"
+ " no variable changes should be sent from disabled fields [changed sent previously]"
+ " try further toggling and tabbing around",
- Label.CONTENT_RAW);
+ ContentMode.RAW);
Panel root = new Panel("Enabled");
Panel one = new Panel("Enabled");
diff --git a/tests/testbench/com/vaadin/tests/util/Log.java b/tests/testbench/com/vaadin/tests/util/Log.java
index bdb40d56d7..aa5034b3f7 100644
--- a/tests/testbench/com/vaadin/tests/util/Log.java
+++ b/tests/testbench/com/vaadin/tests/util/Log.java
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.VerticalLayout;
public class Log extends VerticalLayout {
@@ -49,7 +50,7 @@ public class Log extends VerticalLayout {
}
private Label createEventLabel() {
- Label l = new Label(" ", Label.CONTENT_XHTML);
+ Label l = new Label(" ", ContentMode.XHTML);
l.setWidth(null);
return l;
}
diff --git a/tests/testbench/com/vaadin/tests/util/SampleDirectory.java b/tests/testbench/com/vaadin/tests/util/SampleDirectory.java
index 9ed71843d5..a1f3202cea 100644
--- a/tests/testbench/com/vaadin/tests/util/SampleDirectory.java
+++ b/tests/testbench/com/vaadin/tests/util/SampleDirectory.java
@@ -9,6 +9,7 @@ import java.io.File;
import com.vaadin.Application;
import com.vaadin.terminal.SystemError;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Label.ContentMode;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root;
@@ -64,7 +65,7 @@ public class SampleDirectory {
errorPanel.setStyleName("strong");
errorPanel.setComponentError(new SystemError(
"Cannot provide sample directory"));
- errorPanel.addComponent(new Label(errorMessage, Label.CONTENT_XHTML));
+ errorPanel.addComponent(new Label(errorMessage, ContentMode.XHTML));
// Remove all components from applications main window
root.getContent().removeAllComponents();
// Add error panel