Example usage for com.google.gwt.user.cellview.client Column setSortable

List of usage examples for com.google.gwt.user.cellview.client Column setSortable

Introduction

In this page you can find the example usage for com.google.gwt.user.cellview.client Column setSortable.

Prototype

public void setSortable(boolean sortable) 

Source Link

Document

Set whether or not the column can be sorted.

Usage

From source file:ua.oilukraine.client.TabelView.java

/**
 * Add the columns to the table./*from  w w w.j  a v a 2s  .co m*/
 */
private void initTableColumns(final SelectionModel<DebtorsData> selectionModel,
        ColumnSortEvent.ListHandler<DebtorsData> sortHandler) {
    // Checkbox column. This table will uses a checkbox column for selection.
    // Alternatively, you can call cellTable.setSelectionEnabled(true) to enable
    // mouse selection.
    Column<DebtorsData, Boolean> checkColumn = new Column<DebtorsData, Boolean>(new CheckboxCell(true, false)) {
        @Override
        public Boolean getValue(DebtorsData object) {
            // Get the value from the selection model.
            return selectionModel.isSelected(object);
        }
    };
    cellTable.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
    cellTable.setColumnWidth(checkColumn, 40, Unit.PX);

    // Firm name.
    Column<DebtorsData, String> FirmNameColumn = new Column<DebtorsData, String>(new TextCell()) {
        @Override
        public String getValue(DebtorsData object) {
            return object.getName();
        }
    };
    FirmNameColumn.setSortable(true);
    sortHandler.setComparator(FirmNameColumn, new Comparator<DebtorsData>() {
        @Override
        public int compare(DebtorsData o1, DebtorsData o2) {
            return o1.getName().compareTo(o2.getName());
        }
    });
    cellTable.addColumn(FirmNameColumn, "");
    //        FirmNameColumn.setFieldUpdater(new FieldUpdater<DebtorsData, String>() {
    //            @Override
    //            public void update(int index, DebtorsData object, String value) {
    //                // Called when the user changes the value.
    //                object.setName(value);
    //                //    ContactDatabase.get().refreshDisplays();
    //            }
    //        });
    cellTable.setColumnWidth(FirmNameColumn, 20, Unit.PCT);

    // OKPO
    Column<DebtorsData, String> okpoColumn = new Column<DebtorsData, String>(new TextCell()) {
        @Override
        public String getValue(DebtorsData object) {
            return object.getOkpo();
        }
    };
    okpoColumn.setSortable(true);
    sortHandler.setComparator(okpoColumn, new Comparator<DebtorsData>() {
        @Override
        public int compare(DebtorsData o1, DebtorsData o2) {
            return o1.getOkpo().compareTo(o2.getOkpo());
        }
    });
    cellTable.addColumn(okpoColumn, "");
    //        okpoColumn.setFieldUpdater(new FieldUpdater<DebtorsData, String>() {
    //            @Override
    //            public void update(int index, DebtorsData object, String value) {
    //                // Called when the user changes the value.
    //                object.setOkpo(value);
    //                //    ContactDatabase.get().refreshDisplays();
    //            }
    //        });
    cellTable.setColumnWidth(okpoColumn, 20, Unit.PCT);

    // Name Buh
    Column<DebtorsData, String> nameBuhColumn = new Column<DebtorsData, String>(new TextCell()) {
        @Override
        public String getValue(DebtorsData object) {
            return object.getName_buh();
        }
    };
    nameBuhColumn.setSortable(true);
    sortHandler.setComparator(nameBuhColumn, new Comparator<DebtorsData>() {
        @Override
        public int compare(DebtorsData o1, DebtorsData o2) {
            return o1.getName_buh().compareTo(o2.getName_buh());
        }
    });
    cellTable.addColumn(nameBuhColumn, "");
    //        okpoColumn.setFieldUpdater(new FieldUpdater<DebtorsData, String>() {
    //            @Override
    //            public void update(int index, DebtorsData object, String value) {
    //                // Called when the user changes the value.
    //                object.setOkpo(value);
    //                //    ContactDatabase.get().refreshDisplays();
    //            }
    //        });
    cellTable.setColumnWidth(nameBuhColumn, 20, Unit.PCT);

    // Phone Work Buh
    Column<DebtorsData, String> phoneWorkBuhColumn = new Column<DebtorsData, String>(new TextCell()) {
        @Override
        public String getValue(DebtorsData object) {
            return object.getPhone_work();
        }
    };
    phoneWorkBuhColumn.setSortable(true);
    sortHandler.setComparator(phoneWorkBuhColumn, new Comparator<DebtorsData>() {
        @Override
        public int compare(DebtorsData o1, DebtorsData o2) {
            return o1.getPhone_work().compareTo(o2.getPhone_work());
        }
    });
    cellTable.addColumn(phoneWorkBuhColumn, " ");
    //        okpoColumn.setFieldUpdater(new FieldUpdater<DebtorsData, String>() {
    //            @Override
    //            public void update(int index, DebtorsData object, String value) {
    //                // Called when the user changes the value.
    //                object.setOkpo(value);
    //                //    ContactDatabase.get().refreshDisplays();
    //            }
    //        });
    cellTable.setColumnWidth(phoneWorkBuhColumn, 20, Unit.PCT);

    // Phone Mob Buh
    Column<DebtorsData, String> phoneMobBuhColumn = new Column<DebtorsData, String>(new TextCell()) {
        @Override
        public String getValue(DebtorsData object) {
            return object.getPhone_mob();
        }
    };
    phoneMobBuhColumn.setSortable(true);
    sortHandler.setComparator(phoneMobBuhColumn, new Comparator<DebtorsData>() {
        @Override
        public int compare(DebtorsData o1, DebtorsData o2) {
            return o1.getPhone_mob().compareTo(o2.getPhone_mob());
        }
    });
    cellTable.addColumn(phoneMobBuhColumn, " ");
    //        okpoColumn.setFieldUpdater(new FieldUpdater<DebtorsData, String>() {
    //            @Override
    //            public void update(int index, DebtorsData object, String value) {
    //                // Called when the user changes the value.
    //                object.setOkpo(value);
    //                //    ContactDatabase.get().refreshDisplays();
    //            }
    //        });
    cellTable.setColumnWidth(phoneMobBuhColumn, 20, Unit.PCT);

    // Date Info
    DateCell dateCell = new DateCell();
    Column<DebtorsData, Date> dateColumn = new Column<DebtorsData, Date>(dateCell) {
        @Override
        public Date getValue(DebtorsData object) {
            return object.getDate_info();
        }
    };
    dateColumn.setSortable(true);
    dateColumn.setDefaultSortAscending(false);
    sortHandler.setComparator(dateColumn, new Comparator<DebtorsData>() {
        @Override
        public int compare(DebtorsData o1, DebtorsData o2) {
            return o1.getDate_info().compareTo(o2.getDate_info());
        }
    });
    cellTable.addColumn(dateColumn, " ");
    dateColumn.setFieldUpdater(new FieldUpdater<DebtorsData, Date>() {
        @Override
        public void update(int index, DebtorsData object, Date value) {
            // Called when the user changes the value.
            object.setDate_info(value);
            //    ContactDatabase.get().refreshDisplays();
        }
    });

    // DatePickerCell.
    DateTimeFormat dateFormat = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_MEDIUM);
    DatePickerCell datePicCell = new DatePickerCell(dateFormat);

    Column<DebtorsData, Date> datePicColumn = new Column<DebtorsData, Date>(datePicCell) {
        @Override
        public Date getValue(DebtorsData object) {
            return object.getDate_info();
        }
    };
    dateColumn.setSortable(true);
    dateColumn.setDefaultSortAscending(false);
    sortHandler.setComparator(dateColumn, new Comparator<DebtorsData>() {
        @Override
        public int compare(DebtorsData o1, DebtorsData o2) {
            return o1.getDate_info().compareTo(o2.getDate_info());
        }
    });
    cellTable.addColumn(dateColumn, "  Pic");

    //        addColumn(new DatePickerCell(dateFormat), "DatePicker", new GetValue<Date>() {
    //            @Override
    //            public Date getValue(ContactInfo contact) {
    //                return contact.getBirthday();
    //            }
    //        }, new FieldUpdater<ContactInfo, Date>() {
    //            @Override
    //            public void update(int index, ContactInfo object, Date value) {
    //                pendingChanges.add(new BirthdayChange(object, value));
    //            }
    //        });
    //        /**
    //         * Add a column with a header.
    //         *
    //         * @param <C> the cell type
    //         * @param cell the cell used to render the column
    //         * @param headerText the header string
    //         * @param getter the value getter for the cell
    //         */
    //    private <C> Column<ContactInfo, C> addColumn(Cell<C> cell, String headerText,
    //            final GetValue<C> getter, FieldUpdater<ContactInfo, C> fieldUpdater) {
    //        Column<ContactInfo, C> column = new Column<ContactInfo, C>(cell) {
    //            @Override
    //            public C getValue(ContactInfo object) {
    //                return getter.getValue(object);
    //            }
    //        };
    //        column.setFieldUpdater(fieldUpdater);
    //        if (cell instanceof AbstractEditableCell<?, ?>) {
    //            editableCells.add((AbstractEditableCell<?, ?>) cell);
    //        }
    //        contactList.addColumn(column, headerText);
    //        return column;
    //    }
    ///////////////////////////////////////////////////////////////////////
    //        // Address.
    //        Column<DebtorsData, String> addressColumn = new Column<DebtorsData, String>(
    //                new TextCell()) {
    //            @Override
    //            public String getValue(DebtorsData object) {
    //                return object.getAddress();
    //            }
    //        };
    //        addressColumn.setSortable(true);
    //        addressColumn.setDefaultSortAscending(false);
    //        sortHandler.setComparator(addressColumn, new Comparator<DebtorsData>() {
    //            @Override
    //            public int compare(DebtorsData o1, DebtorsData o2) {
    //                return o1.getAddress().compareTo(o2.getAddress());
    //            }
    //        });
    //        cellTable.addColumn(addressColumn, constants.cwCellTableColumnAddress());
    //        cellTable.setColumnWidth(addressColumn, 60, Unit.PCT);
    //
    //        ///////////////////////////////////////////////////////////////////////
    //        // Last name.
    //        Column<DebtorsData, String> lastNameColumn = new Column<DebtorsData, String>(
    //                new EditTextCell()) {
    //            @Override
    //            public String getValue(DebtorsData object) {
    //                return object.getLastName();
    //            }
    //        };
    //        lastNameColumn.setSortable(true);
    //        sortHandler.setComparator(lastNameColumn, new Comparator<DebtorsData>() {
    //            @Override
    //            public int compare(DebtorsData o1, DebtorsData o2) {
    //                return o1.getLastName().compareTo(o2.getLastName());
    //            }
    //        });
    //        cellTable.addColumn(lastNameColumn, constants.cwCellTableColumnLastName());
    //        lastNameColumn.setFieldUpdater(new FieldUpdater<DebtorsData, String>() {
    //            @Override
    //            public void update(int index, DebtorsData object, String value) {
    //                // Called when the user changes the value.
    //                object.setLastName(value);
    //                ContactDatabase.get().refreshDisplays();
    //            }
    //        });
    //        cellTable.setColumnWidth(lastNameColumn, 20, Unit.PCT);
    //
    //        // Category.
    //        final Category[] categories = ContactDatabase.get().queryCategories();
    //        List<String> categoryNames = new ArrayList<String>();
    //        for (Category category : categories) {
    //            categoryNames.add(category.getDisplayName());
    //        }
    //        SelectionCell categoryCell = new SelectionCell(categoryNames);
    //        Column<DebtorsData, String> categoryColumn = new Column<DebtorsData, String>(
    //                categoryCell) {
    //            @Override
    //            public String getValue(DebtorsData object) {
    //                return object.getCategory().getDisplayName();
    //            }
    //        };
    //        cellTable.addColumn(categoryColumn, constants.cwCellTableColumnCategory());
    //        categoryColumn.setFieldUpdater(new FieldUpdater<DebtorsData, String>() {
    //            @Override
    //            public void update(int index, DebtorsData object, String value) {
    //                for (Category category : categories) {
    //                    if (category.getDisplayName().equals(value)) {
    //                        object.setCategory(category);
    //                    }
    //                }
    //                ContactDatabase.get().refreshDisplays();
    //            }
    //        });
    //        cellTable.setColumnWidth(categoryColumn, 130, Unit.PX);
    //
    //        // Address.
    //        Column<DebtorsData, String> addressColumn = new Column<DebtorsData, String>(
    //                new TextCell()) {
    //            @Override
    //            public String getValue(DebtorsData object) {
    //                return object.getAddress();
    //            }
    //        };
    //        addressColumn.setSortable(true);
    //        addressColumn.setDefaultSortAscending(false);
    //        sortHandler.setComparator(addressColumn, new Comparator<DebtorsData>() {
    //            @Override
    //            public int compare(DebtorsData o1, DebtorsData o2) {
    //                return o1.getAddress().compareTo(o2.getAddress());
    //            }
    //        });
    //        cellTable.addColumn(addressColumn, constants.cwCellTableColumnAddress());
    //        cellTable.setColumnWidth(addressColumn, 60, Unit.PCT);
}

