Search in sources :

Example 1 with ProjectCountUpdate

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);
    });
}
Also used : ProjectCountUpdate(org.kie.workbench.common.screens.library.api.ProjectCountUpdate)

Example 2 with ProjectCountUpdate

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()));
        }
    });
}
Also used : WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) TileWidget(org.kie.workbench.common.screens.library.client.widgets.common.TileWidget) ProjectCountUpdate(org.kie.workbench.common.screens.library.api.ProjectCountUpdate)

Example 3 with ProjectCountUpdate

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()));
            });
        }
    });
}
Also used : ProjectCountUpdate(org.kie.workbench.common.screens.library.api.ProjectCountUpdate)

Aggregations

ProjectCountUpdate (org.kie.workbench.common.screens.library.api.ProjectCountUpdate)3 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)1 TileWidget (org.kie.workbench.common.screens.library.client.widgets.common.TileWidget)1