/** * Register a instance of a client-side action handler. * * @param handler The {@link ClientActionHandler}; */ protected void register(final ClientActionHandler<?, ?> handler) { register(handler.getActionType(), new IndirectProvider<ClientActionHandler<?, ?>>() { @Override public void get(AsyncCallback<ClientActionHandler<?, ?>> callback) { callback.onSuccess(handler); } }); }
/** * Register a instance of a client-side action handler. * * @param handler The {@link ClientActionHandler}; */ protected void register(final ClientActionHandler<?, ?> handler) { register(handler.getActionType(), new IndirectProvider<ClientActionHandler<?, ?>>() { @Override public void get(AsyncCallback<ClientActionHandler<?, ?>> callback) { callback.onSuccess(handler); } }); }
private void delegateFailure(ClientActionHandler<?, ?> clientActionHandler) { ClientActionHandlerMismatchException exception = new ClientActionHandlerMismatchException(action.getClass(), clientActionHandler.getActionType()); onFailure(exception); }
@SuppressWarnings("unchecked") @Override public void onSuccess(ClientActionHandler<?, ?> clientActionHandler) { if (clientActionHandler.getActionType() != action.getClass()) { delegateFailure(clientActionHandler); } else if (dispatchRequest.isPending()) { delegateExecute((ClientActionHandler<A, R>) clientActionHandler); } }
@Override public void onSuccess(ClientActionHandler<?, ?> clientActionHandler) { if (clientActionHandler.getActionType() != action.getClass()) { dispatchRequest.cancel(); callback.onFailure(new ClientActionHandlerMismatchException( (Class<? extends Action<?>>) action.getClass(), clientActionHandler.getActionType())); return; } if (dispatchRequest.isPending()) { dispatchRequest.setDelegate(((ClientActionHandler<A, R>) clientActionHandler).undo( action, result, callback, new UndoCommand<A, R>() { @Override public DispatchRequest undo(A action, R result, AsyncCallback<Void> callback) { if (dispatchRequest.isPending()) { return doUndo(securityCookie, action, result, callback); } else { return null; } } })); } }
@Override public void onSuccess(ClientActionHandler<?, ?> clientActionHandler) { if (clientActionHandler.getActionType() != action.getClass()) { dispatchRequest.cancel(); callback.onFailure(new ClientActionHandlerMismatchException( (Class<? extends Action<?>>) action.getClass(), clientActionHandler.getActionType())); return; } if (dispatchRequest.isPending()) { dispatchRequest.setDelegate(((ClientActionHandler<A, R>) clientActionHandler).execute( action, callback, new ExecuteCommand<A, R>() { @Override public DispatchRequest execute(A action, AsyncCallback<R> resultCallback) { if (dispatchRequest.isPending()) { return doExecute(securityCookie, action, resultCallback); } else { return null; } } })); } }