aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2016-11-25 17:59:01 +0200
committerVaadin Code Review <review@vaadin.com>2016-11-28 07:58:06 +0000
commit051bac514c04c76c4291c106cd77dc9ea1255ac8 (patch)
tree7ed9bafe7ea61f96c3b03627b8e1414de6ce9412
parent0090a4823226a6ded49ea373a3cd4a317090f3d5 (diff)
downloadvaadin-framework-051bac514c04c76c4291c106cd77dc9ea1255ac8.tar.gz
vaadin-framework-051bac514c04c76c4291c106cd77dc9ea1255ac8.zip
Add state classes for Abstract(Single)ComponentContainer
Change-Id: I6939fbc6f7aed0897f50b19f85fb62d0b8368cc7
-rw-r--r--client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java6
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java11
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java14
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/AbstractComponentContainerState.java27
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/AbstractLayoutState.java10
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/AbstractSingleComponentContainerState.java28
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/loginform/LoginFormState.java4
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/panel/PanelState.java4
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java4
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/tabsheet/TabsheetState.java4
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java11
-rw-r--r--uitest/src/main/java/com/vaadin/tests/widgetset/client/UseStateFromHierachyChangeConnectorState.java4
12 files changed, 112 insertions, 15 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java
index c2bf273e7d..858b21d308 100644
--- a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java
@@ -60,6 +60,7 @@ import com.vaadin.shared.EventId;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.ComponentStateUtil;
import com.vaadin.shared.ui.TabIndexState;
+import com.vaadin.shared.ui.ui.UIState;
public abstract class AbstractComponentConnector extends AbstractConnector
implements ComponentConnector, HasErrorIndicator {
@@ -437,6 +438,11 @@ public abstract class AbstractComponentConnector extends AbstractConnector
// + Util.getSimpleName(getWidget())
// + " which does not implement Focusable");
}
+ } else if (getState() instanceof UIState
+ && getWidget() instanceof Focusable) {
+ // UI behaves like a component with TabIndexState
+ ((Focusable) getWidget())
+ .setTabIndex(((UIState) getState()).tabIndex);
}
Profiler.leave(
"AbstractComponentConnector.onStateChanged update tab index");
diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java b/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java
index f3cfd72931..a7b1051699 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java
@@ -23,6 +23,7 @@ import java.util.LinkedList;
import com.vaadin.server.ComponentSizeValidator;
import com.vaadin.shared.Registration;
+import com.vaadin.shared.ui.AbstractComponentContainerState;
/**
* Extension to {@link AbstractComponent} that defines the default
@@ -317,4 +318,14 @@ public abstract class AbstractComponentContainer extends AbstractComponent
public Iterator<Component> getComponentIterator() {
return iterator();
}
+
+ @Override
+ protected AbstractComponentContainerState getState() {
+ return (AbstractComponentContainerState) super.getState();
+ }
+
+ @Override
+ protected AbstractComponentContainerState getState(boolean markAsDirty) {
+ return (AbstractComponentContainerState) super.getState(markAsDirty);
+ }
}
diff --git a/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java b/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java
index fbb937e148..822ff0588c 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java
@@ -25,6 +25,7 @@ import com.vaadin.server.ComponentSizeValidator;
import com.vaadin.server.VaadinService;
import com.vaadin.server.VaadinSession;
import com.vaadin.shared.Registration;
+import com.vaadin.shared.ui.AbstractSingleComponentContainerState;
import com.vaadin.ui.declarative.DesignContext;
import com.vaadin.ui.declarative.DesignException;
@@ -352,4 +353,17 @@ public abstract class AbstractSingleComponentContainer extends AbstractComponent
design.appendChild(childNode);
}
}
+
+ @Override
+ protected AbstractSingleComponentContainerState getState() {
+ return (AbstractSingleComponentContainerState) super.getState();
+ }
+
+ @Override
+ protected AbstractSingleComponentContainerState getState(
+ boolean markAsDirty) {
+ return (AbstractSingleComponentContainerState) super.getState(
+ markAsDirty);
+ }
+
} \ No newline at end of file
diff --git a/shared/src/main/java/com/vaadin/shared/ui/AbstractComponentContainerState.java b/shared/src/main/java/com/vaadin/shared/ui/AbstractComponentContainerState.java
new file mode 100644
index 0000000000..fe5568a976
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/shared/ui/AbstractComponentContainerState.java
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+import com.vaadin.shared.AbstractComponentState;
+
+/**
+ * Default shared state implementation for AbstractComponentContainer.
+ *
+ * @since 8.0
+ */
+public class AbstractComponentContainerState extends AbstractComponentState {
+}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/AbstractLayoutState.java b/shared/src/main/java/com/vaadin/shared/ui/AbstractLayoutState.java
index 625806f9ef..65c8e1740b 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/AbstractLayoutState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/AbstractLayoutState.java
@@ -15,8 +15,12 @@
*/
package com.vaadin.shared.ui;
-import com.vaadin.shared.AbstractComponentState;
-
-public class AbstractLayoutState extends AbstractComponentState {
+/**
+ * Shared state for AbstractLayout.
+ *
+ * @author Vaadin Ltd
+ * @since 7.0
+ */
+public class AbstractLayoutState extends AbstractComponentContainerState {
}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/AbstractSingleComponentContainerState.java b/shared/src/main/java/com/vaadin/shared/ui/AbstractSingleComponentContainerState.java
new file mode 100644
index 0000000000..e5b9b61077
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/shared/ui/AbstractSingleComponentContainerState.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+import com.vaadin.shared.AbstractComponentState;
+
+/**
+ * Default shared state implementation for AbstractSingleComponentContainer.
+ *
+ * @since 8.0
+ */
+public class AbstractSingleComponentContainerState
+ extends AbstractComponentState {
+}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/loginform/LoginFormState.java b/shared/src/main/java/com/vaadin/shared/ui/loginform/LoginFormState.java
index 5dd89f7619..107e324209 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/loginform/LoginFormState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/loginform/LoginFormState.java
@@ -16,11 +16,11 @@
package com.vaadin.shared.ui.loginform;
-import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.Connector;
import com.vaadin.shared.communication.URLReference;
+import com.vaadin.shared.ui.AbstractSingleComponentContainerState;
-public class LoginFormState extends AbstractComponentState {
+public class LoginFormState extends AbstractSingleComponentContainerState {
public Connector userNameFieldConnector;
public Connector passwordFieldConnector;
public Connector loginButtonConnector;
diff --git a/shared/src/main/java/com/vaadin/shared/ui/panel/PanelState.java b/shared/src/main/java/com/vaadin/shared/ui/panel/PanelState.java
index 34793a827d..455a37d41a 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/panel/PanelState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/panel/PanelState.java
@@ -15,10 +15,10 @@
*/
package com.vaadin.shared.ui.panel;
-import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.annotations.NoLayout;
+import com.vaadin.shared.ui.AbstractSingleComponentContainerState;
-public class PanelState extends AbstractComponentState {
+public class PanelState extends AbstractSingleComponentContainerState {
{
primaryStyleName = "v-panel";
}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java b/shared/src/main/java/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java
index ef97926ed0..3e94f68457 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java
+++ b/shared/src/main/java/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.AbstractComponentState;
import com.vaadin.shared.Connector;
+import com.vaadin.shared.ui.AbstractComponentContainerState;
-public class AbstractSplitPanelState extends AbstractComponentState {
+public class AbstractSplitPanelState extends AbstractComponentContainerState {
public Connector firstChild = null;
public Connector secondChild = null;
public SplitterState splitterState = new SplitterState();
diff --git a/shared/src/main/java/com/vaadin/shared/ui/tabsheet/TabsheetState.java b/shared/src/main/java/com/vaadin/shared/ui/tabsheet/TabsheetState.java
index f1b01fc076..2755f48b43 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/tabsheet/TabsheetState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/tabsheet/TabsheetState.java
@@ -18,11 +18,11 @@ package com.vaadin.shared.ui.tabsheet;
import java.util.ArrayList;
import java.util.List;
-import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.annotations.DelegateToWidget;
import com.vaadin.shared.annotations.NoLayout;
+import com.vaadin.shared.ui.AbstractComponentContainerState;
-public class TabsheetState extends AbstractComponentState {
+public class TabsheetState extends AbstractComponentContainerState {
public static final String PRIMARY_STYLE_NAME = "v-tabsheet";
{
diff --git a/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java b/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java
index 82054e1d30..c2c7b5c27a 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/ui/UIState.java
@@ -21,10 +21,17 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import com.vaadin.shared.annotations.NoLayout;
import com.vaadin.shared.communication.PushMode;
-import com.vaadin.shared.ui.TabIndexState;
+import com.vaadin.shared.ui.AbstractSingleComponentContainerState;
+
+public class UIState extends AbstractSingleComponentContainerState {
+ /**
+ * The <i>tabulator index</i> of the field.
+ */
+ @NoLayout
+ public int tabIndex = 0;
-public class UIState extends TabIndexState {
public TooltipConfigurationState tooltipConfiguration = new TooltipConfigurationState();
public LoadingIndicatorConfigurationState loadingIndicatorConfiguration = new LoadingIndicatorConfigurationState();
public int pollInterval = -1;
diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/UseStateFromHierachyChangeConnectorState.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/UseStateFromHierachyChangeConnectorState.java
index 59cf0a02de..fda981a88b 100644
--- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/UseStateFromHierachyChangeConnectorState.java
+++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/UseStateFromHierachyChangeConnectorState.java
@@ -16,10 +16,10 @@
package com.vaadin.tests.widgetset.client;
-import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.Connector;
+import com.vaadin.shared.ui.AbstractSingleComponentContainerState;
public class UseStateFromHierachyChangeConnectorState
- extends AbstractComponentState {
+ extends AbstractSingleComponentContainerState {
public Connector child;
}