From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.DataAssignmentViewImpl.java

License:Apache License

private void addNameColumn() {
    Column<DataAssignmentRow, String> column = new Column<DataAssignmentRow, String>(new TextCell()) {
        @Override/*from  w  ww .j av a2 s . co m*/
        public String getValue(DataAssignmentRow row) {
            return row.getName();
        }
    };
    column.setSortable(true);
    Comparator<DataAssignmentRow> comparator = new Comparator<DataAssignmentRow>() {
        @Override
        public int compare(DataAssignmentRow o1, DataAssignmentRow o2) {
            if (o1 == o2) {
                return 0;
            }
            String v1 = o1.getName();
            String v2 = o2.getName();
            return v1.compareTo(v2);
        }
    };
    gridView.addPermanentColumn("Name", column, comparator, 150, Style.Unit.PX);
}

From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.ExtractAttributesViewImpl.java

License:Apache License

private void addNameColumn() {
    Column<ExtractAttributesRow, String> column = new Column<ExtractAttributesRow, String>(new TextCell()) {
        @Override//from  w ww .  java2 s. co m
        public String getValue(ExtractAttributesRow row) {
            return row.getName();
        }
    };
    // TODO: commented out until we start saving changes in the experiment profile
    //column.setFieldUpdater(new FieldUpdater<ExtractAttributesRow, String>() {
    //    @Override
    //    public void update(int index, ExtractAttributesRow row, String value) {
    //        // TODO check names are unique
    //        row.setName(value);
    //        updateRow(row);
    //    }
    //});
    column.setSortable(true);
    Comparator<ExtractAttributesRow> comparator = new Comparator<ExtractAttributesRow>() {
        @Override
        public int compare(ExtractAttributesRow o1, ExtractAttributesRow o2) {
            if (o1 == o2) {
                return 0;
            }
            String v1 = o1.getName();
            String v2 = o2.getName();
            return v1.compareTo(v2);
        }
    };
    gridView.addPermanentColumn("Name", column, comparator, 150, Style.Unit.PX);
}

