コード例 #1
0
 /** Handles change events from {@link History}. */
 @Override
 public void onValueChange(final ValueChangeEvent<String> event) {
   if (locked) {
     defferedNavigation =
         new Command() {
           @Override
           public void execute() {
             onValueChange(event);
           }
         };
     return;
   }
   if (!getLock()) {
     return;
   }
   String historyToken = event.getValue();
   try {
     if (historyToken.trim().equals("")) {
       unlock();
       revealDefaultPlace();
     } else {
       historyToken = modifyNameToken(historyToken);
       placeHierarchy = tokenFormatter.toPlaceRequestHierarchy(historyToken);
       setPreviousRequestUrl(getCurrentPlaceRequest());
       doRevealPlace(getCurrentPlaceRequest(), true);
     }
   } catch (TokenFormatException e) {
     unlock();
     error(historyToken);
     NavigationEvent.fire(this, null);
   }
 }
コード例 #2
0
 @Override
 public String buildRelativeHistoryToken(int level) {
   List<PlaceRequest> placeHierarchyCopy = truncatePlaceHierarchy(level);
   if (placeHierarchyCopy.size() == 0) {
     return "";
   }
   return tokenFormatter.toHistoryToken(placeHierarchyCopy);
 }
コード例 #3
0
 @Override
 public void updateHistory(PlaceRequest request, boolean updateBrowserUrl) {
   try {
     // Make sure the request match
     assert request.hasSameNameToken(getCurrentPlaceRequest())
         : "Internal error, PlaceRequest passed to updateHistory doesn't match the tail of the place hierarchy.";
     placeHierarchy.set(placeHierarchy.size() - 1, request);
     if (updateBrowserUrl) {
       String historyToken = tokenFormatter.toHistoryToken(placeHierarchy);
       String browserHistoryToken = getBrowserHistoryToken();
       if (browserHistoryToken == null || !browserHistoryToken.equals(historyToken)) {
         setBrowserHistoryToken(historyToken, false);
       }
       saveHistoryToken(historyToken);
     }
   } catch (TokenFormatException e) {
     // Do nothing.
   }
 }
コード例 #4
0
  @Override
  public void execute() {
    String initialToken = History.getToken();
    if (!initialToken.isEmpty() && !isBlackListed(initialToken)) {
      List<PlaceRequest> hierarchy = formatter.toPlaceRequestHierarchy(initialToken);
      final PlaceRequest placeRequest = hierarchy.get(hierarchy.size() - 1);

      Scheduler.get()
          .scheduleDeferred(
              new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
                  placeManager.revealPlace(placeRequest, true);
                }
              });
      bootstrapContext.setInitialPlace(placeRequest.getNameToken());
    } else {
      placeManager.revealDefaultPlace();
    }
  }
コード例 #5
0
 @Override
 public String buildHistoryToken(PlaceRequest request) {
   return tokenFormatter.toPlaceToken(request);
 }
コード例 #6
0
 @Override
 public String buildRelativeHistoryToken(PlaceRequest request, int level) {
   List<PlaceRequest> placeHierarchyCopy = truncatePlaceHierarchy(level);
   placeHierarchyCopy.add(request);
   return tokenFormatter.toHistoryToken(placeHierarchyCopy);
 }