checkboxes.clear();
uncheckMasterCheckBox();
for (int i = 0; i < gpsTraces.size(); i++) {
final int count = i;
final GPSTrace gpsTrace = gpsTraces.get(i);
GWT.log(gpsTrace.getName());
CheckBox cb = new CheckBox();
cb.setFormValue(gpsTrace.getId()); //store the id in the checkbox value
checkboxes.add(cb); // keep track for selecting all|none to delete
cb.setStyleName(style.checkbox());
// if a checkbox is checked, deselect the master checkbox
cb.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
uncheckMasterCheckBox();
}
});
Label name = new Label(gpsTrace.getName());
name.setStyleName(style.list());
// also store id/name for use later
gpsTraceNames.put(gpsTrace.getId(), gpsTrace.getName());
//TODO: add clickable only if we load the details to edit
// name.addStyleName(style.clickable());
name.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
//TODO: loadTagDetails(gpsTrace);
}
});
String description = gpsTrace.getDescription();
if( description.length() > 10)
{
description = description.substring(0, 10) + "...";
}
Label desc = new Label(description);
desc.setTitle(gpsTrace.getDescription());
Label upload = new Label(DateTimeFormat.getMediumDateTimeFormat().format(gpsTrace.getUploadDate()));
Label processed = new Label("No");
Label processedDate = new Label("n/a");
if( gpsTrace.isProcessed() )
{
processed.setText("Yes");
processedDate.setText(DateTimeFormat.getMediumDateTimeFormat().format(gpsTrace.getProcessDate()));
}
Label records = new Label(Integer.toString(gpsTrace.getRecordCount()));
Label matchedRecords = new Label(Integer.toString(gpsTrace.getMatchedCount()));
int row = i + 1; // to account for column headers
gpsTraceList.setWidget(row, 0, cb);
gpsTraceList.getCellFormatter().setWidth(row, 0, "20px");
gpsTraceList.setWidget(row, 1, name);