Java Code Examples for com.google.gwt.user.client.Window.Location#replace()

The following examples show how to use com.google.gwt.user.client.Window.Location#replace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GadgetWidget.java    From swellrt with Apache License 2.0 5 votes vote down vote up
@Override
public void requestNavigateTo(String url) {
  log("Requested navigate to: ", url);
  // NOTE(user): Currently only allow the gadgets to change the fragment part of the URL.
  String newFragment = url.replaceFirst(BEFORE_FRAGMENT_PATTERN, "");
  if (newFragment.matches(FRAGMENT_VALIDATION_PATTERN)) {
    Location.replace(Location.getHref().replaceFirst(FRAGMENT_PATTERN, "") + "#" + newFragment);
  } else {
    log("Navigate request denied.");
  }
}
 
Example 2
Source File: GadgetWidget.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
@Override
public void requestNavigateTo(String url) {
  log("Requested navigate to: ", url);
  // NOTE(user): Currently only allow the gadgets to change the fragment part of the URL.
  String newFragment = url.replaceFirst(BEFORE_FRAGMENT_PATTERN, "");
  if (newFragment.matches(FRAGMENT_VALIDATION_PATTERN)) {
    Location.replace(Location.getHref().replaceFirst(FRAGMENT_PATTERN, "") + "#" + newFragment);
  } else {
    log("Navigate request denied.");
  }
}