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

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

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

History.encodeHistoryToken介绍

[英]Encode a history token for use as part of a URI.
[中]对历史标记进行编码以用作URI的一部分。

代码示例

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

/**
 * Sets the history token referenced by this hyperlink. This is the history
 * token that will be passed to {@link History#newItem} when this link is
 * clicked.
 *
 * @param targetHistoryToken the new history token, which may not be null (use
 *          {@link Anchor} instead if you don't need history processing)
 */
@SuppressIsSafeUriCastCheck //TODO(bangert): Refactor setPropertyString
public void setTargetHistoryToken(String targetHistoryToken) {
 assert targetHistoryToken != null
  : "targetHistoryToken must not be null, consider using Anchor instead";
 this.targetHistoryToken = targetHistoryToken;
 String hash = History.encodeHistoryToken(targetHistoryToken);
 anchorElem.setPropertyString("href", "#" + hash);
}

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

/**
 * Replace the current history token on top of the browsers history stack.
 *
 * <p>Note: This method has problems. The URL is updated with window.location.replace,
 * this unfortunately has side effects when using the deprecated iframe linker
 * (ie. "std" linker). Make sure you are using the cross site iframe linker when using
 * this method in your code.
 *
 * <p>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 history token to replace current top entry
 * @param issueEvent issueEvent true if a
 *          {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}
 *          event should be issued
 */
public static void replaceItem(String historyToken, boolean issueEvent) {
 token = historyToken;
 impl.replaceToken(encodeHistoryToken(historyToken));
 if (issueEvent) {
  fireCurrentHistoryState();
 }
}

代码示例来源: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: org.gwtbootstrap3/gwtbootstrap3

@Override
public void setTargetHistoryToken(final String targetHistoryToken) {
  this.targetHistoryToken = targetHistoryToken;
  final String hash = History.encodeHistoryToken(targetHistoryToken);
  setHref("#" + hash);
}

代码示例来源:origin: gwtbootstrap3/gwtbootstrap3

/**
 * {@inheritDoc}
 */
@Override
public void setTargetHistoryToken(final String targetHistoryToken) {
  this.targetHistoryToken = targetHistoryToken;
  final String hash = History.encodeHistoryToken(targetHistoryToken);
  setHref("#" + hash);
}

代码示例来源:origin: gwtbootstrap3/gwtbootstrap3

@Override
public void setTargetHistoryToken(final String targetHistoryToken) {
  this.targetHistoryToken = targetHistoryToken;
  final String hash = History.encodeHistoryToken(targetHistoryToken);
  setHref("#" + hash);
}

代码示例来源:origin: gwtbootstrap3/gwtbootstrap3

/**
 * {@inheritDoc}
 */
@Override
public void setTargetHistoryToken(final String targetHistoryToken) {
  this.targetHistoryToken = targetHistoryToken;
  final String hash = History.encodeHistoryToken(targetHistoryToken);
  setHref("#" + hash);
}

代码示例来源:origin: org.gwtbootstrap3/gwtbootstrap3

/**
 * {@inheritDoc}
 */
@Override
public void setTargetHistoryToken(final String targetHistoryToken) {
  this.targetHistoryToken = targetHistoryToken;
  final String hash = History.encodeHistoryToken(targetHistoryToken);
  setHref("#" + hash);
}

代码示例来源:origin: org.gwtbootstrap3/gwtbootstrap3

/**
 * {@inheritDoc}
 */
@Override
public void setTargetHistoryToken(final String targetHistoryToken) {
  this.targetHistoryToken = targetHistoryToken;
  final String hash = History.encodeHistoryToken(targetHistoryToken);
  setHref("#" + hash);
}

代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material

/**
 * Set the target history token for the widget. Note, that you should use either
 * {@link #setTargetHistoryToken(String)} or {@link #setHref(String)}, but not both as
 * {@link #setHref(String)} resets the target history token.
 *
 * @param targetHistoryToken String target history token of the widget
 */
@Override
public void setTargetHistoryToken(final String targetHistoryToken) {
  this.targetHistoryToken = targetHistoryToken;
  if (targetHistoryToken != null) {
    setHref("#" + History.encodeHistoryToken(targetHistoryToken));
  }
}

