com.google.gwt.user.client.History.getToken()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中com.google.gwt.user.client.History.getToken()方法的一些代码示例,展示了History.getToken()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。History.getToken()方法的具体详情如下:
包路径:com.google.gwt.user.client.History
类名称:History
方法名:getToken

History.getToken介绍

[英]Gets the current history token. The handler will not receive a ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)event for the initial token; requiring that an application request the token explicitly on startup gives it an opportunity to run different initialization code in the presence or absence of an initial token.
[中]获取当前历史标记。处理程序不会收到初始令牌的ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)事件;要求应用程序在启动时显式请求令牌,使其有机会在存在或不存在初始令牌的情况下运行不同的初始化代码。

代码示例

代码示例来源:origin: kaaproject/kaa

  1. private void processHistory(ValueChangeEvent<String> event) {
  2. String historyToken;
  3. if (event != null) {
  4. historyToken = event.getValue();
  5. } else {
  6. historyToken = History.getToken();
  7. }
  8. updateHistoryParamsFromToken(historyToken);
  9. }

代码示例来源:origin: kaaproject/kaa

  1. @Override
  2. public void onModuleLoad() {
  3. HistoryHandler historyHandler = new HistoryHandler();
  4. History.addValueChangeHandler(historyHandler);
  5. updateHistoryParamsFromToken(History.getToken());
  6. authService.checkAuth(new AsyncCallback<AuthResultDto>() {
  7. @Override
  8. public void onFailure(Throwable caught) {
  9. authResult = Result.ERROR;
  10. showLogin();
  11. Utils.handleException(caught, view);
  12. }
  13. @Override
  14. public void onSuccess(AuthResultDto result) {
  15. authResult = result.getAuthResult();
  16. if (authResult == Result.OK) {
  17. redirectToModule("kaaAdmin");
  18. } else {
  19. showLogin();
  20. if (authResult == Result.ERROR) {
  21. view.setErrorMessage(Utils.messages.unexpectedError());
  22. } else if (authResult == Result.KAA_ADMIN_NOT_EXISTS) {
  23. view.setInfoMessage(Utils.messages.kaaAdminNotExists());
  24. }
  25. }
  26. }
  27. });
  28. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. public String getToken() {
  2. return History.getToken();
  3. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Fire
  3. * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}
  4. * events with the current history state. This is most often called at the end
  5. * of an application's
  6. * {@link com.google.gwt.core.client.EntryPoint#onModuleLoad()} to inform
  7. * history handlers of the initial application state.
  8. */
  9. public static void fireCurrentHistoryState() {
  10. String currentToken = getToken();
  11. historyEventSource.fireValueChangedEvent(currentToken);
  12. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. private static void onHashChanged() {
  2. /*
  3. * We guard against firing events twice, some browser (e.g. safari) tend to
  4. * fire events on startup if HTML5 pushstate is used.
  5. */
  6. String hashToken = getDecodedHash();
  7. if (!hashToken.equals(getToken())) {
  8. token = hashToken;
  9. historyEventSource.fireValueChangedEvent(hashToken);
  10. }
  11. }
  12. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Adds a new browser history entry. Calling this method will cause
  3. * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}
  4. * to be called as well if and only if issueEvent is true.
  5. *
  6. * @param historyToken the token to associate with the new history item
  7. * @param issueEvent true if a
  8. * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}
  9. * event should be issued
  10. */
  11. public static void newItem(String historyToken, boolean issueEvent) {
  12. historyToken = (historyToken == null) ? "" : historyToken;
  13. if (!historyToken.equals(getToken())) {
  14. token = historyToken;
  15. String updateToken = encodeHistoryToken(historyToken);
  16. impl.newToken(updateToken);
  17. if (issueEvent) {
  18. historyEventSource.fireValueChangedEvent(historyToken);
  19. }
  20. }
  21. }

代码示例来源:origin: OpenNMS/opennms

  1. @Override
  2. public String getValue() {
  3. return History.getToken();
  4. }

代码示例来源:origin: stephenh/tessell

  1. @Override
  2. public String getToken() {
  3. return History.getToken();
  4. }

代码示例来源:origin: org.opennms.features/vaadin-node-maps

  1. @Override
  2. public String getValue() {
  3. return History.getToken();
  4. }

代码示例来源:origin: kiegroup/appformer

  1. @Override
  2. public String getToken() {
  3. return History.getToken();
  4. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. /**
  2. * Fire
  3. * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}
  4. * events with the current history state. This is most often called at the end
  5. * of an application's
  6. * {@link com.google.gwt.core.client.EntryPoint#onModuleLoad()} to inform
  7. * history handlers of the initial application state.
  8. */
  9. public static void fireCurrentHistoryState() {
  10. String currentToken = getToken();
  11. historyEventSource.fireValueChangedEvent(currentToken);
  12. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. /**
  2. * Fire
  3. * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}
  4. * events with the current history state. This is most often called at the end
  5. * of an application's
  6. * {@link com.google.gwt.core.client.EntryPoint#onModuleLoad()} to inform
  7. * history handlers of the initial application state.
  8. */
  9. public static void fireCurrentHistoryState() {
  10. String currentToken = getToken();
  11. historyEventSource.fireValueChangedEvent(currentToken);
  12. }

代码示例来源:origin: dennisjzh/GwtMobile-UI

  1. @Override
  2. public void startUp(Page startUpPage) {
  3. String token = History.getToken();
  4. loadPage(token);
  5. }

代码示例来源:origin: fr.putnami.pwt/pwt

  1. @Override
  2. public void redraw() {
  3. redraw(History.getToken());
  4. }

代码示例来源:origin: org.eagle-i/eagle-i-search-gwt

  1. public String getCurrentPageParams() {
  2. final String historyToken = History.getToken();
  3. return parsePageParams(historyToken);
  4. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. private static void onHashChanged() {
  2. /*
  3. * We guard against firing events twice, some browser (e.g. safari) tend to
  4. * fire events on startup if HTML5 pushstate is used.
  5. */
  6. String hashToken = getDecodedHash();
  7. if (!hashToken.equals(getToken())) {
  8. token = hashToken;
  9. historyEventSource.fireValueChangedEvent(hashToken);
  10. }
  11. }
  12. }

代码示例来源:origin: net.sf.javaprinciples.client/client-presentation

  1. private ModelPlace determineCurrentPlace()
  2. {
  3. String token = History.getToken();
  4. String[] parts = token.split(":");
  5. if (parts.length != 2)
  6. {
  7. // This is unexpected - how best to handle?
  8. return null;
  9. }
  10. return new ModelPlace.Tokenizer().getPlace(parts[1]);
  11. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. private static void onHashChanged() {
  2. /*
  3. * We guard against firing events twice, some browser (e.g. safari) tend to
  4. * fire events on startup if HTML5 pushstate is used.
  5. */
  6. String hashToken = getDecodedHash();
  7. if (!hashToken.equals(getToken())) {
  8. token = hashToken;
  9. historyEventSource.fireValueChangedEvent(hashToken);
  10. }
  11. }
  12. }

代码示例来源:origin: bedatadriven/activityinfo

  1. private void onNavigationCompleted(PageState place) {
  2. String token = PageStateSerializer.serialize(place);
  3. /*
  4. * If it's a duplicate, we're not totally interested
  5. */
  6. if (!token.equals(History.getToken())) {
  7. /*
  8. * Lodge in the browser's history
  9. */
  10. History.newItem(token, false);
  11. }
  12. }

代码示例来源:origin: bedatadriven/activityinfo

  1. private void fireInitialPage() {
  2. if (History.getToken().length() != 0) {
  3. Log.debug("HistoryManager: firing initial placed based on intial token: "
  4. + History.getToken());
  5. History.fireCurrentHistoryState();
  6. } else {
  7. eventBus.fireEvent(new NavigationEvent(
  8. NavigationHandler.NAVIGATION_REQUESTED, new DashboardPlace()));
  9. }
  10. }

相关文章