From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.ProtocolsViewImpl.java

License:Apache License

private void addNameColumn() {
    final EditSuggestCell nameCell = new EditSuggestCell(null) {
        @Override/*w  w  w.ja  v a 2  s . c  om*/
        public boolean validateInput(String value, int rowIndex) {
            if (value == null || trimValue(value).isEmpty()) {
                NotificationPopupPanel.error("Protocol with empty name is not permitted.", true, false);
                return false;
            }
            if (!isNameUnique(value, rowIndex)) {
                NotificationPopupPanel.error("Protocol with the name '" + value + "' already exists.", true,
                        false);
                return false;
            }
            return true;
        }
    };

    Column<ProtocolRow, String> column = new Column<ProtocolRow, String>(nameCell) {
        @Override
        public String getValue(ProtocolRow row) {
            String v = row.getName();
            return v == null ? "" : v;
        }
    };

    column.setFieldUpdater(new FieldUpdater<ProtocolRow, String>() {
        @Override
        public void update(int index, ProtocolRow row, String value) {
            row.setName(trimValue(value));
            updateRow(row);
        }
    });

    column.setSortable(true);
    Comparator<ProtocolRow> comparator = new Comparator<ProtocolRow>() {
        @Override
        public int compare(ProtocolRow o1, ProtocolRow o2) {
            if (o1 == o2) {
                return 0;
            }
            String v1 = o1.getName();
            String v2 = o2.getName();
            return v1.compareTo(v2);
        }
    };

    gridView.addPermanentColumn("Name", column, comparator, 150, Style.Unit.PX);
}

