]> source.dussan.org Git - vaadin-framework.git/commitdiff
Implement new Label
authorArtur Signell <artur@vaadin.com>
Thu, 25 Aug 2016 16:37:57 +0000 (19:37 +0300)
committerArtur Signell <artur@vaadin.com>
Fri, 26 Aug 2016 16:49:06 +0000 (19:49 +0300)
Label does intentionally not implement HasValue as it
cannot provide a value to a model

Change-Id: I36b8e1794d64caf566fa802177051ae2eb637bf9

100 files changed:
client/src/main/java/com/vaadin/client/ui/label/LabelConnector.java
compatibility-client/src/main/java/com/vaadin/v7/client/ui/label/LabelConnector.java [new file with mode: 0644]
compatibility-server/src/main/java/com/vaadin/v7/ui/Label.java [new file with mode: 0644]
compatibility-server/src/test/java/com/vaadin/tests/server/component/label/LabelConvertersTest.java [new file with mode: 0644]
compatibility-server/src/test/java/com/vaadin/tests/server/component/label/LabelListenersTest.java [new file with mode: 0644]
compatibility-server/src/test/java/com/vaadin/v7/ui/LabelDataSourceTest.java [new file with mode: 0644]
server/src/main/java/com/vaadin/server/FontIcon.java
server/src/main/java/com/vaadin/ui/Label.java
server/src/test/java/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java
server/src/test/java/com/vaadin/tests/server/component/label/LabelConvertersTest.java [deleted file]
server/src/test/java/com/vaadin/tests/server/component/label/LabelDeclarativeTest.java
server/src/test/java/com/vaadin/tests/server/component/label/LabelListenersTest.java [deleted file]
server/src/test/java/com/vaadin/ui/LabelDataSourceTest.java [deleted file]
server/src/test/java/com/vaadin/ui/LabelTest.java [new file with mode: 0644]
shared/src/main/java/com/vaadin/shared/ui/label/ContentMode.java
shared/src/main/java/com/vaadin/v7/shared/ui/label/ContentMode.java [new file with mode: 0644]
shared/src/main/java/com/vaadin/v7/shared/ui/label/LabelState.java [new file with mode: 0644]
uitest/src/main/java/com/vaadin/tests/Components.java
uitest/src/main/java/com/vaadin/tests/CustomLayoutDemo.java
uitest/src/main/java/com/vaadin/tests/LayoutDemo.java
uitest/src/main/java/com/vaadin/tests/NativeWindowing.java
uitest/src/main/java/com/vaadin/tests/PerformanceTestBasicComponentRendering.java
uitest/src/main/java/com/vaadin/tests/PerformanceTestLabelsAndOrderedLayouts.java
uitest/src/main/java/com/vaadin/tests/PerformanceTestSubTreeCaching.java
uitest/src/main/java/com/vaadin/tests/TestCaptionWrapper.java
uitest/src/main/java/com/vaadin/tests/TestForNativeWindowing.java
uitest/src/main/java/com/vaadin/tests/TestForRichTextEditor.java
uitest/src/main/java/com/vaadin/tests/TestForStyledUpload.java
uitest/src/main/java/com/vaadin/tests/TestForUpload.java
uitest/src/main/java/com/vaadin/tests/TestIFrames.java
uitest/src/main/java/com/vaadin/tests/TreeFilesystem.java
uitest/src/main/java/com/vaadin/tests/UsingObjectsInSelect.java
uitest/src/main/java/com/vaadin/tests/application/ApplicationCloseTest.java
uitest/src/main/java/com/vaadin/tests/components/AbstractTestUI.java
uitest/src/main/java/com/vaadin/tests/components/TestBase.java
uitest/src/main/java/com/vaadin/tests/components/button/ButtonMouseDetails.java
uitest/src/main/java/com/vaadin/tests/components/caption/IconsInCaption.java
uitest/src/main/java/com/vaadin/tests/components/colorpicker/ColorPickerTestUI.java
uitest/src/main/java/com/vaadin/tests/components/combobox/ComboFocusBlurEvents.java
uitest/src/main/java/com/vaadin/tests/components/combobox/ComboPushTiming.java
uitest/src/main/java/com/vaadin/tests/components/customcomponent/ClipContent.java
uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldEmptyValid.java
uitest/src/main/java/com/vaadin/tests/components/datefield/ValueThroughProperty.java
uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropBatchUpload.java
uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/SingleUseDragAndDropUpload.java
uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/TooltipHandlingWhenNotDefined.java
uitest/src/main/java/com/vaadin/tests/components/grid/GridWithLabelEditor.java
uitest/src/main/java/com/vaadin/tests/components/label/LabelModes.java
uitest/src/main/java/com/vaadin/tests/components/label/LabelPropertySourceValue.java
uitest/src/main/java/com/vaadin/tests/components/label/LabelTest.java
uitest/src/main/java/com/vaadin/tests/components/label/Labels.java
uitest/src/main/java/com/vaadin/tests/components/label/MarginsInLabels.java
uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelectJump.java
uitest/src/main/java/com/vaadin/tests/components/optiongroup/OptionGroupMultipleValueChange.java
uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java
uitest/src/main/java/com/vaadin/tests/components/orderedlayout/LayoutResizeTest.java
uitest/src/main/java/com/vaadin/tests/components/panel/PanelShouldNotScroll.java
uitest/src/main/java/com/vaadin/tests/components/popupview/PopupViewOffScreen.java
uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaEmptyString.java
uitest/src/main/java/com/vaadin/tests/components/table/EditableTableLeak.java
uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java
uitest/src/main/java/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java
uitest/src/main/java/com/vaadin/tests/components/table/SortLabelsInTable.java
uitest/src/main/java/com/vaadin/tests/components/table/TableInTabsheet.java
uitest/src/main/java/com/vaadin/tests/components/table/TableMatchesMouseDownMouseUpElement.java
uitest/src/main/java/com/vaadin/tests/components/table/TableRowScrolledBottom.java
uitest/src/main/java/com/vaadin/tests/components/table/Tables.java
uitest/src/main/java/com/vaadin/tests/components/treetable/ComponentsInTreeTable.java
uitest/src/main/java/com/vaadin/tests/components/ui/LazyInitUIs.java
uitest/src/main/java/com/vaadin/tests/components/ui/UISerialization.java
uitest/src/main/java/com/vaadin/tests/components/window/LazyWindowResize.java
uitest/src/main/java/com/vaadin/tests/extensions/ResponsiveUI.java
uitest/src/main/java/com/vaadin/tests/fieldgroup/AbstractBasicCrud.java
uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java
uitest/src/main/java/com/vaadin/tests/integration/JSR286Portlet.java
uitest/src/main/java/com/vaadin/tests/layouts/HiddenHorizontalLayout.java
uitest/src/main/java/com/vaadin/tests/layouts/TestLayoutPerformance.java
uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseAddReplaceMove.java
uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutForSpacingMargin.java
uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java
uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridAddReplaceMove.java
uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridBaseLayoutTestUI.java
uitest/src/main/java/com/vaadin/tests/layouts/layouttester/GridLayout/GridLayoutMarginSpacing.java
uitest/src/main/java/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java
uitest/src/main/java/com/vaadin/tests/push/BasicPush.java
uitest/src/main/java/com/vaadin/tests/push/PushConfiguration.java
uitest/src/main/java/com/vaadin/tests/push/PushConfigurator.java
uitest/src/main/java/com/vaadin/tests/serialization/SerializerTest.java
uitest/src/main/java/com/vaadin/tests/themes/CSSInjectTest.java
uitest/src/main/java/com/vaadin/tests/themes/valo/Labels.java
uitest/src/main/java/com/vaadin/tests/themes/valo/PopupViews.java
uitest/src/main/java/com/vaadin/tests/themes/valo/ValoThemeUI.java
uitest/src/main/java/com/vaadin/tests/util/Log.java
uitest/src/main/java/com/vaadin/tests/util/SampleDirectory.java
uitest/src/main/java/com/vaadin/tests/widgetset/client/ClientRpcClassConnector.java
uitest/src/main/java/com/vaadin/tests/widgetset/client/IdTestLabelConnector.java
uitest/src/main/java/com/vaadin/tests/widgetset/client/LabelState.java
uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java
uitest/src/main/java/com/vaadin/tests/widgetset/server/grid/GridClientColumnRenderers.java
uitest/src/test/java/com/vaadin/tests/serialization/SerializerTestTest.java

