From 1fb40df8742791803e0a08328028bbbd67deb78b Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 20 Jan 2017 10:13:25 +0200 Subject: Overload AbstarctComponent.setDescription() with content mode parameter (#8252) * Overload AbstarctComponent.setDescription() with content mode parameter Fixes #8185 --- .../com/vaadin/shared/AbstractComponentState.java | 3 ++ .../java/com/vaadin/shared/ui/ContentMode.java | 40 ++++++++++++++++++++++ .../com/vaadin/shared/ui/label/ContentMode.java | 40 ---------------------- .../com/vaadin/shared/ui/label/LabelState.java | 1 + 4 files changed, 44 insertions(+), 40 deletions(-) create mode 100644 shared/src/main/java/com/vaadin/shared/ui/ContentMode.java delete mode 100644 shared/src/main/java/com/vaadin/shared/ui/label/ContentMode.java (limited to 'shared') diff --git a/shared/src/main/java/com/vaadin/shared/AbstractComponentState.java b/shared/src/main/java/com/vaadin/shared/AbstractComponentState.java index a60ae7aaf5..81f808f676 100644 --- a/shared/src/main/java/com/vaadin/shared/AbstractComponentState.java +++ b/shared/src/main/java/com/vaadin/shared/AbstractComponentState.java @@ -20,6 +20,7 @@ import java.util.List; import com.vaadin.shared.annotations.NoLayout; import com.vaadin.shared.communication.SharedState; +import com.vaadin.shared.ui.ContentMode; /** * Default shared state implementation for AbstractComponent. @@ -33,6 +34,8 @@ public class AbstractComponentState extends SharedState { public String width = ""; @NoLayout public String description = ""; + @NoLayout + public ContentMode descriptionContentMode = ContentMode.PREFORMATTED; // Note: for the caption, there is a difference between null and an empty // string! public String caption = null; diff --git a/shared/src/main/java/com/vaadin/shared/ui/ContentMode.java b/shared/src/main/java/com/vaadin/shared/ui/ContentMode.java new file mode 100644 index 0000000000..e283728425 --- /dev/null +++ b/shared/src/main/java/com/vaadin/shared/ui/ContentMode.java @@ -0,0 +1,40 @@ +/* + * 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.shared.ui; + +/** + * Content modes defining how the client should interpret a Label's value. + * + * @since 7.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 + +} 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 deleted file mode 100644 index f5d31fe46f..0000000000 --- a/shared/src/main/java/com/vaadin/shared/ui/label/ContentMode.java +++ /dev/null @@ -1,40 +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.shared.ui.label; - -/** - * Content modes defining how the client should interpret a Label's value. - * - * @since 7.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 - -} diff --git a/shared/src/main/java/com/vaadin/shared/ui/label/LabelState.java b/shared/src/main/java/com/vaadin/shared/ui/label/LabelState.java index 40a6399817..84e65449e6 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/label/LabelState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/label/LabelState.java @@ -16,6 +16,7 @@ package com.vaadin.shared.ui.label; import com.vaadin.shared.AbstractComponentState; +import com.vaadin.shared.ui.ContentMode; public class LabelState extends AbstractComponentState { { -- cgit v1.2.3