Package org.archive.wayback.util

Examples of org.archive.wayback.util.StringFormatter


   * Set the Locale for the request, which impacts UI Strings
   * @param l
   */
  public void setLocale(Locale l) {
    ResourceBundle b = ResourceBundle.getBundle(UI_RESOURCE_BUNDLE_NAME,l);
    formatter = new StringFormatter(b,l);
  }
View Full Code Here


 
  private String getUserLocale(HttpServletRequest httpRequest) {
    Locale l = httpRequest.getLocale();
    ResourceBundle b = ResourceBundle.getBundle(UI_RESOURCE_BUNDLE_NAME,
        httpRequest.getLocale());
    formatter = new StringFormatter(b,l);
    return emptyIfNull(httpRequest.getLocale().getDisplayLanguage());
  }
View Full Code Here

   * Set the Locale for the request, which impacts UI Strings
   * @param l
   */
  public void setLocale(Locale l) {
    ResourceBundle b = ResourceBundle.getBundle(UI_RESOURCE_BUNDLE_NAME,l);
    formatter = new StringFormatter(b,l);
  }
View Full Code Here

 
  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,
View Full Code Here

TOP

Related Classes of org.archive.wayback.util.StringFormatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.