private void processHistory(ValueChangeEvent<String> event) { String historyToken; if (event != null) { historyToken = event.getValue(); } else { historyToken = History.getToken(); } updateHistoryParamsFromToken(historyToken); }
@Override public void onModuleLoad() { HistoryHandler historyHandler = new HistoryHandler(); History.addValueChangeHandler(historyHandler); updateHistoryParamsFromToken(History.getToken()); authService.checkAuth(new AsyncCallback<AuthResultDto>() { @Override public void onFailure(Throwable caught) { authResult = Result.ERROR; showLogin(); Utils.handleException(caught, view); } @Override public void onSuccess(AuthResultDto result) { authResult = result.getAuthResult(); if (authResult == Result.OK) { redirectToModule("kaaAdmin"); } else { showLogin(); if (authResult == Result.ERROR) { view.setErrorMessage(Utils.messages.unexpectedError()); } else if (authResult == Result.KAA_ADMIN_NOT_EXISTS) { view.setInfoMessage(Utils.messages.kaaAdminNotExists()); } } } }); }
public String getToken() { return History.getToken(); }
/** * Fire * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)} * events with the current history state. This is most often called at the end * of an application's * {@link com.google.gwt.core.client.EntryPoint#onModuleLoad()} to inform * history handlers of the initial application state. */ public static void fireCurrentHistoryState() { String currentToken = getToken(); historyEventSource.fireValueChangedEvent(currentToken); }
private static void onHashChanged() { /* * We guard against firing events twice, some browser (e.g. safari) tend to * fire events on startup if HTML5 pushstate is used. */ String hashToken = getDecodedHash(); if (!hashToken.equals(getToken())) { token = hashToken; historyEventSource.fireValueChangedEvent(hashToken); } } }
/** * Adds a new browser history entry. Calling this method will cause * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)} * to be called as well if and only if issueEvent is true. * * @param historyToken the token to associate with the new history item * @param issueEvent true if a * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)} * event should be issued */ public static void newItem(String historyToken, boolean issueEvent) { historyToken = (historyToken == null) ? "" : historyToken; if (!historyToken.equals(getToken())) { token = historyToken; String updateToken = encodeHistoryToken(historyToken); impl.newToken(updateToken); if (issueEvent) { historyEventSource.fireValueChangedEvent(historyToken); } } }
@Override public String getValue() { return History.getToken(); }
@Override public String getToken() { return History.getToken(); }
@Override public String getValue() { return History.getToken(); }
@Override public String getToken() { return History.getToken(); }
/** * Fire * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)} * events with the current history state. This is most often called at the end * of an application's * {@link com.google.gwt.core.client.EntryPoint#onModuleLoad()} to inform * history handlers of the initial application state. */ public static void fireCurrentHistoryState() { String currentToken = getToken(); historyEventSource.fireValueChangedEvent(currentToken); }
/** * Fire * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)} * events with the current history state. This is most often called at the end * of an application's * {@link com.google.gwt.core.client.EntryPoint#onModuleLoad()} to inform * history handlers of the initial application state. */ public static void fireCurrentHistoryState() { String currentToken = getToken(); historyEventSource.fireValueChangedEvent(currentToken); }
@Override public void startUp(Page startUpPage) { String token = History.getToken(); loadPage(token); }
@Override public void redraw() { redraw(History.getToken()); }
public String getCurrentPageParams() { final String historyToken = History.getToken(); return parsePageParams(historyToken); }
private static void onHashChanged() { /* * We guard against firing events twice, some browser (e.g. safari) tend to * fire events on startup if HTML5 pushstate is used. */ String hashToken = getDecodedHash(); if (!hashToken.equals(getToken())) { token = hashToken; historyEventSource.fireValueChangedEvent(hashToken); } } }
private ModelPlace determineCurrentPlace() { String token = History.getToken(); String[] parts = token.split(":"); if (parts.length != 2) { // This is unexpected - how best to handle? return null; } return new ModelPlace.Tokenizer().getPlace(parts[1]); }
private static void onHashChanged() { /* * We guard against firing events twice, some browser (e.g. safari) tend to * fire events on startup if HTML5 pushstate is used. */ String hashToken = getDecodedHash(); if (!hashToken.equals(getToken())) { token = hashToken; historyEventSource.fireValueChangedEvent(hashToken); } } }
private void onNavigationCompleted(PageState place) { String token = PageStateSerializer.serialize(place); /* * If it's a duplicate, we're not totally interested */ if (!token.equals(History.getToken())) { /* * Lodge in the browser's history */ History.newItem(token, false); } }
private void fireInitialPage() { if (History.getToken().length() != 0) { Log.debug("HistoryManager: firing initial placed based on intial token: " + History.getToken()); History.fireCurrentHistoryState(); } else { eventBus.fireEvent(new NavigationEvent( NavigationHandler.NAVIGATION_REQUESTED, new DashboardPlace())); } }