From d13ca5506a2f7eb3dce75b98238bdb280ec7fa20 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 25 Aug 2016 19:37:57 +0300 Subject: Implement new Label Label does intentionally not implement HasValue as it cannot provide a value to a model Change-Id: I36b8e1794d64caf566fa802177051ae2eb637bf9 --- .../src/main/java/com/vaadin/v7/ui/Label.java | 624 +++++++++++++++++++++ .../component/label/LabelConvertersTest.java | 87 +++ .../server/component/label/LabelListenersTest.java | 103 ++++ .../java/com/vaadin/v7/ui/LabelDataSourceTest.java | 118 ++++ 4 files changed, 932 insertions(+) create mode 100644 compatibility-server/src/main/java/com/vaadin/v7/ui/Label.java create mode 100644 compatibility-server/src/test/java/com/vaadin/tests/server/component/label/LabelConvertersTest.java create mode 100644 compatibility-server/src/test/java/com/vaadin/tests/server/component/label/LabelListenersTest.java create mode 100644 compatibility-server/src/test/java/com/vaadin/v7/ui/LabelDataSourceTest.java (limited to 'compatibility-server/src') 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 index 0000000000..dc89fffabf --- /dev/null +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Label.java @@ -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} + * + *

+ * The contents of the label may contain simple formatting: + *

+ * The b,i,u and li tags can contain all the tags in + * the list recursively. + *

+ * + * @author Vaadin Ltd. + * @since 3.0 + */ +@SuppressWarnings("serial") +public class Label extends AbstractComponent implements Property, + Property.Viewer, Property.ValueChangeListener, + Property.ValueChangeNotifier, Comparable