use of org.apache.tapestry5.internal.PageCatalogTotals in project tapestry-5 by apache.
the class PageCatalog method onRecomputeTotals.
public void onRecomputeTotals() {
totals = new PageCatalogTotals();
Flow<Page> pages = F.flow(getPages());
totals.loadedPages = pages.count();
totals.definedPages = getPageNames().size();
totals.uniquePageNames = pages.map(new Mapper<Page, String>() {
public String map(Page element) {
return element.getName();
}
}).toSet().size();
totals.components = pages.reduce(new Reducer<Integer, Page>() {
public Integer reduce(Integer accumulator, Page element) {
return accumulator + element.getStats().componentCount;
}
}, 0);
Set<String> selectorIds = pages.map(new Mapper<Page, String>() {
public String map(Page element) {
return element.getSelector().toShortString();
}
}).toSet();
totals.selectors = InternalUtils.joinSorted(selectorIds);
}
Aggregations