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

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

本文整理了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

private void processHistory(ValueChangeEvent<String> event) {
 String historyToken;
 if (event != null) {
  historyToken = event.getValue();
 } else {
  historyToken = History.getToken();
 }
 updateHistoryParamsFromToken(historyToken);
}

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

@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());
    }
   }
  }
 });
}

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

public String getToken() {
 return History.getToken();
}

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

/**
 * 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);
}

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

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);
  }
 }
}

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

/**
 * 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);
  }
 }
}

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

@Override
public String getValue() {
  return History.getToken();
}

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

@Override
public String getToken() {
 return History.getToken();
}

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

@Override
public String getValue() {
  return History.getToken();
}

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

@Override
public String getToken() {
  return History.getToken();
}

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

/**
 * 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);
}

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

/**
 * 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);
}

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

@Override
public void startUp(Page startUpPage) {
  String token = History.getToken();
  loadPage(token);
}

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

@Override
public void redraw() {
  redraw(History.getToken());
}

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

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

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

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);
  }
 }
}

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

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]);
}

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

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);
  }
 }
}

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

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);
  }
}

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

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()));
  }
}

相关文章