Search in sources :

Example 11 with PathPlaceRequest

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

the class GuidedDecisionTableGraphEditorPresenterTest method getPresenter.

@Override
protected GuidedDecisionTableGraphEditorPresenter getPresenter() {
    return new GuidedDecisionTableGraphEditorPresenter(view, dtServiceCaller, docks, mock(PerspectiveManager.class), dtGraphServiceCaller, moduleServiceCaller, graphSaveAndRenameServiceCaller, notification, saveInProgressEvent, decisionTableSelectedEvent, mock(GuidedDecisionTableDocksHandler.class), analysisReportScreen, validationPopup, dtGraphResourceType, editMenuBuilder, viewMenuBuilder, insertMenuBuilder, radarMenuBuilder, modeller, helper, beanManager, placeManager, lockManager, columnsPage, saveAndRenameCommandBuilder, alertsButtonMenuItemBuilder, downloadMenuItemBuilder, editorSearchIndex, searchBarComponent, searchableElementFactory, searchPerformed) {

        {
            workbenchContext = GuidedDecisionTableGraphEditorPresenterTest.this.workbenchContext;
            projectController = GuidedDecisionTableGraphEditorPresenterTest.this.projectController;
            promises = GuidedDecisionTableGraphEditorPresenterTest.this.promises;
        }

        @Override
        protected Command getSaveAndRenameCommand() {
            return mock(Command.class);
        }

        @Override
        PathPlaceRequest getPathPlaceRequest(final Path path) {
            // Avoid use of IOC.getBeanManager().lookupBean(..) in PathPlaceRequest for Unit Tests
            final PathPlaceRequest pathPlaceRequest = new PathPlaceRequest(path) {

                @Override
                protected ObservablePath createObservablePath(final Path path) {
                    final ObservablePath op = new ObservablePathImpl().wrap(path);
                    return op;
                }
            };
            return pathPlaceRequest;
        }
    };
}
Also used : PerspectiveManager(org.uberfire.client.mvp.PerspectiveManager) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Path(org.uberfire.backend.vfs.Path) ObservablePathImpl(org.uberfire.backend.vfs.impl.ObservablePathImpl) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Example 12 with PathPlaceRequest

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

the class NewFormDefinitionlHandler method create.

@Override
public void create(org.guvnor.common.services.project.model.Package pkg, String baseFileName, final NewResourcePresenter presenter) {
    BusyPopup.showMessage(translationService.getTranslation(FormEditorConstants.NewFormDefinitionlHandlerSelectFormUse));
    modelerService.call(path -> {
        BusyPopup.close();
        presenter.complete();
        notifySuccess();
        PlaceRequest place = new PathPlaceRequest((Path) path, "FormEditor");
        placeManager.goTo(place);
    }, (message, throwable) -> {
        BusyPopup.close();
        ErrorPopup.showMessage(CommonConstants.INSTANCE.SorryAnItemOfThatNameAlreadyExistsInTheRepositoryPleaseChooseAnother());
        return false;
    }).createForm(pkg.getPackageMainResourcesPath(), buildFileName(baseFileName, resourceType), formModelsPresenter.getFormModel());
}
Also used : FormEditorConstants(org.kie.workbench.common.forms.editor.client.resources.i18n.FormEditorConstants) ResourceTypeDefinition(org.uberfire.workbench.type.ResourceTypeDefinition) PlaceManager(org.uberfire.client.mvp.PlaceManager) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) FormDefinitionResourceType(org.kie.workbench.common.forms.editor.client.type.FormDefinitionResourceType) Inject(javax.inject.Inject) CommonConstants(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants) NewResourcePresenter(org.kie.workbench.common.widgets.client.handlers.NewResourcePresenter) FormModelsPresenter(org.kie.workbench.common.forms.editor.client.handler.formModel.FormModelsPresenter) IsWidget(com.google.gwt.user.client.ui.IsWidget) Pair(org.uberfire.commons.data.Pair) FormEditorService(org.kie.workbench.common.forms.editor.service.shared.FormEditorService) Path(org.uberfire.backend.vfs.Path) Event(javax.enterprise.event.Event) TranslationService(org.jboss.errai.ui.client.local.spi.TranslationService) ErrorPopup(org.uberfire.ext.widgets.common.client.common.popups.errors.ErrorPopup) PlaceRequest(org.uberfire.mvp.PlaceRequest) List(java.util.List) Caller(org.jboss.errai.common.client.api.Caller) PostConstruct(javax.annotation.PostConstruct) ApplicationScoped(javax.enterprise.context.ApplicationScoped) DefaultNewResourceHandler(org.kie.workbench.common.widgets.client.handlers.DefaultNewResourceHandler) ValidatorWithReasonCallback(org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback) BusyPopup(org.uberfire.ext.widgets.common.client.common.BusyPopup) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) Path(org.uberfire.backend.vfs.Path) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest)

Example 13 with PathPlaceRequest

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

the class AbstractProjectDiagramEditor method onLoadError.

private void onLoadError(final ClientRuntimeError error) {
    showError(error);
    // close editor in case of error when opening the editor
    placeManager.forceClosePlace(new PathPlaceRequest(versionRecordManager.getCurrentPath(), getEditorIdentifier()));
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest)

Example 14 with PathPlaceRequest

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

the class ClientProjectOpenReusableSubprocessService method openReusableSubprocess.

