diff options
author | Leif Åstrand <leif@vaadin.com> | 2015-01-09 08:29:54 +0200 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2015-01-12 13:00:20 +0000 |
commit | 2e0d4f149a9b02e38fe32411d66b715714bd526a (patch) | |
tree | 51b1e7d821231d743c855c4ccc6c7dad929ad553 /shared | |
parent | d7dbc0fb1b863089108035cd9a4094aacbdbd290 (diff) | |
download | vaadin-framework-2e0d4f149a9b02e38fe32411d66b715714bd526a.tar.gz vaadin-framework-2e0d4f149a9b02e38fe32411d66b715714bd526a.zip |
Add @BackgroundMessage annotation (#15373)
Change-Id: Id5367b7b1ef4b7dbabfd58902ac6134222e641ba
Diffstat (limited to 'shared')
4 files changed, 41 insertions, 0 deletions
diff --git a/shared/src/com/vaadin/shared/annotations/BackgroundMessage.java b/shared/src/com/vaadin/shared/annotations/BackgroundMessage.java new file mode 100644 index 0000000000..885c0de4d2 --- /dev/null +++ b/shared/src/com/vaadin/shared/annotations/BackgroundMessage.java @@ -0,0 +1,35 @@ +/* + * Copyright 2000-2014 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.annotations; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +/** + * Annotation used to mark server RPC methods that perform background tasks that + * are transparent to the user. The framework will show a loading indicator when + * sending requests for RPC methods that are not marked with this annotation. + * The loading indicator is hidden once a response is received. + * + * @since + * @author Vaadin Ltd + */ +@Target(ElementType.METHOD) +@Documented +public @interface BackgroundMessage { + // Just an empty marker annotation +} diff --git a/shared/src/com/vaadin/shared/data/DataRequestRpc.java b/shared/src/com/vaadin/shared/data/DataRequestRpc.java index 773a82fa9a..c2a13d470c 100644 --- a/shared/src/com/vaadin/shared/data/DataRequestRpc.java +++ b/shared/src/com/vaadin/shared/data/DataRequestRpc.java @@ -16,6 +16,7 @@ package com.vaadin.shared.data; +import com.vaadin.shared.annotations.BackgroundMessage; import com.vaadin.shared.annotations.Delayed; import com.vaadin.shared.communication.ServerRpc; @@ -39,6 +40,7 @@ public interface DataRequestRpc extends ServerRpc { * @param cacheSize * the number of cached rows */ + @BackgroundMessage public void requestRows(int firstRowIndex, int numberOfRows, int firstCachedRowIndex, int cacheSize); diff --git a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorServerRpc.java b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorServerRpc.java index dd437094c7..54153005e3 100644 --- a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorServerRpc.java +++ b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorServerRpc.java @@ -15,8 +15,10 @@ */ package com.vaadin.shared.ui.progressindicator; +import com.vaadin.shared.annotations.BackgroundMessage; import com.vaadin.shared.communication.ServerRpc; public interface ProgressIndicatorServerRpc extends ServerRpc { + @BackgroundMessage public void poll(); } diff --git a/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java b/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java index 8227415e58..20e4dbdf4c 100644 --- a/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java +++ b/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java @@ -15,6 +15,7 @@ */ package com.vaadin.shared.ui.ui; +import com.vaadin.shared.annotations.BackgroundMessage; import com.vaadin.shared.annotations.Delayed; import com.vaadin.shared.communication.ServerRpc; import com.vaadin.shared.ui.ClickRpc; @@ -27,6 +28,7 @@ public interface UIServerRpc extends ClickRpc, ServerRpc { @Delayed(lastOnly = true) public void scroll(int scrollTop, int scrollLeft); + @BackgroundMessage @Delayed(lastOnly = true) /* * @Delayed just to get lastOnly semantics, sendPendingVariableChanges() |