use of org.kie.workbench.common.screens.library.api.ProjectCountUpdate in project kie-wb-common by kiegroup.
the class PopulatedLibraryScreen method updateView.
private void updateView(Collection<TileWidget<WorkspaceProject>> projects) {
view.clearProjects();
this.projectCountUpdateEvent.fire(new ProjectCountUpdate(projects.size(), this.getOrganizationalUnit().getSpace()));
projects.forEach(project -> {
view.addProject(project);
});
}
use of org.kie.workbench.common.screens.library.api.ProjectCountUpdate in project kie-wb-common by kiegroup.
the class PopulatedLibraryScreen method onNewProjectEvent.
public void onNewProjectEvent(@Observes NewProjectEvent e) {
projectContext.getActiveOrganizationalUnit().ifPresent(organizationalUnit -> {
if (eventOnCurrentSpace(organizationalUnit, e.getWorkspaceProject().getSpace())) {
Optional<TileWidget<WorkspaceProject>> workspaceOptional = findTile(e.getWorkspaceProject());
// Checking if the project is already there
if (workspaceOptional.isPresent()) {
return;
}
TileWidget<WorkspaceProject> tile = createProjectWidget(e.getWorkspaceProject());
Optional<TileWidget<WorkspaceProject>> optional = Optional.ofNullable(libraryTiles.higher(tile));
if (optional.isPresent()) {
view.addProject(tile, optional.get());
} else {
view.addProject(tile);
}
this.projectCountUpdateEvent.fire(new ProjectCountUpdate(libraryTiles.size(), this.getOrganizationalUnit().getSpace()));
}
});
}
use of org.kie.workbench.common.screens.library.api.ProjectCountUpdate in project kie-wb-common by kiegroup.
the class PopulatedLibraryScreen method onRepositoryRemovedEvent.
public void onRepositoryRemovedEvent(@Observes RepositoryRemovedEvent e) {
projectContext.getActiveOrganizationalUnit().ifPresent(p -> {
if (eventOnCurrentSpace(p, e.getRepository().getSpace())) {
findTile(e.getRepository()).ifPresent(tile -> {
view.removeProject(tile);
libraryTiles.remove(tile);
tileWidgets.destroy(tile);
this.projectCountUpdateEvent.fire(new ProjectCountUpdate(libraryTiles.size(), this.getOrganizationalUnit().getSpace()));
});
}
});
}
Aggregations