From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.ProtocolsViewImpl.java

License:Apache License

private void addTypeColumn() {
    Column<ProtocolRow, String> column = new Column<ProtocolRow, String>(new TextCell()) {
        @Override//from   w  w  w  .ja v a  2s .  c o m
        public String getValue(ProtocolRow row) {
            return row.getProtocolType().getLabel();
        }
    };
    column.setSortable(true);
    Comparator<ProtocolRow> comparator = new Comparator<ProtocolRow>() {
        @Override
        public int compare(ProtocolRow o1, ProtocolRow o2) {
            if (o1 == o2) {
                return 0;
            }
            String v1 = o1.getProtocolType().getLabel();
            String v2 = o2.getProtocolType().getLabel();
            return v1.compareTo(v2);
        }
    };
    gridView.addPermanentColumn("Type", column, comparator, 300, Style.Unit.PX);
}

From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.ProtocolsViewImpl.java

License:Apache License

private void addHardwareColumn() {
    Column<ProtocolRow, String> column = new ProtocolHardwareColumn(new EditTextCell(),
            new EditSelectionCell(sequencingHardware)) {
        @Override/*from   w  w w .j a  v a2s .co m*/
        public String getValue(ProtocolRow row) {
            String v = row.getHardware();
            return v == null ? "" : v;
        }
    };

    column.setFieldUpdater(new FieldUpdater<ProtocolRow, String>() {
        @Override
        public void update(int index, ProtocolRow row, String value) {
            row.setHardware(value);
            updateRow(row);
        }
    });
    column.setSortable(true);
    Comparator<ProtocolRow> comparator = new Comparator<ProtocolRow>() {
        @Override
        public int compare(ProtocolRow o1, ProtocolRow o2) {
            if (o1 == o2) {
                return 0;
            }
            String v1 = o1.getHardware();
            String v2 = o2.getHardware();
            return v1.compareTo(v2);
        }
    };
    gridView.addPermanentColumn("Hardware", column, comparator, 150, Style.Unit.PX);
}

