Exemple #1
0
  @Override
  protected void configureDisplay(CellTable<IndexedDIP> display) {

    dateCreated =
        new Column<IndexedDIP, Date>(
            new DateCell(DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_MEDIUM))) {
          @Override
          public Date getValue(IndexedDIP dip) {
            return dip != null ? dip.getDateCreated() : null;
          }
        };

    lastModified =
        new Column<IndexedDIP, Date>(
            new DateCell(DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_MEDIUM))) {
          @Override
          public Date getValue(IndexedDIP dip) {
            return dip != null ? dip.getLastModified() : null;
          }
        };

    titleColumn =
        new TextColumn<IndexedDIP>() {

          @Override
          public String getValue(IndexedDIP dip) {
            return dip != null ? dip.getTitle() : null;
          }
        };

    titleColumn.setSortable(true);
    dateCreated.setSortable(true);
    lastModified.setSortable(true);

    display.addColumn(titleColumn, messages.aipGenericTitle());
    display.addColumn(dateCreated, messages.dipCreatedDate());
    display.addColumn(lastModified, messages.dipLastModified());

    Label emptyInfo = new Label(messages.noItemsToDisplay());
    display.setEmptyTableWidget(emptyInfo);

    // define default sorting
    display.getColumnSortList().push(new ColumnSortInfo(titleColumn, true));

    // display.setColumnWidth(titleColumn, 7.0, Unit.EM);
    display.setColumnWidth(dateCreated, 13.0, Unit.EM);
    display.setColumnWidth(lastModified, 13.0, Unit.EM);

    dateCreated.setCellStyleNames("nowrap");
    lastModified.setCellStyleNames("nowrap");

    addStyleName("my-collections-table");
    emptyInfo.addStyleName("my-collections-empty-info");
  }
Exemple #2
0
  private void setupTestDataGrid() {
    testDataGrid = new CellTable<TaskDataDto>();
    testDataGrid.setWidth("500px");
    testDataGrid.setEmptyTableWidget(new Label("No Tests"));

    // Add a selection model so we can select cells.
    final SelectionModel<TaskDataDto> selectionModel =
        new MultiSelectionModel<TaskDataDto>(
            new ProvidesKey<TaskDataDto>() {
              @Override
              public Object getKey(TaskDataDto item) {
                return item.getTaskName();
              }
            });
    testDataGrid.setSelectionModel(
        selectionModel, DefaultSelectionEventManager.<TaskDataDto>createCheckboxManager());

    // Checkbox column. This table will uses a checkbox column for selection.
    // Alternatively, you can call dataGrid.setSelectionEnabled(true) to enable mouse selection.
    Column<TaskDataDto, Boolean> checkColumn =
        new Column<TaskDataDto, Boolean>(new CheckboxCell(true, false)) {
          @Override
          public Boolean getValue(TaskDataDto object) {
            // Get the value from the selection model.
            return selectionModel.isSelected(object);
          }
        };
    testDataGrid.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
    testDataGrid.setColumnWidth(checkColumn, 40, Style.Unit.PX);

    testDataGrid.addColumn(
        new TextColumn<TaskDataDto>() {
          @Override
          public String getValue(TaskDataDto object) {
            return object.getTaskName();
          }
        },
        "Tests");
    testDataGrid.setRowData(Collections.EMPTY_LIST);
  }
Exemple #3
0
 private void initializeTable() {
   dataProvider.addDataDisplay(table);
   table.setPageSize(PAGE_SIZE);
   table.setEmptyTableWidget(noValues);
   pager.setDisplay(table);
 }