示例#1
0
  @Test
  public void placeManagerUserCallUpdateHistoryWhenRevealingPlace() {
    // Given
    doAnswer(
            invocation -> {
              Object[] args = invocation.getArguments();
              deferredCommandManager.addCommand(
                  () ->
                      placeManager.updateHistory(
                          new PlaceRequest.Builder()
                              .nameToken("dummyNameToken")
                              .with("dummyParam", "dummyValue")
                              .build(),
                          true));
              ((PlaceRequestInternalEvent) args[0]).setHandled();
              return null;
            })
        .when(eventBus)
        .fireEventFromSource(isA(PlaceRequestInternalEvent.class), eq(placeManager));

    // When
    placeManager.revealPlace(new PlaceRequest.Builder().nameToken("dummyNameToken").build());
    deferredCommandManager.pump();

    // Then
    PlaceRequest placeRequest = placeManager.getCurrentPlaceRequest();
    assertEquals("dummyNameToken", placeRequest.getNameToken());
    assertEquals(1, placeRequest.getParameterNames().size());
    assertEquals("dummyValue", placeRequest.getParameter("dummyParam", null));

    verify(gwtWindowMethods).setBrowserHistoryToken(any(String.class), eq(false));
  }
示例#2
0
  @Override
  public void prepareFromRequest(PlaceRequest request) {
    super.prepareFromRequest(request);

    String idString = request.getParameter(ParameterTokens.TOKEN_ID, null);
    try {
      id = Integer.parseInt(idString);
    } catch (NumberFormatException e) {
      id = 0;
    }
  }
示例#3
0
文件: Places.java 项目: hal/hal.next
 /** Returns a new place request with the a new value for the specified parameter. */
 public PlaceRequest.Builder replaceParameter(
     PlaceRequest placeRequest, String parameter, String newValue) {
   PlaceRequest.Builder builder =
       new PlaceRequest.Builder().nameToken(placeRequest.getNameToken());
   for (String p : placeRequest.getParameterNames()) {
     if (parameter.equals(p)) {
       builder.with(parameter, newValue);
     } else {
       builder.with(p, placeRequest.getParameter(p, ""));
     }
   }
   return builder;
 }
  @Override
  public void prepareFromRequest(PlaceRequest request) {
    super.prepareFromRequest(request);
    // fireEvent(new
    // ChangeTabEvent(ApplicationPresenter.SLOT_ChangeTab,getProxy()));

    stories.clear();
    getView().showPublish(false);

    newsDesk = null;
    String desk = request.getParameter("desk", "inbox");
    getView().selectTab(desk);

    if (desk.equals("inbox")) {
      newsDesk = null;
    } else {
      newsDesk = StringUtils.searchEnum(NewsDesk.class, desk);
    }

    SearchFilter searchFilter = getView().getSearchFilter();
    searchFilter.setDesk(newsDesk);
    loadSearchParams();
    loadStories(searchFilter);
  }
示例#5
0
文件: Places.java 项目: hal/hal.next
 public boolean isExternal(PlaceRequest placeRequest) {
   return Boolean.parseBoolean(placeRequest.getParameter(EXTERNAL_PARAM, String.valueOf(false)));
 }
 @Override
 public void prepareFromRequest(final PlaceRequest request) {
   federation = request.getParameter(FEDERATION_REQUEST_PARAM, null);
   serviceProvider = request.getParameter(SERVICE_PROVIDER_REQUEST_PARAM, null);
 }