From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.ProtocolsViewImpl.java

License:Apache License

private void addSoftwareColumn() {
    Column<ProtocolRow, String> column = new Column<ProtocolRow, String>(new EditTextCell()) {
        @Override//from   w ww  .  j  av  a  2s.c  o m
        public String getValue(ProtocolRow row) {
            String v = row.getSoftware();
            return v == null ? "" : v;
        }
    };
    column.setFieldUpdater(new FieldUpdater<ProtocolRow, String>() {
        @Override
        public void update(int index, ProtocolRow row, String value) {
            row.setSoftware(value);
            updateRow(row);
        }
    });
    column.setSortable(true);
    Comparator<ProtocolRow> comparator = new Comparator<ProtocolRow>() {
        @Override
        public int compare(ProtocolRow o1, ProtocolRow o2) {
            if (o1 == o2) {
                return 0;
            }
            String v1 = o1.getSoftware();
            String v2 = o2.getSoftware();
            return v1.compareTo(v2);
        }
    };
    gridView.addPermanentColumn("Software", column, comparator, 150, Style.Unit.PX);
}

From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.ProtocolsViewImpl.java

License:Apache License

private void addPerformerColumn() {
    Column<ProtocolRow, String> column = new Column<ProtocolRow, String>(new EditTextCell()) {
        @Override/*from www .j a  v  a2s .  c  o m*/
        public String getValue(ProtocolRow row) {
            String v = row.getPerformer();
            return v == null ? "" : v;
        }
    };
    column.setFieldUpdater(new FieldUpdater<ProtocolRow, String>() {
        @Override
        public void update(int index, ProtocolRow row, String value) {
            row.setPerformer(value);
            updateRow(row);
        }
    });
    column.setSortable(true);
    Comparator<ProtocolRow> comparator = new Comparator<ProtocolRow>() {
        @Override
        public int compare(ProtocolRow o1, ProtocolRow o2) {
            if (o1 == o2) {
                return 0;
            }
            String v1 = o1.getPerformer();
            String v2 = o2.getPerformer();
            return v1.compareTo(v2);
        }
    };
    gridView.addPermanentColumn("Performer", column, comparator, 150, Style.Unit.PX);
}

From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.design.SamplesViewImpl.java

License:Apache License

