From 63bf051247461cff44c9f23d19d2e1064266d55f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Wed, 4 Jan 2012 14:37:31 +0200 Subject: [PATCH] #8019 Enum for Label.ContentMode --- src/com/vaadin/ui/Label.java | 266 ++++++++++-------- .../com/vaadin/tests/Components.java | 7 +- .../com/vaadin/tests/CustomLayoutDemo.java | 5 +- .../com/vaadin/tests/LayoutDemo.java | 19 +- .../com/vaadin/tests/NativeWindowing.java | 3 +- ...erformanceTestBasicComponentRendering.java | 3 +- ...erformanceTestLabelsAndOrderedLayouts.java | 3 +- .../tests/PerformanceTestSubTreeCaching.java | 3 +- .../com/vaadin/tests/TestCaptionWrapper.java | 3 +- .../vaadin/tests/TestForNativeWindowing.java | 3 +- .../vaadin/tests/TestForRichTextEditor.java | 3 +- .../com/vaadin/tests/TestForStyledUpload.java | 7 +- .../com/vaadin/tests/TestForUpload.java | 8 +- .../com/vaadin/tests/TestIFrames.java | 3 +- .../com/vaadin/tests/TreeFilesystem.java | 3 +- .../vaadin/tests/UsingObjectsInSelect.java | 3 +- .../application/ApplicationCloseTest.java | 5 +- .../tests/components/AbstractTestRoot.java | 3 +- .../com/vaadin/tests/components/TestBase.java | 3 +- .../components/button/ButtonMouseDetails.java | 3 +- .../components/caption/IconsInCaption.java | 3 +- .../combobox/ComboFocusBlurEvents.java | 11 +- .../customcomponent/ClipContent.java | 7 +- .../datefield/DateFieldEmptyValid.java | 3 +- .../datefield/ValueThroughProperty.java | 3 +- .../tests/components/label/LabelModes.java | 7 +- .../tests/components/label/LabelTest.java | 20 +- .../vaadin/tests/components/label/Labels.java | 5 +- .../OptionGroupMultipleValueChange.java | 3 +- .../panel/PanelShouldNotScroll.java | 3 +- .../popupview/PopupViewOffScreen.java | 3 +- .../components/table/EditableTableLeak.java | 3 +- .../LabelEmbeddedClickThroughForTable.java | 5 +- .../vaadin/tests/components/table/Tables.java | 3 +- .../components/window/LazyWindowResize.java | 3 +- .../integration/JSR286PortletApplication.java | 3 +- .../tests/integration/LiferayThemeDemo.java | 33 +-- .../tests/layouts/HiddenHorizontalLayout.java | 3 +- .../tests/layouts/TestLayoutPerformance.java | 9 +- .../layouttester/HorizontalLayoutTests.java | 3 +- .../layouttester/VerticalLayoutTests.java | 11 +- .../com/vaadin/tests/tickets/Ticket1225.java | 5 +- .../com/vaadin/tests/tickets/Ticket124.java | 3 +- .../com/vaadin/tests/tickets/Ticket1444.java | 3 +- .../com/vaadin/tests/tickets/Ticket1804.java | 3 +- .../com/vaadin/tests/tickets/Ticket1811.java | 3 +- .../com/vaadin/tests/tickets/Ticket1819.java | 3 +- .../com/vaadin/tests/tickets/Ticket1970.java | 5 +- .../com/vaadin/tests/tickets/Ticket2104.java | 3 +- .../com/vaadin/tests/tickets/Ticket2117.java | 3 +- .../com/vaadin/tests/tickets/Ticket2119.java | 3 +- .../com/vaadin/tests/tickets/Ticket2240.java | 3 +- .../com/vaadin/tests/tickets/Ticket2279.java | 5 +- .../com/vaadin/tests/tickets/Ticket2287.java | 5 +- .../com/vaadin/tests/tickets/Ticket2304.java | 3 +- .../com/vaadin/tests/tickets/Ticket2426.java | 14 +- .../com/vaadin/tests/tickets/Ticket5952.java | 3 +- .../com/vaadin/tests/tickets/Ticket677.java | 3 +- .../testbench/com/vaadin/tests/util/Log.java | 3 +- .../vaadin/tests/util/SampleDirectory.java | 3 +- 60 files changed, 334 insertions(+), 242 deletions(-) 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 = "