Search in sources :

Example 6 with PathPlaceRequest

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

the class LibraryPlacesTest method goToAssetTest.

@Test
public void goToAssetTest() {
    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));
    libraryPlaces.goToAsset(path);
    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());
    assertNull(value.getPackage());
}
Also used : ObservablePath(org.uberfire.backend.vfs.ObservablePath) Path(org.uberfire.backend.vfs.Path) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) WorkspaceProjectContextChangeEvent(org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 7 with PathPlaceRequest

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

the class DataObjectBrowser method openDataObject.

private void openDataObject(final DataObject dataObject) {
    final Path objectPath = getContext().getDataObjectPath(dataObject.getClassName());
    if (objectPath != null) {
        view.showBusyIndicator(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.Loading());
        modelerService.call(new RemoteCallback<Boolean>() {

            @Override
            public void callback(Boolean exists) {
                view.hideBusyIndicator();
                if (Boolean.TRUE.equals(exists)) {
                    placeManager.goTo(new PathPlaceRequest(objectPath));
                } else {
                    view.showYesNoCancelPopup(CommonConstants.INSTANCE.Warning(), Constants.INSTANCE.objectBrowser_message_file_not_exists_or_renamed(objectPath.toURI()), new Command() {

                        @Override
                        public void execute() {
                        // do nothing.
                        }
                    }, CommonConstants.INSTANCE.Close(), ButtonType.WARNING, null, null, null, null, null, null);
                }
            }
        }, new DataModelerErrorCallback(CommonConstants.INSTANCE.ExceptionNoSuchFile0(objectPath.toURI()))).exists(objectPath);
    }
}
Also used : Path(org.uberfire.backend.vfs.Path) DataModelCommand(org.kie.workbench.common.screens.datamodeller.client.command.DataModelCommand) Command(org.uberfire.mvp.Command) AddPropertyCommand(org.kie.workbench.common.screens.datamodeller.client.command.AddPropertyCommand) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) DataModelerErrorCallback(org.kie.workbench.common.screens.datamodeller.client.DataModelerErrorCallback) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Example 8 with PathPlaceRequest

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

the class AbstractProjectDiagramEditor method initializeStunnerEditor.

void initializeStunnerEditor() {
    stunnerEditor.setOnResetContentHashProcessor(h -> this.originalHash = h);
    stunnerEditor.setParsingExceptionProcessor(e -> {
        ProjectMetadata pm = (ProjectMetadata) e.getMetadata();
        updateTitle(pm.getTitle());
        resetEditorPagesOnLoadError(pm.getOverview());
        menuSessionItems.setEnabled(false);
        notification.fire(new NotificationEvent(translationService.getValue(StunnerWidgetsConstants.DiagramParsingError, Objects.toString(e.getMessage(), "")), NotificationEvent.NotificationType.ERROR));
    });
    stunnerEditor.setExceptionProcessor(e -> {
        // close editor in case of error when opening the editor
        placeManager.forceClosePlace(new PathPlaceRequest(versionRecordManager.getCurrentPath(), getEditorIdentifier()));
    });
}
Also used : ProjectMetadata(org.kie.workbench.common.stunner.project.diagram.ProjectMetadata) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Example 9 with PathPlaceRequest

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

the class GuidedDecisionTableGraphEditorPresenter method onOpenDocumentsInEditor.

@Override
public void onOpenDocumentsInEditor(final List<Path> selectedDocumentPaths) {
    if (selectedDocumentPaths == null || selectedDocumentPaths.isEmpty()) {
        return;
    }
    view.showLoading();
    loadGraphLatch = new LoadGraphLatch(selectedDocumentPaths.size(), getSelectDecisionTableCommand(selectedDocumentPaths.get(0)));
    selectedDocumentPaths.stream().forEach((p) -> {
        final PathPlaceRequest placeRequest = getPathPlaceRequest(p);
        loadGraphLatch.loadDocument(placeRequest.getPath(), placeRequest);
    });
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest)

Example 10 with PathPlaceRequest

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

the class GuidedDecisionTableGraphEditorPresenterTest method checkReload.

@Test
public void checkReload() {
    final ObservablePath dtGraphPath = mock(ObservablePath.class);
    final PathPlaceRequest dtGraphPlaceRequest = mock(PathPlaceRequest.class);
    final GuidedDecisionTableEditorGraphContent dtGraphContent = makeDecisionTableGraphContent();
    final ObservablePath dtPath = mock(ObservablePath.class);
    final PlaceRequest dtPlaceRequest = mock(PlaceRequest.class);
    final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent(0);
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(dtPath, dtPath, dtPlaceRequest, dtContent);
    final GuidedDecisionTableGraphEntry dtGraphEntry = new GuidedDecisionTableGraphEntry(dtPath, dtPath);
    dtGraphContent.getModel().getEntries().add(dtGraphEntry);
    when(dtPath.toURI()).thenReturn("dtPath");
    when(dtGraphPath.toURI()).thenReturn("dtGraphPath");
    when(dtGraphPath.getFileName()).thenReturn("filename");
    when(dtService.loadContent(eq(dtPath))).thenReturn(dtContent);
    when(dtGraphService.loadContent(eq(dtGraphPath))).thenReturn(dtGraphContent);
    when(versionRecordManager.getCurrentPath()).thenReturn(dtGraphPath);
    when(modeller.addDecisionTable(any(ObservablePath.class), any(PlaceRequest.class), any(GuidedDecisionTableEditorContent.class), any(Boolean.class), any(), any())).thenReturn(dtPresenter);
    when(modeller.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(dtPresenter);
        }
    });
    presenter.onStartup(dtGraphPath, dtGraphPlaceRequest);
    verify(presenter, times(1)).loadDocumentGraph(dtGraphPath);
    presenter.reload();
    verify(presenter, times(1)).deregisterDocument(eq(dtPresenter));
    verify(presenter, times(2)).loadDocumentGraph(dtGraphPath);
    verify(modeller, times(1)).releaseDecisionTables();
    verify(modellerView, times(1)).clear();
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) GuidedDecisionTableEditorGraphContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent) GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) OverviewWidgetPresenter(org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) GuidedDecisionTableGraphEntry(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry) 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