public BubbleCalendarData(UIResults results) {
this.results = results;
CaptureSearchResults cResults = results.getCaptureResults();
WaybackRequest wbRequest = results.getWbRequest();
StringFormatter fmt = wbRequest.getFormatter();
String searchUrl =
UrlOperations.stripDefaultPortFromUrl(wbRequest.getRequestUrl());
searchUrlForHTML = fmt.escapeHtml(searchUrl);
searchUrlForJS = fmt.escapeJavaScript(searchUrl);
firstResultDate = cResults.getFirstResultDate();
firstResultReplayUrl = fmt.escapeHtml(results.resultToReplayUrl(cResults.getResults().getFirst()));
lastResultDate = cResults.getLastResultDate();
lastResultReplayUrl = fmt.escapeHtml(results.resultToReplayUrl(cResults.getResults().getLast()));
Date searchStartDate = wbRequest.getStartDate();
Date searchEndDate = wbRequest.getEndDate();
months = capturePartitioner.getRange(monthSize,searchStartDate,searchEndDate);
years = partitionPartitioner.getRange(yearSize,searchStartDate,searchEndDate);
// To build the graph, we need to break all the results into 1 month
// partitions, so partition all the results into the months:
capturePartitioner.populate(months,cResults.iterator());
// To fill in the calendar, we need to break the current year into day
// sized partitions, so first partition those months into years:
partitionPartitioner.populate(years,months.iterator());
// find the active year:
Partition<Partition<CaptureSearchResult>> activeYear = null;
for(Partition<Partition<CaptureSearchResult>> year : years) {
if(year.isContainsClosest()) {
activeYear = year;
break;
}
}
// if there's no activeYear, something is quite wrong...
// TODO: check anyways:
if (activeYear == null) {
activeYear = years.get(years.size() - 1);
}
String yearStr = fmt.format("{0,date,yyyy}",activeYear.getStart());
yearNum = Integer.parseInt(yearStr);
// now unroll the months in the active year into day-sized partitions:
List<Partition<CaptureSearchResult>> days =
capturePartitioner.getRange(daySize,