コード例 #1
0
 public void updateFootCells() {
   int rowIndex = -1;
   if (isColumnTitlesEnabled()) rowIndex++;
   if (isColumnFilteringEnabled()) rowIndex++;
   rowIndex += rows.size();
   for (int i = 0; i < getFootRowCount(); i++) {
     rowIndex++;
     for (AColumn column : columns) {
       table.setWidget(rowIndex, column.index, column.getFootCellWidget(i));
     }
   }
 }
コード例 #2
0
  protected void onUpdate() {
    if (sortColumnIndex == -1) {
      sortColumnIndex = getInitialSortColumnIndex();
      reverseSort = isInitialSortReverse();
    }

    Collection<O> objects;
    try {
      objects = getObjects();
    } catch (Exception ex) {
      throw new RuntimeException(Str.getSimpleName(getClass()) + ".getObjects() failed.", ex);
    }

    log.info("Objects loaded:", objects.size());

    int rowIndex = -1;

    if (isColumnTitlesEnabled()) {
      rowIndex++;
      for (AColumn column : columns) {
        String columnTitle;
        try {
          columnTitle = column.getTitle();
        } catch (Exception ex) {
          log.error(ex);
          columnTitle = "ERROR: " + Str.formatException(ex);
        }

        boolean customSortingEnabled = isCustomSortingEnabled();

        Widget titleWidget = Widgets.textFieldlabel(columnTitle, false);
        if (titleWidget != null && customSortingEnabled && isShowColumnSortingToggleIcon())
          titleWidget.addStyleName("columnTitleWithSortToggle");

        if (titleWidget != null && (sortColumnIndex == column.index)) {
          // Sortierte Spalte hervorheben
          Style style = titleWidget.getElement().getStyle();
          style.setColor("#444");
          style.setFontWeight(FontWeight.BOLD);
          if (reverseSort) style.setFontStyle(FontStyle.ITALIC);
        }

        table.setWidget(
            rowIndex,
            column.index,
            Widgets.frame(
                titleWidget,
                Widgets.defaultSpacing,
                0,
                Widgets.defaultSpacing,
                Widgets.defaultSpacing / 2));

        if (customSortingEnabled) {
          for (int col = 0; col < columns.size(); col++) {
            table.getCellFormatter().setStyleName(rowIndex, col, "clickable");
          }
        }
      }
    }

    if (isColumnFilteringEnabled()) {
      rowIndex++;
      for (AColumn column : columns) {
        TextBox filterTextbox = column.getFilterWidget();
        SimplePanel frame = Widgets.frame(filterTextbox, Widgets.defaultSpacing);
        table.setWidget(rowIndex, column.index, frame);
      }
    }

    try {
      rows = createRows(objects, rowIndex);
    } catch (Exception ex) {
      throw new RuntimeException(Str.getSimpleName(getClass()) + ".createRows() failed.", ex);
    }
    table.setVisible(!rows.isEmpty());

    for (Row row : rows) {
      appendRow(row);
      rowIndex++;
    }

    for (int i = 0; i < getFootRowCount(); i++) {
      rowIndex++;
      for (AColumn column : columns) {
        table.setWidget(rowIndex, column.index, column.getFootCellWidget(i));
      }
    }
  }