private void addNameColumn() {
    final EditSuggestCell nameCell = new EditSuggestCell(null) {
        @Override/*from w  ww . j a va2  s. c  o  m*/
        public boolean validateInput(String value, int rowIndex) {
            if (value == null || trimValue(value).isEmpty()) {
                NotificationPopupPanel.error("Sample with empty name is not permitted.", true, false);
                return false;
            }
            if (!isNameUnique(value, rowIndex)) {
                NotificationPopupPanel.error("Sample with the name '" + value + "' already exists.", true,
                        false);
                return false;
            }
            return true;
        }
    };
    Column<SampleRow, String> column = new SampleNameColumn(nameCell);

    column.setFieldUpdater(new FieldUpdater<SampleRow, String>() {
        @Override
        public void update(int index, SampleRow row, String value) {
            row.setName(trimValue(value));
            updateRow(row);
        }
    });
    column.setSortable(true);
    Comparator<SampleRow> comparator = new Comparator<SampleRow>() {
        @Override
        public int compare(SampleRow o1, SampleRow o2) {
            if (o1 == o2) {
                return 0;
            }
            String v1 = o1.getName();
            String v2 = o2.getName();
            return v1.compareTo(v2);
        }
    };
    gridView.addPermanentColumn("Name", column, comparator, 150, Style.Unit.PX);
}

From source file:uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.SheetModeViewImpl.java

License:Apache License

private void initColumns(Table table, CustomDataGrid<IndexedRow> dataGrid,
        ColumnSortEvent.ListHandler<IndexedRow> sortHandler, boolean hasHeaders) {
    if (table == null || table.isEmpty()) {
        return;/*w w  w  .  j  a va2s.c om*/
    }

    int nColumns = table.getTrimmedWidth();

    Row headerRow = table.getRow(0);

    for (int i = 0; i < nColumns + 1; i++) {
        if (i == 0) {
            Column<IndexedRow, String> column = new Column<IndexedRow, String>(new TextCell()) {
                @Override
                public String getValue(IndexedRow row) {
                    return row.getIndex() + "";
                }
            };
            sortHandler.setComparator(column, new Comparator<IndexedRow>() {
                @Override
                public int compare(IndexedRow o1, IndexedRow o2) {
                    if (o1 == o2) {
                        return 0;
                    }
                    int v1 = o1.getIndex();
                    int v2 = o2.getIndex();
                    return new Integer(v1).compareTo(v2);
                }
            });
            column.setSortable(true);
            dataGrid.addColumn(column, new TextHeader("N"));
            dataGrid.setColumnWidth(i, 50, Style.Unit.PX);
            continue;
        }

        final int colIndex = (i - 1);
        String title = String.valueOf(i) + (hasHeaders ? ": " + headerRow.getValue(colIndex) : "");
        Column<IndexedRow, String> column = new Column<IndexedRow, String>(
                new TextCell(MultiLineSafeHtmlRenderer.getInstance())) {
            @Override
            public String getCellStyleNames(Cell.Context context, IndexedRow row) {
                String value = row.getValue(colIndex);
                return isEmpty(value) ? "app-MageTabEmptyCell"
                        : isUnassigned(value) ? "app-MageTabUnassignedCell" : null;
            }

            @Override
            public String getValue(IndexedRow row) {
                String value = row.getValue(colIndex);
                return isEmpty(value) || isUnassigned(value) ? "" : value;
            }

            private boolean isUnassigned(String value) {
                return value != null && value.startsWith("____UNASSIGNED____");
            }

            private boolean isEmpty(String value) {
                return value == null || value.isEmpty();
            }
        };
        sortHandler.setComparator(column, new Comparator<IndexedRow>() {
            @Override
            public int compare(IndexedRow o1, IndexedRow o2) {
                if (o1 == o2) {
                    return 0;
                }
                String v1 = o1.getValue(colIndex);
                String v2 = o2.getValue(colIndex);
                if (v1 != null) {
                    return (v2 != null) ? v1.compareTo(v2) : 1;
                }
                return -1;
            }
        });
        column.setSortable(true);
        dataGrid.addResizableColumn(column, title);
        dataGrid.setColumnWidth(i, 150, Style.Unit.PX);
    }
    dataGrid.getColumnSortList().push(dataGrid.getColumn(0));
}