|
|
|
@ -131,7 +131,7 @@ public class ItemsTable<T extends CatalogueDataset> extends AbstractItemsCellTab
|
|
|
|
|
this.dataProvider = dataProvider;
|
|
|
|
|
initAbstractTable(eventBus, fireEventOnClick, dataProvider, ContentModeratorWidgetConstants.ITEMS_PER_PAGE);
|
|
|
|
|
this.dataProvider.addDataDisplay(sortedCellTable);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.isAsyncronusTable = dataProvider instanceof
|
|
|
|
|
// AbstractDataProvider?true:false;
|
|
|
|
|
this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true;
|
|
|
|
@ -148,7 +148,12 @@ public class ItemsTable<T extends CatalogueDataset> extends AbstractItemsCellTab
|
|
|
|
|
public String getValue(T object) {
|
|
|
|
|
if (object == null)
|
|
|
|
|
return "";
|
|
|
|
|
return ((CatalogueDataset) object).getType();
|
|
|
|
|
|
|
|
|
|
String type = ((CatalogueDataset) object).getType();
|
|
|
|
|
|
|
|
|
|
if (type == null)
|
|
|
|
|
return "";
|
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ADDING TOOLTIP
|
|
|
|
@ -156,13 +161,16 @@ public class ItemsTable<T extends CatalogueDataset> extends AbstractItemsCellTab
|
|
|
|
|
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
|
|
|
|
if (object == null)
|
|
|
|
|
return;
|
|
|
|
|
sb.appendHtmlConstant("<div title=\"" + ((CatalogueDataset) object).getType() + "\">");
|
|
|
|
|
String type = ((CatalogueDataset) object).getType();
|
|
|
|
|
if (type == null)
|
|
|
|
|
type = "";
|
|
|
|
|
sb.appendHtmlConstant("<div title=\"" + type + "\">");
|
|
|
|
|
super.render(context, object, sb);
|
|
|
|
|
sb.appendHtmlConstant("</div>");
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sortedCellTable.addColumn(name, "Type", true);
|
|
|
|
|
sortedCellTable.addColumn(type, "Type", true);
|
|
|
|
|
|
|
|
|
|
if (!isAsyncronusTable) {
|
|
|
|
|
Comparator<T> c = new Comparator<T>() {
|
|
|
|
@ -177,41 +185,6 @@ public class ItemsTable<T extends CatalogueDataset> extends AbstractItemsCellTab
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (this.displayFields.contains(DISPLAY_FIELD.ICON)) {
|
|
|
|
|
// // ICONS
|
|
|
|
|
// ImageResourceCell iconResourceCell = new ImageResourceCell() {
|
|
|
|
|
// public Set<String> getConsumedEvents() {
|
|
|
|
|
// HashSet<String> events = new HashSet<String>();
|
|
|
|
|
// events.add("click");
|
|
|
|
|
// return events;
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
//
|
|
|
|
|
// icon = new Column<T, ImageResource>(iconResourceCell) {
|
|
|
|
|
// @Override
|
|
|
|
|
// public ImageResource getValue(T dataObj) {
|
|
|
|
|
// return Util.getImage(dataObj);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /*
|
|
|
|
|
// * (non-Javadoc)
|
|
|
|
|
// *
|
|
|
|
|
// * @see
|
|
|
|
|
// * com.google.gwt.user.cellview.client.Column#render(com.google.gwt.cell.client.
|
|
|
|
|
// * Cell.Context, java.lang.Object,
|
|
|
|
|
// * com.google.gwt.safehtml.shared.SafeHtmlBuilder)
|
|
|
|
|
// */
|
|
|
|
|
// @Override
|
|
|
|
|
// public void render(Context context, T object, SafeHtmlBuilder sb) {
|
|
|
|
|
// super.render(context, object, sb);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
//// icon.setSortable(false);
|
|
|
|
|
// sortedCellTable.addColumn(icon, "", false);
|
|
|
|
|
// sortedCellTable.setColumnWidth(icon, 32.0, Unit.PX);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (this.displayFields.contains(DISPLAY_FIELD.NAME)) {
|
|
|
|
|
|
|
|
|
|
// NAME
|
|
|
|
@ -286,7 +259,7 @@ public class ItemsTable<T extends CatalogueDataset> extends AbstractItemsCellTab
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sortedCellTable.addColumn(author, "Title", true);
|
|
|
|
|
sortedCellTable.addColumn(author, "Author", true);
|
|
|
|
|
|
|
|
|
|
if (!isAsyncronusTable) {
|
|
|
|
|
Comparator<T> c = new Comparator<T>() {
|
|
|
|
@ -300,7 +273,7 @@ public class ItemsTable<T extends CatalogueDataset> extends AbstractItemsCellTab
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.displayFields.contains(DISPLAY_FIELD.AUTHOR)) {
|
|
|
|
|
if (this.displayFields.contains(DISPLAY_FIELD.CREATED)) {
|
|
|
|
|
|
|
|
|
|
DateCell date = new DateCell(dtformat);
|
|
|
|
|
dateColumn = new Column<T, Date>(date) {
|
|
|
|
@ -341,6 +314,7 @@ public class ItemsTable<T extends CatalogueDataset> extends AbstractItemsCellTab
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GWT.log("startSortByColumn: " + startSortByColumn);
|
|
|
|
|
|
|
|
|
@ -358,6 +332,11 @@ public class ItemsTable<T extends CatalogueDataset> extends AbstractItemsCellTab
|
|
|
|
|
break;
|
|
|
|
|
case AUTHOR:
|
|
|
|
|
if (this.displayFields.contains(DISPLAY_FIELD.AUTHOR)) {
|
|
|
|
|
sortedCellTable.setInitialSortColumn(author);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CREATED:
|
|
|
|
|
if (this.displayFields.contains(DISPLAY_FIELD.CREATED)) {
|
|
|
|
|
sortedCellTable.setDefaultSortOrder(dateColumn, false); // sorts ascending on first click
|
|
|
|
|
sortedCellTable.setInitialSortColumn(dateColumn);
|
|
|
|
|
GWT.log("sortedCellTable: " + sortedCellTable);
|
|
|
|
@ -366,6 +345,7 @@ public class ItemsTable<T extends CatalogueDataset> extends AbstractItemsCellTab
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* final SingleSelectionModel<Item> selectionModel = new
|
|
|
|
|