public class DefaultClientActionHandlerRegistry extends Object implements ClientActionHandlerRegistry
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.
public class MyActionHandlerRegistry extends DefaultClientActionHandlerRegistry {
@Inject
public DefaultClientRestActionHandlerRegistry(
RetrieveFooClientActionHandler handler,
Provider<ListFooClientActionHandler> provider,
AsyncProvider<UpdateFooClientActionHandler> asyncProvider,
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;
}
}
Constructor and Description |
---|
DefaultClientActionHandlerRegistry() |
Modifier and Type | Method and Description |
---|---|
<A> IndirectProvider<ClientActionHandler<?,?>> |
find(Class<A> actionClass)
Gets the client-side action handler that supports the specific action.
|
protected void |
register(Class<?> actionType,
AsyncProvider<? extends ClientActionHandler<?,?>> handlerProvider)
Register an
AsyncProvider of a client-side action handler. |
protected <B extends ProviderBundle> |
register(Class<?> actionType,
AsyncProvider<B> bundleProvider,
int providerId)
Register a client-side action handler that is part of a
ProviderBundle . |
protected void |
register(Class<?> actionType,
IndirectProvider<ClientActionHandler<?,?>> handlerProvider)
Register an
IndirectProvider of a client-side action handler. |
protected void |
register(Class<?> actionType,
javax.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.
|
protected void register(ClientActionHandler<?,?> handler)
handler
- The ClientActionHandler
;protected void register(Class<?> actionType, javax.inject.Provider<? extends ClientActionHandler<?,?>> handlerProvider)
Provider
of a client-side action handler.actionType
- The type of action that the client-side action handler supports.handlerProvider
- The Provider
of the handler.protected void register(Class<?> actionType, AsyncProvider<? extends ClientActionHandler<?,?>> handlerProvider)
AsyncProvider
of a client-side action handler.actionType
- The type of that the client-side action handler supports.handlerProvider
- The AsyncProvider
of the handler.protected <B extends ProviderBundle> void register(Class<?> actionType, AsyncProvider<B> bundleProvider, int providerId)
ProviderBundle
.actionType
- The type of that the client-side action handler supports.bundleProvider
- The Provider
of the
ProviderBundle
.providerId
- The id of the client-side action handler provider.protected void register(Class<?> actionType, IndirectProvider<ClientActionHandler<?,?>> handlerProvider)
IndirectProvider
of a client-side action handler.handlerProvider
- The IndirectProvider
.public <A> IndirectProvider<ClientActionHandler<?,?>> find(Class<A> actionClass)
ClientActionHandlerRegistry
find
in interface ClientActionHandlerRegistry
null
if no appropriate client-side action handler could be
found.Copyright © 2010-2014 ArcBees. All Rights Reserved.