return o1.getEndDate().compareTo(o2.getEndDate());
}
});
this.slotsGrid.addColumn(endDateColumn, this.constants.endDate());
// Number of products.
Column<SlotSummaryDTO, Number> productsColumn = new Column<SlotSummaryDTO, Number>(new NumberCell()) {
@Override
public Number getValue(SlotSummaryDTO object) {
return object.getNbProducts();
}
};
productsColumn.setSortable(true);
sortHandler.setComparator(productsColumn, new Comparator<SlotSummaryDTO>() {
public int compare(SlotSummaryDTO o1, SlotSummaryDTO o2) {
return (int) (o2.getNbProducts() - o1.getNbProducts());
}
});
this.slotsGrid.addColumn(productsColumn, constants.products());
this.slotsGrid.setColumnWidth(productsColumn, 60, Unit.PT);
// Price.
Column<SlotSummaryDTO, Number> priceColumn = new Column<SlotSummaryDTO, Number>(new NumberCell()) {
@Override
public Number getValue(SlotSummaryDTO object) {
return object.getPrice();
}
};