代码示例来源:origin: GwtMaterialDesign/gwt-material

/**
 * Set the target history token for the widget. Note, that you should use either
 * {@link #setTargetHistoryToken(String)} or {@link #setHref(String)}, but not both as
 * {@link #setHref(String)} resets the target history token.
 *
 * @param targetHistoryToken String target history token of the widget
 */
@Override
public void setTargetHistoryToken(final String targetHistoryToken) {
  this.targetHistoryToken = targetHistoryToken;
  if (targetHistoryToken != null) {
    setHref("#" + History.encodeHistoryToken(targetHistoryToken));
  }
}

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

/**
 * Sets the history token referenced by this hyperlink. This is the history
 * token that will be passed to {@link History#newItem} when this link is
 * clicked.
 *
 * @param targetHistoryToken the new history token, which may not be null (use
 *          {@link Anchor} instead if you don't need history processing)
 */
public void setTargetHistoryToken(String targetHistoryToken) {
 assert targetHistoryToken != null
  : "targetHistoryToken must not be null, consider using Anchor instead";
 this.targetHistoryToken = targetHistoryToken;
 String hash = History.encodeHistoryToken(targetHistoryToken);
 anchorElem.setPropertyString("href", "#" + hash);
}

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

/**
 * Sets the history token referenced by this hyperlink. This is the history
 * token that will be passed to {@link History#newItem} when this link is
 * clicked.
 *
 * @param targetHistoryToken the new history token, which may not be null (use
 *          {@link Anchor} instead if you don't need history processing)
 */
public void setTargetHistoryToken(String targetHistoryToken) {
 assert targetHistoryToken != null
  : "targetHistoryToken must not be null, consider using Anchor instead";
 this.targetHistoryToken = targetHistoryToken;
 String hash = History.encodeHistoryToken(targetHistoryToken);
 anchorElem.setPropertyString("href", "#" + hash);
}

代码示例来源:origin: org.gwtbootstrap3/gwtbootstrap3

/**
 * Set the target history token for the widget. Note, that you should use either {@link #setTargetHistoryToken(String)}
 * or {@link #setHref(String)}, but not both as {@link #setHref(String)} resets the target history token.
 * @param targetHistoryToken String target history token of the widget
 */
@Override
public void setTargetHistoryToken(final String targetHistoryToken) {
  this.targetHistoryToken = targetHistoryToken;
  if (targetHistoryToken != null) {
    final String hash = History.encodeHistoryToken(targetHistoryToken);
    getAnchorElement().setHref("#" + hash);
  }
}

代码示例来源:origin: gwtbootstrap3/gwtbootstrap3

/**
 * Set the target history token for the widget. Note, that you should use either {@link #setTargetHistoryToken(String)}
 * or {@link #setHref(String)}, but not both as {@link #setHref(String)} resets the target history token.
 * @param targetHistoryToken String target history token of the widget
 */
@Override
public void setTargetHistoryToken(final String targetHistoryToken) {
  this.targetHistoryToken = targetHistoryToken;
  if (targetHistoryToken != null) {
    final String hash = History.encodeHistoryToken(targetHistoryToken);
    getAnchorElement().setHref("#" + hash);
  }
}

代码示例来源:origin: com.googlecode.mgwt/mgwt

protected void pushToken(String token) {
  historian.pushState(token, Window.getTitle(), "#" + History.encodeHistoryToken(token));
}

代码示例来源:origin: dankurka/mgwt

protected void pushToken(String token) {
  historian.pushState(token, Window.getTitle(), "#" + History.encodeHistoryToken(token));
}

代码示例来源:origin: com.googlecode.mgwt/mgwt

protected void replaceToken(String token) {
  if (token.length() > 0) {
    historian.replaceState(token, Window.getTitle(), "#" + History.encodeHistoryToken(token));
  } else {
    historian.replaceState(token, Window.getTitle(), "");
  }
}

代码示例来源:origin: dankurka/mgwt

protected void replaceToken(String token) {
  if (token.length() > 0) {
    historian.replaceState(token, Window.getTitle(), "#" + History.encodeHistoryToken(token));
  } else {
    historian.replaceState(token, Window.getTitle(), "");
  }
}

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

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

相关文章