index 40734a7a619fe8361d641ec4a7235a0ba1d2766f..0d66a06941a307b1e622afeb69436ed4a490c86f 100644 (file)
@@ -55,15 +55,9 @@ public class LabelConnector extends AbstractComponentConnector {
             break;
 
         case HTML:
-        case RAW:
             sinkOnloads = true;
-        case XML:
             getWidget().setHTML(getState().text);
             break;
-        default:
-            getWidget().setText("");
-            break;
-
         }
         Profiler.leave("LabelConnector.onStateChanged update content");
 
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/label/LabelConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/label/LabelConnector.java
new file mode 100644 (file)
index 0000000..d8c35a2
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.v7.client.ui.label;
+
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.PreElement;
+import com.vaadin.client.Profiler;
+import com.vaadin.client.WidgetUtil;
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.client.ui.AbstractComponentConnector;
+import com.vaadin.client.ui.VLabel;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.v7.shared.ui.label.LabelState;
+import com.vaadin.v7.ui.Label;
+
+@Connect(value = Label.class, loadStyle = LoadStyle.EAGER)
+public class LabelConnector extends AbstractComponentConnector {
+
+    @Override
+    public LabelState getState() {
+        return (LabelState) super.getState();
+    }
+
+    @Override
+    public void onStateChanged(StateChangeEvent stateChangeEvent) {
+        super.onStateChanged(stateChangeEvent);
+        boolean sinkOnloads = false;
+        Profiler.enter("LabelConnector.onStateChanged update content");
+        switch (getState().contentMode) {
+        case PREFORMATTED:
+            PreElement preElement = Document.get().createPreElement();
+            preElement.setInnerText(getState().text);
+            // clear existing content
+            getWidget().setHTML("");
+            // add preformatted text to dom
+            getWidget().getElement().appendChild(preElement);
+            break;
+
+        case TEXT:
+            getWidget().setText(getState().text);
+            break;
+
+        case HTML:
+        case RAW:
+            sinkOnloads = true;
+        case XML:
+            getWidget().setHTML(getState().text);
+            break;
+        default:
+            getWidget().setText("");
+            break;
+
+        }
+        Profiler.leave("LabelConnector.onStateChanged update content");
+
+        if (sinkOnloads) {
+            Profiler.enter("LabelConnector.onStateChanged sinkOnloads");
+            WidgetUtil.sinkOnloadForImages(getWidget().getElement());
+            Profiler.leave("LabelConnector.onStateChanged sinkOnloads");
+        }
+    }
+
+    @Override
+    public VLabel getWidget() {
+        return (VLabel) super.getWidget();
+    }
+
+}
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Label.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Label.java
new file mode 100644 (file)
index 0000000..dc89fff
--- /dev/null
@@ -0,0 +1,624 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.v7.ui;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Locale;
+
+import org.jsoup.nodes.Element;
+
+import com.vaadin.shared.util.SharedUtil;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.declarative.DesignContext;
+import com.vaadin.ui.declarative.DesignFormatter;
+import com.vaadin.v7.data.Property;
+import com.vaadin.v7.data.util.converter.Converter;
+import com.vaadin.v7.data.util.converter.ConverterUtil;
+import com.vaadin.v7.shared.ui.label.ContentMode;
+import com.vaadin.v7.shared.ui.label.LabelState;
+
+/**
+ * Label component for showing non-editable short texts.
+ *
+ * The label content can be set to the modes specified by {@link ContentMode}
+ *
+ * <p>
+ * The contents of the label may contain simple formatting:
+ * <ul>
+ * <li><b>&lt;b></b> Bold
+ * <li><b>&lt;i></b> Italic
+ * <li><b>&lt;u></b> Underlined
+ * <li><b>&lt;br/></b> Linebreak
+ * <li><b>&lt;ul>&lt;li>item 1&lt;/li>&lt;li>item 2&lt;/li>&lt;/ul></b> List of
+ * items
+ * </ul>
+ * The <b>b</b>,<b>i</b>,<b>u</b> and <b>li</b> tags can contain all the tags in
+ * the list recursively.
+ * </p>
+ *
+ * @author Vaadin Ltd.
+ * @since 3.0
+ */
+@SuppressWarnings("serial")
+public class Label extends AbstractComponent implements Property<String>,
+        Property.Viewer, Property.ValueChangeListener,
+        Property.ValueChangeNotifier, Comparable<Label> {
+
+    /**
+     * @deprecated As of 7.0, use {@link ContentMode#TEXT} instead
+     */
+    @Deprecated
+    public static final ContentMode CONTENT_TEXT = ContentMode.TEXT;
+
+    /**
+     * @deprecated As of 7.0, use {@link ContentMode#PREFORMATTED} instead
+     */
+    @Deprecated
+    public static final ContentMode CONTENT_PREFORMATTED = ContentMode.PREFORMATTED;
+
+    /**
+     * @deprecated As of 7.0, use {@link ContentMode#HTML} instead
+     */
+    @Deprecated
+    public static final ContentMode CONTENT_XHTML = ContentMode.HTML;
+
+    /**
+     * @deprecated As of 7.0, use {@link ContentMode#XML} instead
+     */
+    @Deprecated
+    public static final ContentMode CONTENT_XML = ContentMode.XML;
+
+    /**
+     * @deprecated As of 7.0, use {@link ContentMode#RAW} instead
+     */
+    @Deprecated
+    public static final ContentMode CONTENT_RAW = ContentMode.RAW;
+
+    /**
+     * @deprecated As of 7.0, use {@link ContentMode#TEXT} instead
+     */
+    @Deprecated
+    public static final ContentMode CONTENT_DEFAULT = ContentMode.TEXT;
+
+    /**
+     * A converter used to convert from the data model type to the field type
+     * and vice versa. Label type is always String.
+     */
+    private Converter<String, Object> converter = null;
+
+    private Property<String> dataSource = null;
+
+    /**
+     * Creates an empty Label.
+     */
+    public Label() {
+        this("");
+    }
+
+    /**
+     * Creates a new instance of Label with text-contents.
+     *
+     * @param content
+     */
+    public Label(String content) {
+        this(content, ContentMode.TEXT);
+    }
+
+    /**
+     * Creates a new instance of Label with text-contents read from given
+     * datasource.
+     *
+     * @param contentSource
+     */
+    public Label(Property contentSource) {
+        this(contentSource, ContentMode.TEXT);
+    }
+
+    /**
+     * Creates a new instance of Label with text-contents.
+     *
+     * @param content
+     * @param contentMode
+     */
+    public Label(String content, ContentMode contentMode) {
+        setValue(content);
+        setContentMode(contentMode);
+        setWidth(100, Unit.PERCENTAGE);
+    }
+
+    /**
+     * Creates a new instance of Label with text-contents read from given
+     * datasource.
+     *
+     * @param contentSource
+     * @param contentMode
+     */
+    public Label(Property contentSource, ContentMode contentMode) {
+        setPropertyDataSource(contentSource);
+        setContentMode(contentMode);
+        setWidth(100, Unit.PERCENTAGE);
+    }
+
+    @Override
+    protected LabelState getState() {
+        return (LabelState) super.getState();
+    }
+
+    @Override
+    protected LabelState getState(boolean markAsDirty) {
+        return (LabelState) super.getState(markAsDirty);
+    }
+
+    /**
+     * Gets the value of the label.
+     * <p>
+     * The value of the label is the text that is shown to the end user.
+     * Depending on the {@link ContentMode} it is plain text or markup.
+     * </p>
+     *
+     * @return the value of the label.
+     */
+    @Override
+    public String getValue() {
+        if (getPropertyDataSource() == null) {
+            // Use internal value if we are running without a data source
+            return getState(false).text;
+        }
+        return getDataSourceValue();
+    }
+
+    /**
+     * Returns the current value of the data source converted using the current
+     * locale.
+     *
+     * @return
+     */
+    private String getDataSourceValue() {
+        return ConverterUtil.convertFromModel(
+                getPropertyDataSource().getValue(), String.class,
+                getConverter(), getLocale());
+    }
+
+    /**
+     * Set the value of the label. Value of the label is the XML contents of the
+     * label. Since Vaadin 7.2, changing the value of Label instance with that
+     * method will fire ValueChangeEvent.
+     *
+     * @param newStringValue
+     *            the New value of the label.
+     */
+    @Override
+    public void setValue(String newStringValue) {
+        if (getPropertyDataSource() == null) {
+
+            LabelState state = getState(false);
+            String oldTextValue = state.text;
+            if (!SharedUtil.equals(oldTextValue, newStringValue)) {
+                getState().text = newStringValue;
+                fireValueChange();
+            }
+        } else {
+            throw new IllegalStateException(
+                    "Label is only a Property.Viewer and cannot update its data source");
+        }
+    }
+
+    /**
+     * Gets the type of the Property.
+     *
+     * @see com.vaadin.v7.data.Property#getType()
+     */
+    @Override
+    public Class<String> getType() {
+        return String.class;
+    }
+
+    /**
+     * Gets the viewing data-source property.
+     *
+     * @return the data source property.
+     * @see com.vaadin.v7.data.Property.Viewer#getPropertyDataSource()
+     */
+    @Override
+    public Property getPropertyDataSource() {
+        return dataSource;
+    }
+
+    /**
+     * Sets the property as data-source for viewing. Since Vaadin 7.2 a
+     * ValueChangeEvent is fired if the new value is different from previous.
+     *
+     * @param newDataSource
+     *            the new data source Property
+     * @see com.vaadin.v7.data.Property.Viewer#setPropertyDataSource(com.vaadin.v7.data.Property)
+     */
+    @Override
+    public void setPropertyDataSource(Property newDataSource) {
+        // Stops listening the old data source changes
+        if (dataSource != null && Property.ValueChangeNotifier.class
+                .isAssignableFrom(dataSource.getClass())) {
+            ((Property.ValueChangeNotifier) dataSource).removeListener(this);
+        }
+
+        // Check if the current converter is compatible.
+        if (newDataSource != null
+                && !ConverterUtil.canConverterPossiblyHandle(getConverter(),
+                        getType(), newDataSource.getType())) {
+            // There is no converter set or there is no way the current
+            // converter can be compatible.
+            Converter<String, ?> c = ConverterUtil.getConverter(String.class,
+                    newDataSource.getType(), getSession());
+            setConverter(c);
+        }
+
+        dataSource = newDataSource;
+        if (dataSource != null) {
+            // Update the value from the data source. If data source was set to
+            // null, retain the old value
+            updateValueFromDataSource();
+        }
+
+        // Listens the new data source if possible
+        if (dataSource != null && Property.ValueChangeNotifier.class
+                .isAssignableFrom(dataSource.getClass())) {
+            ((Property.ValueChangeNotifier) dataSource).addListener(this);
+        }
+        markAsDirty();
+    }
+
+    /**
+     * Gets the content mode of the Label.
+     *
+     * @return the Content mode of the label.
+     *
+     * @see ContentMode
+     */
+    public ContentMode getContentMode() {
+        return getState(false).contentMode;
+    }
+
+    /**
+     * Sets the content mode of the Label.
+     *
+     * @param contentMode
+     *            the New content mode of the label.
+     *
+     * @see ContentMode
+     */
+    public void setContentMode(ContentMode contentMode) {
+        if (contentMode == null) {
+            throw new IllegalArgumentException("Content mode can not be null");
+        }
+
+        getState().contentMode = contentMode;
+    }
+
+    /* Value change events */
+
+    private static final Method VALUE_CHANGE_METHOD;
+
+    static {
+        try {
+            VALUE_CHANGE_METHOD = Property.ValueChangeListener.class
+                    .getDeclaredMethod("valueChange",
+                            new Class[] { Property.ValueChangeEvent.class });
+        } catch (final java.lang.NoSuchMethodException e) {
+            // This should never happen
+            throw new java.lang.RuntimeException(
+                    "Internal error finding methods in Label");
+        }
+    }
+
+    /**
+     * Value change event
+     *
+     * @author Vaadin Ltd.
+     * @since 3.0
+     */
+    public static class ValueChangeEvent extends Component.Event
+            implements Property.ValueChangeEvent {
+
+        /**
+         * New instance of text change event
+         *
+         * @param source
+         *            the Source of the event.
+         */
+        public ValueChangeEvent(Label source) {
+            super(source);
+        }
+
+        /**
+         * Gets the Property that has been modified.
+         *
+         * @see com.vaadin.v7.data.Property.ValueChangeEvent#getProperty()
+         */
+        @Override
+        public Property getProperty() {
+            return (Property) getSource();
+        }
+    }
+
+    /**
+     * Adds the value change listener.
+     *
+     * @param listener
+     *            the Listener to be added.
+     * @see com.vaadin.v7.data.Property.ValueChangeNotifier#addListener(com.vaadin.v7.data.Property.ValueChangeListener)
+     */
+    @Override
+    public void addValueChangeListener(Property.ValueChangeListener listener) {
+        addListener(Label.ValueChangeEvent.class, listener,
+                VALUE_CHANGE_METHOD);
+    }
+
+    /**
+     * @deprecated As of 7.0, replaced by
+     *             {@link #addValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener)}
+     **/
+    @Override
+    @Deprecated
+    public void addListener(Property.ValueChangeListener listener) {
+        addValueChangeListener(listener);
+    }
+
+    /**
+     * Removes the value change listener.
+     *
+     * @param listener
+     *            the Listener to be removed.
+     * @see com.vaadin.v7.data.Property.ValueChangeNotifier#removeListener(com.vaadin.v7.data.Property.ValueChangeListener)
+     */
+    @Override
+    public void removeValueChangeListener(
+            Property.ValueChangeListener listener) {
+        removeListener(Label.ValueChangeEvent.class, listener,
+                VALUE_CHANGE_METHOD);
+    }
+
+    /**
+     * @deprecated As of 7.0, replaced by
+     *             {@link #removeValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener)}
+     **/
+    @Override
+    @Deprecated
+    public void removeListener(Property.ValueChangeListener listener) {
+        removeValueChangeListener(listener);
+    }
+
+    /**
+     * Emits the options change event.
+     */
+    protected void fireValueChange() {
+        // Set the error message
+        fireEvent(new Label.ValueChangeEvent(this));
+    }
+
+    /**
+     * Listens the value change events from data source.
+     *
+     * @see com.vaadin.v7.data.Property.ValueChangeListener#valueChange(Property.ValueChangeEvent)
+     */
+    @Override
+    public void valueChange(Property.ValueChangeEvent event) {
+        updateValueFromDataSource();
+    }
+
+    private void updateValueFromDataSource() {
+        // Update the internal value from the data source
+        String newConvertedValue = getDataSourceValue();
+        if (!SharedUtil.equals(newConvertedValue, getState(false).text)) {
+            getState().text = newConvertedValue;
+            fireValueChange();
+        }
+    }
+
+    @Override
+    public void attach() {
+        super.attach();
+        localeMightHaveChanged();
+    }
+
+    @Override
+    public void setLocale(Locale locale) {
+        super.setLocale(locale);
+        localeMightHaveChanged();
+    }
+
+    private void localeMightHaveChanged() {
+        if (getPropertyDataSource() != null) {
+            updateValueFromDataSource();
+        }
+    }
+
+    private String getComparableValue() {
+        String stringValue = getValue();
+        if (stringValue == null) {
+            stringValue = "";
+        }
+
+        if (getContentMode() == ContentMode.HTML
+                || getContentMode() == ContentMode.XML) {
+            return stripTags(stringValue);
+        } else {
+            return stringValue;
+        }
+
+    }
+
+    /**
+     * Compares the Label to other objects.
+     *
+     * <p>
+     * Labels can be compared to other labels for sorting label contents. This
+     * is especially handy for sorting table columns.
+     * </p>
+     *
+     * <p>
+     * In RAW, PREFORMATTED and TEXT modes, the label contents are compared as
+     * is. In XML, UIDL and HTML modes, only CDATA is compared and tags ignored.
+     * If the other object is not a Label, its toString() return value is used
+     * in comparison.
+     * </p>
+     *
+     * @param other
+     *            the Other object to compare to.
+     * @return a negative integer, zero, or a positive integer as this object is
+     *         less than, equal to, or greater than the specified object.
+     * @see java.lang.Comparable#compareTo(java.lang.Object)
+     */
+    @Override
+    public int compareTo(Label other) {
+
+        String thisValue = getComparableValue();
+        String otherValue = other.getComparableValue();
+
+        return thisValue.compareTo(otherValue);
+    }
+
+    /**
+     * Strips the tags from the XML.
+     *
+     * @param xml
+     *            the String containing a XML snippet.
+     * @return the original XML without tags.
+     */
+    private String stripTags(String xml) {
+
+        final StringBuffer res = new StringBuffer();
+
+        int processed = 0;
+        final int xmlLen = xml.length();
+        while (processed < xmlLen) {
+            int next = xml.indexOf('<', processed);
+            if (next < 0) {
+                next = xmlLen;
+            }
+            res.append(xml.substring(processed, next));
+            if (processed < xmlLen) {
+                next = xml.indexOf('>', processed);
+                if (next < 0) {
+                    next = xmlLen;
+                }
+                processed = next + 1;
+            }
+        }
+
+        return res.toString();
+    }
+
+    /**
+     * Gets the converter used to convert the property data source value to the
+     * label value.
+     *
+     * @return The converter or null if none is set.
+     */
+    public Converter<String, Object> getConverter() {
+        return converter;
+    }
+
+    /**
+     * Sets the converter used to convert the label value to the property data
+     * source type. The converter must have a presentation type of String.
+     *
+     * @param converter
+     *            The new converter to use.
+     */
+    public void setConverter(Converter<String, ?> converter) {
+        this.converter = (Converter<String, Object>) converter;
+        markAsDirty();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.vaadin.ui.AbstractComponent#readDesign(org.jsoup.nodes .Element,
+     * com.vaadin.ui.declarative.DesignContext)
+     */
+    @Override
+    public void readDesign(Element design, DesignContext designContext) {
+        super.readDesign(design, designContext);
+        String innerHtml = design.html();
+        boolean plainText = design.hasAttr(DESIGN_ATTR_PLAIN_TEXT);
+        if (plainText) {
+            setContentMode(ContentMode.TEXT);
+        } else {
+            setContentMode(ContentMode.HTML);
+        }
+        if (innerHtml != null && !"".equals(innerHtml)) {
+            if (plainText) {
+                innerHtml = DesignFormatter.decodeFromTextNode(innerHtml);
+            }
+            setValue(innerHtml);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.vaadin.ui.AbstractComponent#getCustomAttributes()
+     */
+    @Override
+    protected Collection<String> getCustomAttributes() {
+        Collection<String> result = super.getCustomAttributes();
+        result.add("value");
+        result.add("content-mode");
+        result.add("plain-text");
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.vaadin.ui.AbstractComponent#writeDesign(org.jsoup.nodes.Element
+     * , com.vaadin.ui.declarative.DesignContext)
+     */
+    @Override
+    public void writeDesign(Element design, DesignContext designContext) {
+        super.writeDesign(design, designContext);
+        String content = getValue();
+        if (content != null) {
+            switch (getContentMode()) {
+            case TEXT:
+            case PREFORMATTED:
+            case XML:
+            case RAW: {
+                // FIXME This attribute is not enough to be able to restore the
+                // content mode in readDesign. The content mode should instead
+                // be written directly in the attribute and restored in
+                // readDesign. See ticket #19435
+                design.attr(DESIGN_ATTR_PLAIN_TEXT, true);
+                String encodeForTextNode = DesignFormatter
+                        .encodeForTextNode(content);
+                if (encodeForTextNode != null) {
+                    design.html(encodeForTextNode);
+                }
+            }
+                break;
+            case HTML:
+                design.html(content);
+                break;
+            default:
+                throw new IllegalStateException(
+                        "ContentMode " + getContentMode()
+                                + " is not supported by writeDesign");
+            }
+        }
+    }
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/label/LabelConvertersTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/label/LabelConvertersTest.java
new file mode 100644 (file)
index 0000000..22f45c6
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.server.component.label;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.data.bean.Person;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
+import com.vaadin.util.CurrentInstance;
+import com.vaadin.v7.data.Property;
+import com.vaadin.v7.data.util.MethodProperty;
+import com.vaadin.v7.ui.Label;
+
+public class LabelConvertersTest {
+    @Before
+    public void clearExistingThreadLocals() {
+        // Ensure no previous test left some thread locals hanging
+        CurrentInstance.clearAll();
+    }
+
+    @Test
+    public void testLabelSetDataSourceLaterOn() {
+        Person p = Person.createTestPerson1();
+        Label l = new Label("My label");
+        assertEquals("My label", l.getValue());
+        assertNull(l.getConverter());
+        l.setPropertyDataSource(new MethodProperty<String>(p, "firstName"));
+        assertEquals(p.getFirstName(), l.getValue());
+        p.setFirstName("123");
+        assertEquals("123", l.getValue());
+    }
+
+    @Test
+    public void testIntegerDataSource() {
+        VaadinSession.setCurrent(new AlwaysLockedVaadinSession(null));
+        Label l = new Label("Foo");
+        Property ds = new MethodProperty<Integer>(Person.createTestPerson1(),
+                "age");
+        l.setPropertyDataSource(ds);
+        assertEquals(String.valueOf(Person.createTestPerson1().getAge()),
+                l.getValue());
+    }
+
+    @Test
+    public void testSetValueWithDataSource() {
+        try {
+            MethodProperty<String> property = new MethodProperty<String>(
+                    Person.createTestPerson1(), "firstName");
+            Label l = new Label(property);
+            l.setValue("Foo");
+            fail("setValue should throw an exception when a data source is set");
+        } catch (Exception e) {
+        }
+
+    }
+
+    @Test
+    public void testLabelWithoutDataSource() {
+        Label l = new Label("My label");
+        assertEquals("My label", l.getValue());
+        assertNull(l.getConverter());
+        assertNull(l.getPropertyDataSource());
+        l.setValue("New value");
+        assertEquals("New value", l.getValue());
+        assertNull(l.getConverter());
+        assertNull(l.getPropertyDataSource());
+    }
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/label/LabelListenersTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/label/LabelListenersTest.java
new file mode 100644 (file)
index 0000000..7c19c9c
--- /dev/null
@@ -0,0 +1,103 @@
+package com.vaadin.tests.server.component.label;
+
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+import com.vaadin.tests.server.component.AbstractListenerMethodsTestBase;
+import com.vaadin.v7.data.Property;
+import com.vaadin.v7.data.Property.ValueChangeListener;
+import com.vaadin.v7.ui.Label;
+import com.vaadin.v7.ui.Label.ValueChangeEvent;
+
+public class LabelListenersTest extends AbstractListenerMethodsTestBase {
+
+    @Test
+    public void testValueChangeListenerAddGetRemove() throws Exception {
+        testListenerAddGetRemove(Label.class, ValueChangeEvent.class,
+                ValueChangeListener.class);
+    }
+
+    @Test
+    public void testValueChangeFiredWhenSettingValue() {
+        Label underTest = new Label();
+
+        // setup the mock listener
+        ValueChangeListener mockListener = createStrictMock(
+                ValueChangeListener.class);
+        // record
+        mockListener.valueChange(
+                anyObject(com.vaadin.v7.data.Property.ValueChangeEvent.class));
+
+        // test
+        underTest.addValueChangeListener(mockListener);
+
+        replay(mockListener);
+        underTest.setValue("A new value");
+
+        verify(mockListener);
+
+    }
+
+    @Test
+    public void testValueChangeFiredWhenSettingPropertyDataSource() {
+        // setup
+        Label underTest = new Label();
+
+        Property mockProperty = EasyMock.createMock(Property.class);
+
+        ValueChangeListener mockListener = createStrictMock(
+                ValueChangeListener.class);
+        // record
+        mockListener.valueChange(
+                anyObject(com.vaadin.v7.data.Property.ValueChangeEvent.class));
+
+        expect(mockProperty.getType()).andReturn(String.class).atLeastOnce();
+        expect(mockProperty.getValue()).andReturn("Any").atLeastOnce();
+
+        // test
+
+        replay(mockListener, mockProperty);
+        underTest.addValueChangeListener(mockListener);
+        underTest.setPropertyDataSource(mockProperty);
+
+        verify(mockListener);
+
+    }
+
+    @Test
+    public void testValueChangeNotFiredWhenNotSettingValue() {
+        Label underTest = new Label();
+        // setup the mock listener
+        ValueChangeListener mockListener = createStrictMock(
+                ValueChangeListener.class);
+        // record: nothing to record
+
+        // test
+        underTest.addValueChangeListener(mockListener);
+        replay(mockListener);
+        verify(mockListener);
+    }
+
+    @Test
+    public void testNoValueChangeFiredWhenSettingPropertyDataSourceToNull() {
+        Label underTest = new Label();
+        // setup the mock Listener
+        ValueChangeListener mockListener = createStrictMock(
+                ValueChangeListener.class);
+        // record: nothing to record
+
+        // test
+        underTest.addValueChangeListener(mockListener);
+        underTest.setPropertyDataSource(null);
+
+        replay(mockListener);
+        verify(mockListener);
+    }
+
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/v7/ui/LabelDataSourceTest.java b/compatibility-server/src/test/java/com/vaadin/v7/ui/LabelDataSourceTest.java
new file mode 100644 (file)
index 0000000..42d0d72
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.v7.ui;
+
+import java.util.Locale;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.util.AlwaysLockedVaadinSession;
+import com.vaadin.tests.util.MockUI;
+import com.vaadin.ui.UI;
+import com.vaadin.v7.data.util.ObjectProperty;
+
+public class LabelDataSourceTest {
+
+    Label label;
+    private static final String STRING_DS_VALUE = "String DatA source";
+    private static final int INTEGER_DS_VALUE = 1587;
+    private static final String INTEGER_STRING_VALUE_FI = "1 587";
+    private static final String INTEGER_STRING_VALUE_EN_US = "1,587";
+    private static final Object INTEGER_STRING_VALUE_DE = "1.587";
+    ObjectProperty<String> stringDataSource;
+    private ObjectProperty<Integer> integerDataSource;
+    VaadinSession vaadinSession;
+
+    @Before
+    public void setup() {
+        vaadinSession = new AlwaysLockedVaadinSession(null);
+        VaadinSession.setCurrent(vaadinSession);
+
+        label = new Label();
+        stringDataSource = new ObjectProperty<String>(STRING_DS_VALUE);
+        integerDataSource = new ObjectProperty<Integer>(INTEGER_DS_VALUE);
+    }
+
+    @Test
+    public void stringDataSource() {
+        label.setPropertyDataSource(stringDataSource);
+        Assert.assertEquals(STRING_DS_VALUE, label.getState().text);
+        Assert.assertEquals(STRING_DS_VALUE, label.getValue());
+        Assert.assertEquals(stringDataSource, label.getPropertyDataSource());
+        label.setPropertyDataSource(null);
+        Assert.assertEquals(STRING_DS_VALUE, label.getState().text);
+        Assert.assertEquals(STRING_DS_VALUE, label.getValue());
+        Assert.assertEquals(null, label.getPropertyDataSource());
+        label.setValue("foo");
+        Assert.assertEquals("foo", label.getState().text);
+        Assert.assertEquals("foo", label.getValue());
+        Assert.assertNull(label.getPropertyDataSource());
+
+    }
+
+    @Test
+    public void integerDataSourceFi() {
+        label.setLocale(new Locale("fi", "FI"));
+        label.setPropertyDataSource(integerDataSource);
+        Assert.assertEquals(INTEGER_STRING_VALUE_FI, label.getState().text);
+        Assert.assertEquals(INTEGER_STRING_VALUE_FI, label.getValue());
+        Assert.assertEquals(integerDataSource, label.getPropertyDataSource());
+    }
+
+    @Test
+    public void integerDataSourceEn() {
+        label.setLocale(new Locale("en", "US"));
+        label.setPropertyDataSource(integerDataSource);
+        Assert.assertEquals(INTEGER_STRING_VALUE_EN_US, label.getState().text);
+        Assert.assertEquals(INTEGER_STRING_VALUE_EN_US, label.getValue());
+        Assert.assertEquals(integerDataSource, label.getPropertyDataSource());
+    }
+
+    @Test
+    public void changeLocaleAfterDataSource() {
+        label.setLocale(new Locale("en", "US"));
+        label.setPropertyDataSource(integerDataSource);
+        label.setLocale(new Locale("fi", "FI"));
+        Assert.assertEquals(INTEGER_STRING_VALUE_FI, label.getState().text);
+        Assert.assertEquals(INTEGER_STRING_VALUE_FI, label.getValue());
+        Assert.assertEquals(integerDataSource, label.getPropertyDataSource());
+    }
+
+    @Test
+    public void setRemoveDataSource() {
+        label.setValue("before");
+        label.setPropertyDataSource(stringDataSource);
+        Assert.assertEquals(STRING_DS_VALUE, label.getValue());
+        label.setPropertyDataSource(null);
+        Assert.assertEquals(STRING_DS_VALUE, label.getValue());
+        label.setValue("after");
+        Assert.assertEquals("after", label.getValue());
+    }
+
+    @Test
+    public void attachToSessionWithDifferentLocale() {
+        label.setValue("before");
+        // label.setLocale(Locale.GERMANY);
+        label.setPropertyDataSource(integerDataSource);
+        UI ui = new MockUI();
+        ui.setLocale(Locale.GERMANY);
+        ui.setContent(label);
+        Assert.assertEquals(INTEGER_STRING_VALUE_DE, label.getState().text);
+    }
+}
index c7aeec2987765ca00412a380868466f3cd24d13c..68a6f40269ffe84674cc7cfeab562940fd3d5b56 100644 (file)
@@ -16,8 +16,8 @@
 
 package com.vaadin.server;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Label;
+import com.vaadin.v7.shared.ui.label.ContentMode;
 
 /**
  * A font icon is a type of icon that is made by displaying one character from a
index 21aa7bdcbe967360ec044292c1f0a3a3545b7d98..161d4ddc73f4ff6db0e44f0e97d7ed06b7f646df 100644 (file)
 
 package com.vaadin.ui;
 
-import java.lang.reflect.Method;
 import java.util.Collection;
-import java.util.Locale;
 
 import org.jsoup.nodes.Element;
 
 import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.shared.ui.label.LabelState;
-import com.vaadin.shared.util.SharedUtil;
 import com.vaadin.ui.declarative.DesignContext;
 import com.vaadin.ui.declarative.DesignFormatter;
-import com.vaadin.v7.data.Property;
-import com.vaadin.v7.data.util.converter.Converter;
-import com.vaadin.v7.data.util.converter.ConverterUtil;
 
 /**
  * Label component for showing non-editable short texts.
- *
- * The label content can be set to the modes specified by {@link ContentMode}
- *
  * <p>
- * The contents of the label may contain simple formatting:
- * <ul>
- * <li><b>&lt;b></b> Bold
- * <li><b>&lt;i></b> Italic
- * <li><b>&lt;u></b> Underlined
- * <li><b>&lt;br/></b> Linebreak
- * <li><b>&lt;ul>&lt;li>item 1&lt;/li>&lt;li>item 2&lt;/li>&lt;/ul></b> List of
- * items
- * </ul>
- * The <b>b</b>,<b>i</b>,<b>u</b> and <b>li</b> tags can contain all the tags in
- * the list recursively.
- * </p>
+ * The label content can be set to the modes specified by {@link ContentMode}.
+ * If content mode is set to HTML, any HTML content is allowed.
  *
  * @author Vaadin Ltd.
  * @since 3.0
  */
 @SuppressWarnings("serial")
-public class Label extends AbstractComponent implements Property<String>,
-        Property.Viewer, Property.ValueChangeListener,
-        Property.ValueChangeNotifier, Comparable<Label> {
-
-    /**
-     * @deprecated As of 7.0, use {@link ContentMode#TEXT} instead
-     */
-    @Deprecated
-    public static final ContentMode CONTENT_TEXT = ContentMode.TEXT;
-
-    /**
-     * @deprecated As of 7.0, use {@link ContentMode#PREFORMATTED} instead
-     */
-    @Deprecated
-    public static final ContentMode CONTENT_PREFORMATTED = ContentMode.PREFORMATTED;
-
-    /**
-     * @deprecated As of 7.0, use {@link ContentMode#HTML} instead
-     */
-    @Deprecated
-    public static final ContentMode CONTENT_XHTML = ContentMode.HTML;
-
-    /**
-     * @deprecated As of 7.0, use {@link ContentMode#XML} instead
-     */
-    @Deprecated
-    public static final ContentMode CONTENT_XML = ContentMode.XML;
-
-    /**
-     * @deprecated As of 7.0, use {@link ContentMode#RAW} instead
-     */
-    @Deprecated
-    public static final ContentMode CONTENT_RAW = ContentMode.RAW;
-
-    /**
-     * @deprecated As of 7.0, use {@link ContentMode#TEXT} instead
-     */
-    @Deprecated
-    public static final ContentMode CONTENT_DEFAULT = ContentMode.TEXT;
-
-    /**
-     * A converter used to convert from the data model type to the field type
-     * and vice versa. Label type is always String.
-     */
-    private Converter<String, Object> converter = null;
-
-    private Property<String> dataSource = null;
+public class Label extends AbstractComponent {
 
     /**
      * Creates an empty Label.
@@ -110,47 +45,27 @@ public class Label extends AbstractComponent implements Property<String>,
     }
 
     /**
-     * Creates a new instance of Label with text-contents.
-     *
-     * @param content
-     */
-    public Label(String content) {
-        this(content, ContentMode.TEXT);
-    }
-
-    /**
-     * Creates a new instance of Label with text-contents read from given
-     * datasource.
-     *
-     * @param contentSource
-     */
-    public Label(Property contentSource) {
-        this(contentSource, ContentMode.TEXT);
-    }
-
-    /**
-     * Creates a new instance of Label with text-contents.
+     * Creates a new instance with text content mode and the given text.
      *
-     * @param content
-     * @param contentMode
+     * @param text
+     *            the text to set
      */
-    public Label(String content, ContentMode contentMode) {
-        setValue(content);
-        setContentMode(contentMode);
-        setWidth(100, Unit.PERCENTAGE);
+    public Label(String text) {
+        this(text, ContentMode.TEXT);
     }
 
     /**
-     * Creates a new instance of Label with text-contents read from given
-     * datasource.
+     * Creates a new instance with the given text and content mode.
      *
-     * @param contentSource
+     * @param text
+     *            the text to set
      * @param contentMode
+     *            the content mode to use
      */
-    public Label(Property contentSource, ContentMode contentMode) {
-        setPropertyDataSource(contentSource);
+    public Label(String text, ContentMode contentMode) {
+        setValue(text);
         setContentMode(contentMode);
-        setWidth(100, Unit.PERCENTAGE);
+        setWidth("100%");
     }
 
     @Override
@@ -164,126 +79,9 @@ public class Label extends AbstractComponent implements Property<String>,
     }
 
     /**
-     * Gets the value of the label.
-     * <p>
-     * The value of the label is the text that is shown to the end user.
-     * Depending on the {@link ContentMode} it is plain text or markup.
-     * </p>
-     *
-     * @return the value of the label.
-     */
-    @Override
-    public String getValue() {
-        if (getPropertyDataSource() == null) {
-            // Use internal value if we are running without a data source
-            return getState(false).text;
-        }
-        return getDataSourceValue();
-    }
-
-    /**
-     * Returns the current value of the data source converted using the current
-     * locale.
+     * Gets the content mode of the label.
      *
-     * @return
-     */
-    private String getDataSourceValue() {
-        return ConverterUtil.convertFromModel(
-                getPropertyDataSource().getValue(), String.class,
-                getConverter(), getLocale());
-    }
-
-    /**
-     * Set the value of the label. Value of the label is the XML contents of the
-     * label. Since Vaadin 7.2, changing the value of Label instance with that
-     * method will fire ValueChangeEvent.
-     *
-     * @param newStringValue
-     *            the New value of the label.
-     */
-    @Override
-    public void setValue(String newStringValue) {
-        if (getPropertyDataSource() == null) {
-
-            LabelState state = getState(false);
-            String oldTextValue = state.text;
-            if (!SharedUtil.equals(oldTextValue, newStringValue)) {
-                getState().text = newStringValue;
-                fireValueChange();
-            }
-        } else {
-            throw new IllegalStateException(
-                    "Label is only a Property.Viewer and cannot update its data source");
-        }
-    }
-
-    /**
-     * Gets the type of the Property.
-     *
-     * @see com.vaadin.v7.data.Property#getType()
-     */
-    @Override
-    public Class<String> getType() {
-        return String.class;
-    }
-
-    /**
-     * Gets the viewing data-source property.
-     *
-     * @return the data source property.
-     * @see com.vaadin.v7.data.Property.Viewer#getPropertyDataSource()
-     */
-    @Override
-    public Property getPropertyDataSource() {
-        return dataSource;
-    }
-
-    /**
-     * Sets the property as data-source for viewing. Since Vaadin 7.2 a
-     * ValueChangeEvent is fired if the new value is different from previous.
-     *
-     * @param newDataSource
-     *            the new data source Property
-     * @see com.vaadin.v7.data.Property.Viewer#setPropertyDataSource(com.vaadin.v7.data.Property)
-     */
-    @Override
-    public void setPropertyDataSource(Property newDataSource) {
-        // Stops listening the old data source changes
-        if (dataSource != null && Property.ValueChangeNotifier.class
-                .isAssignableFrom(dataSource.getClass())) {
-            ((Property.ValueChangeNotifier) dataSource).removeListener(this);
-        }
-
-        // Check if the current converter is compatible.
-        if (newDataSource != null
-                && !ConverterUtil.canConverterPossiblyHandle(
-                        getConverter(), getType(), newDataSource.getType())) {
-            // There is no converter set or there is no way the current
-            // converter can be compatible.
-            Converter<String, ?> c = ConverterUtil.getConverter(
-                    String.class, newDataSource.getType(), getSession());
-            setConverter(c);
-        }
-
-        dataSource = newDataSource;
-        if (dataSource != null) {
-            // Update the value from the data source. If data source was set to
-            // null, retain the old value
-            updateValueFromDataSource();
-        }
-
-        // Listens the new data source if possible
-        if (dataSource != null && Property.ValueChangeNotifier.class
-                .isAssignableFrom(dataSource.getClass())) {
-            ((Property.ValueChangeNotifier) dataSource).addListener(this);
-        }
-        markAsDirty();
-    }
-
-    /**
-     * Gets the content mode of the Label.
-     *
-     * @return the Content mode of the label.
+     * @return the content mode of the label
      *
      * @see ContentMode
      */
@@ -292,10 +90,10 @@ public class Label extends AbstractComponent implements Property<String>,
     }
 
     /**
-     * Sets the content mode of the Label.
+     * Sets the content mode of the label.
      *
      * @param contentMode
-     *            the New content mode of the label.
+     *            the content mode to set
      *
      * @see ContentMode
      */
@@ -307,248 +105,30 @@ public class Label extends AbstractComponent implements Property<String>,
         getState().contentMode = contentMode;
     }
 
-    /* Value change events */
-
-    private static final Method VALUE_CHANGE_METHOD;
-
-    static {
-        try {
-            VALUE_CHANGE_METHOD = Property.ValueChangeListener.class
-                    .getDeclaredMethod("valueChange",
-                            new Class[] { Property.ValueChangeEvent.class });
-        } catch (final java.lang.NoSuchMethodException e) {
-            // This should never happen
-            throw new java.lang.RuntimeException(
-                    "Internal error finding methods in Label");
-        }
-    }
-
-    /**
-     * Value change event
-     *
-     * @author Vaadin Ltd.
-     * @since 3.0
-     */
-    public static class ValueChangeEvent extends Component.Event
-            implements Property.ValueChangeEvent {
-
-        /**
-         * New instance of text change event
-         *
-         * @param source
-         *            the Source of the event.
-         */
-        public ValueChangeEvent(Label source) {
-            super(source);
-        }
-
-        /**
-         * Gets the Property that has been modified.
-         *
-         * @see com.vaadin.v7.data.Property.ValueChangeEvent#getProperty()
-         */
-        @Override
-        public Property getProperty() {
-            return (Property) getSource();
-        }
-    }
-
-    /**
-     * Adds the value change listener.
-     *
-     * @param listener
-     *            the Listener to be added.
-     * @see com.vaadin.v7.data.Property.ValueChangeNotifier#addListener(com.vaadin.v7.data.Property.ValueChangeListener)
-     */
-    @Override
-    public void addValueChangeListener(Property.ValueChangeListener listener) {
-        addListener(Label.ValueChangeEvent.class, listener,
-                VALUE_CHANGE_METHOD);
-    }
-
-    /**
-     * @deprecated As of 7.0, replaced by
-     *             {@link #addValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener)}
-     **/
-    @Override
-    @Deprecated
-    public void addListener(Property.ValueChangeListener listener) {
-        addValueChangeListener(listener);
-    }
-
-    /**
-     * Removes the value change listener.
-     *
-     * @param listener
-     *            the Listener to be removed.
-     * @see com.vaadin.v7.data.Property.ValueChangeNotifier#removeListener(com.vaadin.v7.data.Property.ValueChangeListener)
-     */
-    @Override
-    public void removeValueChangeListener(
-            Property.ValueChangeListener listener) {
-        removeListener(Label.ValueChangeEvent.class, listener,
-                VALUE_CHANGE_METHOD);
-    }
-
-    /**
-     * @deprecated As of 7.0, replaced by
-     *             {@link #removeValueChangeListener(com.vaadin.v7.data.Property.ValueChangeListener)}
-     **/
-    @Override
-    @Deprecated
-    public void removeListener(Property.ValueChangeListener listener) {
-        removeValueChangeListener(listener);
-    }
-
-    /**
-     * Emits the options change event.
-     */
-    protected void fireValueChange() {
-        // Set the error message
-        fireEvent(new Label.ValueChangeEvent(this));
-    }
-
     /**
-     * Listens the value change events from data source.
+     * Sets the text to be shown in the label.
      *
-     * @see com.vaadin.v7.data.Property.ValueChangeListener#valueChange(Property.ValueChangeEvent)
+     * @param value
+     *            the text to show in the label, null is converted to an empty
+     *            string
      */
-    @Override
-    public void valueChange(Property.ValueChangeEvent event) {
-        updateValueFromDataSource();
-    }
-
-    private void updateValueFromDataSource() {
-        // Update the internal value from the data source
-        String newConvertedValue = getDataSourceValue();
-        if (!SharedUtil.equals(newConvertedValue, getState(false).text)) {
-            getState().text = newConvertedValue;
-            fireValueChange();
-        }
-    }
-
-    @Override
-    public void attach() {
-        super.attach();
-        localeMightHaveChanged();
-    }
-
-    @Override
-    public void setLocale(Locale locale) {
-        super.setLocale(locale);
-        localeMightHaveChanged();
-    }
-
-    private void localeMightHaveChanged() {
-        if (getPropertyDataSource() != null) {
-            updateValueFromDataSource();
-        }
-    }
-
-    private String getComparableValue() {
-        String stringValue = getValue();
-        if (stringValue == null) {
-            stringValue = "";
-        }
-
-        if (getContentMode() == ContentMode.HTML
-                || getContentMode() == ContentMode.XML) {
-            return stripTags(stringValue);
+    public void setValue(String value) {
+        if (value == null) {
+            getState().text = "";
         } else {
-            return stringValue;
+            getState().text = value;
         }
-
-    }
-
-    /**
-     * Compares the Label to other objects.
-     *
-     * <p>
-     * Labels can be compared to other labels for sorting label contents. This
-     * is especially handy for sorting table columns.
-     * </p>
-     *
-     * <p>
-     * In RAW, PREFORMATTED and TEXT modes, the label contents are compared as
-     * is. In XML, UIDL and HTML modes, only CDATA is compared and tags ignored.
-     * If the other object is not a Label, its toString() return value is used
-     * in comparison.
-     * </p>
-     *
-     * @param other
-     *            the Other object to compare to.
-     * @return a negative integer, zero, or a positive integer as this object is
-     *         less than, equal to, or greater than the specified object.
-     * @see java.lang.Comparable#compareTo(java.lang.Object)
-     */
-    @Override
-    public int compareTo(Label other) {
-
-        String thisValue = getComparableValue();
-        String otherValue = other.getComparableValue();
-
-        return thisValue.compareTo(otherValue);
     }
 
     /**
-     * Strips the tags from the XML.
+     * Gets the text shown in the label.
      *
-     * @param xml
-     *            the String containing a XML snippet.
-     * @return the original XML without tags.
+     * @return the text shown in the label, not null
      */
-    private String stripTags(String xml) {
-
-        final StringBuffer res = new StringBuffer();
-
-        int processed = 0;
-        final int xmlLen = xml.length();
-        while (processed < xmlLen) {
-            int next = xml.indexOf('<', processed);
-            if (next < 0) {
-                next = xmlLen;
-            }
-            res.append(xml.substring(processed, next));
-            if (processed < xmlLen) {
-                next = xml.indexOf('>', processed);
-                if (next < 0) {
-                    next = xmlLen;
-                }
-                processed = next + 1;
-            }
-        }
-
-        return res.toString();
-    }
-
-    /**
-     * Gets the converter used to convert the property data source value to the
-     * label value.
-     *
-     * @return The converter or null if none is set.
-     */
-    public Converter<String, Object> getConverter() {
-        return converter;
-    }
-
-    /**
-     * Sets the converter used to convert the label value to the property data
-     * source type. The converter must have a presentation type of String.
-     *
-     * @param converter
-     *            The new converter to use.
-     */
-    public void setConverter(Converter<String, ?> converter) {
-        this.converter = (Converter<String, Object>) converter;
-        markAsDirty();
+    public String getValue() {
+        return getState(false).text;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see com.vaadin.ui.AbstractComponent#readDesign(org.jsoup.nodes .Element,
-     * com.vaadin.ui.declarative.DesignContext)
-     */
     @Override
     public void readDesign(Element design, DesignContext designContext) {
         super.readDesign(design, designContext);
@@ -567,11 +147,6 @@ public class Label extends AbstractComponent implements Property<String>,
         }
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see com.vaadin.ui.AbstractComponent#getCustomAttributes()
-     */
     @Override
     protected Collection<String> getCustomAttributes() {
         Collection<String> result = super.getCustomAttributes();
@@ -581,12 +156,6 @@ public class Label extends AbstractComponent implements Property<String>,
         return result;
     }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see com.vaadin.ui.AbstractComponent#writeDesign(org.jsoup.nodes.Element
-     * , com.vaadin.ui.declarative.DesignContext)
-     */
     @Override
     public void writeDesign(Element design, DesignContext designContext) {
         super.writeDesign(design, designContext);
@@ -594,9 +163,7 @@ public class Label extends AbstractComponent implements Property<String>,
         if (content != null) {
             switch (getContentMode()) {
             case TEXT:
-            case PREFORMATTED:
-            case XML:
-            case RAW: {
+            case PREFORMATTED: {
                 // FIXME This attribute is not enough to be able to restore the
                 // content mode in readDesign. The content mode should instead
                 // be written directly in the attribute and restored in
@@ -612,11 +179,8 @@ public class Label extends AbstractComponent implements Property<String>,
             case HTML:
                 design.html(content);
                 break;
-            default:
-                throw new IllegalStateException(
-                        "ContentMode " + getContentMode()
-                                + " is not supported by writeDesign");
             }
         }
     }
+
 }
index 7cbe33233ae03234b72f2e580ed1410da0045b7e..3822251de35a403b619e48f8b393755e58ca766d 100644 (file)
@@ -41,6 +41,7 @@ import com.vaadin.ui.AbstractComponent;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.HorizontalSplitPanel;
 import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
 import com.vaadin.ui.declarative.Design;
 import com.vaadin.ui.declarative.DesignContext;
 
@@ -151,7 +152,8 @@ public class AbstractComponentDeclarativeTest
 
     @Test
     public void testSizeAuto() {
-        String design = "<vaadin-label size-auto />";
+        component = new Panel();
+        String design = "<vaadin-panel size-auto />";
         component.setSizeUndefined();
         testRead(design, component);
         testWrite(design, component);
@@ -191,7 +193,8 @@ public class AbstractComponentDeclarativeTest
 
     @Test
     public void testWidthAuto() {
-        String design = "<vaadin-label height=\"20px\"/ width-auto />";
+        component = new Panel();
+        String design = "<vaadin-panel height=\"20px\"/ width-auto />";
         component.setCaptionAsHtml(false);
         component.setHeight("20px");
         component.setWidth(null);
diff --git a/server/src/test/java/com/vaadin/tests/server/component/label/LabelConvertersTest.java b/server/src/test/java/com/vaadin/tests/server/component/label/LabelConvertersTest.java
deleted file mode 100644 (file)
index 3c80f11..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2000-2016 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.server.component.label;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.vaadin.server.VaadinSession;
-import com.vaadin.tests.data.bean.Person;
-import com.vaadin.tests.util.AlwaysLockedVaadinSession;
-import com.vaadin.ui.Label;
-import com.vaadin.util.CurrentInstance;
-import com.vaadin.v7.data.Property;
-import com.vaadin.v7.data.util.MethodProperty;
-
-public class LabelConvertersTest {
-    @Before
-    public void clearExistingThreadLocals() {
-        // Ensure no previous test left some thread locals hanging
-        CurrentInstance.clearAll();
-    }
-
-    @Test
-    public void testLabelSetDataSourceLaterOn() {
-        Person p = Person.createTestPerson1();
-        Label l = new Label("My label");
-        assertEquals("My label", l.getValue());
-        assertNull(l.getConverter());
-        l.setPropertyDataSource(new MethodProperty<String>(p, "firstName"));
-        assertEquals(p.getFirstName(), l.getValue());
-        p.setFirstName("123");
-        assertEquals("123", l.getValue());
-    }
-
-    @Test
-    public void testIntegerDataSource() {
-        VaadinSession.setCurrent(new AlwaysLockedVaadinSession(null));
-        Label l = new Label("Foo");
-        Property ds = new MethodProperty<Integer>(Person.createTestPerson1(),
-                "age");
-        l.setPropertyDataSource(ds);
-        assertEquals(String.valueOf(Person.createTestPerson1().getAge()),
-                l.getValue());
-    }
-
-    @Test
-    public void testSetValueWithDataSource() {
-        try {
-            MethodProperty<String> property = new MethodProperty<String>(
-                    Person.createTestPerson1(), "firstName");
-            Label l = new Label(property);
-            l.setValue("Foo");
-            fail("setValue should throw an exception when a data source is set");
-        } catch (Exception e) {
-        }
-
-    }
-
-    @Test
-    public void testLabelWithoutDataSource() {
-        Label l = new Label("My label");
-        assertEquals("My label", l.getValue());
-        assertNull(l.getConverter());
-        assertNull(l.getPropertyDataSource());
-        l.setValue("New value");
-        assertEquals("New value", l.getValue());
-        assertNull(l.getConverter());
-        assertNull(l.getPropertyDataSource());
-    }
-}
index a8988ae0576c39fdb59f09c8d62d245a395e1ffd..ae8e5c6878a02317d6d7adeb2ccd4473da332bc4 100644 (file)
@@ -113,22 +113,6 @@ public class LabelDeclarativeTest extends DeclarativeTestBase<Label> {
         Assert.assertEquals("&amp; Test", root.html());
     }
 
-    @Test
-    public void testNullValue() {
-        Label label = new Label();
-        label.setValue(null);
-
-        label.setContentMode(ContentMode.TEXT);
-        Element root = new Element(Tag.valueOf("vaadin-label"), "");
-        label.writeDesign(root, new DesignContext());
-        Assert.assertEquals("", root.html());
-
-        label.setContentMode(ContentMode.HTML);
-        root = new Element(Tag.valueOf("vaadin-label"), "");
-        label.writeDesign(root, new DesignContext());
-        Assert.assertEquals("", root.html());
-    }
-
     /**
      * FIXME Using another content mode than TEXT OR HTML is currently not
      * supported and will cause the content mode to fallback without the users
diff --git a/server/src/test/java/com/vaadin/tests/server/component/label/LabelListenersTest.java b/server/src/test/java/com/vaadin/tests/server/component/label/LabelListenersTest.java
deleted file mode 100644 (file)
index 212187e..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.vaadin.tests.server.component.label;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.createStrictMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import org.easymock.EasyMock;
-import org.junit.Test;
-
-import com.vaadin.tests.server.component.AbstractListenerMethodsTestBase;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Label.ValueChangeEvent;
-import com.vaadin.v7.data.Property;
-import com.vaadin.v7.data.Property.ValueChangeListener;
-
-public class LabelListenersTest extends AbstractListenerMethodsTestBase {
-
-    @Test
-    public void testValueChangeListenerAddGetRemove() throws Exception {
-        testListenerAddGetRemove(Label.class, ValueChangeEvent.class,
-                ValueChangeListener.class);
-    }
-
-    @Test
-    public void testValueChangeFiredWhenSettingValue() {
-        Label underTest = new Label();
-
-        // setup the mock listener
-        ValueChangeListener mockListener = createStrictMock(
-                ValueChangeListener.class);
-        // record
-        mockListener.valueChange(
-                anyObject(com.vaadin.v7.data.Property.ValueChangeEvent.class));
-
-        // test
-        underTest.addValueChangeListener(mockListener);
-
-        replay(mockListener);
-        underTest.setValue("A new value");
-
-        verify(mockListener);
-
-    }
-
-    @Test
-    public void testValueChangeFiredWhenSettingPropertyDataSource() {
-        // setup
-        Label underTest = new Label();
-
-        Property mockProperty = EasyMock.createMock(Property.class);
-
-        ValueChangeListener mockListener = createStrictMock(
-                ValueChangeListener.class);
-        // record
-        mockListener.valueChange(
-                anyObject(com.vaadin.v7.data.Property.ValueChangeEvent.class));
-
-        expect(mockProperty.getType()).andReturn(String.class).atLeastOnce();
-        expect(mockProperty.getValue()).andReturn("Any").atLeastOnce();
-
-        // test
-
-        replay(mockListener, mockProperty);
-        underTest.addValueChangeListener(mockListener);
-        underTest.setPropertyDataSource(mockProperty);
-
-        verify(mockListener);
-
-    }
-
-    @Test
-    public void testValueChangeNotFiredWhenNotSettingValue() {
-        Label underTest = new Label();
-        // setup the mock listener
-        ValueChangeListener mockListener = createStrictMock(
-                ValueChangeListener.class);
-        // record: nothing to record
-
-        // test
-        underTest.addValueChangeListener(mockListener);
-        replay(mockListener);
-        verify(mockListener);
-    }
-
-    @Test
-    public void testNoValueChangeFiredWhenSettingPropertyDataSourceToNull() {
-        Label underTest = new Label();
-        // setup the mock Listener
-        ValueChangeListener mockListener = createStrictMock(
-                ValueChangeListener.class);
-        // record: nothing to record
-
-        // test
-        underTest.addValueChangeListener(mockListener);
-        underTest.setPropertyDataSource(null);
-
-        replay(mockListener);
-        verify(mockListener);
-    }
-
-}
diff --git a/server/src/test/java/com/vaadin/ui/LabelDataSourceTest.java b/server/src/test/java/com/vaadin/ui/LabelDataSourceTest.java
deleted file mode 100644 (file)
index e164534..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2000-2016 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.ui;
-
-import java.util.Locale;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.vaadin.server.VaadinSession;
-import com.vaadin.tests.util.AlwaysLockedVaadinSession;
-import com.vaadin.tests.util.MockUI;
-import com.vaadin.v7.data.util.ObjectProperty;
-
-public class LabelDataSourceTest {
-
-    Label label;
-    private static final String STRING_DS_VALUE = "String DatA source";
-    private static final int INTEGER_DS_VALUE = 1587;
-    private static final String INTEGER_STRING_VALUE_FI = "1 587";
-    private static final String INTEGER_STRING_VALUE_EN_US = "1,587";
-    private static final Object INTEGER_STRING_VALUE_DE = "1.587";
-    ObjectProperty<String> stringDataSource;
-    private ObjectProperty<Integer> integerDataSource;
-    VaadinSession vaadinSession;
-
-    @Before
-    public void setup() {
-        vaadinSession = new AlwaysLockedVaadinSession(null);
-        VaadinSession.setCurrent(vaadinSession);
-
-        label = new Label();
-        stringDataSource = new ObjectProperty<String>(STRING_DS_VALUE);
-        integerDataSource = new ObjectProperty<Integer>(INTEGER_DS_VALUE);
-    }
-
-    @Test
-    public void stringDataSource() {
-        label.setPropertyDataSource(stringDataSource);
-        Assert.assertEquals(STRING_DS_VALUE, label.getState().text);
-        Assert.assertEquals(STRING_DS_VALUE, label.getValue());
-        Assert.assertEquals(stringDataSource, label.getPropertyDataSource());
-        label.setPropertyDataSource(null);
-        Assert.assertEquals(STRING_DS_VALUE, label.getState().text);
-        Assert.assertEquals(STRING_DS_VALUE, label.getValue());
-        Assert.assertEquals(null, label.getPropertyDataSource());
-        label.setValue("foo");
-        Assert.assertEquals("foo", label.getState().text);
-        Assert.assertEquals("foo", label.getValue());
-        Assert.assertNull(label.getPropertyDataSource());
-
-    }
-
-    @Test
-    public void integerDataSourceFi() {
-        label.setLocale(new Locale("fi", "FI"));
-        label.setPropertyDataSource(integerDataSource);
-        Assert.assertEquals(INTEGER_STRING_VALUE_FI, label.getState().text);
-        Assert.assertEquals(INTEGER_STRING_VALUE_FI, label.getValue());
-        Assert.assertEquals(integerDataSource, label.getPropertyDataSource());
-    }
-
-    @Test
-    public void integerDataSourceEn() {
-        label.setLocale(new Locale("en", "US"));
-        label.setPropertyDataSource(integerDataSource);
-        Assert.assertEquals(INTEGER_STRING_VALUE_EN_US, label.getState().text);
-        Assert.assertEquals(INTEGER_STRING_VALUE_EN_US, label.getValue());
-        Assert.assertEquals(integerDataSource, label.getPropertyDataSource());
-    }
-
-    @Test
-    public void changeLocaleAfterDataSource() {
-        label.setLocale(new Locale("en", "US"));
-        label.setPropertyDataSource(integerDataSource);
-        label.setLocale(new Locale("fi", "FI"));
-        Assert.assertEquals(INTEGER_STRING_VALUE_FI, label.getState().text);
-        Assert.assertEquals(INTEGER_STRING_VALUE_FI, label.getValue());
-        Assert.assertEquals(integerDataSource, label.getPropertyDataSource());
-    }
-
-    @Test
-    public void setRemoveDataSource() {
-        label.setValue("before");
-        label.setPropertyDataSource(stringDataSource);
-        Assert.assertEquals(STRING_DS_VALUE, label.getValue());
-        label.setPropertyDataSource(null);
-        Assert.assertEquals(STRING_DS_VALUE, label.getValue());
-        label.setValue("after");
-        Assert.assertEquals("after", label.getValue());
-    }
-
-    @Test
-    public void attachToSessionWithDifferentLocale() {
-        label.setValue("before");
-        // label.setLocale(Locale.GERMANY);
-        label.setPropertyDataSource(integerDataSource);
-        UI ui = new MockUI();
-        ui.setLocale(Locale.GERMANY);
-        ui.setContent(label);
-        Assert.assertEquals(INTEGER_STRING_VALUE_DE, label.getState().text);
-    }
-}
diff --git a/server/src/test/java/com/vaadin/ui/LabelTest.java b/server/src/test/java/com/vaadin/ui/LabelTest.java
new file mode 100644 (file)
index 0000000..5bf082f
--- /dev/null
@@ -0,0 +1,25 @@
+package com.vaadin.ui;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class LabelTest {
+
+    @Test
+    public void emptyLabelValue() {
+        Assert.assertEquals("", new Label().getValue());
+    }
+
+    @Test
+    public void labelInitialValue() {
+        Assert.assertEquals("initial", new Label("initial").getValue());
+    }
+
+    @Test
+    public void labelSetValue() {
+        Label label = new Label();
+        label.setValue("foo");
+        Assert.assertEquals("foo", label.getValue());
+    }
+
+}
index 56a6ced22678170e5c8f913df0b13ef7044eae08..f5d31fe46f40eb746c56663d5adaf71b49f63397 100644 (file)
@@ -18,7 +18,7 @@ package com.vaadin.shared.ui.label;
 /**
  * Content modes defining how the client should interpret a Label's value.
  *
- * @since 7.0.0
+ * @since 7.0
  */
 public enum ContentMode {
     /**
@@ -35,23 +35,6 @@ public enum ContentMode {
     /**
      * Content mode, where the label contains HTML.
      */
-    HTML,
+    HTML
 
-    /**
-     * Content mode, where the label contains well-formed or well-balanced XML.
-     * This is handled in the same way as {@link #HTML}.
-     *
-     * @deprecated Use {@link #HTML} instead
-     */
-    @Deprecated
-    XML,
-
-    /**
-     * Legacy content mode, where the label contains RAW output. This is handled
-     * in exactly the same way as {@link #HTML}.
-     *
-     * @deprecated Use {@link #HTML} instead
-     */
-    @Deprecated
-    RAW;
 }
diff --git a/shared/src/main/java/com/vaadin/v7/shared/ui/label/ContentMode.java b/shared/src/main/java/com/vaadin/v7/shared/ui/label/ContentMode.java
new file mode 100644 (file)
index 0000000..e6292b4
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.v7.shared.ui.label;
+
+/**
+ * Content modes defining how the client should interpret a Label's value.
+ *
+ * @since 7.0.0
+ */
+public enum ContentMode {
+    /**
+     * Content mode, where the label contains only plain text.
+     */
+    TEXT,
+
+    /**
+     * Content mode, where the label contains preformatted text. In this mode
+     * newlines are preserved when rendered on the screen.
+     */
+    PREFORMATTED,
+
+    /**
+     * Content mode, where the label contains HTML.
+     */
+    HTML,
+
+    /**
+     * Content mode, where the label contains well-formed or well-balanced XML.
+     * This is handled in the same way as {@link #HTML}.
+     *
+     * @deprecated Use {@link #HTML} instead
+     */
+    @Deprecated
+    XML,
+
+    /**
+     * Legacy content mode, where the label contains RAW output. This is handled
+     * in exactly the same way as {@link #HTML}.
+     *
+     * @deprecated Use {@link #HTML} instead
+     */
+    @Deprecated
+    RAW;
+}
diff --git a/shared/src/main/java/com/vaadin/v7/shared/ui/label/LabelState.java b/shared/src/main/java/com/vaadin/v7/shared/ui/label/LabelState.java
new file mode 100644 (file)
index 0000000..64cc3b5
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.v7.shared.ui.label;
+
+import com.vaadin.shared.AbstractComponentState;
+
+public class LabelState extends AbstractComponentState {
+    {
+        primaryStyleName = "v-label";
+    }
+    public ContentMode contentMode = ContentMode.TEXT;
+    public String text = "";
+}
index d16afa123283c954de30f7739bec77dc45d16ea0..767084bc521dbd852b141fc08be2091813669cbd 100644 (file)
@@ -13,7 +13,6 @@ import com.vaadin.server.ExternalResource;
 import com.vaadin.server.LegacyApplication;
 import com.vaadin.server.Sizeable;
 import com.vaadin.shared.MouseEventDetails.MouseButton;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractComponentTest;
 import com.vaadin.ui.AbstractComponent;
 import com.vaadin.ui.Component;
@@ -27,6 +26,7 @@ import com.vaadin.v7.data.util.DefaultItemSorter;
 import com.vaadin.v7.data.util.HierarchicalContainer;
 import com.vaadin.v7.event.ItemClickEvent;
 import com.vaadin.v7.event.ItemClickEvent.ItemClickListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Tree;
 import com.vaadin.v7.ui.Tree.ItemStyleGenerator;
 
index 580faf9be39e17eb6f822b0459ebb773af9545d4..76ade94d60129ecab41059b607204d9271a1e526 100644 (file)
@@ -16,7 +16,6 @@
 
 package com.vaadin.tests;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Component.Event;
@@ -28,6 +27,7 @@ import com.vaadin.ui.Panel;
 import com.vaadin.ui.PasswordField;
 import com.vaadin.ui.TextField;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Field;
 import com.vaadin.v7.ui.Tree;
 
index 0be5305708d0dbdbecd3c8cbb012bca24a0dd669..6d6ea68e3ecf74199904f5a72bdb18f06df9ba2f 100644 (file)
@@ -17,7 +17,6 @@
 package com.vaadin.tests;
 
 import com.vaadin.server.ClassResource;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.Embedded;
 import com.vaadin.ui.GridLayout;
@@ -28,6 +27,7 @@ import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.TabSheet;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 
 /**
  * This example demonstrates layouts. Layouts are populated with sample Vaadin
index 4d60ea4279bcae65b34abceedefba81287fe8883..9953caa72327e2a0861ad5446ecb0b186e40a18f 100644 (file)
@@ -20,9 +20,9 @@ import java.net.MalformedURLException;
 import java.net.URL;
 
 import com.vaadin.server.LegacyApplication;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.VerticalLayout;
index 2617da651eb0d2e7994da7a2c98bcbbbe21923b5..8048c1997dd537a1dad4d821372782d4c3261b05 100644 (file)
@@ -20,13 +20,13 @@ import java.util.Date;
 import java.util.Map;
 
 import com.vaadin.server.UserError;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.CustomComponent;
 import com.vaadin.ui.DateField;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.TabSheet;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.ComboBox;
 import com.vaadin.v7.ui.Table;
 import com.vaadin.v7.ui.TextField;
index 44ec2927ab1585458e9014ab36486255943d410a..9ca07e25791c967e1a1474118d851260ee3aa4e1 100644 (file)
@@ -18,11 +18,11 @@ package com.vaadin.tests;
 
 import java.util.Date;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.AbstractOrderedLayout;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.CustomComponent;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.VerticalLayout;
index 5d22ddf2a4990455af4a12972cf653d23cc5fc8c..dd3e1d8fda501b021209f60009f664d13175112b 100644 (file)
@@ -18,12 +18,12 @@ package com.vaadin.tests;
 
 import java.util.Date;
 
-import com.vaadin.shared.ui.label.ContentMode;
 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.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 
 public class PerformanceTestSubTreeCaching extends CustomComponent {
index 43960ef70c3fc9321e19c3ba7e80cb27bfe7d2b2..1e5aca115f3a06ebc63f11f5aee1232eb5ae169c 100644 (file)
@@ -20,7 +20,6 @@ import com.vaadin.server.ClassResource;
 import com.vaadin.server.ErrorMessage;
 import com.vaadin.server.ExternalResource;
 import com.vaadin.server.UserError;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.AbstractComponent;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.CheckBox;
@@ -38,6 +37,7 @@ import com.vaadin.ui.TabSheet;
 import com.vaadin.ui.Upload;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.NativeSelect;
 import com.vaadin.v7.ui.OptionGroup;
 import com.vaadin.v7.ui.ProgressIndicator;
index 18db338f812db1681a65c7fbb260ecd38c8ac088..845542c1d3b052eec39219162a2482e87aff49b0 100644 (file)
@@ -20,9 +20,9 @@ import java.net.MalformedURLException;
 import java.net.URL;
 
 import com.vaadin.server.LegacyApplication;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.VerticalLayout;
index 5ad1032879d40923c519d94612620faa40cd73e4..bfaf702258169403f59afe6ccfe08596704b3fef 100644 (file)
@@ -16,7 +16,6 @@
 
 package com.vaadin.tests;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.CheckBox;
 import com.vaadin.ui.CustomComponent;
@@ -24,6 +23,7 @@ import com.vaadin.ui.Label;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.v7.data.Property.ValueChangeEvent;
 import com.vaadin.v7.data.Property.ValueChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.RichTextArea;
 
 /**
index 3f53686071af2f6ea4b556660e44b47cd058822f..cc694757ccb3782e019d36aebdfc9d2da5780291 100644 (file)
@@ -28,7 +28,6 @@ import java.lang.management.MemoryMXBean;
 
 import com.vaadin.server.LegacyApplication;
 import com.vaadin.server.StreamResource;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Label;
@@ -46,6 +45,7 @@ import com.vaadin.ui.Upload.StartedListener;
 import com.vaadin.ui.Upload.SucceededEvent;
 import com.vaadin.ui.Upload.SucceededListener;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.ProgressIndicator;
 
 public class TestForStyledUpload extends LegacyApplication
index 5014dcfac4c5f3359c99b591ba14ee0ef049737e..e9106caa7d7ef57cdd8c7434a92899df2af2d255 100644 (file)
@@ -29,7 +29,6 @@ import java.lang.management.ManagementFactory;
 import java.lang.management.MemoryMXBean;
 
 import com.vaadin.server.StreamResource;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.CheckBox;
@@ -45,6 +44,7 @@ import com.vaadin.ui.Upload.StartedEvent;
 import com.vaadin.ui.Upload.StartedListener;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.v7.data.Property.ValueChangeEvent;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.AbstractField;
 import com.vaadin.v7.ui.ProgressIndicator;
 import com.vaadin.v7.ui.Select;
index d04bbc7f4ae4ae4720a2f4e714e739a93caaf325..f11e62c9c1705411d0f8ae74d2887853216c2d81 100644 (file)
 
 package com.vaadin.tests;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.CustomComponent;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 
 public class TestIFrames extends CustomComponent {
 
index 7f5c6da809c4128394907232b8b6e8e299f40855..f648899a6b24588ae1185d6c8a328e37f6466d5d 100644 (file)
@@ -19,13 +19,13 @@ package com.vaadin.tests;
 import java.io.File;
 
 import com.vaadin.server.VaadinSession;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.util.SampleDirectory;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.v7.data.Item;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Tree;
 import com.vaadin.v7.ui.Tree.ExpandEvent;
 
index d2058fd88616544eb6bf8fd5bc397c1804aecc67..6afc3326fe4827322a929a01022bd4b4a525c70f 100644 (file)
@@ -19,13 +19,13 @@ package com.vaadin.tests;
 import java.util.LinkedList;
 import java.util.Random;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.v7.data.Property.ValueChangeEvent;
 import com.vaadin.v7.data.Property.ValueChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Select;
 
 public class UsingObjectsInSelect extends com.vaadin.server.LegacyApplication
index c3ba0adb0bcd2481428cd7dba8107fafcf0f61c7..15cd30108e4d695521de03676c7c543c5332c202 100644 (file)
@@ -1,9 +1,9 @@
 package com.vaadin.tests.application;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 
index e2e9488a1aabff1f57fc77c264f91d2bfe680a43..9af17a6d9cc4befedc1e0566cb950beea46d1884 100644 (file)
@@ -7,7 +7,6 @@ import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinServlet;
 import com.vaadin.server.WebBrowser;
 import com.vaadin.shared.communication.PushMode;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.shared.ui.ui.Transport;
 import com.vaadin.shared.ui.ui.UIState.PushConfigurationState;
 import com.vaadin.ui.Button;
@@ -15,6 +14,7 @@ import com.vaadin.ui.Component;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Notification;
 import com.vaadin.ui.Notification.Type;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.PushConfiguration;
 import com.vaadin.ui.UI;
 import com.vaadin.ui.VerticalLayout;
index f2d48a9ffaa9aadbf5c40e32417a5aeb5ce3b8e7..e1adf36056158a050aa543644e03208694966abb 100644 (file)
@@ -1,10 +1,10 @@
 package com.vaadin.tests.components;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 
 /**
  *
index 1b6a81551a9efe1a57fe3a5d536d69f1d7c1ee1a..8c166c33d6c05995e1123afe4ba862ad656da8b4 100644 (file)
@@ -1,9 +1,9 @@
 package com.vaadin.tests.components.button;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Label;
 
 public class ButtonMouseDetails extends TestBase {
index f4cc2e5560ce5662a6309b1812a0b85fedd479ef..6a62e023f85ac6499f5c182db680bd2a7b3eae88 100644 (file)
@@ -1,7 +1,6 @@
 package com.vaadin.tests.components.caption;
 
 import com.vaadin.server.ThemeResource;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.VaadinClasses;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.tests.util.Log;
@@ -11,6 +10,7 @@ import com.vaadin.ui.Label;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.v7.data.Property.ValueChangeEvent;
 import com.vaadin.v7.data.Property.ValueChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.ComboBox;
 
 public class IconsInCaption extends TestBase {
index 950634039f58fd1e423b0f4b254e0f1776ffb72c..3b3a9e87cb51759c047f11b74ffbf70e626d74f9 100644 (file)
@@ -29,7 +29,6 @@ import javax.imageio.ImageIO;
 import com.vaadin.server.StreamResource;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.shared.ui.colorpicker.Color;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Alignment;
 import com.vaadin.ui.CheckBox;
@@ -39,6 +38,7 @@ import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.AbstractColorPicker;
 import com.vaadin.v7.ui.ColorPicker;
 import com.vaadin.v7.ui.ColorPickerArea;
index 3fbe2d02a761f8476fe3404bf2680f234c5e6227..84141e07854bdcb617e51861817af94d49cbffa6 100644 (file)
@@ -6,11 +6,11 @@ import java.util.List;
 import com.vaadin.event.FieldEvents;
 import com.vaadin.event.FieldEvents.BlurEvent;
 import com.vaadin.event.FieldEvents.FocusEvent;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Label;
 import com.vaadin.v7.data.util.ObjectProperty;
+import com.vaadin.v7.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.ComboBox;
+import com.vaadin.v7.ui.Label;
 import com.vaadin.v7.ui.TextField;
 
 public class ComboFocusBlurEvents extends TestBase {
index 7e3c493c2d658b0504c6c4426885b0925d48b028..e6c70dafb60ea2b8f6bc2790103608bf69306f1a 100644 (file)
@@ -10,11 +10,11 @@ import com.vaadin.event.FieldEvents;
 import com.vaadin.event.FieldEvents.BlurEvent;
 import com.vaadin.event.FieldEvents.FocusEvent;
 import com.vaadin.server.VaadinSession;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Label;
 import com.vaadin.v7.data.util.ObjectProperty;
+import com.vaadin.v7.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.ComboBox;
+import com.vaadin.v7.ui.Label;
 import com.vaadin.v7.ui.ProgressIndicator;
 import com.vaadin.v7.ui.TextField;
 
@@ -75,6 +75,7 @@ public class ComboPushTiming extends TestBase {
 
     private void changeValue(final ComboBox cb) {
         executor.execute(new Runnable() {
+            @Override
             public void run() {
                 VaadinSession.getCurrent().lock();
                 try {
index df666e0ad6a446aa11ebb81c1c423aaa86689c98..2efe104b35bad6a642d31cd0052a5f88bb8bf34c 100644 (file)
@@ -1,11 +1,11 @@
 package com.vaadin.tests.components.customcomponent;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.CustomComponent;
 import com.vaadin.ui.Label;
 import com.vaadin.v7.data.Property.ValueChangeEvent;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.TextField;
 
 public class ClipContent extends TestBase {
index 2b660b8b0b40dc07c419ce2144d150b1d9e3fbe2..2e046127ac1151facc3afddbf4bfcbe1d44338c8 100644 (file)
@@ -5,7 +5,6 @@ import java.util.Date;
 import java.util.Locale;
 
 import com.vaadin.shared.ui.datefield.Resolution;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.tests.util.Log;
 import com.vaadin.ui.Button;
@@ -15,6 +14,7 @@ import com.vaadin.ui.Label;
 import com.vaadin.v7.data.Property.ValueChangeEvent;
 import com.vaadin.v7.data.Property.ValueChangeListener;
 import com.vaadin.v7.data.util.ObjectProperty;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.PopupDateField;
 
 @SuppressWarnings("serial")
index 45df14eea1d30cf0f8877bae75b014f7c2564f37..98e94c49ee944ee49cc3bf7fc03837ee0b266ae0 100644 (file)
@@ -4,15 +4,15 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.Locale;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 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.v7.data.Property;
 import com.vaadin.v7.data.util.ObjectProperty;
+import com.vaadin.v7.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.DateField;
+import com.vaadin.v7.ui.Label;
 import com.vaadin.v7.ui.PopupDateField;
 
 public class ValueThroughProperty extends TestBase {
index b3285e948c3cdcfb6634c627d30bc90617edfa27..9671b849f04897ff5a4deb204d76337bc93018f5 100644 (file)
@@ -27,11 +27,11 @@ import com.vaadin.event.dd.acceptcriteria.AcceptAll;
 import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
 import com.vaadin.server.StreamVariable;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.DragAndDropWrapper;
 import com.vaadin.ui.DragAndDropWrapper.WrapperTransferable;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Html5File;
 import com.vaadin.ui.Label;
 
index fc272545391a48109fd03e68d0ba07d920413a28..bec5eae9492178a073fb808ee76157d8d6a4f28e 100644 (file)
@@ -28,11 +28,11 @@ import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
 import com.vaadin.server.FontAwesome;
 import com.vaadin.server.StreamVariable;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUIWithLog;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.DragAndDropWrapper;
 import com.vaadin.ui.DragAndDropWrapper.WrapperTransferable;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Html5File;
 import com.vaadin.ui.Label;
 
index 93f559f4e71867a1bc7eddc9efdf708f1ed3c690..168cf25acc387f14ecacce52d309764d22cc47d3 100644 (file)
@@ -1,5 +1,6 @@
 package com.vaadin.tests.components.draganddropwrapper;
 
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.CssLayout;
 import com.vaadin.ui.DragAndDropWrapper;
@@ -14,7 +15,7 @@ public class TooltipHandlingWhenNotDefined extends TestBase {
         CssLayout wrapperLayout = new CssLayout();
         wrapperLayout.setWidth("100%");
 
-        Label label = new Label("Can I has the tooltip?", Label.CONTENT_XHTML);
+        Label label = new Label("Can I has the tooltip?", ContentMode.HTML);
         label.setId("tooltipLabel");
         label.setDescription("Good! Tooltip works!");
         label.setSizeUndefined();
index 22d8cf5097a32161bdcfadbb4384adcf45e04c5f..f80f219c95bc87c1484923dbf9589a6879a79f60 100644 (file)
@@ -19,11 +19,11 @@ import java.util.Collection;
 
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.tests.components.AbstractTestUI;
-import com.vaadin.ui.Label;
 import com.vaadin.v7.data.Validator;
 import com.vaadin.v7.data.Validator.InvalidValueException;
 import com.vaadin.v7.ui.Field;
 import com.vaadin.v7.ui.Grid;
+import com.vaadin.v7.ui.Label;
 
 public class GridWithLabelEditor extends AbstractTestUI {
 
index d70fd5ab4c14fb3cff7bfbcfca7c37e369413b5a..6c61e16402ab51011ccdf50cac12c8dcf8afd3f6 100644 (file)
@@ -37,12 +37,6 @@ public class LabelModes extends ComponentTestCase<Label> {
         l.setWidth(null);
         addTestComponent(l);
 
-        l = createLabel(
-                "This label                       contains\nnewlines and spaces\nand is in\nraw mode");
-        l.setContentMode(ContentMode.RAW);
-        l.setWidth(null);
-        addTestComponent(l);
-
     }
 
     private Label createLabel(String text, String caption) {
index 10bdd4051590863a88fae1708929bd0d0bb54428..bbce7b7744d877d4267b8dc801e2f1579129a565 100644 (file)
@@ -5,8 +5,8 @@ import com.vaadin.tests.components.AbstractTestUI;
 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.v7.data.util.ObjectProperty;
+import com.vaadin.v7.ui.Label;
 
 public class LabelPropertySourceValue extends AbstractTestUI {
     private Label label;
index 6dbc3398cb2294fcff09cc7371014bc3350871bf..0fe39fb6b19f8631e5c8301e8ad145fecebcc078 100644 (file)
@@ -7,10 +7,8 @@ import java.util.List;
 import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractComponentTest;
 import com.vaadin.ui.Label;
-import com.vaadin.v7.data.Property.ValueChangeListener;
 
-public class LabelTest extends AbstractComponentTest<Label>
-        implements ValueChangeListener {
+public class LabelTest extends AbstractComponentTest<Label> {
 
     private Command<Label, String> setValueCommand = new Command<Label, String>() {
 
@@ -20,18 +18,6 @@ public class LabelTest extends AbstractComponentTest<Label>
         }
     };
 
-    private Command<Label, Boolean> valueChangeListenerCommand = new Command<Label, Boolean>() {
-        @Override
-        public void execute(Label c, Boolean value, Object data) {
-            if (value) {
-                c.addListener(LabelTest.this);
-            } else {
-                c.removeListener(LabelTest.this);
-
-            }
-        }
-    };
-
     private Command<Label, ContentMode> contentModeCommand = new Command<Label, ContentMode>() {
         @Override
         public void execute(Label c, ContentMode value, Object data) {
@@ -50,7 +36,6 @@ public class LabelTest extends AbstractComponentTest<Label>
 
         createContentModeSelect(CATEGORY_FEATURES);
         createValueSelect(CATEGORY_FEATURES);
-        createValueChangeListener(CATEGORY_LISTENERS);
     }
 
     private void createValueSelect(String category) {
@@ -77,32 +62,10 @@ public class LabelTest extends AbstractComponentTest<Label>
         LinkedHashMap<String, ContentMode> options = new LinkedHashMap<String, ContentMode>();
         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.HTML);
-        options.put("XML", ContentMode.XML);
 
         createSelectAction("Content mode", category, options, "Text",
                 contentModeCommand);
     }
 
-    private void createValueChangeListener(String category) {
-        createBooleanAction("Value change listener", category, false,
-                valueChangeListenerCommand);
-    }
-
-    @Override
-    public void valueChange(com.vaadin.v7.data.Property.ValueChangeEvent event) {
-        Object o = event.getProperty().getValue();
-
-        // Distinguish between null and 'null'
-        String value = "null";
-        if (o != null) {
-            value = "'" + o.toString() + "'";
-        }
-
-        log(event.getClass().getSimpleName() + ", new value: " + value);
-    }
-
 }
index 0d296b1b92e40bc63dd11870239a748155b17545..c7f8f98289a6c6bbea59caffd5a6af26e31616f3 100644 (file)
@@ -1,9 +1,9 @@
 package com.vaadin.tests.components.label;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.ComponentTestCase;
 import com.vaadin.tests.util.LoremIpsum;
 import com.vaadin.ui.Label;
+import com.vaadin.shared.ui.label.ContentMode;
 
 public class Labels extends ComponentTestCase<Label> {
 
index b18b92dfc8784bbbabd336f59a491d0f08fcf3e7..65f542bd27507900690af6ddb55dd8abc238f674 100644 (file)
@@ -1,7 +1,6 @@
 package com.vaadin.tests.components.label;
 
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.AbstractLayout;
 import com.vaadin.ui.Accordion;
@@ -9,6 +8,7 @@ import com.vaadin.ui.GridLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.TabSheet;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 
 public class MarginsInLabels extends AbstractTestUI {
 
index 9c446befd9758eec226f913efd37215a0d85ba4b..2bce0ac8c9640181d7b9ed5c84e1f2853f317202 100644 (file)
@@ -4,10 +4,10 @@ import java.util.ArrayList;
 
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.shared.ui.MarginInfo;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Label;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.AbstractSelect;
 import com.vaadin.v7.ui.ListSelect;
 
index d430774b916501cf54a37fa554fa02f1fb6117c3..c1c9a25548cec739eda9163c085650f775c7b882 100644 (file)
@@ -1,10 +1,10 @@
 package com.vaadin.tests.components.optiongroup;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Label;
 import com.vaadin.v7.data.Property;
 import com.vaadin.v7.data.Property.ValueChangeEvent;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.OptionGroup;
 
 public class OptionGroupMultipleValueChange extends TestBase {
index fe8cafa1a11929e259d1be13e5dd9dcfcf7576b5..8011dcb9718213dab84878e07b43f06880aa66f7 100644 (file)
@@ -10,7 +10,6 @@ import com.vaadin.event.LayoutEvents.LayoutClickListener;
 import com.vaadin.server.ThemeResource;
 import com.vaadin.server.UserError;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.AbstractComponent;
 import com.vaadin.ui.AbstractOrderedLayout;
@@ -26,6 +25,7 @@ import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.themes.Reindeer;
 import com.vaadin.v7.data.Property.ValueChangeEvent;
 import com.vaadin.v7.data.Property.ValueChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.AbstractField;
 import com.vaadin.v7.ui.NativeSelect;
 import com.vaadin.v7.ui.TextField;
index 931ebfa5e165e56f3c9b215fcd5852ed08fba1e4..56d99b7d03a69bcbce6e4900254ad2aa59e76e5e 100644 (file)
@@ -1,7 +1,6 @@
 package com.vaadin.tests.components.orderedlayout;
 
 import com.vaadin.server.ThemeResource;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Alignment;
 import com.vaadin.ui.Button;
@@ -13,6 +12,7 @@ import com.vaadin.ui.Label;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.VerticalSplitPanel;
 import com.vaadin.ui.themes.Reindeer;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 
 public class LayoutResizeTest extends TestBase {
index 15ca0d521ed8c638d65deb031c476a7ea29223ac..d2f502d2c1dba30027dc6074936fd77ec0dccffe 100644 (file)
@@ -1,10 +1,10 @@
 package com.vaadin.tests.components.panel;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.CssLayout;
 import com.vaadin.ui.Label;
index 9e214e2598b32c587b06a1e05d56a04f7e1077cf..9d79d94c9c3e319cdf1bb7017177b9632367de79 100644 (file)
@@ -3,7 +3,6 @@ package com.vaadin.tests.components.popupview;
 import java.util.ArrayList;
 import java.util.List;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.tests.util.LoremIpsum;
 import com.vaadin.ui.Button;
@@ -16,6 +15,7 @@ import com.vaadin.ui.Panel;
 import com.vaadin.ui.PopupView;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.themes.BaseTheme;
+import com.vaadin.shared.ui.label.ContentMode;
 
 public class PopupViewOffScreen extends TestBase {
 
index 17a8c2ea51bb8cfa0f0f49677ac836c0d22d33ac..3914351735190532991c2e4f3aed349358f600a8 100644 (file)
@@ -1,11 +1,11 @@
 package com.vaadin.tests.components.richtextarea;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 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.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.RichTextArea;
 
 public class RichTextAreaEmptyString extends TestBase {
index ae4c83e78951aa2a7905c9fa340641f687560dc1..b0aef8ed9a8de4453f0a52de39b55377b3ea7659 100644 (file)
@@ -6,7 +6,6 @@ import java.io.OutputStream;
 import java.io.Serializable;
 import java.util.HashMap;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.tests.util.TestUtils;
 import com.vaadin.ui.Button;
@@ -16,6 +15,7 @@ import com.vaadin.ui.CheckBox;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.Label;
 import com.vaadin.v7.data.Container;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.DefaultFieldFactory;
 import com.vaadin.v7.ui.Field;
 import com.vaadin.v7.ui.Table;
index c6cba16f91c3856ea8cde7f99d9f535c1940c80d..fc0e15aa40f04930254b4f9fad9741e2a3b38967 100644 (file)
@@ -2,11 +2,11 @@ package com.vaadin.tests.components.table;
 
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.shared.MouseEventDetails;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Window;
 import com.vaadin.v7.data.util.BeanItemContainer;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 
 public class HeaderRightClickAfterDrag extends AbstractTestUI {
index d398c0c32559579dd631e95054676f4d19357224..7b6f9c858f369dd4d33545d306a70b9ec50e1739 100644 (file)
@@ -2,7 +2,6 @@ package com.vaadin.tests.components.table;
 
 import com.vaadin.server.ThemeResource;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.Embedded;
@@ -10,6 +9,7 @@ import com.vaadin.ui.Label;
 import com.vaadin.v7.data.Item;
 import com.vaadin.v7.event.ItemClickEvent;
 import com.vaadin.v7.event.ItemClickEvent.ItemClickListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 
 public class LabelEmbeddedClickThroughForTable extends AbstractTestUI {
index d0e592c0183a478cfef94cc29bc9dd5e234b13c1..3222491ab62e803a4eede8720ef93457195363fc 100644 (file)
@@ -17,8 +17,8 @@ package com.vaadin.tests.components.table;
 
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.tests.components.AbstractTestUI;
-import com.vaadin.ui.Label;
 import com.vaadin.v7.data.Item;
+import com.vaadin.v7.ui.Label;
 import com.vaadin.v7.ui.Table;
 
 public class SortLabelsInTable extends AbstractTestUI {
index cb6509c11059af2805237deb05577e4413752e5c..92d353daa14466fb7800e97fa17c370da1f3680e 100644 (file)
@@ -3,7 +3,6 @@ package com.vaadin.tests.components.table;
 import java.net.MalformedURLException;
 
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.AbsoluteLayout;
 import com.vaadin.ui.HorizontalLayout;
@@ -11,6 +10,7 @@ import com.vaadin.ui.Label;
 import com.vaadin.ui.TabSheet;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.themes.Reindeer;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 import com.vaadin.v7.ui.Table.Align;
 
index 267e8a5b03d04416777e869017b0c6bfc0fe0cee..1842449a572bc310769c4d16dd3b20c67bb727a5 100644 (file)
@@ -1,7 +1,6 @@
 package com.vaadin.tests.components.table;
 
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
@@ -10,6 +9,7 @@ import com.vaadin.ui.Component;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.v7.data.Item;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 
 public class TableMatchesMouseDownMouseUpElement extends AbstractTestUI {
index 963038661a39031ab8fdd4a376f61a3eddc7b4ba..e8797cbae17d5c237e1a915d90d561d6d40f9e0b 100644 (file)
@@ -1,10 +1,10 @@
 package com.vaadin.tests.components.table;
 
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Label;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 
 public class TableRowScrolledBottom extends AbstractTestUI {
index 898733129a3a3334840f635e26bb4515c4f4ea56..34ec27ea8e8b852005576e442914b65db4daa30a 100644 (file)
@@ -9,13 +9,13 @@ import com.vaadin.event.Action;
 import com.vaadin.event.Action.Handler;
 import com.vaadin.server.Resource;
 import com.vaadin.shared.ui.MultiSelectMode;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.shared.ui.table.CollapseMenuContent;
 import com.vaadin.shared.ui.table.TableConstants;
 import com.vaadin.tests.components.select.AbstractSelectTestCase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Label;
 import com.vaadin.v7.event.ItemClickEvent.ItemClickListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 import com.vaadin.v7.ui.Table.Align;
 import com.vaadin.v7.ui.Table.CellStyleGenerator;
index 3a0e2812e44fd46320f3477ddc3460bb86983223..4e30b13b978ff71a090997fe88bfc882ea478ba4 100644 (file)
@@ -1,5 +1,6 @@
 package com.vaadin.tests.components.treetable;
 
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Component;
@@ -32,7 +33,7 @@ public class ComponentsInTreeTable extends TestBase {
         tt.addItem(new Object[] { l, "VerticalLayout" }, 2);
 
         Label lbl = new Label("<b>foo</b><br/><i>bar</i>");
-        lbl.setContentMode(Label.CONTENT_XHTML);
+        lbl.setContentMode(ContentMode.HTML);
         tt.addItem(new Object[] { lbl, "Label" }, 3);
 
         tt.addItem(new Object[] { new Button("Test"), "Button" }, 4);
index aa4fee34f188e84ec4ee0edfd02a2202bdb2f452..47aded8f38c6529b328100076d524e537b814cd7 100644 (file)
@@ -6,12 +6,12 @@ import com.vaadin.server.UIClassSelectionEvent;
 import com.vaadin.server.UICreateEvent;
 import com.vaadin.server.UIProviderEvent;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUIProvider;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Link;
 import com.vaadin.ui.UI;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 
 public class LazyInitUIs extends AbstractTestUIProvider {
 
index 7f85b22facfc80a9ae3d34907f7ee6654439a3b8..aecd5375ebd308acdf04e7e30e09655a267e8894 100644 (file)
@@ -26,12 +26,12 @@ import java.io.StringWriter;
 import java.util.Date;
 
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.tests.util.Log;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Label;
 
 public class UISerialization extends AbstractTestUI {
index 70d83a466bfa430d06d60a441e492e87d323b4d8..6dfda77a65fa794d971366e88c749f262534d4af 100644 (file)
@@ -2,7 +2,6 @@ package com.vaadin.tests.components.window;
 
 import com.vaadin.server.Page.BrowserWindowResizeEvent;
 import com.vaadin.server.Page.BrowserWindowResizeListener;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestCase;
 import com.vaadin.tests.util.Log;
 import com.vaadin.tests.util.LoremIpsum;
@@ -13,6 +12,7 @@ import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 import com.vaadin.ui.Window.ResizeEvent;
 import com.vaadin.ui.Window.ResizeListener;
+import com.vaadin.shared.ui.label.ContentMode;
 
 public class LazyWindowResize extends AbstractTestCase {
 
index 76afc417d269e21785ba8bb026f3bf77f3b97390..22e9e3b7302614cd3529aea881ae19d8a29e3ea0 100644 (file)
@@ -19,11 +19,11 @@ package com.vaadin.tests.extensions;
 import com.vaadin.annotations.Theme;
 import com.vaadin.server.Responsive;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.CssLayout;
 import com.vaadin.ui.HorizontalSplitPanel;
 import com.vaadin.ui.Label;
+import com.vaadin.shared.ui.label.ContentMode;
 
 @Theme("tests-responsive")
 public class ResponsiveUI extends AbstractTestUI {
index 7ba28c46f7b8243a0275cfc346cce618850bf349..29b22b4a76a7017c4e8996944515aeb9216e9050 100644 (file)
@@ -20,7 +20,6 @@ import java.util.Map;
 
 import com.vaadin.annotations.Theme;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.shared.util.SharedUtil;
 import com.vaadin.tests.components.AbstractTestUIWithLog;
 import com.vaadin.ui.Alignment;
@@ -44,6 +43,7 @@ import com.vaadin.v7.data.fieldgroup.PropertyId;
 import com.vaadin.v7.data.util.BeanItem;
 import com.vaadin.v7.data.util.BeanItemContainer;
 import com.vaadin.v7.data.validator.IntegerRangeValidator;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.ComboBox;
 import com.vaadin.v7.ui.Field;
 import com.vaadin.v7.ui.TextField;
index c747272606e3fe85659287810093f2c21ea6b6b4..1f348b0cd2a0c85bb172aea3643c2f3df152b061 100644 (file)
@@ -24,7 +24,6 @@ import com.vaadin.server.Resource;
 import com.vaadin.server.ThemeResource;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.shared.Position;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Accordion;
 import com.vaadin.ui.Button;
@@ -45,6 +44,7 @@ import com.vaadin.ui.TabSheet;
 import com.vaadin.ui.TextField;
 import com.vaadin.ui.Upload;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.AbstractSelect;
 import com.vaadin.v7.ui.ComboBox;
 import com.vaadin.v7.ui.ListSelect;
index f09b790bc888ab3a847a6aa03280010cd160d15f..6b760d4a43744263b9755bf676f82b74c0642291 100644 (file)
@@ -27,7 +27,6 @@ import com.vaadin.server.VaadinPortletService;
 import com.vaadin.server.VaadinPortletSession;
 import com.vaadin.server.VaadinPortletSession.PortletListener;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Embedded;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Link;
@@ -37,6 +36,7 @@ import com.vaadin.ui.UI;
 import com.vaadin.ui.Upload;
 import com.vaadin.ui.Upload.Receiver;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.TextField;
 
 /**
index ba3716eec8ece2fb9a9547c01e68e0506b568fbc..fad186ea0dc6e2b5a612b865c45ae3e52233a4d4 100644 (file)
@@ -1,9 +1,9 @@
 package com.vaadin.tests.layouts;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.VerticalLayout;
index 72be418a22fdfacff741ca9ee043f6f918f42c19..7a4e132cf30bf3a12530f121f93c62ef80ddd5ff 100644 (file)
@@ -1,6 +1,5 @@
 package com.vaadin.tests.layouts;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.AbstractComponent;
 import com.vaadin.ui.Button;
@@ -12,6 +11,7 @@ import com.vaadin.ui.GridLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Layout;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.NativeSelect;
 import com.vaadin.v7.ui.TextField;
 
index ebdb8fdcff916355e66be7bae29646b787106910..713fb9165653473bb61d53f7f1f382565ef454d0 100644 (file)
@@ -16,7 +16,6 @@
 package com.vaadin.tests.layouts.layouttester;
 
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.AbstractComponent;
 import com.vaadin.ui.AbstractLayout;
 import com.vaadin.ui.Button;
@@ -24,6 +23,7 @@ import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Button.ClickListener;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 import com.vaadin.v7.ui.TextField;
 
index 6295bbce70dc5cfe228634a93f6ff01203fa726c..3124806a2e7bd3e730f5ce1994e93b08145b9db0 100644 (file)
 package com.vaadin.tests.layouts.layouttester;
 
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.AbstractLayout;
 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.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 
 /**
index 4c1d9a1b3a3077229b326ed5f1065df0039ef68a..e10c3974f8c392b2a7f108674a6bfe75176ba2c5 100644 (file)
@@ -19,7 +19,6 @@ import com.vaadin.server.Resource;
 import com.vaadin.server.ThemeResource;
 import com.vaadin.server.UserError;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.AbstractComponent;
 import com.vaadin.ui.AbstractLayout;
@@ -33,6 +32,7 @@ import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.TabSheet;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 import com.vaadin.v7.ui.TextField;
 
index a07e97ab1f69683ebb099c76c62edae796ae8f0e..6db347ba9a92c9fe7f5c2169d0683ac93c44103a 100644 (file)
 package com.vaadin.tests.layouts.layouttester.GridLayout;
 
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.AbstractComponent;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Button.ClickListener;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 import com.vaadin.v7.ui.TextField;
 
index ffd4e2abe1d234c47f3f1e452dead4c0f3e0f4c4..b6e88ea18eb7245383f39577ede3a503110f603c 100644 (file)
 package com.vaadin.tests.layouts.layouttester.GridLayout;
 
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.layouts.layouttester.BaseLayoutTestUI;
 import com.vaadin.ui.AbstractComponent;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.GridLayout;
 import com.vaadin.ui.Label;
 
index 8287f443a88aba121521d84f05a9a1286395e614..3a56e2397867fc8a6c2a4a559fae8ea7e1ae9a31 100644 (file)
 package com.vaadin.tests.layouts.layouttester.GridLayout;
 
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 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.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.Table;
 
 /**
index 9c7fe6378e63a6f5020aa21c4196d3287bd5e4c1..32fd52c63367826296f34ffdae04d290725f49b0 100644 (file)
@@ -7,7 +7,6 @@ import com.vaadin.server.Page.Styles;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.shared.ui.MarginInfo;
 import com.vaadin.shared.ui.colorpicker.Color;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Alignment;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.HorizontalLayout;
@@ -17,6 +16,7 @@ import com.vaadin.ui.UI;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.v7.data.Property.ValueChangeEvent;
 import com.vaadin.v7.data.Property.ValueChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.ColorPicker;
 import com.vaadin.v7.ui.ComboBox;
 import com.vaadin.v7.ui.TextArea;
index 2819eb00fe008a650d9351a7bf1a81e442202e6b..6b0d0d04038e71b1c31c26c371257b8568de3a89 100644 (file)
@@ -24,8 +24,8 @@ import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 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.v7.data.util.ObjectProperty;
 
 @Push
 public class BasicPush extends AbstractTestUI {
@@ -40,10 +40,8 @@ public class BasicPush extends AbstractTestUI {
 
     public static final String INCREMENT_BUTTON_ID = "incrementCounter";
 
-    private ObjectProperty<Integer> counter = new ObjectProperty<Integer>(0);
-
-    private ObjectProperty<Integer> counter2 = new ObjectProperty<Integer>(0);
-
+    private int clientCounter = 0;
+    private int serverCounter = 0;
     private final Timer timer = new Timer(true);
 
     private TimerTask task;
@@ -56,7 +54,7 @@ public class BasicPush extends AbstractTestUI {
         /*
          * Client initiated push.
          */
-        Label lbl = new Label(counter);
+        Label lbl = new Label("0");
         lbl.setCaption("Client counter (click 'increment' to update):");
         lbl.setId(CLIENT_COUNTER_ID);
         addComponent(lbl);
@@ -66,7 +64,8 @@ public class BasicPush extends AbstractTestUI {
 
                     @Override
                     public void buttonClick(ClickEvent event) {
-                        counter.setValue(counter.getValue() + 1);
+                        clientCounter++;
+                        lbl.setValue(String.valueOf(clientCounter));
                     }
                 });
         incrementButton.setId(INCREMENT_BUTTON_ID);
@@ -77,36 +76,31 @@ public class BasicPush extends AbstractTestUI {
         /*
          * Server initiated push.
          */
-        lbl = new Label(counter2);
-        lbl.setCaption("Server counter (updates each 3s by server thread) :");
-        lbl.setId(SERVER_COUNTER_ID);
-        addComponent(lbl);
-
-        Button startTimer = new Button("Start timer",
-                new Button.ClickListener() {
-
-                    @Override
-                    public void buttonClick(ClickEvent event) {
-                        counter2.setValue(0);
-                        if (task != null) {
-                            task.cancel();
-                        }
-                        task = new TimerTask() {
-
-                            @Override
-                            public void run() {
-                                access(new Runnable() {
-                                    @Override
-                                    public void run() {
-                                        counter2.setValue(
-                                                counter2.getValue() + 1);
-                                    }
-                                });
-                            }
-                        };
-                        timer.scheduleAtFixedRate(task, 3000, 3000);
-                    }
-                });
+        Label serverCounterLabel = new Label("0");
+        serverCounterLabel.setCaption(
+                "Server counter (updates each 3s by server thread) :");
+        serverCounterLabel.setId(SERVER_COUNTER_ID);
+        addComponent(serverCounterLabel);
+
+        Button startTimer = new Button("Start timer", (ClickListener) event -> {
+            serverCounter = 0;
+            serverCounterLabel.setValue(String.valueOf(serverCounter));
+            if (task != null) {
+                task.cancel();
+            }
+            task = new TimerTask() {
+
+                @Override
+                public void run() {
+                    access(() -> {
+                        serverCounter++;
+                        serverCounterLabel
+                                .setValue(String.valueOf(serverCounter));
+                    });
+                }
+            };
+            timer.scheduleAtFixedRate(task, 3000, 3000);
+        });
         startTimer.setId(START_TIMER_ID);
         addComponent(startTimer);
 
index ca4f325bceab282c6be34b3489a3ef49ae7f3858..79160818651eddcaa6df6c0b9ddf5ad90af90b0a 100644 (file)
@@ -25,14 +25,11 @@ import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Label;
-import com.vaadin.v7.data.util.ObjectProperty;
 
 public class PushConfiguration extends AbstractTestUI {
 
-    private ObjectProperty<Integer> counter = new ObjectProperty<Integer>(0);
-
-    private ObjectProperty<Integer> counter2 = new ObjectProperty<Integer>(0);
-
+    private int counter = 0;
+    private int counter2 = 0;
     private final Timer timer = new Timer(true);
 
     private final TimerTask task = new TimerTask() {
@@ -42,11 +39,13 @@ public class PushConfiguration extends AbstractTestUI {
             access(new Runnable() {
                 @Override
                 public void run() {
-                    counter2.setValue(counter2.getValue() + 1);
+                    counter2++;
+                    serverCounterLabel.setValue("" + counter2);
                 }
             });
         }
     };
+    private Label serverCounterLabel;
 
     @Override
     protected void setup(VaadinRequest request) {
@@ -56,32 +55,32 @@ public class PushConfiguration extends AbstractTestUI {
         /*
          * Client initiated push.
          */
-        Label lbl = new Label(counter);
-        lbl.setCaption("Client counter (click 'increment' to update):");
-        addComponent(lbl);
+        Label clientCounterLabel = new Label("0");
+        clientCounterLabel
+                .setCaption("Client counter (click 'increment' to update):");
+        addComponent(clientCounterLabel);
 
         addComponent(new Button("Increment", new Button.ClickListener() {
 
             @Override
             public void buttonClick(ClickEvent event) {
-                counter.setValue(counter.getValue() + 1);
+                clientCounterLabel.setValue("" + counter++);
             }
         }));
 
         spacer();
 
-        /*
-         * Server initiated push.
-         */
-        lbl = new Label(counter2);
-        lbl.setCaption("Server counter (updates each 1s by server thread) :");
-        addComponent(lbl);
+        serverCounterLabel = new Label(String.valueOf(counter2));
+        serverCounterLabel.setCaption(
+                "Server counter (updates each 1s by server thread) :");
+        addComponent(serverCounterLabel);
 
         addComponent(new Button("Reset", new Button.ClickListener() {
 
             @Override
             public void buttonClick(ClickEvent event) {
-                counter2.setValue(0);
+                counter2 = 0;
+                serverCounterLabel.setValue("0");
             }
         }));
     }
index 73fec4026c2a7a7b287830a1ae7922e4ad52dcff..65c4df06e8c7c3a9bb4501c18f43c0c457a88244 100644 (file)
@@ -23,7 +23,6 @@ import java.util.ArrayList;
 import java.util.Collections;
 
 import com.vaadin.shared.communication.PushMode;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.shared.ui.ui.Transport;
 import com.vaadin.ui.Alignment;
 import com.vaadin.ui.Button;
@@ -36,6 +35,7 @@ import com.vaadin.ui.UI;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.v7.data.Property.ValueChangeEvent;
 import com.vaadin.v7.data.Property.ValueChangeListener;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.NativeSelect;
 import com.vaadin.v7.ui.TextField;
 
index ab0e25156391cc2e5e7a48d3830c4c6a33e80812..e07abaa9f62df616041944ccf7b1efb3bc548f57 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright 2000-2016 Vaadin Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
@@ -258,13 +258,13 @@ public class SerializerTest extends AbstractTestUI {
         };
 
         rpc.sendEnum(ContentMode.TEXT,
-                new ContentMode[] { ContentMode.PREFORMATTED, ContentMode.XML },
-                Arrays.asList(ContentMode.HTML, ContentMode.RAW));
+                new ContentMode[] { ContentMode.PREFORMATTED,
+                        ContentMode.TEXT },
+                Arrays.asList(ContentMode.HTML, ContentMode.TEXT));
 
         state.contentMode = ContentMode.TEXT;
-        state.array = new ContentMode[] { ContentMode.PREFORMATTED,
-                ContentMode.XML };
-        state.list = Arrays.asList(ContentMode.HTML, ContentMode.RAW);
+        state.array = new ContentMode[] { ContentMode.PREFORMATTED };
+        state.list = Arrays.asList(ContentMode.HTML);
 
         rpc.sendDate(new Date(1));
         rpc.sendDate(new Date(2013 - 1900, 5 - 1, 31, 11, 12, 13));
index fec4399d6384e121a5ed7d801ad328d1b9de0ec3..7f2d42172e32d783f09fa91fa8b8fb38e6efbd38 100644 (file)
@@ -7,11 +7,11 @@ import java.util.UUID;
 import com.vaadin.server.Page;
 import com.vaadin.server.Page.Styles;
 import com.vaadin.server.StreamResource;
-import com.vaadin.shared.ui.label.ContentMode;
 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.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.TextArea;
 
 public class CSSInjectTest extends TestBase {
index ef394353af3a9ee1849ec581e574ca524090e623..245dcd8b035b9054107881831a38819144fa6a4d 100644 (file)
@@ -18,12 +18,12 @@ package com.vaadin.tests.themes.valo;
 import com.vaadin.navigator.View;
 import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
 import com.vaadin.shared.ui.MarginInfo;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.themes.ValoTheme;
+import com.vaadin.shared.ui.label.ContentMode;
 
 /**
  *
index 2bcbf1ab7a70ebb4bae8f040f6df6fd1bd7fd09f..70a87faf0c5f0b50c9369f35aa95b20cdbb2d056 100644 (file)
@@ -17,7 +17,6 @@ package com.vaadin.tests.themes.valo;
 
 import com.vaadin.navigator.View;
 import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
@@ -25,6 +24,7 @@ import com.vaadin.ui.PopupView;
 import com.vaadin.ui.PopupView.Content;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.themes.ValoTheme;
+import com.vaadin.shared.ui.label.ContentMode;
 
 public class PopupViews extends VerticalLayout implements View {
     public PopupViews() {
index db4e36e49a544f53dd07c5d11e94d26a9042177e..f8543d2aa68d09971ab621fd9a35729f52beb696 100644 (file)
@@ -34,7 +34,6 @@ import com.vaadin.server.ThemeResource;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinSession;
 import com.vaadin.server.WebBrowser;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Alignment;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
@@ -56,6 +55,7 @@ import com.vaadin.v7.data.Property.ValueChangeEvent;
 import com.vaadin.v7.data.Property.ValueChangeListener;
 import com.vaadin.v7.data.util.HierarchicalContainer;
 import com.vaadin.v7.data.util.IndexedContainer;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.NativeSelect;
 
 @Theme("tests-valo")
index 54e266fa405ad314a503bab511c3591e4a28a2e8..b8e6cccd9155731a42393f4675e4f2176504c260 100644 (file)
@@ -3,9 +3,9 @@ package com.vaadin.tests.util;
 import java.util.ArrayList;
 import java.util.List;
 
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 
 public class Log extends VerticalLayout {
     List<Label> eventLabels = new ArrayList<Label>();
index d2048b528f0aedd0561a6454a393e10a397176d2..fa898d708d81eaa8662e6f106b4d6fed10077843 100644 (file)
@@ -21,11 +21,11 @@ import java.io.File;
 import com.vaadin.server.SystemError;
 import com.vaadin.server.VaadinService;
 import com.vaadin.server.VaadinSession;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Panel;
 import com.vaadin.ui.VerticalLayout;
+import com.vaadin.shared.ui.label.ContentMode;
 
 /**
  * Provides sample directory based on application directory. If this fails then
index 2d78375ffece1b9ef50b42342d036285ee0614bf..7465989fb0d62b5f98b75a39499785994e97cb25 100644 (file)
  */
 package com.vaadin.tests.widgetset.client;
 
-import com.vaadin.client.ui.label.LabelConnector;
 import com.vaadin.shared.ui.Connect;
 import com.vaadin.shared.ui.MediaControl;
 import com.vaadin.tests.widgetset.server.ClientRpcClassComponent;
+import com.vaadin.v7.client.ui.label.LabelConnector;
 
 @Connect(ClientRpcClassComponent.class)
 public class ClientRpcClassConnector extends LabelConnector {
index 7a165d2dfab700ede556c7ff21480caec2bee930..4f2f9c1e9734e3ad8211e5b863a9f4ebc2de89fd 100644 (file)
@@ -1,7 +1,7 @@
 package com.vaadin.tests.widgetset.client;
 
-import com.vaadin.client.ui.label.LabelConnector;
 import com.vaadin.shared.ui.Connect;
+import com.vaadin.v7.client.ui.label.LabelConnector;
 
 /**
  * Connects server-side <code>IdTestLabel</code> component to client-side
index ed0152aebb89b6de72fe1f186f54cbeb189886c4..4d321a59725c5b7d2d3c3bfc664da02988c2a5aa 100644 (file)
@@ -20,7 +20,7 @@ import com.vaadin.shared.AbstractComponentState;
 
 /**
  * State class with the same simple name as
- * {@link com.vaadin.shared.ui.label.LabelState} to test #8683
+ * {@link com.vaadin.v7.shared.ui.label.LabelState} to test #8683
  *
  * @author Vaadin Ltd
  * @version @VERSION@
index 745af93b113dae117224fbd9a69e983c1490eb02..d2c55175543e615f1335e12a967b992ff7e07877 100644 (file)
@@ -32,8 +32,8 @@ import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.extensions.AbstractExtensionConnector;
 import com.vaadin.shared.Connector;
 import com.vaadin.shared.ui.Connect;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.widgetset.server.SerializerTestExtension;
+import com.vaadin.shared.ui.label.ContentMode;
 
 import elemental.json.Json;
 import elemental.json.JsonBoolean;
index 459a36865ea9da9f861f22390b9155a3f2038e09..91c65cccafd8af7d7ddca15a292e1cdce25f41b2 100644 (file)
@@ -19,7 +19,6 @@ import java.util.Arrays;
 
 import com.vaadin.annotations.Widgetset;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.widgetset.TestingWidgetSet;
 import com.vaadin.tests.widgetset.client.grid.GridClientColumnRendererConnector.Renderers;
 import com.vaadin.tests.widgetset.client.grid.GridClientColumnRendererRpc;
@@ -32,6 +31,7 @@ import com.vaadin.ui.NativeButton;
 import com.vaadin.ui.UI;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.v7.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.v7.ui.NativeSelect;
 
 @Widgetset(TestingWidgetSet.NAME)
index f3e3d3836a32ca9ac7548a4ccb08b9abd8821d56..db3bdd7a3669ab683216f4e279a48cf9e7b1aad5 100644 (file)
@@ -38,7 +38,7 @@ public class SerializerTestTest extends MultiBrowserTest {
         Assert.assertEquals("sendDate: January 1, 1970 12:00:00 AM UTC",
                 getLogRow(logRow++));
         Assert.assertEquals(
-                "sendEnum: PREFORMATTED, [HTML, RAW], [PREFORMATTED, XML]",
+                "sendEnum: PREFORMATTED, [HTML, TEXT], [PREFORMATTED, TEXT]",
                 getLogRow(logRow++));
         Assert.assertEquals(
                 "sendWrappedGenerics: {[SimpleTestBean(1)]={1=[SimpleTestBean(42)]}}",