From 65981705b433d9ed02c667a2d838ced2b6314573 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 20 Nov 2012 12:04:11 +0200 Subject: Renamed ComponentState to AbstractComponentState (#9032) Change-Id: Ida6e0cb7064580be36627fd735d79b82ee69356d --- .../com/vaadin/shared/AbstractComponentState.java | 48 ++++++++++++++++++++++ shared/src/com/vaadin/shared/ComponentState.java | 47 --------------------- .../vaadin/shared/ui/AbstractEmbeddedState.java | 4 +- .../com/vaadin/shared/ui/AbstractLayoutState.java | 4 +- .../com/vaadin/shared/ui/AbstractMediaState.java | 4 +- .../shared/ui/BrowserPopupExtensionState.java | 4 +- .../com/vaadin/shared/ui/ComponentStateUtil.java | 14 +++---- .../vaadin/shared/ui/JavaScriptComponentState.java | 4 +- shared/src/com/vaadin/shared/ui/TabIndexState.java | 4 +- .../com/vaadin/shared/ui/button/ButtonState.java | 4 +- .../src/com/vaadin/shared/ui/label/LabelState.java | 4 +- .../src/com/vaadin/shared/ui/link/LinkState.java | 4 +- .../com/vaadin/shared/ui/menubar/MenuBarState.java | 4 +- .../src/com/vaadin/shared/ui/panel/PanelState.java | 4 +- .../vaadin/shared/ui/popupview/PopupViewState.java | 4 +- .../ui/splitpanel/AbstractSplitPanelState.java | 4 +- .../vaadin/shared/ui/tabsheet/TabsheetState.java | 4 +- shared/src/com/vaadin/shared/ui/ui/UIState.java | 4 +- 18 files changed, 85 insertions(+), 84 deletions(-) create mode 100644 shared/src/com/vaadin/shared/AbstractComponentState.java delete mode 100644 shared/src/com/vaadin/shared/ComponentState.java (limited to 'shared/src/com') diff --git a/shared/src/com/vaadin/shared/AbstractComponentState.java b/shared/src/com/vaadin/shared/AbstractComponentState.java new file mode 100644 index 0000000000..e1f7916874 --- /dev/null +++ b/shared/src/com/vaadin/shared/AbstractComponentState.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 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; + +import java.util.List; + +import com.vaadin.shared.communication.SharedState; +import com.vaadin.ui.AbstractComponent; + +/** + * Default shared state implementation for {@link AbstractComponent}. + * + * State classes of components should typically extend this class. + * + * @since 7.0 + */ +public class AbstractComponentState extends SharedState { + public String height = ""; + public String width = ""; + public boolean readOnly = false; + public boolean immediate = false; + public String description = ""; + // Note: for the caption, there is a difference between null and an empty + // string! + public String caption = null; + public List styles = null; + public String id = null; + public String primaryStyleName = null; + + // HTML formatted error message for the component + // TODO this could be an object with more information, but currently the UI + // only uses the message + public String errorMessage = null; +} diff --git a/shared/src/com/vaadin/shared/ComponentState.java b/shared/src/com/vaadin/shared/ComponentState.java deleted file mode 100644 index d8b5fec587..0000000000 --- a/shared/src/com/vaadin/shared/ComponentState.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2011 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; - -import java.util.List; - -import com.vaadin.shared.communication.SharedState; - -/** - * Default shared state implementation for UI components. - * - * State classes of concrete components should extend this class. - * - * @since 7.0 - */ -public class ComponentState extends SharedState { - public String height = ""; - public String width = ""; - public boolean readOnly = false; - public boolean immediate = false; - public String description = ""; - // Note: for the caption, there is a difference between null and an empty - // string! - public String caption = null; - public List styles = null; - public String id = null; - public String primaryStyleName = null; - - // HTML formatted error message for the component - // TODO this could be an object with more information, but currently the UI - // only uses the message - public String errorMessage = null; -} diff --git a/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java index 608152cc54..b7e689f8bc 100644 --- a/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java +++ b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java @@ -1,8 +1,8 @@ package com.vaadin.shared.ui; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class AbstractEmbeddedState extends ComponentState { +public class AbstractEmbeddedState extends AbstractComponentState { public static final String SOURCE_RESOURCE = "source"; diff --git a/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java b/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java index 4fc865626c..cbb02ceaa4 100644 --- a/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java +++ b/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java @@ -15,8 +15,8 @@ */ package com.vaadin.shared.ui; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class AbstractLayoutState extends ComponentState { +public class AbstractLayoutState extends AbstractComponentState { } \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/AbstractMediaState.java b/shared/src/com/vaadin/shared/ui/AbstractMediaState.java index 76d4e1b000..56c1989d5b 100644 --- a/shared/src/com/vaadin/shared/ui/AbstractMediaState.java +++ b/shared/src/com/vaadin/shared/ui/AbstractMediaState.java @@ -18,10 +18,10 @@ package com.vaadin.shared.ui; import java.util.ArrayList; import java.util.List; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.communication.URLReference; -public class AbstractMediaState extends ComponentState { +public class AbstractMediaState extends AbstractComponentState { public boolean showControls; public String altText; diff --git a/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java b/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java index a9ca6841d8..199de54f8f 100644 --- a/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java +++ b/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java @@ -16,9 +16,9 @@ package com.vaadin.shared.ui; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class BrowserPopupExtensionState extends ComponentState { +public class BrowserPopupExtensionState extends AbstractComponentState { public String target = "_blank"; diff --git a/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java b/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java index 33f841fa09..8106e8af98 100644 --- a/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java +++ b/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java @@ -2,7 +2,7 @@ package com.vaadin.shared.ui; import java.util.HashSet; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.communication.SharedState; public final class ComponentStateUtil { @@ -11,27 +11,27 @@ public final class ComponentStateUtil { // Util class is not instantiable } - public static final boolean isUndefinedWidth(ComponentState state) { + public static final boolean isUndefinedWidth(AbstractComponentState state) { return state.width == null || "".equals(state.width); } - public static final boolean isUndefinedHeight(ComponentState state) { + public static final boolean isUndefinedHeight(AbstractComponentState state) { return state.height == null || "".equals(state.height); } - public static final boolean hasDescription(ComponentState state) { + public static final boolean hasDescription(AbstractComponentState state) { return state.description != null && !"".equals(state.description); } - public static final boolean hasStyles(ComponentState state) { + public static final boolean hasStyles(AbstractComponentState state) { return state.styles != null && !state.styles.isEmpty(); } - public static final boolean isRelativeWidth(ComponentState state) { + public static final boolean isRelativeWidth(AbstractComponentState state) { return state.width != null && state.width.endsWith("%"); } - public static final boolean isRelativeHeight(ComponentState state) { + public static final boolean isRelativeHeight(AbstractComponentState state) { return state.height != null && state.height.endsWith("%"); } diff --git a/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java b/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java index 7a2eedd95d..1252b7f235 100644 --- a/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java +++ b/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java @@ -21,10 +21,10 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.JavaScriptConnectorState; -public class JavaScriptComponentState extends ComponentState implements +public class JavaScriptComponentState extends AbstractComponentState implements JavaScriptConnectorState { private Set callbackNames = new HashSet(); diff --git a/shared/src/com/vaadin/shared/ui/TabIndexState.java b/shared/src/com/vaadin/shared/ui/TabIndexState.java index a9cb56e5ed..bb446829be 100644 --- a/shared/src/com/vaadin/shared/ui/TabIndexState.java +++ b/shared/src/com/vaadin/shared/ui/TabIndexState.java @@ -15,7 +15,7 @@ */ package com.vaadin.shared.ui; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; /** * Interface implemented by state classes that support tab indexes. @@ -24,7 +24,7 @@ import com.vaadin.shared.ComponentState; * @since 7.0.0 * */ -public class TabIndexState extends ComponentState { +public class TabIndexState extends AbstractComponentState { /** * The tabulator index of the field. diff --git a/shared/src/com/vaadin/shared/ui/button/ButtonState.java b/shared/src/com/vaadin/shared/ui/button/ButtonState.java index e7272379bb..48feb596dc 100644 --- a/shared/src/com/vaadin/shared/ui/button/ButtonState.java +++ b/shared/src/com/vaadin/shared/ui/button/ButtonState.java @@ -16,14 +16,14 @@ package com.vaadin.shared.ui.button; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.ui.TabIndexState; /** * Shared state for {@link com.vaadin.ui.Button} and * {@link com.vaadin.ui.NativeButton}. * - * @see ComponentState + * @see AbstractComponentState * * @since 7.0 */ diff --git a/shared/src/com/vaadin/shared/ui/label/LabelState.java b/shared/src/com/vaadin/shared/ui/label/LabelState.java index 2cccc310aa..72cdcaad62 100644 --- a/shared/src/com/vaadin/shared/ui/label/LabelState.java +++ b/shared/src/com/vaadin/shared/ui/label/LabelState.java @@ -15,9 +15,9 @@ */ package com.vaadin.shared.ui.label; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class LabelState extends ComponentState { +public class LabelState extends AbstractComponentState { { primaryStyleName = "v-label"; } diff --git a/shared/src/com/vaadin/shared/ui/link/LinkState.java b/shared/src/com/vaadin/shared/ui/link/LinkState.java index 96b4600000..3e4436f5e3 100644 --- a/shared/src/com/vaadin/shared/ui/link/LinkState.java +++ b/shared/src/com/vaadin/shared/ui/link/LinkState.java @@ -1,8 +1,8 @@ package com.vaadin.shared.ui.link; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class LinkState extends ComponentState { +public class LinkState extends AbstractComponentState { { primaryStyleName = "v-link"; } diff --git a/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java b/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java index cf1ef99c06..192dfa2e0f 100644 --- a/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java +++ b/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java @@ -1,8 +1,8 @@ package com.vaadin.shared.ui.menubar; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class MenuBarState extends ComponentState { +public class MenuBarState extends AbstractComponentState { { primaryStyleName = "v-menubar"; } diff --git a/shared/src/com/vaadin/shared/ui/panel/PanelState.java b/shared/src/com/vaadin/shared/ui/panel/PanelState.java index 9d502df8fe..433bef72a5 100644 --- a/shared/src/com/vaadin/shared/ui/panel/PanelState.java +++ b/shared/src/com/vaadin/shared/ui/panel/PanelState.java @@ -15,9 +15,9 @@ */ package com.vaadin.shared.ui.panel; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class PanelState extends ComponentState { +public class PanelState extends AbstractComponentState { { primaryStyleName = "v-panel"; } diff --git a/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java b/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java index 0f83d0fcd4..2af516daac 100644 --- a/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java +++ b/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java @@ -1,8 +1,8 @@ package com.vaadin.shared.ui.popupview; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class PopupViewState extends ComponentState { +public class PopupViewState extends AbstractComponentState { public String html; public boolean hideOnMouseOut; diff --git a/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java index 8bddffdfd6..fb1b4c1262 100644 --- a/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java +++ b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java @@ -17,10 +17,10 @@ package com.vaadin.shared.ui.splitpanel; import java.io.Serializable; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; import com.vaadin.shared.Connector; -public class AbstractSplitPanelState extends ComponentState { +public class AbstractSplitPanelState extends AbstractComponentState { public Connector firstChild = null; public Connector secondChild = null; public SplitterState splitterState = new SplitterState(); diff --git a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java index a36acca9dc..c89a20bb22 100644 --- a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java +++ b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java @@ -1,8 +1,8 @@ package com.vaadin.shared.ui.tabsheet; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class TabsheetState extends ComponentState { +public class TabsheetState extends AbstractComponentState { { primaryStyleName = "v-tabsheet"; } diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java index 028218409f..59eff36435 100644 --- a/shared/src/com/vaadin/shared/ui/ui/UIState.java +++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java @@ -15,9 +15,9 @@ */ package com.vaadin.shared.ui.ui; -import com.vaadin.shared.ComponentState; +import com.vaadin.shared.AbstractComponentState; -public class UIState extends ComponentState { +public class UIState extends AbstractComponentState { { primaryStyleName = "v-ui"; } -- cgit v1.2.3