summaryrefslogtreecommitdiffstats
path: root/compatibility-client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-08-22 13:24:19 +0300
committerArtur Signell <artur@vaadin.com>2016-08-22 13:06:44 +0000
commita6873053f005c195c5e43211761c5f936be14a4e (patch)
tree2e29f966b48d592402f0e20b5a87330a201bb841 /compatibility-client
parentc6b44ac8adc9b2ffd6290c98643a633f405dd6c6 (diff)
downloadvaadin-framework-a6873053f005c195c5e43211761c5f936be14a4e.tar.gz
vaadin-framework-a6873053f005c195c5e43211761c5f936be14a4e.zip
Move ProgressBar/ProgressIndicator to compatibility package
Change-Id: I9d8ef17fc4bd903ad6c4e258b800b72029e507fd
Diffstat (limited to 'compatibility-client')
-rw-r--r--compatibility-client/src/main/java/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java56
-rw-r--r--compatibility-client/src/main/java/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java75
2 files changed, 131 insertions, 0 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java b/compatibility-client/src/main/java/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java
new file mode 100644
index 0000000000..1fd9a2f985
--- /dev/null
+++ b/compatibility-client/src/main/java/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java
@@ -0,0 +1,56 @@
+/*
+ * 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.client.ui.progressindicator;
+
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.client.ui.AbstractFieldConnector;
+import com.vaadin.client.ui.VProgressBar;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.progressindicator.ProgressBarState;
+import com.vaadin.v7.ui.ProgressBar;
+
+/**
+ * Connector for {@link VProgressBar}.
+ *
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+@Connect(ProgressBar.class)
+public class ProgressBarConnector extends AbstractFieldConnector {
+
+ public ProgressBarConnector() {
+ super();
+ }
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+ getWidget().setIndeterminate(getState().indeterminate);
+ getWidget().setState(getState().state);
+ }
+
+ @Override
+ public ProgressBarState getState() {
+ return (ProgressBarState) super.getState();
+ }
+
+ @Override
+ public VProgressBar getWidget() {
+ return (VProgressBar) super.getWidget();
+ }
+
+}
diff --git a/compatibility-client/src/main/java/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java b/compatibility-client/src/main/java/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
new file mode 100644
index 0000000000..ff4802d2f3
--- /dev/null
+++ b/compatibility-client/src/main/java/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
@@ -0,0 +1,75 @@
+/*
+ * 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.client.ui.progressindicator;
+
+import com.google.gwt.user.client.Timer;
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.client.ui.VProgressBar;
+import com.vaadin.client.ui.VProgressIndicator;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.progressindicator.ProgressIndicatorServerRpc;
+import com.vaadin.shared.ui.progressindicator.ProgressIndicatorState;
+import com.vaadin.v7.ui.ProgressIndicator;
+
+/**
+ * Connector for {@link VProgressBar} with polling support.
+ *
+ * @since 7.0
+ * @author Vaadin Ltd
+ * @deprecated as of 7.1, use {@link ProgressBarConnector} combined with server
+ * push or UI polling.
+ */
+@Connect(ProgressIndicator.class)
+@Deprecated
+public class ProgressIndicatorConnector extends ProgressBarConnector {
+
+ @Override
+ public ProgressIndicatorState getState() {
+ return (ProgressIndicatorState) super.getState();
+ }
+
+ private Timer poller = new Timer() {
+
+ @Override
+ public void run() {
+ getRpcProxy(ProgressIndicatorServerRpc.class).poll();
+ }
+
+ };
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+
+ if (isEnabled()) {
+ poller.scheduleRepeating(getState().pollingInterval);
+ } else {
+ poller.cancel();
+ }
+ }
+
+ @Override
+ public VProgressIndicator getWidget() {
+ return (VProgressIndicator) super.getWidget();
+ }
+
+ @Override
+ public void onUnregister() {
+ super.onUnregister();
+ poller.cancel();
+ }
+}