com.vaadin.client.
Class EventHelper
- java.lang.Object
-
- com.vaadin.client.EventHelper
-
public class EventHelper extends Object
Helper class for attaching/detaching handlers for Vaadin client side components, based on identifiers in UIDL. Helpers expect Paintables to be both listeners and sources for events. This helper cannot be used for more complex widgets.
Possible current registration is given as parameter. The returned registration (possibly the same as given, should be store for next update.
Pseudocode what helpers do:
if paintable has event listener in UIDL if registration is null register paintable as as handler for event return the registration else if registration is not null remove the handler from paintable return null
-
-
Constructor Summary
Constructors Constructor Description EventHelper()
-
Method Summary
All Methods Modifier and Type Method Description static <T extends ComponentConnector & com.google.gwt.event.dom.client.BlurHandler>
com.google.gwt.event.shared.HandlerRegistrationupdateBlurHandler(T connector, com.google.gwt.event.shared.HandlerRegistration handlerRegistration)
Adds or removes a blur handler depending on if the connector has blur listeners on the server side or not.
static <T extends ComponentConnector & com.google.gwt.event.dom.client.BlurHandler>
com.google.gwt.event.shared.HandlerRegistrationupdateBlurHandler(T connector, com.google.gwt.event.shared.HandlerRegistration handlerRegistration, com.google.gwt.user.client.ui.Widget widget)
Adds or removes a blur handler depending on if the connector has blur listeners on the server side or not.
static <T extends ComponentConnector & com.google.gwt.event.dom.client.FocusHandler>
com.google.gwt.event.shared.HandlerRegistrationupdateFocusHandler(T connector, com.google.gwt.event.shared.HandlerRegistration handlerRegistration)
Adds or removes a focus handler depending on if the connector has focus listeners on the server side or not.
static <T extends ComponentConnector & com.google.gwt.event.dom.client.FocusHandler>
com.google.gwt.event.shared.HandlerRegistrationupdateFocusHandler(T connector, com.google.gwt.event.shared.HandlerRegistration handlerRegistration, com.google.gwt.user.client.ui.Widget widget)
Adds or removes a focus handler depending on if the connector has focus listeners on the server side or not.
static <H extends com.google.gwt.event.shared.EventHandler>
com.google.gwt.event.shared.HandlerRegistrationupdateHandler(ComponentConnector connector, H handler, String eventIdentifier, com.google.gwt.event.shared.HandlerRegistration handlerRegistration, com.google.gwt.event.dom.client.DomEvent.Type<H> type, com.google.gwt.user.client.ui.Widget widget)
static <H extends com.google.gwt.event.shared.EventHandler,W extends com.google.gwt.user.client.ui.Widget>
com.google.gwt.event.shared.HandlerRegistrationupdateHandler(ComponentConnector connector, String eventIdentifier, com.google.gwt.event.shared.HandlerRegistration handlerRegistration, Supplier<com.google.gwt.event.shared.HandlerRegistration> handlerProvider)
Updates handler registered using
handlerProvider
: removes it if connector doesn't have anymoreeventIdentifier
using providedhandlerRegistration
and adds it via providedhandlerProvider
if connector has event listener witheventIdentifier
.
-
-
-
Method Detail
-
updateFocusHandler
public static <T extends ComponentConnector & com.google.gwt.event.dom.client.FocusHandler> com.google.gwt.event.shared.HandlerRegistration updateFocusHandler(T connector, com.google.gwt.event.shared.HandlerRegistration handlerRegistration)
Adds or removes a focus handler depending on if the connector has focus listeners on the server side or not.
Parameters:
connector
- The connector to update. Must implement focusHandler.handlerRegistration
- The old registration reference or null if no handler has been registered previouslyReturns:
a new registration handler that can be used to unregister the handler later
-
updateFocusHandler
public static <T extends ComponentConnector & com.google.gwt.event.dom.client.FocusHandler> com.google.gwt.event.shared.HandlerRegistration updateFocusHandler(T connector, com.google.gwt.event.shared.HandlerRegistration handlerRegistration, com.google.gwt.user.client.ui.Widget widget)
Adds or removes a focus handler depending on if the connector has focus listeners on the server side or not.
Parameters:
connector
- The connector to update. Must implement focusHandler.handlerRegistration
- The old registration reference or null if no handler has been registered previouslywidget
- The widget which emits focus eventsReturns:
a new registration handler that can be used to unregister the handler later
-
updateBlurHandler
public static <T extends ComponentConnector & com.google.gwt.event.dom.client.BlurHandler> com.google.gwt.event.shared.HandlerRegistration updateBlurHandler(T connector, com.google.gwt.event.shared.HandlerRegistration handlerRegistration)
Adds or removes a blur handler depending on if the connector has blur listeners on the server side or not.
Parameters:
connector
- The connector to update. Must implement BlurHandler.handlerRegistration
- The old registration reference or null if no handler has been registered previouslyReturns:
a new registration handler that can be used to unregister the handler later
-
updateBlurHandler
public static <T extends ComponentConnector & com.google.gwt.event.dom.client.BlurHandler> com.google.gwt.event.shared.HandlerRegistration updateBlurHandler(T connector, com.google.gwt.event.shared.HandlerRegistration handlerRegistration, com.google.gwt.user.client.ui.Widget widget)
Adds or removes a blur handler depending on if the connector has blur listeners on the server side or not.
Parameters:
connector
- The connector to update. Must implement BlurHandler.handlerRegistration
- The old registration reference or null if no handler has been registered previouslywidget
- The widget which emits blur eventsReturns:
a new registration handler that can be used to unregister the handler later
-
updateHandler
public static <H extends com.google.gwt.event.shared.EventHandler> com.google.gwt.event.shared.HandlerRegistration updateHandler(ComponentConnector connector, H handler, String eventIdentifier, com.google.gwt.event.shared.HandlerRegistration handlerRegistration, com.google.gwt.event.dom.client.DomEvent.Type<H> type, com.google.gwt.user.client.ui.Widget widget)
-
updateHandler
public static <H extends com.google.gwt.event.shared.EventHandler,W extends com.google.gwt.user.client.ui.Widget> com.google.gwt.event.shared.HandlerRegistration updateHandler(ComponentConnector connector, String eventIdentifier, com.google.gwt.event.shared.HandlerRegistration handlerRegistration, Supplier<com.google.gwt.event.shared.HandlerRegistration> handlerProvider)
Updates handler registered using
handlerProvider
: removes it if connector doesn't have anymoreeventIdentifier
using providedhandlerRegistration
and adds it via providedhandlerProvider
if connector has event listener witheventIdentifier
.Parameters:
connector
- connector to check event listener presenceeventIdentifier
- event identifier whose presence in the connector is checkedhandlerRegistration
- resulting handler registration to remove added handler in case of absence event listenerhandlerProvider
- the strategy to register handlerReturns:
handlerRegistration which should be used to remove registered handler via
handlerProvider
-
-