Search in sources :

Example 11 with DefaultPlaceRequest

use of org.uberfire.mvp.impl.DefaultPlaceRequest in project kie-wb-common by kiegroup.

the class LibraryPlacesTest method onSelectLibraryTest.

@Test
public void onSelectLibraryTest() {
    doReturn(PlaceStatus.OPEN).when(placeManager).getStatus(LibraryPlaces.LIBRARY_PERSPECTIVE);
    final DefaultPlaceRequest projectSettingsPlaceRequest = new DefaultPlaceRequest(LibraryPlaces.LIBRARY_SCREEN);
    final PlaceGainFocusEvent placeGainFocusEvent = mock(PlaceGainFocusEvent.class);
    doReturn(projectSettingsPlaceRequest).when(placeGainFocusEvent).getPlace();
    libraryPlaces.onSelectPlaceEvent(placeGainFocusEvent);
    verify(libraryPlaces).hideDocks();
    verify(libraryPlaces).setupLibraryBreadCrumbsWithoutProject();
}
Also used : PlaceGainFocusEvent(org.uberfire.client.workbench.events.PlaceGainFocusEvent) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) Test(org.junit.Test)

Example 12 with DefaultPlaceRequest

use of org.uberfire.mvp.impl.DefaultPlaceRequest in project kie-wb-common by kiegroup.

the class LibraryPlacesTest method showDocksTest.

@Test
public void showDocksTest() {
    libraryPlaces.showDocks();
    libraryPlaces.showDocks();
    verify(docks, times(1)).setup(LibraryPlaces.LIBRARY_PERSPECTIVE, new DefaultPlaceRequest(LibraryPlaces.PROJECT_EXPLORER));
    verify(docks, times(1)).show();
    verify(docks, never()).hide();
}
Also used : DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) Test(org.junit.Test)

Example 13 with DefaultPlaceRequest

use of org.uberfire.mvp.impl.DefaultPlaceRequest in project kie-wb-common by kiegroup.

the class LibraryPlacesTest method goToProjectSettingsTest.

@Test
public void goToProjectSettingsTest() {
    final DefaultPlaceRequest placeRequest = new DefaultPlaceRequest(LibraryPlaces.PROJECT_SETTINGS);
    libraryPlaces.goToAsset(null);
    verify(placeManager).goTo(placeRequest);
}
Also used : DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) Test(org.junit.Test)

Example 14 with DefaultPlaceRequest

use of org.uberfire.mvp.impl.DefaultPlaceRequest in project kie-wb-common by kiegroup.

the class LibraryPlacesTest method goToLibraryWithDefaultOrganizationalUnitTest.

@Test
public void goToLibraryWithDefaultOrganizationalUnitTest() {
    when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.empty()).thenReturn(Optional.of(mock(OrganizationalUnit.class)));
    doReturn(Optional.empty()).when(projectContext).getActiveWorkspaceProject();
    doReturn(Optional.empty()).when(projectContext).getActiveModule();
    final PlaceRequest placeRequest = new DefaultPlaceRequest(LibraryPlaces.LIBRARY_SCREEN);
    final PartDefinitionImpl part = new PartDefinitionImpl(placeRequest);
    part.setSelectable(false);
    libraryPlaces.goToLibrary();
    verify(libraryPlaces).closeLibraryPlaces();
    verify(placeManager).goTo(eq(part), any(PanelDefinition.class));
    verify(libraryPlaces).setupLibraryBreadCrumbsWithoutProject();
    verify(projectContextChangeEvent, times(2)).fire(any(WorkspaceProjectContextChangeEvent.class));
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) PartDefinitionImpl(org.uberfire.workbench.model.impl.PartDefinitionImpl) PanelDefinition(org.uberfire.workbench.model.PanelDefinition) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) WorkspaceProjectContextChangeEvent(org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent) Test(org.junit.Test)

Example 15 with DefaultPlaceRequest

use of org.uberfire.mvp.impl.DefaultPlaceRequest in project kie-wb-common by kiegroup.

the class SocialHomePagePerspective method buildPerspective.

@Perspective
public PerspectiveDefinition buildPerspective() {
    final PerspectiveDefinition p = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());
    p.setName("Social Home Page Perspective");
    final PanelDefinition west = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());
    west.setWidth(450);
    west.setMinWidth(450);
    west.addPart(new PartDefinitionImpl(new DefaultPlaceRequest("SocialHomePageSidePresenter")));
    p.getRoot().addPart(new PartDefinitionImpl(new DefaultPlaceRequest("SocialHomePageMainPresenter")));
    p.getRoot().insertChild(CompassPosition.WEST, west);
    return p;
}
Also used : SimpleWorkbenchPanelPresenter(org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter) PartDefinitionImpl(org.uberfire.workbench.model.impl.PartDefinitionImpl) PerspectiveDefinitionImpl(org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl) PanelDefinition(org.uberfire.workbench.model.PanelDefinition) PerspectiveDefinition(org.uberfire.workbench.model.PerspectiveDefinition) PanelDefinitionImpl(org.uberfire.workbench.model.impl.PanelDefinitionImpl) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) MultiListWorkbenchPanelPresenter(org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter) Perspective(org.uberfire.client.annotations.Perspective) WorkbenchPerspective(org.uberfire.client.annotations.WorkbenchPerspective)

Aggregations

DefaultPlaceRequest (org.uberfire.mvp.impl.DefaultPlaceRequest)46 PartDefinitionImpl (org.uberfire.workbench.model.impl.PartDefinitionImpl)29 Test (org.junit.Test)17 PlaceRequest (org.uberfire.mvp.PlaceRequest)15 PanelDefinition (org.uberfire.workbench.model.PanelDefinition)14 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)12 Perspective (org.uberfire.client.annotations.Perspective)11 WorkbenchPerspective (org.uberfire.client.annotations.WorkbenchPerspective)11 PerspectiveDefinition (org.uberfire.workbench.model.PerspectiveDefinition)11 PerspectiveDefinitionImpl (org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl)11 MultiListWorkbenchPanelPresenter (org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter)8 WorkspaceProjectContextChangeEvent (org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent)7 PanelDefinitionImpl (org.uberfire.workbench.model.impl.PanelDefinitionImpl)7 HashMap (java.util.HashMap)4 UberfireDock (org.uberfire.client.workbench.docks.UberfireDock)3 PlaceGainFocusEvent (org.uberfire.client.workbench.events.PlaceGainFocusEvent)3 SimpleWorkbenchPanelPresenter (org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter)3 StaticWorkbenchPanelPresenter (org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter)3 ArrayList (java.util.ArrayList)2 WorkbenchProjectMetricsEvent (org.kie.workbench.common.screens.library.client.events.WorkbenchProjectMetricsEvent)2