Search in sources :

Example 1 with FolderListing

use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.

the class HelperWrapper method getUserExplorerLastData.

public UserExplorerLastData getUserExplorerLastData() {
    UserExplorerLastData userExplorerLastData = new UserExplorerLastData();
    if (activeOptionsArgumentCaptor != null) {
        userExplorerLastData.setOptions(activeOptionsArgumentCaptor.getValue());
    }
    if (packageArgumentCaptor == null) {
        return userExplorerLastData;
    }
    Package value = packageArgumentCaptor.getValue();
    FolderListing folderListing = folderListingArgumentCaptor.getValue();
    if (folderListing != null) {
        userExplorerLastData.setFolderItem(projectArgumentCaptor.getValue().getRepository(), projectArgumentCaptor.getValue().getBranch().getName(), moduleArgumentCaptor.getValue(), folderListing.getItem());
    }
    if (value != null && includePackage) {
        userExplorerLastData.setPackage(projectArgumentCaptor.getValue().getRepository(), projectArgumentCaptor.getValue().getBranch().getName(), moduleArgumentCaptor.getValue(), value);
    } else if (includePackage) {
        userExplorerLastData.setPackage(projectArgumentCaptor.getValue().getRepository(), projectArgumentCaptor.getValue().getBranch().getName(), moduleArgumentCaptor.getValue(), new Package());
    }
    return userExplorerLastData;
}
Also used : Package(org.guvnor.common.services.project.model.Package) FolderListing(org.kie.workbench.common.screens.explorer.model.FolderListing)

Example 2 with FolderListing

use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.

the class BaseViewPresenter method onResourceRenamed.

// Refresh when a Resource has been renamed, if it exists in the active package
public void onResourceRenamed(@Observes final ResourceRenamedEvent event) {
    if (!baseView.isVisible()) {
        return;
    }
    final Path sourcePath = event.getPath();
    final Path destinationPath = event.getDestinationPath();
    boolean refresh = false;
    if (Utils.isInFolderItem(activeContextItems.getActiveFolderItem(), sourcePath)) {
        refresh = true;
    } else if (Utils.isInFolderItem(activeContextItems.getActiveFolderItem(), destinationPath)) {
        refresh = true;
    }
    if (refresh) {
        explorerService.call(new RemoteCallback<FolderListing>() {

            @Override
            public void callback(final FolderListing folderListing) {
                baseView.setItems(folderListing);
            }
        }).getFolderListing(activeContextItems.getActiveProject(), activeContextItems.getActiveModule(), activeContextItems.getActiveFolderItem(), activeOptions.getOptions());
    }
}
Also used : Path(org.uberfire.backend.vfs.Path) FolderListing(org.kie.workbench.common.screens.explorer.model.FolderListing) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Example 3 with FolderListing

use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.

the class BaseViewPresenterUpdateTest method hideTagWhenActiveContentExists.

@Test
public void hideTagWhenActiveContentExists() throws Exception {
    when(activeContextOptions.canShowTag()).thenReturn(false);
    final FolderListing folderListing = mock(FolderListing.class);
    when(activeContextItems.getActiveContent()).thenReturn(folderListing);
    presenter.update();
    verify(view).setItems(folderListing);
}
Also used : FolderListing(org.kie.workbench.common.screens.explorer.model.FolderListing) Test(org.junit.Test)

Example 4 with FolderListing

use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.

the class BaseBreadcrumbNavigatorTest method testLoadContentOnlyFolder.

@Test
public void testLoadContentOnlyFolder() {
    final BreadcrumbNavigator navigator = spy(new BreadcrumbNavigator(activeOptions, hiddenTypeDef, user));
    final FolderItem item = new FolderItem(path, "item1", FolderItemType.FILE);
    final List<FolderItem> content = new ArrayList<FolderItem>() {

        {
            add(new FolderItem(mock(Path.class), "Folder1", FolderItemType.FOLDER));
        }
    };
    final List<FolderItem> segments = new ArrayList<FolderItem>();
    final FolderListing listing = new FolderListing(item, content, segments);
    navigator.loadContent(listing);
    verify(navigator).setupBreadcrumb(listing);
    verify(navigator).setupUpFolder(listing);
    verify(navigator).setupContent(listing);
    verify(navigator).showNavigatorPanel();
}
Also used : FolderItem(org.kie.workbench.common.screens.explorer.model.FolderItem) ArrayList(java.util.ArrayList) FolderListing(org.kie.workbench.common.screens.explorer.model.FolderListing) Test(org.junit.Test)

Example 5 with FolderListing

use of org.kie.workbench.common.screens.explorer.model.FolderListing in project kie-wb-common by kiegroup.

the class BaseBreadcrumbNavigatorTest method testLoadContentFileAndFolder.

@Test
public void testLoadContentFileAndFolder() {
    final BreadcrumbNavigator navigator = spy(new BreadcrumbNavigator(activeOptions, hiddenTypeDef, user));
    final FolderItem item = new FolderItem(path, "item1", FolderItemType.FILE);
    final List<FolderItem> content = new ArrayList<FolderItem>() {

        {
            add(new FolderItem(mock(Path.class), "File1", FolderItemType.FILE));
            add(new FolderItem(mock(Path.class), "Folder1", FolderItemType.FOLDER));
        }
    };
    final List<FolderItem> segments = new ArrayList<FolderItem>();
    final FolderListing listing = new FolderListing(item, content, segments);
    navigator.loadContent(listing);
    verify(navigator).setupBreadcrumb(listing);
    verify(navigator).setupUpFolder(listing);
    verify(navigator).setupContent(listing);
    verify(navigator).showNavigatorPanel();
}
Also used : FolderItem(org.kie.workbench.common.screens.explorer.model.FolderItem) ArrayList(java.util.ArrayList) FolderListing(org.kie.workbench.common.screens.explorer.model.FolderListing) Test(org.junit.Test)

Aggregations

FolderListing (org.kie.workbench.common.screens.explorer.model.FolderListing)12 FolderItem (org.kie.workbench.common.screens.explorer.model.FolderItem)8 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)5 Package (org.guvnor.common.services.project.model.Package)4 Module (org.guvnor.common.services.project.model.Module)2 Before (org.junit.Before)2 ActiveOptions (org.kie.workbench.common.screens.explorer.service.ActiveOptions)2 KieModuleService (org.kie.workbench.common.services.shared.project.KieModuleService)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 Path (org.uberfire.backend.vfs.Path)2 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)1 DescriptiveRunnable (org.uberfire.commons.async.DescriptiveRunnable)1 Space (org.uberfire.spaces.Space)1