Added use of projects tree. Split page builder code.
This commit is contained in:
parent
e95c7459bd
commit
1b2969a1eb
@ -183,24 +183,11 @@ public class AgirStatool
|
||||
{
|
||||
try
|
||||
{
|
||||
// Copy CSS file.
|
||||
FileUtils.copyURLToFile(AgirStatool.class.getResource("/org/april/agirstatool/core/pages/agirstatool.css"), new File(this.targetDirectory, "agirstatool.css"));
|
||||
|
||||
Projects projects = listProjectsWithSubStats();
|
||||
|
||||
// Add parent projects with alone statistics.
|
||||
for (Project project : listProjectsWithRawStats())
|
||||
{
|
||||
if (project.hasChild())
|
||||
{
|
||||
project.setName("#" + project.getName());
|
||||
project.setParentId(project.getId());
|
||||
project.setChildCount(0);
|
||||
projects.add(project);
|
||||
}
|
||||
}
|
||||
|
||||
Project all = getRootProject();
|
||||
projects.add(all);
|
||||
//
|
||||
Projects projects = listProjectsFullFull();
|
||||
|
||||
// Create welcome page.
|
||||
String lines = ProjectsRawPageBuilder.build(projects);
|
||||
@ -384,6 +371,50 @@ public class AgirStatool
|
||||
return result;
|
||||
}
|
||||
|
||||
public Projects listProjectsFullFull() throws AgirStatoolException
|
||||
{
|
||||
Projects result;
|
||||
|
||||
result = new Projects();
|
||||
|
||||
//
|
||||
Projects projects = listProjectsWithSubStats();
|
||||
|
||||
// Add parent projects with alone statistics.
|
||||
for (Project project : listProjectsWithRawStats())
|
||||
{
|
||||
if (project.hasChild())
|
||||
{
|
||||
project.setName("#" + project.getName());
|
||||
project.setParentId(project.getId());
|
||||
project.setChildCount(0);
|
||||
projects.add(project);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a root project.
|
||||
Project all = getRootProject();
|
||||
projects.add(all);
|
||||
|
||||
// Transform as tree.
|
||||
for (Project project : projects)
|
||||
{
|
||||
if ((project.hasChild()) || (project.getId() == 0))
|
||||
{
|
||||
result.add(project);
|
||||
|
||||
Projects subProjects = projects.getByParent(project.getId());
|
||||
subProjects.sortByName();
|
||||
project.subProjects().addAll(subProjects);
|
||||
}
|
||||
}
|
||||
|
||||
result.sortByName();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* List projects extended.
|
||||
*
|
||||
|
@ -56,8 +56,6 @@ public class ProjectsGroupedPageBuilder
|
||||
{
|
||||
System.out.println("Building welcome page (2)…");
|
||||
|
||||
projects.sortByName();
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
int index = 0;
|
||||
for (Project project : projects)
|
||||
@ -85,7 +83,7 @@ public class ProjectsGroupedPageBuilder
|
||||
|
||||
if (project.hasChild())
|
||||
{
|
||||
for (Project subProject : projects.getByParent(project.getId()).sortByName())
|
||||
for (Project subProject : project.subProjects())
|
||||
{
|
||||
data.setContent("projectLine", index, "projectId", subProject.getId());
|
||||
data.setAttribute("projectLine", index, "projectName", "style", "padding-left: 25px;");
|
||||
|
@ -54,8 +54,6 @@ public class ProjectsRawPageBuilder
|
||||
{
|
||||
System.out.println("Building welcome page…");
|
||||
|
||||
projects.sortByName();
|
||||
|
||||
TagDataManager data = new TagDataManager();
|
||||
int index = 0;
|
||||
for (Project project : projects)
|
||||
@ -91,7 +89,7 @@ public class ProjectsRawPageBuilder
|
||||
|
||||
if (project.hasChild())
|
||||
{
|
||||
for (Project subProject : projects.getByParent(project.getId()).sortByName())
|
||||
for (Project subProject : project.subProjects())
|
||||
{
|
||||
data.setContent("projectLine", index, "projectId", subProject.getId());
|
||||
data.setAttribute("projectLine", index, "projectName", "style", "padding-left: 25px;");
|
||||
|
Loading…
Reference in New Issue
Block a user