|
|
|
@ -13,7 +13,7 @@ import java.util.Set;
|
|
|
|
|
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_DISPLAY_FIELD;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
|
|
|
|
|
|
|
|
@ -60,7 +60,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
|
|
|
|
|
private AbstractDataProvider<T> dataProvider;
|
|
|
|
|
|
|
|
|
|
private List<RECORD_DISPLAY_FIELD> displayFields;
|
|
|
|
|
private List<RECORD_FIELD> displayFields;
|
|
|
|
|
private TextColumn<T> startEndProjectColumn;
|
|
|
|
|
// private Column<T, Date> startProjectDateColumn;
|
|
|
|
|
// private Column<T, Date> endProjectDateColumn;
|
|
|
|
@ -76,7 +76,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
* @param displayFields the display fields
|
|
|
|
|
* @param startSortByColumn the start sort by column
|
|
|
|
|
*/
|
|
|
|
|
public ItemsTable(HandlerManager eventBus, RECORD_DISPLAY_FIELD[] displayFields, SortFilter currentSortFilter) {
|
|
|
|
|
public ItemsTable(HandlerManager eventBus, RECORD_FIELD[] displayFields, SortFilter currentSortFilter) {
|
|
|
|
|
this.eventBus = eventBus;
|
|
|
|
|
this.currentSortFilter = currentSortFilter;
|
|
|
|
|
setDisplayFields(displayFields);
|
|
|
|
@ -108,7 +108,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true;
|
|
|
|
|
setEmptyTableMessage(NO_DATA);
|
|
|
|
|
|
|
|
|
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.NAME)) {
|
|
|
|
|
if (this.displayFields.contains(RECORD_FIELD.NAME)) {
|
|
|
|
|
|
|
|
|
|
// NAME
|
|
|
|
|
name = new TextColumn<T>() {
|
|
|
|
@ -130,7 +130,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sortedCellTable.addColumn(name, "Name", true);
|
|
|
|
|
sortedCellTable.addColumn(name, RECORD_FIELD.NAME.getDisplayName(), true);
|
|
|
|
|
|
|
|
|
|
if (!isAsyncronusTable) {
|
|
|
|
|
Comparator<T> c = new Comparator<T>() {
|
|
|
|
@ -145,7 +145,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.INTRODUCTION)) {
|
|
|
|
|
if (this.displayFields.contains(RECORD_FIELD.INTRODUCTION)) {
|
|
|
|
|
|
|
|
|
|
introduction = new TextColumn<T>() {
|
|
|
|
|
@Override
|
|
|
|
@ -158,7 +158,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sortedCellTable.addColumn(introduction, "Introduction", true);
|
|
|
|
|
sortedCellTable.addColumn(introduction, RECORD_FIELD.INTRODUCTION.getDisplayName(), true);
|
|
|
|
|
|
|
|
|
|
if (!isAsyncronusTable) {
|
|
|
|
|
Comparator<T> c = new Comparator<T>() {
|
|
|
|
@ -174,7 +174,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.AUTHOR)) {
|
|
|
|
|
if (this.displayFields.contains(RECORD_FIELD.AUTHOR)) {
|
|
|
|
|
|
|
|
|
|
author = new TextColumn<T>() {
|
|
|
|
|
@Override
|
|
|
|
@ -187,7 +187,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sortedCellTable.addColumn(author, "Author/s", true);
|
|
|
|
|
sortedCellTable.addColumn(author, RECORD_FIELD.AUTHOR.getDisplayName(), true);
|
|
|
|
|
|
|
|
|
|
if (!isAsyncronusTable) {
|
|
|
|
|
Comparator<T> c = new Comparator<T>() {
|
|
|
|
@ -205,7 +205,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.PROJECT_START_END_DATE)) {
|
|
|
|
|
if (this.displayFields.contains(RECORD_FIELD.PROJECT_START_END_DATE)) {
|
|
|
|
|
|
|
|
|
|
startEndProjectColumn = new TextColumn<T>() {
|
|
|
|
|
@Override
|
|
|
|
@ -219,12 +219,12 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sortedCellTable.addColumn(startEndProjectColumn, "Start/End Date", false);
|
|
|
|
|
sortedCellTable.addColumn(startEndProjectColumn, RECORD_FIELD.PROJECT_START_END_DATE.getDisplayName(), false);
|
|
|
|
|
sortedCellTable.setColumnWidth(startEndProjectColumn, 180, Unit.PX);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.CREATED)) {
|
|
|
|
|
if (this.displayFields.contains(RECORD_FIELD.CREATED)) {
|
|
|
|
|
|
|
|
|
|
DateCell date = new DateCell(dtformat);
|
|
|
|
|
createdColumn = new Column<T, Date>(date) {
|
|
|
|
@ -237,7 +237,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
return (((ConcessioneDV) object).getCreationTime());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
sortedCellTable.addColumn(createdColumn, "Created", true);
|
|
|
|
|
sortedCellTable.addColumn(createdColumn, RECORD_FIELD.CREATED.getDisplayName(), true);
|
|
|
|
|
|
|
|
|
|
if (!isAsyncronusTable) {
|
|
|
|
|
Comparator<T> c = new Comparator<T>() {
|
|
|
|
@ -268,7 +268,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.CREATED_BY)) {
|
|
|
|
|
if (this.displayFields.contains(RECORD_FIELD.CREATED_BY)) {
|
|
|
|
|
|
|
|
|
|
// NAME
|
|
|
|
|
insertedBy = new TextColumn<T>() {
|
|
|
|
@ -280,7 +280,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sortedCellTable.addColumn(insertedBy, "Created by", true);
|
|
|
|
|
sortedCellTable.addColumn(insertedBy, RECORD_FIELD.CREATED_BY.getDisplayName(), true);
|
|
|
|
|
|
|
|
|
|
if (!isAsyncronusTable) {
|
|
|
|
|
Comparator<T> c = new Comparator<T>() {
|
|
|
|
@ -334,17 +334,17 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
if (currentSortFilter != null)
|
|
|
|
|
switch (currentSortFilter.getOrderByField()) {
|
|
|
|
|
case NAME:
|
|
|
|
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.NAME)) {
|
|
|
|
|
if (this.displayFields.contains(RECORD_FIELD.NAME)) {
|
|
|
|
|
sortedCellTable.setInitialSortColumn(name);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case INTRODUCTION:
|
|
|
|
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.INTRODUCTION)) {
|
|
|
|
|
if (this.displayFields.contains(RECORD_FIELD.INTRODUCTION)) {
|
|
|
|
|
sortedCellTable.setInitialSortColumn(introduction);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case AUTHOR:
|
|
|
|
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.AUTHOR)) {
|
|
|
|
|
if (this.displayFields.contains(RECORD_FIELD.AUTHOR)) {
|
|
|
|
|
sortedCellTable.setInitialSortColumn(author);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@ -399,9 +399,9 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
*
|
|
|
|
|
* @param fields the new display fields
|
|
|
|
|
*/
|
|
|
|
|
public void setDisplayFields(RECORD_DISPLAY_FIELD[] fields) {
|
|
|
|
|
public void setDisplayFields(RECORD_FIELD[] fields) {
|
|
|
|
|
this.displayFields = fields != null && fields.length > 0 ? Arrays.asList(fields)
|
|
|
|
|
: Arrays.asList(RECORD_DISPLAY_FIELD.values());
|
|
|
|
|
: Arrays.asList(RECORD_FIELD.values());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -420,7 +420,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|
|
|
|
*
|
|
|
|
|
* @return the displayFields
|
|
|
|
|
*/
|
|
|
|
|
public List<RECORD_DISPLAY_FIELD> getDisplayFields() {
|
|
|
|
|
public List<RECORD_FIELD> getDisplayFields() {
|
|
|
|
|
return displayFields;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|