Refactored BreadcrumbTrail in metrics pages.

This commit is contained in:
Christian P. MOMON 2021-06-13 01:19:35 +02:00
parent 633efbcc8c
commit aaa18e432b
13 changed files with 56 additions and 21 deletions

View file

@ -52,6 +52,29 @@ public class BreadcrumbTrail extends ArrayList<Breadcrumb>
add(label, link); add(label, link);
} }
/**
* Adds the.
*
* @param label
* the label
* @param link
* the link
* @return the breadcrumb trail
*/
public BreadcrumbTrail add(final String label)
{
BreadcrumbTrail result;
Breadcrumb crumb = new Breadcrumb(label, null);
add(crumb);
result = this;
//
return result;
}
/** /**
* Adds the. * Adds the.
* *
@ -88,7 +111,14 @@ public class BreadcrumbTrail extends ArrayList<Breadcrumb>
for (Breadcrumb crumb : this) for (Breadcrumb crumb : this)
{ {
buffer.append(String.format("<a href=\"%s\" style=\"text-decoration: none; padding: 5px;\">%s</a>", crumb.getLink(), XidynUtils.escapeXmlBlank(crumb.getLabel()))); if (crumb.getLink() == null)
{
buffer.append(XidynUtils.escapeXmlBlank(crumb.getLabel()));
}
else
{
buffer.append(String.format("<a href=\"%s\" style=\"text-decoration: none; padding: 5px;\">%s</a>", crumb.getLink(), XidynUtils.escapeXmlBlank(crumb.getLabel())));
}
buffer.append(" > "); buffer.append(" > ");
} }
if (buffer.size() > 2) if (buffer.size() > 2)

View file

@ -61,8 +61,6 @@ public class FederationMetricGenericPage
*/ */
public static void build(final File htmlizeDirectory, final Federation federation, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException public static void build(final File htmlizeDirectory, final Federation federation, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
{ {
String result;
try try
{ {
TagDataManager data = new TagDataManager(); TagDataManager data = new TagDataManager();
@ -80,6 +78,7 @@ public class FederationMetricGenericPage
// //
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("Metrics génériques");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-generic-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-generic-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());

View file

@ -52,8 +52,6 @@ public class FederationMetricSpecificPage
*/ */
public static void build(final File htmlizeDirectory, final Federation federation, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException public static void build(final File htmlizeDirectory, final Federation federation, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
{ {
String result;
try try
{ {
TagDataManager data = new TagDataManager(); TagDataManager data = new TagDataManager();
@ -66,6 +64,7 @@ public class FederationMetricSpecificPage
// //
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("Metrics spécifiques");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-specific-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-specific-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());

View file

@ -76,7 +76,7 @@ public class FederationMetricSummaryPage
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("Metrics résumé");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-summary-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-summary-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());

View file

@ -119,6 +119,7 @@ public class FederationMetricWebPage
// //
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("Metrics web");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-web-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-web-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());

View file

@ -78,8 +78,8 @@ public class OrganizationMetricGenericPage
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add(organization.getName(), organization.getTechnicalName() + ".xhtml"); trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
trail.add(organization.getName(), organization.getTechnicalName() + "-" + organization.getTechnicalName() + ".xhtml"); trail.add("Metrics génériques");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-generic-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-generic-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());

View file

@ -67,8 +67,8 @@ public class OrganizationMetricSpecificPage
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add(organization.getName(), organization.getTechnicalName() + ".xhtml"); trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
trail.add(organization.getName(), organization.getTechnicalName() + "-" + organization.getTechnicalName() + ".xhtml"); trail.add("Metrics spécifiques");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-specific-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-specific-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());

View file

@ -78,7 +78,8 @@ public class OrganizationMetricSummaryPage
// //
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add(organization.getName(), organization.getTechnicalName() + ".xhtml"); trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
trail.add("Metrics résumé");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-summary-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-summary-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());

View file

@ -125,8 +125,8 @@ public class OrganizationMetricWebPage
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add(organization.getName(), organization.getTechnicalName() + ".xhtml"); trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
trail.add(organization.getName(), organization.getTechnicalName() + "-" + organization.getTechnicalName() + ".xhtml"); trail.add("Metrics web");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-web-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-web-%s-%s.xhtml", organization.getLocalFileBaseName(), view.getName(), period.getName());

View file

@ -78,8 +78,9 @@ public class ServiceMetricGenericPage
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricGenericView.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricGenericView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml"); trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
trail.add(service.getName(), service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml"); trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
trail.add("Metrics génériques");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-generic-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-generic-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());

View file

@ -80,8 +80,10 @@ public class ServiceMetricSpecificPage
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSpecificView.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSpecificView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml"); trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
trail.add(service.getName(), service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml"); trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
trail.add("Metrics spécifiques");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-specific-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-specific-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());

View file

@ -77,8 +77,9 @@ public class ServiceMetricSummaryPage
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml"); trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
trail.add(service.getName(), service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml"); trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
trail.add("Metrics résumé");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-summary-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-summary-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());

View file

@ -125,8 +125,9 @@ public class ServiceMetricWebPage
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString(); String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricWebView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail(); BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml"); trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
trail.add(service.getName(), service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml"); trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
trail.add("Metrics web");
String page = WebCharterView.build(content, trail); String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-web-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName()); String filename = String.format("%s-metrics-web-%s-%s.xhtml", service.getLocalFileBaseName(), view.getName(), period.getName());