/** * 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); }
/** * 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(); } }
/** * 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 void setTargetHistoryToken(final String targetHistoryToken) { this.targetHistoryToken = targetHistoryToken; final String hash = History.encodeHistoryToken(targetHistoryToken); setHref("#" + hash); }
/** * {@inheritDoc} */ @Override public void setTargetHistoryToken(final String targetHistoryToken) { this.targetHistoryToken = targetHistoryToken; final String hash = History.encodeHistoryToken(targetHistoryToken); setHref("#" + hash); }
@Override public void setTargetHistoryToken(final String targetHistoryToken) { this.targetHistoryToken = targetHistoryToken; final String hash = History.encodeHistoryToken(targetHistoryToken); setHref("#" + hash); }
/** * {@inheritDoc} */ @Override public void setTargetHistoryToken(final String targetHistoryToken) { this.targetHistoryToken = targetHistoryToken; final String hash = History.encodeHistoryToken(targetHistoryToken); setHref("#" + hash); }
/** * {@inheritDoc} */ @Override public void setTargetHistoryToken(final String targetHistoryToken) { this.targetHistoryToken = targetHistoryToken; final String hash = History.encodeHistoryToken(targetHistoryToken); setHref("#" + hash); }
/** * {@inheritDoc} */ @Override public void setTargetHistoryToken(final String targetHistoryToken) { this.targetHistoryToken = targetHistoryToken; final String hash = History.encodeHistoryToken(targetHistoryToken); setHref("#" + hash); }
/** * 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)); } }
/** * 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)); } }
/** * 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); }
/** * 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); }
/** * 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); } }
/** * 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); } }
protected void pushToken(String token) { historian.pushState(token, Window.getTitle(), "#" + History.encodeHistoryToken(token)); }
protected void pushToken(String token) { historian.pushState(token, Window.getTitle(), "#" + History.encodeHistoryToken(token)); }
protected void replaceToken(String token) { if (token.length() > 0) { historian.replaceState(token, Window.getTitle(), "#" + History.encodeHistoryToken(token)); } else { historian.replaceState(token, Window.getTitle(), ""); } }
protected void replaceToken(String token) { if (token.length() > 0) { historian.replaceState(token, Window.getTitle(), "#" + History.encodeHistoryToken(token)); } else { historian.replaceState(token, Window.getTitle(), ""); } }
/** * 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); } } }