Esempio n. 1
0
 public void updateRowVisibility(Set<String> names) {
   if (names.equals(showNames)) return;
   this.showNames = names;
   int row = 0;
   while (row < table.getRowCount()) {
     Element rowEl = rowFormatter.getElement(row);
     String className = rowEl.getClassName().trim();
     rowFormatter.setVisible(row, className.isEmpty() || showNames.contains(className));
     row++;
   }
 }
Esempio n. 2
0
  public void setModel(ProductInfo[] pi) {
    searchModel = pi;
    while (items.getRowCount() > 0) items.removeRow(0);
    if (searchModel == null || searchModel.length == 0) {
      emptyCartLbl.setVisible(true);
      return;
    }

    RowFormatter fmtr = items.getRowFormatter();
    for (int i = 0; i < searchModel.length; i++) {
      int row = items.insertRow(i);
      for (int j = 0; j < 2; j++) items.insertCell(row, j);
      items.setText(row, 0, searchModel[i].name);
      items.setText(row, 1, searchModel[i].description);
      fmtr.addStyleName(row, "ps-GridRow ps-GridRow-sel");
    }
    emptyCartLbl.setVisible(false);
  }
Esempio n. 3
0
  /**
   * Inits the widget SortableTable, by Parvinder Thapa
   *
   * @link<http://psthapar.googlepages.com/simplesortabletable>
   */
  private void initSortableTable() {
    // sortableTable = new SortableTable();

    table = new FlexTable();

    table.setWidth(500 + "px");
    table.setStyleName("sortableTable");
    table.setBorderWidth(1);
    table.setCellPadding(4);
    table.setCellSpacing(1);

    // sortableTable.setWidth(500 + "px");
    // sortableTable.setStyleName("sortableTable");
    // sortableTable.setBorderWidth(1);
    // sortableTable.setCellPadding(4);
    // sortableTable.setCellSpacing(1);

    // header
    table.setHTML(0, FILE_NAME_COLUMN, FILE_NAME_TEXT);
    table.setHTML(0, STATUS_COLUMN, STATUS_TEXT);
    table.setHTML(0, DATE_COLUMN, DATE_TEXT);
    table.setHTML(0, DOWNLOAD_COLUMN, DOWNLOAD_TEXT);
    // sortableTable.addColumnHeader(FILE_NAME_TEXT, FILE_NAME_COLUMN);
    // sortableTable.addColumnHeader(STATUS_TEXT, STATUS_COLUMN);
    // sortableTable.addColumnHeader(DATE_TEXT, DATE_COLUMN);
    // sortableTable.addColumnHeader(DOWNLOAD_TEXT, DOWNLOAD_COLUMN);

    // COSMETIC PART OF THE WIDGET
    // Set Style Name for the header
    // RowFormatter rowFormatter = sortableTable.getRowFormatter();
    RowFormatter rowFormatter = table.getRowFormatter();
    rowFormatter.setStyleName(0, "tableHeader");

    // Set the Styles for the Data Rows and Columns
    // CellFormatter cellFormatter = sortableTable.getCellFormatter();
    CellFormatter cellFormatter = table.getCellFormatter();
    // Set the styles for the headers
    for (int colIndex = 0; colIndex < 4; colIndex++) {
      cellFormatter.setStyleName(0, colIndex, "headerStyle");
      cellFormatter.setAlignment(
          0, colIndex, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
    }

    for (int rowIndex = 1; rowIndex < 21; rowIndex++) {
      if (rowIndex % 2 == 0) {
        rowFormatter.setStyleName(rowIndex, "customRowStyle");
      } else {
        rowFormatter.setStyleName(rowIndex, "tableRow");
      }
      for (int colIndex = 0; colIndex < 4; colIndex++) {
        cellFormatter.setStyleName(rowIndex, colIndex, "customFont");
        if (colIndex == 1 || colIndex == 3) {
          cellFormatter.setAlignment(
              rowIndex,
              colIndex,
              HasHorizontalAlignment.ALIGN_RIGHT,
              HasVerticalAlignment.ALIGN_MIDDLE);
        } else if (colIndex == 0) {
          cellFormatter.setAlignment(
              rowIndex,
              colIndex,
              HasHorizontalAlignment.ALIGN_LEFT,
              HasVerticalAlignment.ALIGN_MIDDLE);
        }
        if (colIndex == 2) {
          cellFormatter.setAlignment(
              rowIndex,
              colIndex,
              HasHorizontalAlignment.ALIGN_CENTER,
              HasVerticalAlignment.ALIGN_MIDDLE);
        }
      }
    }
    // add(sortableTable);
    add(table);
  }
Esempio n. 4
0
 private void updateCellStyle(int row, ExtLevel level, boolean isTraceLine) {
   rowFormatter.getElement(row).getStyle().setColor(LogParser.getColor(level));
   rowFormatter.setStyleName(row, level == null ? "" : level.getName());
   rowFormatter.setVisible(row, level == null ? true : showNames.contains(level.getName()));
   cellFormatter.getElement(row, 0).getStyle().setPaddingLeft(isTraceLine ? 20 : 2, Unit.PX);
 }