GWTP Dispatch client 0.6-redhat-2

com.gwtplatform.dispatch.client.actionhandler
Class DefaultClientActionHandlerRegistry

java.lang.Object
  extended by com.gwtplatform.dispatch.client.actionhandler.DefaultClientActionHandlerRegistry
All Implemented Interfaces:
ClientActionHandlerRegistry

public class DefaultClientActionHandlerRegistry
extends Object
implements ClientActionHandlerRegistry

The default implementation that ClientActionHandlerRegistry that if bound will not load any client-side action handlers.

To register client-side action handlers, extend this class and call register(com.gwtplatform.dispatch.client.actionhandler.ClientActionHandler) in the constructor.

Example

 
 public class MyActionHandlerRegistry extends
     DefaultClientActionHandlerRegistry {

   @Inject
   public ClientActionHandlerRegistry(
       final RetrieveFooClientActionHandler handler,
       final Provider<ListFooClientActionHandler> provider,
       final AsyncProvider<UpdateFooClientActionHandler> asyncProvider,
       final AsyncProvider<CreateFooBundle> fooCreateBundle) {

     register(handler);
     register(ListFooClientAction.class, provider);
     register(UpdateFooClientAction.class, asyncProvider);
     register(CreateFooClientAction.class, fooCreateBundle,
         CreateFooBundle.ID_CreateFooClientActionHandler);
 }

 // Provider Bundle that will try to combine the presenter and
 // client action handler into the same split point.
 public class CreateFooBundle extends ProviderBundle {

   public static final int ID_CreateFooPresenter = 0;
   public static final int ID_CreateFooClientActionHandler = 1;

   @Inject
   public CreateFooBundle(
       Provider<CreateFooPresenterImpl> presenter,
       Provider<CreateFooClientActionHandler> clientActionHandler) {
     super(2);
     providers[ID_CreateFooPresenter] = presenter;
     providers[ID_CreateFooClientActionHandler] = clientActionHandler;
   }
 }
 
 

Author:
Brendan Doherty

Constructor Summary
DefaultClientActionHandlerRegistry()
           
 
Method Summary
<A extends Action<R>,R extends Result>
IndirectProvider<ClientActionHandler<?,?>>
find(Class<A> actionClass)
          Gets the client-side action handler that supports the specific action.
protected  void register(Class<? extends Action<?>> actionType, com.google.gwt.inject.client.AsyncProvider<? extends ClientActionHandler<?,?>> handlerProvider)
          Register an AsyncProvider of a client-side action handler.
protected
<B extends ProviderBundle>
void
register(Class<? extends Action<?>> actionType, com.google.gwt.inject.client.AsyncProvider<B> bundleProvider, int providerId)
          Register a client-side action handler that is part of a ProviderBundle.
protected  void register(Class<? extends Action<?>> actionType, IndirectProvider<ClientActionHandler<?,?>> handlerProvider)
          Register an IndirectProvider of a client-side action handler.
protected  void register(Class<? extends Action<?>> actionType, com.google.inject.Provider<? extends ClientActionHandler<?,?>> handlerProvider)
          Register a Provider of a client-side action handler.
protected  void register(ClientActionHandler<?,?> handler)
          Register a instance of a client-side action handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultClientActionHandlerRegistry

public DefaultClientActionHandlerRegistry()
Method Detail

register

protected void register(ClientActionHandler<?,?> handler)
Register a instance of a client-side action handler.

Parameters:
handler - The ClientActionHandler;

register

protected void register(Class<? extends Action<?>> actionType,
                        com.google.inject.Provider<? extends ClientActionHandler<?,?>> handlerProvider)
Register a Provider of a client-side action handler.

Parameters:
actionType - The type of Action that the client-side action handler supports.
handlerProvider - The Provider of the handler.

register

protected void register(Class<? extends Action<?>> actionType,
                        com.google.gwt.inject.client.AsyncProvider<? extends ClientActionHandler<?,?>> handlerProvider)
Register an AsyncProvider of a client-side action handler.

Parameters:
actionType - The type of Action that the client-side action handler supports.
handlerProvider - The AsyncProvider of the handler.

register

protected <B extends ProviderBundle> void register(Class<? extends Action<?>> actionType,
                                                   com.google.gwt.inject.client.AsyncProvider<B> bundleProvider,
                                                   int providerId)
Register a client-side action handler that is part of a ProviderBundle.

Parameters:
actionType - The type of Action that the client-side action handler supports.
bundleProvider - The Provider of the ProviderBundle.
providerId - The id of the client-side action handler provider.

register

protected void register(Class<? extends Action<?>> actionType,
                        IndirectProvider<ClientActionHandler<?,?>> handlerProvider)
Register an IndirectProvider of a client-side action handler.

Parameters:
handlerProvider - The IndirectProvider.

find

public <A extends Action<R>,R extends Result> IndirectProvider<ClientActionHandler<?,?>> find(Class<A> actionClass)
Description copied from interface: ClientActionHandlerRegistry
Gets the client-side action handler that supports the specific action.

Specified by:
find in interface ClientActionHandlerRegistry
Returns:
The the client-side action handler , or null if no appropriate client-side action handler could be found.

GWTP Dispatch client 0.6-redhat-2

Copyright © 2010-2012 ArcBees. All Rights Reserved.