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

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

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

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

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

  1. /**
  2. * Replace the current history token on top of the browsers history stack.
  3. *
  4. * <p>Note: This method has problems. The URL is updated with window.location.replace,
  5. * this unfortunately has side effects when using the deprecated iframe linker
  6. * (ie. "std" linker). Make sure you are using the cross site iframe linker when using
  7. * this method in your code.
  8. *
  9. * <p>Calling this method will cause
  10. * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}
  11. * to be called as well if and only if issueEvent is true.
  12. *
  13. * @param historyToken history token to replace current top entry
  14. * @param issueEvent issueEvent true if a
  15. * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}
  16. * event should be issued
  17. */
  18. public static void replaceItem(String historyToken, boolean issueEvent) {
  19. token = historyToken;
  20. impl.replaceToken(encodeHistoryToken(historyToken));
  21. if (issueEvent) {
  22. fireCurrentHistoryState();
  23. }
  24. }

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

  1. @Override
  2. public void setTargetHistoryToken(final String targetHistoryToken) {
  3. this.targetHistoryToken = targetHistoryToken;
  4. final String hash = History.encodeHistoryToken(targetHistoryToken);
  5. setHref("#" + hash);
  6. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void setTargetHistoryToken(final String targetHistoryToken) {
  6. this.targetHistoryToken = targetHistoryToken;
  7. final String hash = History.encodeHistoryToken(targetHistoryToken);
  8. setHref("#" + hash);
  9. }

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

  1. @Override
  2. public void setTargetHistoryToken(final String targetHistoryToken) {
  3. this.targetHistoryToken = targetHistoryToken;
  4. final String hash = History.encodeHistoryToken(targetHistoryToken);
  5. setHref("#" + hash);
  6. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void setTargetHistoryToken(final String targetHistoryToken) {
  6. this.targetHistoryToken = targetHistoryToken;
  7. final String hash = History.encodeHistoryToken(targetHistoryToken);
  8. setHref("#" + hash);
  9. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void setTargetHistoryToken(final String targetHistoryToken) {
  6. this.targetHistoryToken = targetHistoryToken;
  7. final String hash = History.encodeHistoryToken(targetHistoryToken);
  8. setHref("#" + hash);
  9. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void setTargetHistoryToken(final String targetHistoryToken) {
  6. this.targetHistoryToken = targetHistoryToken;
  7. final String hash = History.encodeHistoryToken(targetHistoryToken);
  8. setHref("#" + hash);
  9. }

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

  1. /**
  2. * Set the target history token for the widget. Note, that you should use either
  3. * {@link #setTargetHistoryToken(String)} or {@link #setHref(String)}, but not both as
  4. * {@link #setHref(String)} resets the target history token.
  5. *
  6. * @param targetHistoryToken String target history token of the widget
  7. */
  8. @Override
  9. public void setTargetHistoryToken(final String targetHistoryToken) {
  10. this.targetHistoryToken = targetHistoryToken;
  11. if (targetHistoryToken != null) {
  12. setHref("#" + History.encodeHistoryToken(targetHistoryToken));
  13. }
  14. }

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

  1. /**
  2. * Set the target history token for the widget. Note, that you should use either
  3. * {@link #setTargetHistoryToken(String)} or {@link #setHref(String)}, but not both as
  4. * {@link #setHref(String)} resets the target history token.
  5. *
  6. * @param targetHistoryToken String target history token of the widget
  7. */
  8. @Override
  9. public void setTargetHistoryToken(final String targetHistoryToken) {
  10. this.targetHistoryToken = targetHistoryToken;
  11. if (targetHistoryToken != null) {
  12. setHref("#" + History.encodeHistoryToken(targetHistoryToken));
  13. }
  14. }

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. protected void replaceToken(String token) {
  2. if (token.length() > 0) {
  3. historian.replaceState(token, Window.getTitle(), "#" + History.encodeHistoryToken(token));
  4. } else {
  5. historian.replaceState(token, Window.getTitle(), "");
  6. }
  7. }

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

  1. protected void replaceToken(String token) {
  2. if (token.length() > 0) {
  3. historian.replaceState(token, Window.getTitle(), "#" + History.encodeHistoryToken(token));
  4. } else {
  5. historian.replaceState(token, Window.getTitle(), "");
  6. }
  7. }

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

  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. }

相关文章