private void initTableColumns(final SelectionModel<ProcessSummary> selectionModel) {
    // Checkbox column. This table will uses a checkbox column for selection.
    // Alternatively, you can call dataGrid.setSelectionEnabled(true) to enable
    // mouse selection.

    Column<ProcessSummary, Boolean> checkColumn =
        new Column<ProcessSummary, Boolean>(new CheckboxCell(true, false)) {
          @Override
          public Boolean getValue(ProcessSummary object) {
            // Get the value from the selection model.
            return selectionModel.isSelected(object);
          }
        };

    processdefListGrid.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
    processdefListGrid.setColumnWidth(checkColumn, "40px");

    // Id.
    Column<ProcessSummary, String> processIdColumn =
        new Column<ProcessSummary, String>(new EditTextCell()) {
          @Override
          public String getValue(ProcessSummary object) {
            return object.getId();
          }
        };
    processIdColumn.setSortable(true);
    sortHandler.setComparator(
        processIdColumn,
        new Comparator<ProcessSummary>() {
          public int compare(ProcessSummary o1, ProcessSummary o2) {
            return Long.valueOf(o1.getId()).compareTo(Long.valueOf(o2.getId()));
          }
        });
    processdefListGrid.addColumn(
        processIdColumn, new ResizableHeader(constants.Id(), processdefListGrid, processIdColumn));

    // Process Id String.
    Column<ProcessSummary, String> processNameColumn =
        new Column<ProcessSummary, String>(new EditTextCell()) {
          @Override
          public String getValue(ProcessSummary object) {
            return object.getName();
          }
        };
    processNameColumn.setSortable(true);
    sortHandler.setComparator(
        processNameColumn,
        new Comparator<ProcessSummary>() {
          public int compare(ProcessSummary o1, ProcessSummary o2) {
            return o1.getName().compareTo(o2.getName());
          }
        });
    processdefListGrid.addColumn(
        processNameColumn,
        new ResizableHeader(constants.Name(), processdefListGrid, processNameColumn));

    // Process PKG.
    Column<ProcessSummary, String> processPkgColumn =
        new Column<ProcessSummary, String>(new EditTextCell()) {
          @Override
          public String getValue(ProcessSummary object) {
            return object.getPackageName();
          }
        };
    processPkgColumn.setSortable(true);
    sortHandler.setComparator(
        processPkgColumn,
        new Comparator<ProcessSummary>() {
          public int compare(ProcessSummary o1, ProcessSummary o2) {
            return o1.getPackageName().compareTo(o2.getPackageName());
          }
        });
    processdefListGrid.addColumn(
        processPkgColumn,
        new ResizableHeader(constants.Package(), processdefListGrid, processPkgColumn));

    // Process Session Id.
    Column<ProcessSummary, Number> processSessionIdColumn =
        new Column<ProcessSummary, Number>(new NumberCell()) {
          @Override
          public Number getValue(ProcessSummary object) {
            return object.getSessionId();
          }
        };
    processSessionIdColumn.setSortable(true);
    sortHandler.setComparator(
        processSessionIdColumn,
        new Comparator<ProcessSummary>() {
          public int compare(ProcessSummary o1, ProcessSummary o2) {
            return (o1.getSessionId() == o2.getSessionId()) ? 0 : 1;
          }
        });
    processdefListGrid.addColumn(
        processSessionIdColumn,
        new ResizableHeader("Session Id", processdefListGrid, processSessionIdColumn));
    processdefListGrid.setColumnWidth(processSessionIdColumn, "90px");

    // Version Type
    Column<ProcessSummary, String> versionColumn =
        new Column<ProcessSummary, String>(new EditTextCell()) {
          @Override
          public String getValue(ProcessSummary object) {
            return object.getVersion();
          }
        };
    versionColumn.setSortable(true);
    sortHandler.setComparator(
        versionColumn,
        new Comparator<ProcessSummary>() {
          public int compare(ProcessSummary o1, ProcessSummary o2) {
            return o1.getVersion().compareTo(o2.getVersion());
          }
        });
    processdefListGrid.addColumn(
        versionColumn, new ResizableHeader(constants.Version(), processdefListGrid, versionColumn));
    processdefListGrid.setColumnWidth(versionColumn, "90px");

    // actions (icons)
    List<HasCell<ProcessSummary, ?>> cells = new LinkedList<HasCell<ProcessSummary, ?>>();

    cells.add(
        new StartActionHasCell(
            "Start process",
            new Delegate<ProcessSummary>() {
              @Override
              public void execute(ProcessSummary process) {
                PlaceRequest placeRequestImpl = new DefaultPlaceRequest("Form Display");
                System.out.println("Opening form for process id = " + process.getId());
                placeRequestImpl.addParameter("processId", process.getId());
                placeRequestImpl.addParameter("sessionId", String.valueOf(process.getSessionId()));
                placeManager.goTo(placeRequestImpl);
              }
            }));

    cells.add(
        new DetailsActionHasCell(
            "Details",
            new Delegate<ProcessSummary>() {
              @Override
              public void execute(ProcessSummary process) {

                PlaceRequest placeRequestImpl =
                    new DefaultPlaceRequest(constants.Process_Definition_Details());
                placeRequestImpl.addParameter("processId", process.getId());
                placeRequestImpl.addParameter(
                    "sessionId", Integer.toString(process.getSessionId()));
                placeManager.goTo(placeRequestImpl);
              }
            }));

    CompositeCell<ProcessSummary> cell = new CompositeCell<ProcessSummary>(cells);
    Column<ProcessSummary, ProcessSummary> actionsColumn =
        new Column<ProcessSummary, ProcessSummary>(cell) {
          @Override
          public ProcessSummary getValue(ProcessSummary object) {
            return object;
          }
        };
    processdefListGrid.addColumn(actionsColumn, "Actions");
    processdefListGrid.setColumnWidth(actionsColumn, "70px");
  }
 public void addColumn(
     final Column<JarListPageRow, ?> column,
     final Comparator<JarListPageRow> comparator,
     final String columnName) {
   cellTable.addColumn(column, new ResizableHeader(columnName, cellTable, column));
 }
  private void initTableColumns() {
    final Column<JarListPageRow, String> nameColumn =
        new Column<JarListPageRow, String>(new TextCell()) {
          @Override
          public String getValue(JarListPageRow row) {
            return row.getName();
          }
        };
    cellTable.addColumn(
        nameColumn,
        new ResizableHeader(M2RepoEditorConstants.INSTANCE.Name(), cellTable, nameColumn));

    final Column<JarListPageRow, String> pathColumn =
        new Column<JarListPageRow, String>(new TextCell()) {
          @Override
          public String getValue(JarListPageRow row) {
            return row.getPath();
          }
        };
    cellTable.addColumn(
        pathColumn,
        new ResizableHeader(M2RepoEditorConstants.INSTANCE.Path(), cellTable, pathColumn));

    final Column<JarListPageRow, Date> lastModifiedColumn =
        new Column<JarListPageRow, Date>(
            new DateCell(
                DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM))) {
          @Override
          public Date getValue(JarListPageRow row) {
            return row.getLastModified();
          }
        };
    cellTable.addColumn(
        lastModifiedColumn,
        new ResizableHeader(
            M2RepoEditorConstants.INSTANCE.LastModified(), cellTable, lastModifiedColumn));

    // Add "View kjar detail" button column
    final Column<JarListPageRow, String> openColumn =
        new Column<JarListPageRow, String>(
            new ButtonCell() {
              {
                setSize(ButtonSize.MINI);
              }
            }) {
          public String getValue(JarListPageRow row) {
            return M2RepoEditorConstants.INSTANCE.Open();
          }
        };
    openColumn.setFieldUpdater(
        new FieldUpdater<JarListPageRow, String>() {
          public void update(int index, JarListPageRow row, String value) {
            m2RepoService
                .call(
                    new RemoteCallback<String>() {
                      @Override
                      public void callback(final String response) {
                        JarDetailPopup popup = new JarDetailPopup(response);
                        popup.show();
                      }
                    })
                .loadPOMStringFromJar(row.getPath());
          }
        });
    cellTable.addColumn(
        openColumn,
        new ResizableHeader(M2RepoEditorConstants.INSTANCE.Open(), cellTable, openColumn));
  }
  private void initTableColumns() {
    // addedBy
    Column<CommentSummary, String> addedByColumn =
        new Column<CommentSummary, String>(new TextCell()) {
          @Override
          public String getValue(CommentSummary c) {
            // for some reason the username comes in format [User:'******'], so parse just the
            // <name>
            int first = c.getAddedBy().indexOf('\'');
            int last = c.getAddedBy().lastIndexOf('\'');
            return c.getAddedBy().substring(first + 1, last);
          }
        };
    addedByColumn.setSortable(false);
    commentsListGrid.addColumn(addedByColumn, constants.Added_By());
    commentsListGrid.setColumnWidth(addedByColumn, "100px");

    // date
    Column<CommentSummary, String> addedAtColumn =
        new Column<CommentSummary, String>(new TextCell()) {
          @Override
          public String getValue(CommentSummary c) {
            DateTimeFormat format = DateTimeFormat.getFormat("dd/MM/yyyy HH:mm");
            return format.format(c.getAddedAt());
          }
        };
    addedAtColumn.setSortable(true);
    addedAtColumn.setDefaultSortAscending(true);
    commentsListGrid.addColumn(addedAtColumn, constants.At());
    sortHandler.setComparator(
        addedAtColumn,
        new Comparator<CommentSummary>() {
          @Override
          public int compare(CommentSummary o1, CommentSummary o2) {
            return o1.getAddedAt().compareTo(o2.getAddedAt());
          }
        });

    // comment text
    Column<CommentSummary, String> commentTextColumn =
        new Column<CommentSummary, String>(new TextCell()) {
          @Override
          public String getValue(CommentSummary object) {
            return object.getText();
          }
        };
    addedByColumn.setSortable(false);
    commentsListGrid.addColumn(commentTextColumn, constants.Comment());

    List<HasCell<CommentSummary, ?>> cells = new LinkedList<HasCell<CommentSummary, ?>>();

    cells.add(
        new DeleteCommentActionHasCell(
            constants.Delete(),
            new Delegate<CommentSummary>() {
              @Override
              public void execute(CommentSummary comment) {
                presenter.removeTaskComment(comment.getId());
              }
            }));

    CompositeCell<CommentSummary> cell = new CompositeCell<CommentSummary>(cells);
    Column<CommentSummary, CommentSummary> actionsColumn =
        new Column<CommentSummary, CommentSummary>(cell) {
          @Override
          public CommentSummary getValue(CommentSummary object) {
            return object;
          }
        };
    commentsListGrid.addColumn(actionsColumn, "");
  }