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 --- .../com/vaadin/shared/ui/label/ContentMode.java | 21 +------- .../com/vaadin/v7/shared/ui/label/ContentMode.java | 57 ++++++++++++++++++++++ .../com/vaadin/v7/shared/ui/label/LabelState.java | 26 ++++++++++ 3 files changed, 85 insertions(+), 19 deletions(-) create mode 100644 shared/src/main/java/com/vaadin/v7/shared/ui/label/ContentMode.java create mode 100644 shared/src/main/java/com/vaadin/v7/shared/ui/label/LabelState.java (limited to 'shared/src') diff --git a/shared/src/main/java/com/vaadin/shared/ui/label/ContentMode.java b/shared/src/main/java/com/vaadin/shared/ui/label/ContentMode.java index 56a6ced226..f5d31fe46f 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/label/ContentMode.java +++ b/shared/src/main/java/com/vaadin/shared/ui/label/ContentMode.java @@ -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 index 0000000000..e6292b47c5 --- /dev/null +++ b/shared/src/main/java/com/vaadin/v7/shared/ui/label/ContentMode.java @@ -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 index 0000000000..64cc3b5ee5 --- /dev/null +++ b/shared/src/main/java/com/vaadin/v7/shared/ui/label/LabelState.java @@ -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 = ""; +} -- cgit v1.2.3