use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class ProjectPage method fetchRepository.
private void fetchRepository(final ExampleRepository selectedRepository) {
examplesService.call(new RemoteCallback<Set<ExampleProject>>() {
@Override
public void callback(final Set<ExampleProject> projects) {
activeView = projectsView;
model.getProjects().clear();
model.setSourceRepository(selectedRepository);
final List<ExampleProject> sortedProjects = sort(projects);
projectsView.setProjectsInRepository(sortedProjects);
exampleProjects = sortedProjects;
pageSelectedEvent.fire(new WizardPageSelectedEvent(ProjectPage.this));
}
}, new DefaultErrorCallback() {
@Override
public boolean error(final Message message, final Throwable throwable) {
model.setSourceRepository(null);
model.getSelectedRepository().setUrlValid(false);
return super.error(message, throwable);
}
}).getProjects(selectedRepository);
}
use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class ProjectPage method updateProjectsInRepository.
private void updateProjectsInRepository(final Collection<String> tags) {
List<ExampleProject> resultList = exampleProjects.stream().filter(p -> tags.stream().allMatch(userTag -> p.getTags().stream().anyMatch(projectTag -> projectTag.toLowerCase().contains(userTag.toLowerCase())))).sorted((o1, o2) -> o1.getName().compareTo(o2.getName())).collect(Collectors.toList());
projectsView.setProjectsInRepository(resultList);
pageSelectedEvent.fire(new WizardPageSelectedEvent(ProjectPage.this));
}
use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class ProjectPageViewImpl method setProjectsInRepository.
@Override
public void setProjectsInRepository(final List<ExampleProject> projects) {
this.projects.removeAllChildren();
for (ExampleProject project : projects) {
final ProjectItemView w = makeProjectWidget(project);
this.projects.appendChild(w.asWidget().getElement());
}
}
use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class ProjectPageTest method testIsComplete_SelectedProjects.
@Test
@SuppressWarnings("unchecked")
public void testIsComplete_SelectedProjects() {
model.addProject(new ExampleProject(mock(Path.class), "", "", Collections.EMPTY_LIST));
final Callback<Boolean> callback = mock(Callback.class);
page.isComplete(callback);
verify(callback, times(1)).callback(eq(true));
}
use of org.kie.workbench.common.screens.examples.model.ExampleProject in project kie-wb-common by kiegroup.
the class ProjectPageTest method testIsProjectSelected_Selected.
@Test
public void testIsProjectSelected_Selected() {
final ExampleProject project = mock(ExampleProject.class);
model.addProject(project);
assertTrue(page.isProjectSelected(project));
}
Aggregations