@Override public Deferred execute(GwtCommand command, CommandCallback<?>... callback) { return GwtCommandDispatcher.getInstance().execute(command, callback); }
/** * Logs the user out. */ public static void logout() { GwtCommandDispatcher dispatcher = GwtCommandDispatcher.getInstance(); if (null != dispatcher.getUserToken()) { GwtCommand command = new GwtCommand(LogoutRequest.COMMAND); dispatcher.logout(); dispatcher.execute(command); } }
public void onMapModelChanged(MapModelChangedEvent event) { onLoadRegistration.removeHandler(); label.setContents(I18nProvider.getGlobal().loadScreenLoadText()); if (GwtCommandDispatcher.getInstance().isBusy()) { GwtCommandDispatcher.getInstance().addDispatchStoppedHandler(new DispatchStoppedHandler() { public void onDispatchStopped(DispatchStoppedEvent event) { fadeOut(); } }); } else { fadeOut(); } } });
@Override public void setTokenRequestHandler(TokenRequestHandler tokenRequestHandler) { GwtCommandDispatcher.getInstance().setTokenRequestHandler(tokenRequestHandler); } }
/** * Load the manager application. This will execute the InitializationCommand, and ask to select a valid user if * needed. * * @param tokenRequestHandler * the login handler. */ public void loadManagerApplication(final DeskmanagerTokenRequestHandler tokenRequestHandler) { GwtCommandDispatcher.getInstance().setTokenRequestHandler(tokenRequestHandler); //We execute the getgeodeskscommand because that is only accessible by the manager, we ignore the response. GwtCommand command = new GwtCommand(GetGeodesksRequest.COMMAND); final AbstractCommandCallback<GetGeodesksResponse> callback = new AbstractCommandCallback<GetGeodesksResponse>() { public void execute(GetGeodesksResponse response) { fireGeodeskInitialized(tokenRequestHandler.getProfile()); } }; GwtCommandDispatcher.getInstance().execute(command, callback); }
private void getData() { Point point = mapWidget.getMapModel().getGeometryFactory().createPoint(worldPosition); final Coordinate coordUsedForRetrieval = worldPosition; SearchByLocationRequest request = new SearchByLocationRequest(); request.setLocation(GeometryConverter.toDto(point)); request.setCrs(mapWidget.getMapModel().getCrs()); request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS); int layersToSearch = SearchByLocationRequest.SEARCH_ALL_LAYERS; request.setSearchType(layersToSearch); request.setBuffer(calculateBufferFromPixelTolerance()); request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect()); for (Layer<?> layer : mapWidget.getMapModel().getLayers()) { if (layer.isShowing() && layer instanceof VectorLayer) { request.addLayerWithFilter(layer.getId(), layer.getServerLayerId(), ((VectorLayer) layer).getFilter()); } } GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND); commandRequest.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(commandRequest, new AbstractCommandCallback<SearchByLocationResponse>() { public void execute(SearchByLocationResponse commandResponse) { setTooltipData(coordUsedForRetrieval, commandResponse.getFeatureMap()); } }); }
@Override public void logout() { GwtCommandDispatcher.getInstance().logout(); }
/** No-arguments constructor. */ public CommandServiceImpl() { ExceptionCallbackImpl callback = new ExceptionCallbackImpl(); GwtCommandDispatcher.getInstance().setCommandExceptionCallback(callback); GwtCommandDispatcher.getInstance().setCommunicationExceptionCallback(callback); }
@Override public String getUserToken() { return GwtCommandDispatcher.getInstance().getUserToken(); }
@Override public HandlerRegistration addTokenChangedHandler(TokenChangedHandler handler) { return GwtCommandDispatcher.getInstance().addTokenChangedHandler(handler); }
@Override public void login() { GwtCommandDispatcher.getInstance().login(); }
public void setCommandServiceUrl(String commandServiceUrl) { this.commandServiceUrl = commandServiceUrl; GwtCommandDispatcher.getInstance().setServiceEndPointUrl(commandServiceUrl); }
public void onCommunicationException(Throwable error) { GwtCommandDispatcher.getInstance().onCommunicationException(error); }
public void onCommandException(CommandResponse response) { GwtCommandDispatcher.getInstance().onCommandException(response); }
public void onTokenChanged(TokenChangedEvent event) { setToken(event.getToken(), event.getUserDetail(), false); List<RetryCommand> retryCommands = afterLoginCommands.remove(oldToken); if (null != retryCommands) { for (RetryCommand retryCommand : retryCommands) { execute(retryCommand.getCommand(), retryCommand.getDeferred()); } } } });
public void onWindowClosing(ClosingEvent event) { GwtCommandDispatcher.getInstance().setShowError(false); // Cancel all outstanding requests: for (Deferred deferred : deferreds) { deferred.cancel(); } } });
/** * Add a handler that is called whenever the client stops communicating with the back-end. * * @param handler * The actual handler (closure). * @return The registration for the handler. Using this object the handler can be removed again. */ @Export public JsHandlerRegistration addDispatchStoppedHandler(final DispatchStoppedHandler handler) { HandlerRegistration registration = GwtCommandDispatcher.getInstance().addDispatchStoppedHandler( new org.geomajas.gwt.client.command.event.DispatchStoppedHandler() { public void onDispatchStopped(DispatchStoppedEvent event) { handler.onDispatchStopped(new org.geomajas.plugin.jsapi.client.event.DispatchStoppedEvent()); } }); return new JsHandlerRegistration(new HandlerRegistration[] { registration }); }
/** * Add a handler that is called whenever the client starts communicating with the back-end. * * @param handler * The actual handler (closure). * @return The registration for the handler. Using this object the handler can be removed again. */ @Export public JsHandlerRegistration addDispatchStartedHandler(final DispatchStartedHandler handler) { HandlerRegistration registration = GwtCommandDispatcher.getInstance().addDispatchStartedHandler( new org.geomajas.gwt.client.command.event.DispatchStartedHandler() { public void onDispatchStarted(DispatchStartedEvent event) { handler.onDispatchStarted(new org.geomajas.plugin.jsapi.client.event.DispatchStartedEvent()); } }); return new JsHandlerRegistration(new HandlerRegistration[] { registration }); }
public void setFeatures(List<Feature> features) { this.features = features; SearchFeatureRequest featReq = new SearchFeatureRequest(); featReq.setCriteria(buildCriteria()); featReq.setBooleanOperator("OR"); featReq.setCrs(model.getCrs()); featReq.setLayerId(layer.getServerLayerId()); featReq.setFilter(layer.getFilter()); featReq.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect()); setRequest(featReq); }