Exemplo n.º 1
0
  private String renderYear(YearAnnouncementArchiveEntry year) {
    StringBuilder buffer = new StringBuilder();

    boolean first = true;
    for (int i = year.getFirstPostMonth(); i <= 12; i++) {
      MonthAnnouncementArchiveEntry month = year.getEntries().get(i);

      if (month != null && !first) {
        buffer.append(", ");
      }
      if (month != null && this.getTargetUrl() != null) {
        buffer.append("<a href=\"").append(this.getTargetUrl());
        buffer.append("selectedYear=").append(year.getYear());
        buffer.append("&amp;selectedMonth=").append(month.getMonth());
        buffer.append("\">");
      }
      if (month != null) {
        Locale locale = Language.getLocale();
        LocalDate localDate = new LocalDate();
        localDate = localDate.withMonthOfYear(month.getMonth());

        buffer.append(localDate.toString("MMM.", locale));
        buffer.append(" (");
        buffer.append(month.getAnnouncementCount());
        buffer.append(")");
        first = false;
      }
      if (month != null && this.getTargetUrl() != null) {
        buffer.append("</a>");
      }
    }
    return buffer.toString();
  }
Exemplo n.º 2
0
  private String renderArchive(Object value) {
    AnnouncementArchive archive = (AnnouncementArchive) value;
    StringBuilder buffer = new StringBuilder();

    for (YearAnnouncementArchiveEntry year : archive.getEntries().values()) {
      buffer.append("<p><span>").append(year.getYear()).append("</span> ");
      buffer.append(this.renderYear(archive.getEntries().get(year.getYear())));
      buffer.append("</p>");
    }

    return buffer.toString();
  }