public void onWindowClosing(ClosingEvent event) { GwtCommandDispatcher.getInstance().setShowError(false); // Cancel all outstanding requests: for (Deferred deferred : deferreds) { deferred.cancel(); } } });
/** * Default behaviour for handling a command execution exception. Shows an exception report to the user. * * @param response * command response with error */ public void onCommandException(CommandResponse response) { if (isShowError()) { commandExceptionCallback.onCommandException(response); } }
/** * 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 static void getUsers(final DataCallback<List<UserDto>> onFinish) { FindUsersRequest request = new FindUsersRequest(); GwtCommand command = new GwtCommand(FindUsersRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<FindUsersResponse>() { public void execute(FindUsersResponse response) { if (onFinish != null) { onFinish.execute(response.getUsers()); } } }); }
@Override public Deferred execute(GwtCommand command, CommandCallback<?>... callback) { return GwtCommandDispatcher.getInstance().execute(command, callback); }
@Override public void logout() { GwtCommandDispatcher.getInstance().logout(); }
@Override public void setTokenRequestHandler(TokenRequestHandler tokenRequestHandler) { GwtCommandDispatcher.getInstance().setTokenRequestHandler(tokenRequestHandler); } }
@Override public void login() { GwtCommandDispatcher.getInstance().login(); }
/** * Logout. Clear the user token. * * @since 2.0.0 */ public void logout() { logout(false); }
@Override public void cancel() { // Perhaps we where busy fetching the correct tiles? if (deferred != null) { deferred.cancel(); deferred = null; } // Perhaps we where busy rendering the tiles? }
/** * Default behaviour for handling a communication exception. Shows a warning window to the user. * * @param error * error to report */ public void onCommunicationException(Throwable error) { if (isShowError()) { communicationExceptionCallback.onCommunicationException(error); } }
/** * Set default value for "featureIncludes" when getting features. * * @param lazyFeatureIncludesDefault * default for "featureIncludes" */ public void setLazyFeatureIncludesDefault(int lazyFeatureIncludesDefault) { setUseLazyLoading(false); this.lazyFeatureIncludesDefault = lazyFeatureIncludesDefault; }
/** * Logout. Clear the user token. Can indicate that a login is about to follow. * * @param loginPending * is a new login pending? */ private void logout(boolean loginPending) { setToken(null, null, loginPending); }
/** * Send a command to reload all dynamic layers. */ public static void reloadDynamicLayers() { ReloadDynamicLayersRequest request = new ReloadDynamicLayersRequest(); GwtCommand command = new GwtCommand(ReloadDynamicLayersRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command); }
/** Cancel the fetching of this tile. No call-back will be executed anymore. */ public void cancel() { if (deferred != null) { deferred.cancel(); } }
/** * Set default "featureIncludes" for select commands. * * @param lazyFeatureIncludesSelect * default "featureIncludes" for select commands */ public void setLazyFeatureIncludesSelect(int lazyFeatureIncludesSelect) { setUseLazyLoading(false); this.lazyFeatureIncludesSelect = lazyFeatureIncludesSelect; }
@Override public void getGroups(final DataCallback<List<TerritoryDto>> onFinish) { GetTerritoriesRequest request = new GetTerritoriesRequest(); GwtCommand command = new GwtCommand(GetTerritoriesRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<GetTerritoriesResponse>() { public void execute(GetTerritoriesResponse response) { if (onFinish != null) { onFinish.execute(response.getTerritories()); } } }); }
@Override public void cancel() { if (deferred != null) { deferred.cancel(); deferred = null; currentTileBounds = null; } }
/** * Set "featureIncludes" value when all should be included. * * @param lazyFeatureIncludesAll * "featureIncludes" value when all should be included */ public void setLazyFeatureIncludesAll(int lazyFeatureIncludesAll) { setUseLazyLoading(false); this.lazyFeatureIncludesAll = lazyFeatureIncludesAll; }