コード例 #1
0
ファイル: HeaderCell.java プロジェクト: jackzhoum/JspGrid
  protected void buildHeaderHtml(
      HtmlBuilder html,
      TableModel model,
      Column column,
      String headerClass,
      String sortImage,
      String sortOrder) {
    html.td(2);

    if (StringUtils.isNotEmpty(headerClass)) {
      html.styleClass(headerClass);
    }

    if (StringUtils.isNotEmpty(column.getHeaderStyle())) {
      html.style(column.getHeaderStyle());
    }

    if (StringUtils.isNotEmpty(column.getWidth())) {
      html.width(column.getWidth());
    }

    if (column.isSortable()) {
      if (sortOrder.equals(TableConstants.SORT_ASC)) {
        html.onmouseover(
            "this.className='"
                + BuilderConstants.TABLE_HEADER_SORT_CSS
                + "';this.style.cursor='pointer'");
        if (StringUtils.isNotEmpty(headerClass)) {
          html.onmouseout("this.className='" + headerClass + "';this.style.cursor='default'");
        } else {
          html.onmouseout(
              "this.className='"
                  + BuilderConstants.TABLE_HEADER_CSS
                  + "';this.style.cursor='default'");
        }
      }

      if (sortOrder.equals(TableConstants.SORT_DEFAULT)
          || sortOrder.equals(TableConstants.SORT_DESC)) {
        html.onmouseover("this.style.cursor='pointer'");
        html.onmouseout("this.style.cursor='default'");
      }

      html.onclick(new TableActions(model).getSortAction(column, sortOrder));

      boolean showTooltips = model.getTableHandler().getTable().isShowTooltips();
      if (showTooltips) {
        String headercellTooltip =
            model.getMessages().getMessage(MessagesConstants.COLUMN_HEADERCELL_TOOLTIP_SORT);
        html.title(headercellTooltip + " " + column.getTitle());
      }
    }

    html.close();

    html.append(column.getTitle());

    if (column.isSortable()) {
      if (StringUtils.isNotEmpty(sortImage)) {
        html.nbsp();
        html.img();
        html.src(sortImage);
        html.style("border:0");
        html.alt("Arrow");
        html.xclose();
      }
    }

    html.tdEnd();
  }
コード例 #2
0
ファイル: HeaderCell.java プロジェクト: jackzhoum/JspGrid
 public String getExportDisplay(TableModel model, Column column) {
   return column.getTitle();
 }