Exemple #1
0
  public String getHtmlDisplay(TableModel model, Column column) {
    HtmlBuilder html = new HtmlBuilder();

    String headerClass = null;
    String sortImage = null;
    String sortOrder = null;

    headerClass = column.getHeaderClass();

    if (TableModelUtils.isSorted(model, column.getAlias())) {
      sortOrder = model.getLimit().getSort().getSortOrder();

      if (sortOrder.equals(TableConstants.SORT_DEFAULT)) {
        sortOrder = TableConstants.SORT_ASC;
      } else if (sortOrder.equals(TableConstants.SORT_ASC)) {
        headerClass =
            model.getPreferences().getPreference(PreferencesConstants.TABLE_HEADER_SORT_CLASS);
        sortImage = BuilderUtils.getImage(model, BuilderConstants.SORT_ASC_IMAGE);
        sortOrder = TableConstants.SORT_DESC;
      } else if (sortOrder.equals(TableConstants.SORT_DESC)) {
        headerClass =
            model.getPreferences().getPreference(PreferencesConstants.TABLE_HEADER_SORT_CLASS);
        sortImage = BuilderUtils.getImage(model, BuilderConstants.SORT_DESC_IMAGE);
        sortOrder = TableConstants.SORT_DEFAULT;
      }
    } else {
      sortOrder = TableConstants.SORT_ASC; // the default
    }

    buildHeaderHtml(html, model, column, headerClass, sortImage, sortOrder);

    return html.toString();
  }
Exemple #2
0
 public Object afterBody(TableModel model) {
     if (model.getLimit().getTotalRows() != 0) {
         xlsfo.append(totals(model));
     }
     xlsfo.append(" </fo:table-body> ");
     xlsfo.append(endRoot());
     return xlsfo.toString();
 }