diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-11-26 07:33:40 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-11-26 07:33:40 +0000 |
commit | a53844761aecc890e87feff6ae7df622b4da55af (patch) | |
tree | f3e36de10b934dbe2a40f31054ce1d9adeb2897d /src/com/vaadin/terminal/gwt/client/ComponentDetail.java | |
parent | 6ff6757efad2bc44b19d458a3bea77a27e29772a (diff) | |
download | vaadin-framework-a53844761aecc890e87feff6ae7df622b4da55af.tar.gz vaadin-framework-a53844761aecc890e87feff6ae7df622b4da55af.zip |
optimized event map handling
svn changeset:10050/svn branch:event-framework-3234
Diffstat (limited to 'src/com/vaadin/terminal/gwt/client/ComponentDetail.java')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ComponentDetail.java | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ComponentDetail.java b/src/com/vaadin/terminal/gwt/client/ComponentDetail.java index 2d7f28dd4b..0384a69da3 100644 --- a/src/com/vaadin/terminal/gwt/client/ComponentDetail.java +++ b/src/com/vaadin/terminal/gwt/client/ComponentDetail.java @@ -2,12 +2,12 @@ package com.vaadin.terminal.gwt.client; import java.util.HashMap; +import com.google.gwt.core.client.JsArrayString; import com.vaadin.terminal.gwt.client.RenderInformation.FloatSize; import com.vaadin.terminal.gwt.client.RenderInformation.Size; class ComponentDetail { - private EventListenerRegister eventListenerRegister = new EventListenerRegister(); private Paintable component; private TooltipInfo tooltipInfo = new TooltipInfo(); private String pid; @@ -104,12 +104,38 @@ class ComponentDetail { } } - void registerEventListenersFromUIDL(UIDL uidl) { - eventListenerRegister.registerEventListenersFromUIDL(uidl); - } + private JsArrayString eventListeners; + + /** + * Stores the event listeners registered on server-side and passed along in + * the UIDL. + * + * @param componentUIDL + * The UIDL for the component + * @since 6.2 + */ + native void registerEventListenersFromUIDL(UIDL uidl) + /*-{ + this.@com.vaadin.terminal.gwt.client.ComponentDetail::eventListeners = uidl[1].eventListeners; + }-*/; + /** + * Checks if there is a registered server side listener for the event. + * + * @param eventIdentifier + * The identifier for the event + * @return true if at least one listener has been registered on server side + * for the event identified by eventIdentifier. + */ public boolean hasEventListeners(String eventIdentifier) { - return eventListenerRegister.hasEventListeners(eventIdentifier); + if (eventListeners != null) { + int l = eventListeners.length(); + for (int i = 0; i < l; i++) { + if (eventListeners.get(i).equals(eventIdentifier)) { + return true; + } + } + } + return false; } - } |