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());
}
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());
});
}
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;
}
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;
}
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());
}
Aggregations