Search in sources :

Example 1 with TileWidget

use of org.kie.workbench.common.screens.library.client.widgets.common.TileWidget in project kie-wb-common by kiegroup.

the class ExampleImportPresenterTest method filterProjectsTest.

@Test
public void filterProjectsTest() {
    Set<ExampleProject> projects = new HashSet<>();
    projects.add(new ExampleProject(mock(Path.class), "p1a", "p1a description", null));
    projects.add(new ExampleProject(mock(Path.class), "p3b", "p3b description", null));
    projects.add(new ExampleProject(mock(Path.class), "p2a", "p2a description", null));
    doReturn(projects).when(libraryService).getExampleProjects();
    Map<String, String> params = new HashMap<>();
    params.put("repositoryUrl", "repoUrl");
    importPresenter.onStartup(new DefaultPlaceRequest(LibraryPlaces.PROJECT_SCREEN, params));
    final List<TileWidget> filteredProjects = importPresenter.filterProjects("a");
    assertEquals(2, filteredProjects.size());
}
Also used : HashMap(java.util.HashMap) TileWidget(org.kie.workbench.common.screens.library.client.widgets.common.TileWidget) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) ExampleProject(org.kie.workbench.common.screens.examples.model.ExampleProject) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with TileWidget

use of org.kie.workbench.common.screens.library.client.widgets.common.TileWidget in project kie-wb-common by kiegroup.

the class PopulatedLibraryScreen method updateView.

private void updateView(final List<WorkspaceProject> projects) {
    view.clearProjects();
    projects.stream().forEach(project -> {
        final TileWidget tileWidget = createProjectWidget(project);
        view.addProject(tileWidget.getView().getElement());
    });
}
Also used : TileWidget(org.kie.workbench.common.screens.library.client.widgets.common.TileWidget)

Example 3 with TileWidget

use of org.kie.workbench.common.screens.library.client.widgets.common.TileWidget in project kie-wb-common by kiegroup.

the class PopulatedLibraryScreen method createProjectWidget.

private TileWidget createProjectWidget(final WorkspaceProject project) {
    final TileWidget tileWidget = tileWidgets.get();
    if (project.getMainModule() != null) {
        final POM pom = project.getMainModule().getPom();
        tileWidget.init(project.getName(), pom != null ? pom.getDescription() : "", String.valueOf(project.getMainModule().getNumberOfAssets()), view.getNumberOfAssetsMessage(project.getMainModule().getNumberOfAssets()), selectCommand(project));
    } else {
        tileWidget.init(project.getName(), "", "0", "0", selectCommand(project));
    }
    return tileWidget;
}
Also used : TileWidget(org.kie.workbench.common.screens.library.client.widgets.common.TileWidget) POM(org.guvnor.common.services.project.model.POM)

Example 4 with TileWidget

use of org.kie.workbench.common.screens.library.client.widgets.common.TileWidget in project kie-wb-common by kiegroup.

the class ImportPresenter method createProjectWidget.

private TileWidget createProjectWidget(final ExampleProject project) {
    TileWidget tileWidget = tileWidgets.get();
    tileWidget.init(project.getName(), project.getDescription(), null, null, selectCommand(tileWidget));
    return tileWidget;
}
Also used : TileWidget(org.kie.workbench.common.screens.library.client.widgets.common.TileWidget)

Example 5 with TileWidget

use of org.kie.workbench.common.screens.library.client.widgets.common.TileWidget in project kie-wb-common by kiegroup.

the class ImportPresenter method setupProjects.

private void setupProjects(final Set<ExampleProject> projects) {
    if (projects == null || projects.isEmpty()) {
        showNoProjects();
        return;
    }
    projectWidgetsByName = new HashMap<>();
    projects.forEach(project -> {
        TileWidget projectWidget = createProjectWidget(project);
        projectWidgetsByName.put(project, projectWidget);
    });
    updateView(projectWidgetsByName.values());
}
Also used : TileWidget(org.kie.workbench.common.screens.library.client.widgets.common.TileWidget)

Aggregations

TileWidget (org.kie.workbench.common.screens.library.client.widgets.common.TileWidget)6 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 POM (org.guvnor.common.services.project.model.POM)1 Test (org.junit.Test)1 ExampleProject (org.kie.workbench.common.screens.examples.model.ExampleProject)1 DefaultPlaceRequest (org.uberfire.mvp.impl.DefaultPlaceRequest)1