de.novanic.eventservice.client.event
Interface RemoteEventService

All Known Implementing Classes:
DefaultRemoteEventService

public interface RemoteEventService

The RemoteEventService supports listening to the server via RemoteEventListeners (RemoteEventListener). It keeps a connection to the server. When an event occurred at the server, the RemoteEventService informs the RemoteEventListeners about the event and starts listening at the server again. When no RemoteEventListeners registered anymore, the RemoteEventService stops listening till new RemoteEventListeners are registered. The listening works with a domain/context scope. See the documentation/manual to get more information about the listening concept.

Author:
sstrohschein
Date: 09.08.2008
Time: 22:22:14

Method Summary
 void addListener(Domain aDomain, RemoteEventListener aRemoteListener)
          Adds a listener for a domain.
 void addListener(Domain aDomain, RemoteEventListener aRemoteListener, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Adds a listener for a domain.
 void addListener(Domain aDomain, RemoteEventListener aRemoteListener, EventFilter anEventFilter)
          Adds a listener for a domain.
 void addListener(Domain aDomain, RemoteEventListener aRemoteListener, EventFilter anEventFilter, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Adds a listener for a domain.
 void addUnlistenListener(UnlistenEventListener.Scope anUnlistenScope, UnlistenEventListener anUnlistenEventListener, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Registers an UnlistenEventListener to listen for all user/client domain deregistrations and timeouts.
 void addUnlistenListener(UnlistenEventListener.Scope anUnlistenScope, UnlistenEventListener anUnlistenEventListener, UnlistenEvent anUnlistenEvent, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Registers an UnlistenEventListener to listen for all user/client domain deregistrations and timeouts.
 void addUnlistenListener(UnlistenEventListener anUnlistenEventListener, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Registers an UnlistenEventListener to listen for all user/client domain deregistrations and timeouts.
 void addUnlistenListener(UnlistenEventListener anUnlistenEventListener, UnlistenEvent anUnlistenEvent, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Registers an UnlistenEventListener to listen for all user/client domain deregistrations and timeouts.
 void deregisterEventFilter(Domain aDomain)
          Deregisters the EventFilter for a domain.
 void deregisterEventFilter(Domain aDomain, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Deregisters the EventFilter for a domain.
 java.util.Set<Domain> getActiveDomains()
          Returns all active domains (all domains where the client has listeners registered).
 java.util.List<RemoteEventListener> getRegisteredListeners(Domain aDomain)
          Returns all registered listeners of a domain.
 boolean isActive()
          Checks if the RemoteEventService is active (listening).
 void registerEventFilter(Domain aDomain, EventFilter anEventFilter)
          Registers an EventFilter for a domain.
 void registerEventFilter(Domain aDomain, EventFilter anEventFilter, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Registers an EventFilter for a domain.
 void removeListener(Domain aDomain, RemoteEventListener aRemoteListener)
          Removes a listener for a domain.
 void removeListener(Domain aDomain, RemoteEventListener aRemoteListener, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Removes a listener for a domain.
 void removeListeners()
          Removes all RemoteEventListeners and deactivates the RemoteEventService (stop listening).
 void removeListeners(com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Removes all RemoteEventListeners and deactivates the RemoteEventService (stop listening).
 void removeListeners(Domain aDomain)
          Stops listening for the corresponding domain.
 void removeListeners(Domain aDomain, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Stops listening for the corresponding domain.
 void removeListeners(java.util.Set<Domain> aDomains)
          Calls unlisten for a set of domains (stop listening for these domains).
 void removeListeners(java.util.Set<Domain> aDomains, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Calls unlisten for a set of domains (stop listening for these domains).
 void removeUnlistenListener(UnlistenEventListener anUnlistenEventListener, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Removes an UnlistenEventListener.
 void removeUnlistenListeners(com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
          Stops listening for UnlistenEvent instances.
 

Method Detail

addListener

void addListener(Domain aDomain,
                 RemoteEventListener aRemoteListener)
Adds a listener for a domain. It activates the RemoteEventService if it was inactive.

Parameters:
aDomain - domain
aRemoteListener - new listener

addListener

void addListener(Domain aDomain,
                 RemoteEventListener aRemoteListener,
                 com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Adds a listener for a domain. It activates the RemoteEventService if it was inactive.

Parameters:
aDomain - domain
aRemoteListener - new listener
aCallback - callback (only called when no listener is registered for the domain)

addListener

void addListener(Domain aDomain,
                 RemoteEventListener aRemoteListener,
                 EventFilter anEventFilter)
Adds a listener for a domain. The EventFilter is applied to the domain to filter events before the RemoteEventListener recognizes the event. It activates the RemoteEventService if it was inactive.

Parameters:
aDomain - domain
aRemoteListener - new listener
anEventFilter - EventFilter to filter the events before RemoteEventListener

addListener

void addListener(Domain aDomain,
                 RemoteEventListener aRemoteListener,
                 EventFilter anEventFilter,
                 com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Adds a listener for a domain. The EventFilter is applied to the domain to filter events before the RemoteEventListener recognizes the event. It activates the RemoteEventService if it was inactive.

Parameters:
aDomain - domain
aRemoteListener - new listener
anEventFilter - EventFilter to filter the events before RemoteEventListener
aCallback - callback (only called when no listener is registered for the domain)

addUnlistenListener

void addUnlistenListener(UnlistenEventListener anUnlistenEventListener,
                         com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Registers an UnlistenEventListener to listen for all user/client domain deregistrations and timeouts. The scope for unlisten events to receive is set to UnlistenEventListener.Scope.UNLISTEN by default. To use other scopes see addUnlistenListener(de.novanic.eventservice.client.event.listener.unlisten.UnlistenEventListener.Scope, de.novanic.eventservice.client.event.listener.unlisten.UnlistenEventListener, com.google.gwt.user.client.rpc.AsyncCallback).

Parameters:
anUnlistenEventListener - UnlistenEventListener to listen for all user/client domain deregistrations and timeouts.
aCallback - callback

addUnlistenListener

void addUnlistenListener(UnlistenEventListener.Scope anUnlistenScope,
                         UnlistenEventListener anUnlistenEventListener,
                         com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Registers an UnlistenEventListener to listen for all user/client domain deregistrations and timeouts.

Parameters:
anUnlistenEventListener - UnlistenEventListener to listen for all user/client domain deregistrations and timeouts.
anUnlistenScope - scope of the unlisten events to receive
aCallback - callback

addUnlistenListener

void addUnlistenListener(UnlistenEventListener anUnlistenEventListener,
                         UnlistenEvent anUnlistenEvent,
                         com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Registers an UnlistenEventListener to listen for all user/client domain deregistrations and timeouts. The custom UnlistenEvent will be registered at the server side and transferred to all users/clients which have an UnlistenEventListener registered. That UnlistenEvent can for example contain user information of your specific user-system to recover the user in your user-system on a timeout. The scope for unlisten events to receive is set to UnlistenEventListener.Scope.UNLISTEN by default. To use other scopes see addUnlistenListener(de.novanic.eventservice.client.event.listener.unlisten.UnlistenEventListener.Scope, de.novanic.eventservice.client.event.listener.unlisten.UnlistenEventListener, de.novanic.eventservice.client.event.listener.unlisten.UnlistenEvent, com.google.gwt.user.client.rpc.AsyncCallback).

Parameters:
anUnlistenEventListener - UnlistenEventListener to listen for all user/client domain deregistrations and timeouts.
anUnlistenEvent - UnlistenEvent which can contain custom data
aCallback - callback

addUnlistenListener

void addUnlistenListener(UnlistenEventListener.Scope anUnlistenScope,
                         UnlistenEventListener anUnlistenEventListener,
                         UnlistenEvent anUnlistenEvent,
                         com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Registers an UnlistenEventListener to listen for all user/client domain deregistrations and timeouts. The custom UnlistenEvent will be registered at the server side and transferred to all users/clients which have an UnlistenEventListener registered. That UnlistenEvent can for example contain user information of your specific user-system to recover the user in your user-system on a timeout.

Parameters:
anUnlistenScope - scope of the unlisten events to receive
anUnlistenEventListener - UnlistenEventListener to listen for all user/client domain deregistrations and timeouts.
anUnlistenEvent - UnlistenEvent which can contain custom data
aCallback - callback

removeListener

void removeListener(Domain aDomain,
                    RemoteEventListener aRemoteListener)
Removes a listener for a domain. The RemoteEventService will get inactive, when no other listeners are registered.

Parameters:
aDomain - domain
aRemoteListener - listener to remove

removeListener

void removeListener(Domain aDomain,
                    RemoteEventListener aRemoteListener,
                    com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Removes a listener for a domain. The RemoteEventService will get inactive, when no other listeners are registered.

Parameters:
aDomain - domain
aRemoteListener - listener to remove
aCallback - callback

registerEventFilter

void registerEventFilter(Domain aDomain,
                         EventFilter anEventFilter)
Registers an EventFilter for a domain. This can be used when a listener is already added and an EventFilter needed later or isn't available when the listener is added.

Parameters:
aDomain - domain
anEventFilter - EventFilter to filter the events before RemoteEventListener

registerEventFilter

void registerEventFilter(Domain aDomain,
                         EventFilter anEventFilter,
                         com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Registers an EventFilter for a domain. This can be used when a listener is already added and an EventFilter needed later or isn't available when the listener is added.

Parameters:
aDomain - domain
anEventFilter - EventFilter to filter the events before RemoteEventListener
aCallback - callback

deregisterEventFilter

void deregisterEventFilter(Domain aDomain)
Deregisters the EventFilter for a domain.

Parameters:
aDomain - domain to remove the EventFilter from

deregisterEventFilter

void deregisterEventFilter(Domain aDomain,
                           com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Deregisters the EventFilter for a domain.

Parameters:
aDomain - domain to remove the EventFilter from
aCallback - callback

isActive

boolean isActive()
Checks if the RemoteEventService is active (listening).

Returns:
true when active/listening, otherwise false

getActiveDomains

java.util.Set<Domain> getActiveDomains()
Returns all active domains (all domains where the client has listeners registered).

Returns:
all active domains

getRegisteredListeners

java.util.List<RemoteEventListener> getRegisteredListeners(Domain aDomain)
Returns all registered listeners of a domain.

Parameters:
aDomain - domain
Returns:
all registered listeners of the domain

removeListeners

void removeListeners()
Removes all RemoteEventListeners and deactivates the RemoteEventService (stop listening).


removeListeners

void removeListeners(com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Removes all RemoteEventListeners and deactivates the RemoteEventService (stop listening).

Parameters:
aCallback - callback (only called when a listener is registered for the domain)

removeListeners

void removeListeners(java.util.Set<Domain> aDomains)
Calls unlisten for a set of domains (stop listening for these domains). The RemoteEventListeners for these domains will also be removed. removeListeners() can be used to call unlisten for all domains.

Parameters:
aDomains - domains to unlisten

removeListeners

void removeListeners(java.util.Set<Domain> aDomains,
                     com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Calls unlisten for a set of domains (stop listening for these domains). The RemoteEventListeners for these domains will also be removed. DefaultRemoteEventService.removeListeners() can be used to call unlisten for all domains.

Parameters:
aDomains - domains to unlisten
aCallback - callback (only called when a listener is registered for the domain)

removeListeners

void removeListeners(Domain aDomain)
Stops listening for the corresponding domain. The RemoteEventFilters for the domain will also be removed. removeListeners() can be used to call unlisten for all domains.

Parameters:
aDomain - domain to unlisten

removeListeners

void removeListeners(Domain aDomain,
                     com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Stops listening for the corresponding domain. The RemoteEventFilters for the domain will also be removed. DefaultRemoteEventService.removeListeners() can be used to call unlisten for all domains.

Parameters:
aDomain - domain to unlisten
aCallback - callback (only called when a listener is registered for the domain)

removeUnlistenListener

void removeUnlistenListener(UnlistenEventListener anUnlistenEventListener,
                            com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Removes an UnlistenEventListener. The RemoteEventService will get inactive, when no other listeners are registered.

Parameters:
anUnlistenEventListener - UnlistenEventListener to remove
aCallback - callback

removeUnlistenListeners

void removeUnlistenListeners(com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Void> aCallback)
Stops listening for UnlistenEvent instances.

Parameters:
aCallback - callback (only called when an UnlistenEventListener is registered)