List of usage examples for com.google.gwt.inject.client AsyncProvider get
void get(AsyncCallback<? super T> callback);
From source file:com.guit.client.place.PlaceManagerImpl.java
License:Apache License
@SuppressWarnings("unchecked") private <D> void getPlace(final String placeName, final PlaceCallback<D> callback) { if (places.containsKey(placeName)) { callback.onSuccess((Place<D>) places.get(placeName)); } else if (providedPlaces.containsKey(placeName)) { Provider<? extends Place<?>> placeProvider = providedPlaces.get(placeName); Place<?> place = placeProvider.get(); places.put(placeName, place);//w w w .j av a2s . c o m callback.onSuccess((Place<D>) place); } else if (asyncProvidedPlaces.containsKey(placeName)) { AsyncProvider<Place<D>> asyncProvider = (AsyncProvider<Place<D>>) asyncProvidedPlaces.get(placeName); asyncProvider.get(new AbstractAsyncCallback<Place<D>>() { @Override public void success(Place<D> place) { places.put(placeName, place); callback.onSuccess(place); } }); } else { // The exception is only for development mode assert false : "Error on history manager. The place " + placeName + " is not registered. It should be binded as Singleton."; // In production we just go to the default place if (defaultPlace != null) { getPlace(defaultPlace, callback); } } }
From source file:com.gwtplatform.dispatch.client.actionhandler.DefaultClientActionHandlerRegistry.java
License:Apache License
/** * Register an {@link com.google.gwt.inject.client.AsyncProvider} of a client-side action handler. * * @param actionType The type of that the client-side action handler supports. * @param handlerProvider The {@link com.google.gwt.inject.client.AsyncProvider} of the handler. *//*from ww w .ja v a 2 s.co m*/ protected void register(Class<?> actionType, final AsyncProvider<? extends ClientActionHandler<?, ?>> handlerProvider) { register(actionType, new IndirectProvider<ClientActionHandler<?, ?>>() { @Override public void get(AsyncCallback<ClientActionHandler<?, ?>> callback) { handlerProvider.get(callback); } }); }
From source file:com.gwtplatform.dispatch.rest.client.interceptor.DefaultRestInterceptorRegistry.java
License:Apache License
/** * Register an {@link com.google.gwt.inject.client.AsyncProvider} of a client-side interceptor. * * @param context The {@link InterceptorContext} for the rest interceptor. * @param handlerProvider The {@link com.google.gwt.inject.client.AsyncProvider} of the handler. *///from w w w.ja v a 2s .com protected void register(InterceptorContext context, final AsyncProvider<RestInterceptor> handlerProvider) { register(context, new IndirectProvider<RestInterceptor>() { @Override public void get(AsyncCallback<RestInterceptor> callback) { handlerProvider.get(callback); } }); }
From source file:com.gwtplatform.dispatch.rpc.client.interceptor.DefaultRpcInterceptorRegistry.java
License:Apache License
/** * Register an {@link com.google.gwt.inject.client.AsyncProvider} of a client-side interceptor. * * @param actionType The type of that the client-side interceptor supports. * @param handlerProvider The {@link com.google.gwt.inject.client.AsyncProvider} of the handler. *//*from w ww.java 2 s . co m*/ protected void register(Class<?> actionType, final AsyncProvider<? extends RpcInterceptor<?, ?>> handlerProvider) { register(actionType, new IndirectProvider<RpcInterceptor<?, ?>>() { @Override public void get(AsyncCallback<RpcInterceptor<?, ?>> callback) { handlerProvider.get(callback); } }); }
From source file:org.jboss.hal.core.finder.ColumnRegistry.java
License:Apache License
@SuppressWarnings("unchecked") private void lookupInternal(String id, LookupCallback callback) { if (columns.containsKey(id)) { // this is a regular column: we're ready to go FinderColumn column = (FinderColumn) columns.get(id).get(); resolve(id, column);//from w w w . ja v a 2 s. c o m callback.found(column); } else if (asyncColumns.containsKey(id)) { // the column sits behind a split point: load it asynchronously logger.debug("Load async column '{}'", id); AsyncProvider<FinderColumn> asyncProvider = asyncColumns.get(id); asyncProvider.get(new AsyncCallback<FinderColumn>() { @Override public void onFailure(final Throwable throwable) { callback.error("Unable to load column '" + id + "': " + throwable.getMessage()); //NON-NLS } @Override public void onSuccess(final FinderColumn column) { resolve(id, column); callback.found(column); } }); } else { //noinspection HardCodedStringLiteral callback.error( "Unknown column '" + id + "'. Please make sure to register all columns, before using them."); } }
From source file:stroom.security.client.ManageUserPlugin.java
License:Apache License
@Inject public ManageUserPlugin(final EventBus eventBus, final ClientSecurityContext securityContext, final AsyncProvider<UsersAndGroupsPresenter> usersAndGroupsPresenterProvider, final AsyncProvider<DocumentPermissionsPresenter> documentPermissionsPresenterProvider) { super(eventBus, securityContext); this.usersAndGroupsPresenterProvider = usersAndGroupsPresenterProvider; eventBus.addHandler(ShowPermissionsEntityDialogEvent.getType(), new ShowPermissionsEntityDialogEvent.Handler() { @Override// w w w . j av a 2 s . com public void onPermissions(final ShowPermissionsEntityDialogEvent event) { documentPermissionsPresenterProvider .get(new AsyncCallbackAdaptor<DocumentPermissionsPresenter>() { @Override public void onSuccess(final DocumentPermissionsPresenter presenter) { presenter.show(event.getExplorerData()); } }); } }); }