public void openReusableSubprocess(List<String> processData) {
    PlaceRequest placeRequestImpl = new PathPlaceRequest(// "test.bpmn"
    PathFactory.newPathBasedOn(// "test.bpmn"
    processData.get(0), // "default://master@testSpace/ProjectTest/src/main/resources/com/test.bpmn"
    processData.get(1), // not really used
    new PathFactory.PathImpl()));
    placeRequestImpl.addParameter("uuid", processData.get(1));
    placeRequestImpl.addParameter("profile", "jbpm");
    this.placeManager.goTo(placeRequestImpl);
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest)

Example 15 with PathPlaceRequest

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

the class LibraryPlacesTest method setup.

@Before
public void setup() {
    when(user.getIdentifier()).thenReturn("user");
    when(sessionInfo.getIdentity()).thenReturn(user);
    when(libraryPerspective.getPlace()).thenReturn(LIBRARY_PERSPECTIVE_PLACE_REQUEST);
    when(otherPerspective.getPlace()).thenReturn(OTHER_PERSPECTIVE_PLACE_REQUEST);
    windowParameters = new HashMap<>();
    libraryServiceCaller = new CallerMock<>(libraryService);
    vfsServiceCaller = new CallerMock<>(vfsService);
    repositoryServiceCaller = new CallerMock<>(repositoryService);
    organizationalUnitServiceCaller = new CallerMock<>(organizationalUnitService);
    libraryBreadcrumbs = spy(new LibraryBreadcrumbs(breadcrumbs, translationUtils, ts, resourceUtils, projectBranchBreadcrumb));
    libraryPlaces = spy(new LibraryPlaces(breadcrumbs, ts, assetDetailEvent, libraryServiceCaller, new CallerMock<>(projectService), new CallerMock<>(moduleService), placeManager, projectContext, projectContextChangeEvent, notificationEvent, translationUtils, vfsServiceCaller, importRepositoryPopUpPresenters, assetListUpdateEvent, closeUnsavedProjectAssetsPopUpPresenter, projectsSetupEvent, libraryBreadcrumbs, sessionInfo, repositoryServiceCaller, new SyncPromises(), mock(OrganizationalUnitController.class), organizationalUnitServiceCaller, logger, cookie, perspectiveManager) {

        @Override
        protected Map<String, List<String>> getParameterMap() {
            return windowParameters;
        }
    });
    doNothing().when(libraryPlaces).expose();
    libraryPlaces.setup();
    libraryPlaces.init(mock(LibraryPerspective.class));
    activeOrganizationalUnit = mock(OrganizationalUnit.class);
    activeSpace = mock(Space.class);
    activeRepository = mock(Repository.class);
    activeBranch = new Branch("main", mock(Path.class));
    activeModule = mock(Module.class);
    doReturn(Optional.of(activeOrganizationalUnit)).when(projectContext).getActiveOrganizationalUnit();
    activeProject = new WorkspaceProject(activeOrganizationalUnit, activeRepository, activeBranch, activeModule);
    doReturn(Optional.of(activeProject)).when(projectContext).getActiveWorkspaceProject();
    doReturn(Optional.of(activeModule)).when(projectContext).getActiveModule();
    doReturn(Optional.empty()).when(projectContext).getActiveRepositoryRoot();
    doReturn(Optional.empty()).when(projectContext).getActivePackage();
    when(current.getOrganizationalUnit()).thenReturn(activeOrganizationalUnit);
    when(current.getWorkspaceProject()).thenReturn(activeProject);
    when(current.getModule()).thenReturn(activeModule);
    when(activeOrganizationalUnit.getSpace()).thenReturn(activeSpace);
    when(activeRepository.getAlias()).thenReturn("repository");
    when(activeRepository.getIdentifier()).thenReturn("repository");
    when(activeRepository.getSpace()).thenReturn(activeSpace);
    final URIStructureExplorerModel model = mock(URIStructureExplorerModel.class);
    doReturn(mock(Repository.class)).when(model).getRepository();
    doReturn(mock(Module.class)).when(model).getModule();
    doReturn(mock(Path.class)).when(vfsService).get(any());
    final PathPlaceRequest pathPlaceRequest = mock(PathPlaceRequest.class);
    doReturn(mock(ObservablePath.class)).when(pathPlaceRequest).getPath();
    doReturn(pathPlaceRequest).when(libraryPlaces).createPathPlaceRequest(any());
    doReturn(importRepositoryPopUpPresenter).when(importRepositoryPopUpPresenters).get();
    lastSpaceCookie = user.getIdentifier() + "_lastSpace";
    lastProjectCookie = user.getIdentifier() + "_lastProject";
    lastBranchCookie = user.getIdentifier() + "_" + activeProject.getName() + "_lastBranch";
    doReturn("").when(cookie).get(any());
}
Also used : Space(org.uberfire.spaces.Space) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Path(org.uberfire.backend.vfs.Path) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) SyncPromises(org.uberfire.promise.SyncPromises) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) OrganizationalUnitController(org.guvnor.structure.client.security.OrganizationalUnitController) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) LibraryBreadcrumbs(org.kie.workbench.common.screens.library.client.util.breadcrumb.LibraryBreadcrumbs) LibraryPerspective(org.kie.workbench.common.screens.library.client.perspective.LibraryPerspective) URIStructureExplorerModel(org.kie.workbench.common.screens.explorer.model.URIStructureExplorerModel) Repository(org.guvnor.structure.repositories.Repository) Branch(org.guvnor.structure.repositories.Branch) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) ArrayList(java.util.ArrayList) Collections.emptyList(java.util.Collections.emptyList) List(java.util.List) Module(org.guvnor.common.services.project.model.Module) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Before(org.junit.Before)

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