示例#1
0
 public PhotoView() {
   initWidget(uiBinder.createAndBindUi(this));
   cellTable.setWidth("100%", true);
   pager.setDisplay(cellTable);
   initColumns();
   cellTable.addRangeChangeHandler(
       new RangeChangeEvent.Handler() {
         @Override
         public void onRangeChange(RangeChangeEvent event) {
           AppContext.getInstance()
               .getEventBus()
               .fireEvent(new ShowPhotoRange(event.getNewRange()));
         }
       });
 }
示例#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);
  }