Search in sources :

Example 1 with PathPlaceRequest

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

the class LibraryPlaces method onSelectPlaceEvent.

public void onSelectPlaceEvent(@Observes final PlaceGainFocusEvent placeGainFocusEvent) {
    if (isLibraryPerspectiveOpen() && !closingLibraryPlaces) {
        final PlaceRequest place = placeGainFocusEvent.getPlace();
        if (place instanceof PathPlaceRequest) {
            final PathPlaceRequest pathPlaceRequest = (PathPlaceRequest) place;
            setupLibraryBreadCrumbsForAsset(pathPlaceRequest.getPath());
            showDocks();
        } else if (!place.getIdentifier().equals(ALERTS) && isLibraryPlace(place)) {
            hideDocks();
            if (place.getIdentifier().equals(PROJECT_SETTINGS)) {
                setupLibraryBreadCrumbsForAsset(null);
            } else if (projectContext.getActiveWorkspaceProject().isPresent() && place.getIdentifier().equals(LibraryPlaces.PROJECT_SCREEN)) {
                setupLibraryBreadCrumbs();
            } else if (place.getIdentifier().equals(LibraryPlaces.LIBRARY_SCREEN)) {
                setupLibraryBreadCrumbsWithoutProject();
            }
        }
    }
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest)

Example 2 with PathPlaceRequest

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

the class LibraryPlaces method goToAsset.

public void goToAsset(final Path path) {
    moduleService.call((RemoteCallback<Package>) response -> {
        projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(projectContext.getActiveWorkspaceProject().orElse(null), projectContext.getActiveModule().orElse(null), response));
        final PlaceRequest placeRequest = generatePlaceRequest(path);
        placeManager.goTo(placeRequest);
        if (path != null) {
            final ObservablePath observablePath = ((PathPlaceRequest) placeRequest).getPath();
            observablePath.onRename(() -> libraryBreadcrumbs.setupForAsset(getActiveWorkspace(), observablePath));
        }
    }).resolvePackage(path);
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) WorkspaceProjectContextChangeEvent(org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Example 3 with PathPlaceRequest

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

the class CloseUnsavedProjectAssetsPopUpPresenterTest method showTest.

@Test
public void showTest() {
    final Command proceedCallback = mock(Command.class);
    final Command cancelCallback = mock(Command.class);
    final WorkspaceProject project = mock(WorkspaceProject.class);
    doReturn(createPath("default://project/")).when(project).getRootPath();
    doReturn("project").when(project).getName();
    final PathPlaceRequest pathPlaceRequest = mock(PathPlaceRequest.class);
    doReturn(createPath("default://project/package/Asset.java")).when(pathPlaceRequest).getPath();
    final List<PlaceRequest> uncloseablePlaces = new ArrayList<>();
    uncloseablePlaces.add(new DefaultPlaceRequest("screen"));
    uncloseablePlaces.add(pathPlaceRequest);
    presenter.show(project, uncloseablePlaces, proceedCallback, cancelCallback);
    verify(view).clearPlaces();
    verify(closeUnsavedProjectAssetsPopUpListItemPresenter).setup("screen");
    verify(closeUnsavedProjectAssetsPopUpListItemPresenter).setup("package/Asset.java");
    verify(view, times(2)).addPlace(any());
    verify(view).show("project");
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) Command(org.uberfire.mvp.Command) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) ArrayList(java.util.ArrayList) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) Test(org.junit.Test)

Example 4 with PathPlaceRequest

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

the class LibraryPlacesTest method goToAssetTestWithPackage.

@Test
public void goToAssetTestWithPackage() {
    final ObservablePath path = mock(ObservablePath.class);
    final PathPlaceRequest pathPlaceRequest = mock(PathPlaceRequest.class);
    doReturn(path).when(pathPlaceRequest).getPath();
    doReturn(pathPlaceRequest).when(libraryPlaces).createPathPlaceRequest(any(Path.class));
    final Package pkg = mock(Package.class);
    doReturn(pkg).when(moduleService).resolvePackage(path);
    libraryPlaces.goToAsset(path);
    verify(projectContextChangeEvent).fire(projectContextChangeEventArgumentCaptor.capture());
    final WorkspaceProjectContextChangeEvent contextChangeEvent = projectContextChangeEventArgumentCaptor.getValue();
    assertEquals(activeProject, contextChangeEvent.getWorkspaceProject());
    assertEquals(activeModule, contextChangeEvent.getModule());
    assertEquals(pkg, contextChangeEvent.getPackage());
    verify(placeManager).goTo(pathPlaceRequest);
    final ArgumentCaptor<WorkspaceProjectContextChangeEvent> eventArgumentCaptor = ArgumentCaptor.forClass(WorkspaceProjectContextChangeEvent.class);
    verify(projectContextChangeEvent).fire(eventArgumentCaptor.capture());
    final WorkspaceProjectContextChangeEvent value = eventArgumentCaptor.getValue();
    assertEquals(activeProject, value.getWorkspaceProject());
    assertEquals(activeModule, value.getModule());
    assertEquals(pkg, value.getPackage());
}
Also used : ObservablePath(org.uberfire.backend.vfs.ObservablePath) Path(org.uberfire.backend.vfs.Path) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) Package(org.guvnor.common.services.project.model.Package) WorkspaceProjectContextChangeEvent(org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 5 with PathPlaceRequest

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

the class LibraryPlacesTest method onSelectAssetTest.

@Test
public void onSelectAssetTest() {
    doReturn(libraryPerspective).when(perspectiveManager).getCurrentPerspective();
    final ObservablePath path = mock(ObservablePath.class);
    final PathPlaceRequest pathPlaceRequest = mock(PathPlaceRequest.class);
    doReturn(path).when(pathPlaceRequest).getPath();
    final PlaceGainFocusEvent placeGainFocusEvent = mock(PlaceGainFocusEvent.class);
    doReturn(pathPlaceRequest).when(placeGainFocusEvent).getPlace();
    libraryPlaces.onSelectPlaceEvent(placeGainFocusEvent);
    verify(libraryBreadcrumbs).setupForAsset(libraryPlaces.getActiveWorkspace(), path);
}
Also used : PlaceGainFocusEvent(org.uberfire.client.workbench.events.PlaceGainFocusEvent) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Aggregations

PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)20 ObservablePath (org.uberfire.backend.vfs.ObservablePath)12 Test (org.junit.Test)9 PlaceRequest (org.uberfire.mvp.PlaceRequest)9 Path (org.uberfire.backend.vfs.Path)8 GuidedDecisionTableEditorGraphContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent)6 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)5 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)4 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)4 GuidedDecisionTablePresenter (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter)3 GuidedDecisionTableGraphEntry (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry)3 WorkspaceProjectContextChangeEvent (org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent)3 OverviewWidgetPresenter (org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter)3 DefaultPlaceRequest (org.uberfire.mvp.impl.DefaultPlaceRequest)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 GuidedDecisionTableEditorGraphModel (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel)2 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)2 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)2 SaveInProgressEvent (org.uberfire.client.mvp.SaveInProgressEvent)2