Package com.gwtplatform.mvp.shared.proxy

Examples of com.gwtplatform.mvp.shared.proxy.PlaceRequest


        // 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));
    }
View Full Code Here


        // When
        placeManager.revealRelativePlace(0);
        deferredCommandManager.pump();

        // Then
        PlaceRequest placeRequest = placeManager.getCurrentPlaceRequest();
        assertEquals("defaultPlace", placeRequest.getNameToken());
        assertEquals(0, placeRequest.getParameterNames().size());

        verify(gwtWindowMethods).setBrowserHistoryToken(any(String.class), eq(false));
    }
View Full Code Here

        // When
        placeManager.revealPlaceHierarchy(Collections.<PlaceRequest>emptyList());
        deferredCommandManager.pump();

        // Then
        PlaceRequest placeRequest = placeManager.getCurrentPlaceRequest();
        assertEquals("defaultPlace", placeRequest.getNameToken());
        assertEquals(0, placeRequest.getParameterNames().size());

        verify(gwtWindowMethods).setBrowserHistoryToken(any(String.class), eq(false));
    }
View Full Code Here

        // Then
        List<PlaceRequest> placeHierarchy = placeManager.getCurrentPlaceHierarchy();
        assertEquals(1, placeHierarchy.size());

        PlaceRequest placeRequest = placeManager.getCurrentPlaceRequest();
        assertEquals(placeHierarchy.get(0), placeRequest);

        assertEquals("dummyNameTokenBasic", placeRequest.getNameToken());
        assertEquals(1, placeRequest.getParameterNames().size());
        assertEquals("dummyValue", placeRequest.getParameter("dummyParam", null));

        verify(presenter).prepareFromRequest(placeRequest);
        verify(presenter).forceReveal();

        verify(gwtWindowMethods).setBrowserHistoryToken(any(String.class), eq(false));

        assertEquals(1, navigationHandler.navCount);
        placeRequest = navigationHandler.lastEvent.getRequest();
        assertEquals("dummyNameTokenBasic", placeRequest.getNameToken());
        assertEquals(1, placeRequest.getParameterNames().size());
        assertEquals("dummyValue", placeRequest.getParameter("dummyParam", null));
    }
View Full Code Here

     * is deferred but useBrowserUrl must be preserved and the history token must be set only once.
     */
    @Test
    public void placeManagerRevealPlaceRedirectInPrepareFromRequestNoHistory() {
        // Given
        PlaceRequest placeRequest = new PlaceRequest.Builder().nameToken(DummyPresenterRedirectNoHistory.TOKEN).build();

        // When
        placeManager.revealPlace(placeRequest);
        deferredCommandManager.pump();

        // Then
        // assert called only once
        verify(gwtWindowMethods, times(1)).setBrowserHistoryToken(any(String.class), eq(false));

        PlaceRequest finalPlaceRequest = placeManager.getCurrentPlaceRequest();
        assertEquals("dummyNameTokenBasic", finalPlaceRequest.getNameToken());
    }
View Full Code Here

    @Test
    public void placeManagerRevealPlaceRedirectInPrepareFromRequest(
            DummyPresenterRedirect presenter,
            DummyPresenterBasic otherPresenter) {
        // Given
        PlaceRequest placeRequest = new PlaceRequest.Builder().nameToken("dummyNameTokenRedirect").with("dummyParam",
                "dummyValue").build();

        // When
        placeManager.revealPlace(placeRequest);
        deferredCommandManager.pump();

        // Then
        List<PlaceRequest> placeHierarchy = placeManager.getCurrentPlaceHierarchy();
        assertEquals(1, placeHierarchy.size());

        PlaceRequest finalPlaceRequest = placeManager.getCurrentPlaceRequest();
        assertEquals(placeHierarchy.get(0), finalPlaceRequest);

        assertEquals("dummyNameTokenBasic", finalPlaceRequest.getNameToken());
        assertEquals(0, finalPlaceRequest.getParameterNames().size());

        assertEquals(1, presenter.prepareFromRequestCalls);
        assertEquals(placeRequest, presenter.preparedRequest);
        assertEquals(0, presenter.revealInParentCalls);
View Full Code Here

    @Test
    public void placeManagerUserUpdateHistoryWhenRevealPlace(
            DummyPresenterRedirect presenter,
            DummyPresenterBasic otherPresenter) {
        // Given
        PlaceRequest placeRequest = new PlaceRequest.Builder().nameToken("dummyNameTokenRedirect").with("dummyParam",
                "dummyValue").build();

        // When
        placeManager.revealPlace(placeRequest);
        deferredCommandManager.pump();

        // Then
        List<PlaceRequest> placeHierarchy = placeManager.getCurrentPlaceHierarchy();
        assertEquals(1, placeHierarchy.size());

        PlaceRequest finalPlaceRequest = placeManager.getCurrentPlaceRequest();
        assertEquals(placeHierarchy.get(0), finalPlaceRequest);

        assertEquals("dummyNameTokenBasic", finalPlaceRequest.getNameToken());
        assertEquals(0, finalPlaceRequest.getParameterNames().size());

        assertEquals(1, presenter.prepareFromRequestCalls);
        assertEquals(placeRequest, presenter.preparedRequest);
        assertEquals(0, presenter.revealInParentCalls);
View Full Code Here

        delayTestFinish(1000);
    }

    private void revealAdmin() {
        PlaceRequest placeRequest = new Builder().nameToken("admin").build();
        ginjector.getPlaceManager().revealPlace(placeRequest);

        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            @Override
            public void execute() {
View Full Code Here

            }
        });
    }

    private void revealSelfService() {
        PlaceRequest placeRequest = new Builder().nameToken("selfService").build();
        ginjector.getPlaceManager().revealPlace(placeRequest);

        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            @Override
            public void execute() {
View Full Code Here

        }
    }

    @Override
    public void onDetail(ManufacturerDto manufacturerDto) {
        PlaceRequest placeRequest = new Builder().nameToken(NameTokens.getDetailManufacturer())
                .with("id", String.valueOf(manufacturerDto.getId()))
                .build();

        placeManager.revealPlace(placeRequest);
    }
View Full Code Here

TOP

Related Classes of com.gwtplatform.mvp.shared.proxy.PlaceRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.