aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/AbstractComponent.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-04-11 17:32:47 +0300
committerArtur Signell <artur@vaadin.com>2012-04-12 09:58:13 +0300
commit8b3e927419e61ff2eee43a4dcb4b832a3e22746b (patch)
treec09a7e04d8cf2cf2c2cf6e524ee330d36ced8033 /src/com/vaadin/ui/AbstractComponent.java
parent5689234f5db140a4bedd7636c4b0635126b27d61 (diff)
downloadvaadin-framework-8b3e927419e61ff2eee43a4dcb4b832a3e22746b.tar.gz
vaadin-framework-8b3e927419e61ff2eee43a4dcb4b832a3e22746b.zip
Button, NativeButton and CheckBox are no longer Vaadin6Components
Added FocusAndBlurServerRpc for sending focus and blur events to any component.
Diffstat (limited to 'src/com/vaadin/ui/AbstractComponent.java')
-rw-r--r--src/com/vaadin/ui/AbstractComponent.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/vaadin/ui/AbstractComponent.java b/src/com/vaadin/ui/AbstractComponent.java
index b54f5ee948..83e6f54ad3 100644
--- a/src/com/vaadin/ui/AbstractComponent.java
+++ b/src/com/vaadin/ui/AbstractComponent.java
@@ -33,6 +33,7 @@ import com.vaadin.terminal.Resource;
import com.vaadin.terminal.Terminal;
import com.vaadin.terminal.gwt.client.ComponentState;
import com.vaadin.terminal.gwt.client.communication.ClientRpc;
+import com.vaadin.terminal.gwt.client.communication.ServerRpc;
import com.vaadin.terminal.gwt.server.ClientMethodInvocation;
import com.vaadin.terminal.gwt.server.ComponentSizeValidator;
import com.vaadin.terminal.gwt.server.ResourceReference;
@@ -1536,9 +1537,17 @@ public abstract class AbstractComponent implements Component, MethodEventSource
* @param implementation
* RPC interface implementation. Also used to deduce the type.
*/
- protected <T> void registerRpc(T implementation) {
- Class<?>[] interfaces = implementation.getClass().getInterfaces();
- if (interfaces.length != 1) {
+ protected <T extends ServerRpc> void registerRpc(T implementation) {
+ Class<?> cls = implementation.getClass();
+ Class<?>[] interfaces = cls.getInterfaces();
+ while (interfaces.length == 0) {
+ // Search upwards until an interface is found. It must be found as T
+ // extends ServerRpc
+ cls = cls.getSuperclass();
+ interfaces = cls.getInterfaces();
+ }
+ if (interfaces.length != 1
+ || !(ServerRpc.class.isAssignableFrom(interfaces[0]))) {
throw new RuntimeException(
"Use registerRpc(T implementation, Class<T> rpcInterfaceType) if the Rpc implementation implements more than one interface");
}