moved to gwt.2.9.0. Added Sort By facility
This commit is contained in:
parent
f1f1465696
commit
8ed729ea51
|
@ -1,11 +1,11 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<faceted-project>
|
<faceted-project>
|
||||||
<installed facet="jst.web" version="3.0"/>
|
<installed facet="jst.web" version="3.0"/>
|
||||||
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
|
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
|
||||||
<installed facet="java" version="1.7"/>
|
|
||||||
<installed facet="jst.jaxrs" version="1.1"/>
|
<installed facet="jst.jaxrs" version="1.1"/>
|
||||||
|
<installed facet="java" version="1.8"/>
|
||||||
</faceted-project>
|
</faceted-project>
|
||||||
|
|
20
pom.xml
20
pom.xml
|
@ -25,12 +25,12 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Convenience property to set the GWT version -->
|
<!-- Convenience property to set the GWT version -->
|
||||||
<gwtVersion>2.7.0</gwtVersion>
|
<gwtVersion>2.9.0</gwtVersion>
|
||||||
<!-- GWT needs at least java 1.6 -->
|
<!-- GWT needs at least java 1.6 -->
|
||||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
@ -59,6 +59,22 @@
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- needed to compile with gwt > 2.7 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- needed to compile with gwt > 2.7 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>xml-apis</groupId>
|
||||||
|
<artifactId>xml-apis</artifactId>
|
||||||
|
<version>1.4.01</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.gwt</groupId>
|
<groupId>com.google.gwt</groupId>
|
||||||
<artifactId>gwt-user</artifactId>
|
<artifactId>gwt-user</artifactId>
|
||||||
|
|
|
@ -2,6 +2,13 @@ package org.gcube.portlets.user.geoportaldataentry.client;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ConstantsGeoPortalDataEntryApp.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Aug 6, 2021
|
||||||
|
*/
|
||||||
public class ConstantsGeoPortalDataEntryApp {
|
public class ConstantsGeoPortalDataEntryApp {
|
||||||
|
|
||||||
public static final String DATE_FORMAT = ConstantsMPFormBuilder.DATE_FORMAT;
|
public static final String DATE_FORMAT = ConstantsMPFormBuilder.DATE_FORMAT;
|
||||||
|
@ -12,12 +19,59 @@ public class ConstantsGeoPortalDataEntryApp {
|
||||||
|
|
||||||
public static final String ERROR_ON_INIZIALITAION_STAGE_PLEASE_CONTACT_THE_SUPPORT = "Error on inizialization stage, please contact the support!";
|
public static final String ERROR_ON_INIZIALITAION_STAGE_PLEASE_CONTACT_THE_SUPPORT = "Error on inizialization stage, please contact the support!";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum RECORD_TYPE.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Aug 6, 2021
|
||||||
|
*/
|
||||||
public enum RECORD_TYPE {
|
public enum RECORD_TYPE {
|
||||||
CONCESSIONE
|
CONCESSIONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum ACTION_ON_ITEM.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Aug 6, 2021
|
||||||
|
*/
|
||||||
public enum ACTION_ON_ITEM {
|
public enum ACTION_ON_ITEM {
|
||||||
SHOW_ON_MAP, SHOW_METADATA, REMOVE
|
SHOW_ON_MAP, SHOW_METADATA, REMOVE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum RECORD_FIELD.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Aug 6, 2021
|
||||||
|
*/
|
||||||
|
public static enum RECORD_FIELD {
|
||||||
|
NAME, INTRODUCTION, AUTHOR, PROJECT_START, CREATED, CREATED_BY
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum RECORD_FIELD.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Aug 6, 2021
|
||||||
|
*/
|
||||||
|
public static enum RECORD_DISPLAY_FIELD {
|
||||||
|
NAME, INTRODUCTION, AUTHOR, PROJECT_START_END_DATE, CREATED, CREATED_BY
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum ORDER.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Aug 6, 2021
|
||||||
|
*/
|
||||||
|
public static enum ORDER {
|
||||||
|
ASC, DESC
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ import java.util.TreeMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
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.ACTION_ON_ITEM;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ORDER;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEventHandler;
|
||||||
|
@ -24,7 +26,6 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaRecordsPaginate
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable.DISPLAY_FIELD;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogConfirm;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogConfirm;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil.HTML_TAG;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil.HTML_TAG;
|
||||||
|
@ -33,6 +34,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.NewBrowserWind
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
|
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||||
|
@ -90,7 +92,12 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
*/
|
*/
|
||||||
public void onModuleLoad() {
|
public void onModuleLoad() {
|
||||||
|
|
||||||
mainTabPanel = new GeonaMainTabPanel(appManagerBus);
|
RECORD_FIELD[] sortByOptions = new RECORD_FIELD[] { RECORD_FIELD.NAME, RECORD_FIELD.PROJECT_START,
|
||||||
|
RECORD_FIELD.CREATED, RECORD_FIELD.CREATED_BY };
|
||||||
|
|
||||||
|
SortFilter initialSortFilter = new SortFilter(RECORD_FIELD.NAME, ORDER.ASC);
|
||||||
|
|
||||||
|
mainTabPanel = new GeonaMainTabPanel(appManagerBus, sortByOptions, initialSortFilter);
|
||||||
mainTabPanel.setLoaderVisible("Loading...", true);
|
mainTabPanel.setLoaderVisible("Loading...", true);
|
||||||
|
|
||||||
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
||||||
|
@ -386,7 +393,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
|
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
|
||||||
|
|
||||||
GeonaRecordsPaginatedView grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE,
|
GeonaRecordsPaginatedView grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE,
|
||||||
null, DISPLAY_FIELD.NAME);
|
null, getListOfRecordsEvent.getSortFilter());
|
||||||
mainTabPanel.showListOfConcessioniView(grpw);
|
mainTabPanel.showListOfConcessioniView(grpw);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -496,7 +503,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
hp.add(alert);
|
hp.add(alert);
|
||||||
|
|
||||||
appManagerBus.fireEvent(
|
appManagerBus.fireEvent(
|
||||||
new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE));
|
new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||||
|
mainTabPanel.getCurrentSortFilter()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataE
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SearchedData;
|
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.RemoteService;
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
|
@ -52,12 +53,14 @@ public interface GeoportalDataEntryService extends RemoteService {
|
||||||
* Gets the list concessioni.
|
* Gets the list concessioni.
|
||||||
*
|
*
|
||||||
* @param start the start
|
* @param start the start
|
||||||
* @param offset the offset
|
* @param limit the limit
|
||||||
|
* @param filter the filter
|
||||||
* @param reloadFromService the reload from service
|
* @param reloadFromService the reload from service
|
||||||
* @return the list concessioni
|
* @return the list concessioni
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
SearchedData getListConcessioni(Integer start, Integer offset, boolean reloadFromService) throws Exception;
|
public ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SortFilter filter, boolean reloadFromService) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete record.
|
* Delete record.
|
||||||
|
|
|
@ -7,7 +7,8 @@ import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataE
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SearchedData;
|
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
@ -47,7 +48,8 @@ public interface GeoportalDataEntryServiceAsync
|
||||||
void getLinksFor(String itemId, RECORD_TYPE recordType, AsyncCallback<GeoNaItemRef> callback);
|
void getLinksFor(String itemId, RECORD_TYPE recordType, AsyncCallback<GeoNaItemRef> callback);
|
||||||
|
|
||||||
|
|
||||||
void getListConcessioni(Integer start, Integer offset, boolean reloadFromService, AsyncCallback<SearchedData> callback);
|
void getListConcessioni(Integer start, Integer limit, SortFilter filter, boolean reloadFromService,
|
||||||
|
AsyncCallback<ResultSetPaginatedData> callback);
|
||||||
|
|
||||||
|
|
||||||
void deleteRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<Boolean> callback);
|
void deleteRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<Boolean> callback);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
@ -17,13 +18,14 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
||||||
/** The type. */
|
/** The type. */
|
||||||
public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
|
public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
|
||||||
private RECORD_TYPE recordType;
|
private RECORD_TYPE recordType;
|
||||||
|
private SortFilter sortFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new cancel upload event.
|
* Instantiates a new cancel upload event.
|
||||||
*/
|
*/
|
||||||
public GetListOfRecordsEvent(ConstantsGeoPortalDataEntryApp.RECORD_TYPE recordType) {
|
public GetListOfRecordsEvent(ConstantsGeoPortalDataEntryApp.RECORD_TYPE recordType, SortFilter sortFilter) {
|
||||||
this.recordType = recordType;
|
this.recordType = recordType;
|
||||||
|
this.sortFilter = sortFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,9 +59,13 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
||||||
protected void dispatch(GetListOfRecordsEventHandler handler) {
|
protected void dispatch(GetListOfRecordsEventHandler handler) {
|
||||||
handler.onGetList(this);
|
handler.onGetList(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RECORD_TYPE getRecordType() {
|
public RECORD_TYPE getRecordType() {
|
||||||
return recordType;
|
return recordType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SortFilter getSortFilter() {
|
||||||
|
return sortFilter;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ORDER;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable.DISPLAY_FIELD;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Dropdown;
|
||||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||||
import com.github.gwtbootstrap.client.ui.Tab;
|
import com.github.gwtbootstrap.client.ui.Tab;
|
||||||
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
@ -16,6 +20,7 @@ import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
@ -29,6 +34,8 @@ import com.google.gwt.user.client.ui.Widget;
|
||||||
*/
|
*/
|
||||||
public class GeonaMainTabPanel extends Composite {
|
public class GeonaMainTabPanel extends Composite {
|
||||||
|
|
||||||
|
private static final String LABEL_FILTER_SEPARATOR = " - ";
|
||||||
|
|
||||||
private static GeonaMainTabPanelUiBinder uiBinder = GWT.create(GeonaMainTabPanelUiBinder.class);
|
private static GeonaMainTabPanelUiBinder uiBinder = GWT.create(GeonaMainTabPanelUiBinder.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,20 +71,53 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
Tab tabGetListOfProjects;
|
Tab tabGetListOfProjects;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Dropdown dropdownSortBy;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
TextBox textBoxSortBy;
|
||||||
|
|
||||||
private HandlerManager appManagerBus;
|
private HandlerManager appManagerBus;
|
||||||
|
|
||||||
|
private RECORD_FIELD[] sortByFields;
|
||||||
|
|
||||||
|
private SortFilter currentSortFilter;
|
||||||
|
|
||||||
|
private HTML divAnchorTop;
|
||||||
|
|
||||||
|
private HTML anchorTop;
|
||||||
|
|
||||||
|
private HTML divAnchorBotton;
|
||||||
|
|
||||||
|
private HTML anchorBottom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geona main tab panel.
|
* Instantiates a new geona main tab panel.
|
||||||
*
|
*
|
||||||
* @param appManagerBus the first name
|
* @param appManagerBus the first name
|
||||||
|
* @param sortByFields the sort by fields
|
||||||
|
* @param initialSortFilter
|
||||||
*/
|
*/
|
||||||
public GeonaMainTabPanel(HandlerManager appManagerBus) {
|
public GeonaMainTabPanel(HandlerManager appManagerBus, RECORD_FIELD[] sortByFields, SortFilter initialSortFilter) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.appManagerBus = appManagerBus;
|
this.appManagerBus = appManagerBus;
|
||||||
|
this.sortByFields = sortByFields;
|
||||||
|
setCurrentSortFilter(initialSortFilter);
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
|
// Anchor top
|
||||||
|
divAnchorTop = new HTML("<div id=\"topOfTable\"/>");
|
||||||
|
anchorTop = new HTML("<a href=\"#topOfTable\" style=\"float:right\">Go to top of table</a>");
|
||||||
|
|
||||||
|
// Anchor bottom
|
||||||
|
divAnchorBotton = new HTML("<div id=\"bottomOfTable\" />");
|
||||||
|
anchorBottom = new HTML("<a href=\"#bottomOfTable\" style=\"float:right\">Go to bottom of table</a>");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind events.
|
||||||
|
*/
|
||||||
private void bindEvents() {
|
private void bindEvents() {
|
||||||
|
|
||||||
buttCreateNewProject.addClickHandler(new ClickHandler() {
|
buttCreateNewProject.addClickHandler(new ClickHandler() {
|
||||||
|
@ -93,7 +133,7 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE));
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -102,13 +142,49 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
GeonaRecordsPaginatedView grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE,
|
GeonaRecordsPaginatedView grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE,
|
||||||
null, DISPLAY_FIELD.NAME);
|
null, currentSortFilter);
|
||||||
showListOfConcessioniView(grpw);
|
showListOfConcessioniView(grpw);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for (RECORD_FIELD record_FIELD : sortByFields) {
|
||||||
|
|
||||||
|
// ASC
|
||||||
|
SortFilter sortFilter = new SortFilter(record_FIELD, ORDER.ASC);
|
||||||
|
String labelASC = toLabelFilter(sortFilter);
|
||||||
|
NavLink nav = new NavLink(labelASC);
|
||||||
|
dropdownSortBy.add(nav);
|
||||||
|
|
||||||
|
nav.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
GWT.log("Sort by: " + sortFilter);
|
||||||
|
setCurrentSortFilter(sortFilter);
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// //DESC
|
||||||
|
SortFilter sortFilter2 = new SortFilter(record_FIELD, ORDER.DESC);
|
||||||
|
String labelASC2 = toLabelFilter(sortFilter2);
|
||||||
|
NavLink nav2 = new NavLink(labelASC2);
|
||||||
|
dropdownSortBy.add(nav2);
|
||||||
|
|
||||||
|
nav2.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
GWT.log("Sort by: " + sortFilter2);
|
||||||
|
setCurrentSortFilter(sortFilter2);
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,11 +196,23 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
geonaMainFormPanel.add(formPanel);
|
geonaMainFormPanel.add(formPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show list of concessioni view.
|
||||||
|
*
|
||||||
|
* @param grpw the grpw
|
||||||
|
*/
|
||||||
public void showListOfConcessioniView(GeonaRecordsPaginatedView grpw) {
|
public void showListOfConcessioniView(GeonaRecordsPaginatedView grpw) {
|
||||||
geonaListOfConcessioniPanel.clear();
|
geonaListOfConcessioniPanel.clear();
|
||||||
VerticalPanel htmllPanel = new VerticalPanel();
|
VerticalPanel htmllPanel = new VerticalPanel();
|
||||||
|
|
||||||
|
htmllPanel.add(divAnchorTop);
|
||||||
|
htmllPanel.add(anchorBottom);
|
||||||
|
|
||||||
htmllPanel.add(grpw.getCellPanel());
|
htmllPanel.add(grpw.getCellPanel());
|
||||||
htmllPanel.add(grpw.getPagerPanel());
|
htmllPanel.add(grpw.getPagerPanel());
|
||||||
|
|
||||||
|
htmllPanel.add(anchorTop);
|
||||||
|
htmllPanel.add(divAnchorBotton);
|
||||||
geonaListOfConcessioniPanel.add(htmllPanel);
|
geonaListOfConcessioniPanel.add(htmllPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,4 +227,51 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
loader.setVisible(visible);
|
loader.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setCurrentSortFilter(SortFilter sortFilter) {
|
||||||
|
this.currentSortFilter = sortFilter;
|
||||||
|
this.textBoxSortBy.setText(toLabelFilter(sortFilter));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To label filter.
|
||||||
|
*
|
||||||
|
* @param sortFilter the sort filter
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
public String toLabelFilter(SortFilter sortFilter) {
|
||||||
|
|
||||||
|
String labelFilter = sortFilter.getOrderByField().name() + LABEL_FILTER_SEPARATOR
|
||||||
|
+ sortFilter.getOrder().name();
|
||||||
|
GWT.log("Got " + sortFilter);
|
||||||
|
return labelFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To sort filter.
|
||||||
|
*
|
||||||
|
* @param labelFilter the label filter
|
||||||
|
* @return the sort filter
|
||||||
|
*/
|
||||||
|
public SortFilter toSortFilter(String labelFilter) {
|
||||||
|
|
||||||
|
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
||||||
|
|
||||||
|
SortFilter sortFilter = null;
|
||||||
|
try {
|
||||||
|
RECORD_FIELD recordField = RECORD_FIELD.valueOf(array[0]);
|
||||||
|
ORDER orderField = ORDER.valueOf(array[1]);
|
||||||
|
sortFilter = new SortFilter(recordField, orderField);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GWT.log("Got " + sortFilter);
|
||||||
|
return sortFilter;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public SortFilter getCurrentSortFilter() {
|
||||||
|
return currentSortFilter;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
border: 1px solid #eee;
|
border: 1px solid #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.margin-top-5 {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
</ui:style>
|
</ui:style>
|
||||||
<g:HTMLPanel>
|
<g:HTMLPanel>
|
||||||
<b:PageHeader subtext="data entry facility"
|
<b:PageHeader subtext="data entry facility"
|
||||||
|
@ -39,6 +43,15 @@
|
||||||
ui:field="tabGetListOfProjects">
|
ui:field="tabGetListOfProjects">
|
||||||
<b:Navbar>
|
<b:Navbar>
|
||||||
<b:Brand>List of Projects</b:Brand>
|
<b:Brand>List of Projects</b:Brand>
|
||||||
|
<b:Nav>
|
||||||
|
<b:Dropdown text="Sort by" ui:field="dropdownSortBy">
|
||||||
|
</b:Dropdown>
|
||||||
|
|
||||||
|
</b:Nav>
|
||||||
|
<b:Nav>
|
||||||
|
<b:TextBox ui:field="textBoxSortBy" readOnly="true"
|
||||||
|
addStyleNames="{style.margin-top-5}"></b:TextBox>
|
||||||
|
</b:Nav>
|
||||||
<b:Nav>
|
<b:Nav>
|
||||||
<b:NavLink ui:field="buttonReloadConcessioni"
|
<b:NavLink ui:field="buttonReloadConcessioni"
|
||||||
title="Create a new Project" icon="ROTATE_RIGHT">Reload Projects</b:NavLink>
|
title="Create a new Project" icon="ROTATE_RIGHT">Reload Projects</b:NavLink>
|
||||||
|
|
|
@ -3,13 +3,14 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_DISPLAY_FIELD;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable.DISPLAY_FIELD;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.SortedCellTable;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.SortedCellTable;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SearchedData;
|
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
@ -49,21 +50,23 @@ public class GeonaRecordsPaginatedView {
|
||||||
private int serverStartIndex;
|
private int serverStartIndex;
|
||||||
private HandlerManager eventBus;
|
private HandlerManager eventBus;
|
||||||
private RECORD_TYPE recordType;
|
private RECORD_TYPE recordType;
|
||||||
|
private SortFilter currentSortFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geona records paginated view.
|
* Instantiates a new geona records paginated view.
|
||||||
*
|
*
|
||||||
* @param eventbus the eventbus
|
* @param eventbus the eventbus
|
||||||
* @param recordType the record type
|
* @param recordType the record type
|
||||||
* @param displayFields the display fields
|
* @param displayFields the display fields
|
||||||
* @param sortByField the sort by field
|
* @param currentSortFilter the sort by field
|
||||||
*/
|
*/
|
||||||
public GeonaRecordsPaginatedView(HandlerManager eventbus, RECORD_TYPE recordType, DISPLAY_FIELD[] displayFields,
|
public GeonaRecordsPaginatedView(HandlerManager eventbus, RECORD_TYPE recordType,
|
||||||
DISPLAY_FIELD sortByField) {
|
RECORD_DISPLAY_FIELD[] displayFields, SortFilter currentSortFilter) {
|
||||||
this.recordType = recordType;
|
this.recordType = recordType;
|
||||||
|
this.currentSortFilter = currentSortFilter;
|
||||||
this.initClassFirstRangeChanged = true;
|
this.initClassFirstRangeChanged = true;
|
||||||
this.eventBus = eventbus;
|
this.eventBus = eventbus;
|
||||||
itemsTable = new ItemsTable<ConcessioneDV>(eventbus, displayFields, sortByField);
|
itemsTable = new ItemsTable<ConcessioneDV>(eventbus, displayFields, currentSortFilter);
|
||||||
itemsTable.initTable(null, null, dataProvider);
|
itemsTable.initTable(null, null, dataProvider);
|
||||||
|
|
||||||
orginalLoadingIndicator = itemsTable.getCellTable().getLoadingIndicator();
|
orginalLoadingIndicator = itemsTable.getCellTable().getLoadingIndicator();
|
||||||
|
@ -111,13 +114,13 @@ public class GeonaRecordsPaginatedView {
|
||||||
/**
|
/**
|
||||||
* Load new page.
|
* Load new page.
|
||||||
*
|
*
|
||||||
* @param startIdx the start idx
|
* @param startIdx the start idx
|
||||||
* @param limit the limit
|
* @param limit the limit
|
||||||
* @param resetStore the reset store
|
* @param resetStore the reset store
|
||||||
* @param invalidCache the invalid cache
|
* @param invalidCache the invalid cache
|
||||||
*/
|
*/
|
||||||
private void loadNewPage(final int startIdx, final int limit, final boolean resetStore,
|
private void loadNewPage(final int startIdx, final int limit, final boolean resetStore,
|
||||||
final boolean invalidCache) {
|
final SortFilter currentSortFilter, final boolean invalidCache) {
|
||||||
// initFirstRangeChanged = resetStore;
|
// initFirstRangeChanged = resetStore;
|
||||||
GWT.log("loadNewPage with parameters [startIdx: " + startIdx + ", limit: " + limit + ", resetStore:"
|
GWT.log("loadNewPage with parameters [startIdx: " + startIdx + ", limit: " + limit + ", resetStore:"
|
||||||
+ resetStore + "]");
|
+ resetStore + "]");
|
||||||
|
@ -133,7 +136,7 @@ public class GeonaRecordsPaginatedView {
|
||||||
getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false);
|
getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadConcessioni(newStartIndex, limit, serverStartIndex, invalidCache);
|
loadConcessioni(newStartIndex, limit, serverStartIndex, currentSortFilter, invalidCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,7 +147,7 @@ public class GeonaRecordsPaginatedView {
|
||||||
public void loadItemsForType(RECORD_TYPE recordType) {
|
public void loadItemsForType(RECORD_TYPE recordType) {
|
||||||
this.recordType = recordType;
|
this.recordType = recordType;
|
||||||
getCellTable().setVisibleRangeAndClearData(new Range(ITEM_START_INDEX, ITEMS_PER_PAGE), false);
|
getCellTable().setVisibleRangeAndClearData(new Range(ITEM_START_INDEX, ITEMS_PER_PAGE), false);
|
||||||
loadNewPage(ITEM_START_INDEX, ITEMS_PER_PAGE, true, true);
|
loadNewPage(ITEM_START_INDEX, ITEMS_PER_PAGE, true, currentSortFilter, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -152,7 +155,7 @@ public class GeonaRecordsPaginatedView {
|
||||||
*
|
*
|
||||||
* @param result the new new page result
|
* @param result the new new page result
|
||||||
*/
|
*/
|
||||||
private void setNewPageResult(SearchedData result) {
|
private void setNewPageResult(ResultSetPaginatedData result) {
|
||||||
GWT.log("setNewPageResult: " + result);
|
GWT.log("setNewPageResult: " + result);
|
||||||
serverStartIndex = result.getServerEndIndex();
|
serverStartIndex = result.getServerEndIndex();
|
||||||
SelectionModel<? super ConcessioneDV> sm = getCellTable().getSelectionModel();
|
SelectionModel<? super ConcessioneDV> sm = getCellTable().getSelectionModel();
|
||||||
|
@ -194,14 +197,14 @@ public class GeonaRecordsPaginatedView {
|
||||||
* @param limit the limit
|
* @param limit the limit
|
||||||
* @param serverIndex the server index
|
* @param serverIndex the server index
|
||||||
*/
|
*/
|
||||||
private <T> void loadConcessioni(int newStartIndex, int limit, int serverIndex, boolean invalidCache) {
|
private <T> void loadConcessioni(int newStartIndex, int limit, int serverIndex, SortFilter sortFilter,
|
||||||
|
boolean invalidCache) {
|
||||||
showLoading(true);
|
showLoading(true);
|
||||||
|
|
||||||
GWT.log("calling loadItemsForStatus with parameters [startIndex: " + newStartIndex + ", limit: " + limit
|
GWT.log("calling loadItemsForStatus with parameters [startIndex: " + newStartIndex + ", limit: " + limit
|
||||||
+ ", serverIndex:" + serverIndex + "]");
|
+ ", serverIndex:" + serverIndex + ", sortFilter: " + sortFilter + "]");
|
||||||
|
GeoPortalDataEntryApp.greetingService.getListConcessioni(newStartIndex, limit, sortFilter, invalidCache,
|
||||||
GeoPortalDataEntryApp.greetingService.getListConcessioni(newStartIndex, limit, invalidCache,
|
new AsyncCallback<ResultSetPaginatedData>() {
|
||||||
new AsyncCallback<SearchedData>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -211,7 +214,7 @@ public class GeonaRecordsPaginatedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(SearchedData result) {
|
public void onSuccess(ResultSetPaginatedData result) {
|
||||||
showLoading(false);
|
showLoading(false);
|
||||||
setNewPageResult(result);
|
setNewPageResult(result);
|
||||||
|
|
||||||
|
@ -287,7 +290,7 @@ public class GeonaRecordsPaginatedView {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GWT.log("Range changed: " + start + " " + length + " visible count: " + display.getVisibleItemCount());
|
GWT.log("Range changed: " + start + " " + length + " visible count: " + display.getVisibleItemCount());
|
||||||
loadNewPage(start, length, false, false);
|
loadNewPage(start, length, false, currentSortFilter, false);
|
||||||
// eventBus.fireEvent(new TableRangeViewChangedEvent<T>(start, length));
|
// eventBus.fireEvent(new TableRangeViewChangedEvent<T>(start, length));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,9 @@ import java.util.Set;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
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.ACTION_ON_ITEM;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_DISPLAY_FIELD;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Pagination;
|
import com.github.gwtbootstrap.client.ui.Pagination;
|
||||||
import com.google.gwt.cell.client.ButtonCell;
|
import com.google.gwt.cell.client.ButtonCell;
|
||||||
|
@ -58,35 +60,26 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
|
|
||||||
private AbstractDataProvider<T> dataProvider;
|
private AbstractDataProvider<T> dataProvider;
|
||||||
|
|
||||||
/**
|
private List<RECORD_DISPLAY_FIELD> displayFields;
|
||||||
* The Enum DISPLAY_FIELD.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 1, 2016
|
|
||||||
*/
|
|
||||||
public static enum DISPLAY_FIELD {
|
|
||||||
NAME, INTRO, AUTHOR, PROJECT_START_DATE, PROJECT_START_END_DATE, CREATED, CREATED_BY
|
|
||||||
};
|
|
||||||
|
|
||||||
private List<DISPLAY_FIELD> displayFields;
|
|
||||||
private TextColumn<T> startEndProjectColumn;
|
private TextColumn<T> startEndProjectColumn;
|
||||||
// private Column<T, Date> startProjectDateColumn;
|
// private Column<T, Date> startProjectDateColumn;
|
||||||
// private Column<T, Date> endProjectDateColumn;
|
// private Column<T, Date> endProjectDateColumn;
|
||||||
private DISPLAY_FIELD startSortByColumn;
|
|
||||||
private boolean isAsyncronusTable;
|
private boolean isAsyncronusTable;
|
||||||
private TextColumn<T> insertedBy;
|
private TextColumn<T> insertedBy;
|
||||||
private Column<T, Date> createdColumn;
|
private Column<T, Date> createdColumn;
|
||||||
|
private SortFilter currentSortFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new items table.
|
* Instantiates a new items table.
|
||||||
*
|
*
|
||||||
* @param eventBus the event bus
|
* @param eventBus the event bus
|
||||||
* @param fields the fields
|
* @param displayFields the display fields
|
||||||
* @param startSortByColumn the start sort by column
|
* @param startSortByColumn the start sort by column
|
||||||
*/
|
*/
|
||||||
public ItemsTable(HandlerManager eventBus, DISPLAY_FIELD[] fields, DISPLAY_FIELD startSortByColumn) {
|
public ItemsTable(HandlerManager eventBus, RECORD_DISPLAY_FIELD[] displayFields, SortFilter currentSortFilter) {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.startSortByColumn = startSortByColumn;
|
this.currentSortFilter = currentSortFilter;
|
||||||
setDisplayFields(fields);
|
setDisplayFields(displayFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,7 +108,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true;
|
this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true;
|
||||||
setEmptyTableMessage(NO_DATA);
|
setEmptyTableMessage(NO_DATA);
|
||||||
|
|
||||||
if (this.displayFields.contains(DISPLAY_FIELD.NAME)) {
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.NAME)) {
|
||||||
|
|
||||||
// NAME
|
// NAME
|
||||||
name = new TextColumn<T>() {
|
name = new TextColumn<T>() {
|
||||||
|
@ -152,7 +145,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.displayFields.contains(DISPLAY_FIELD.INTRO)) {
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.INTRODUCTION)) {
|
||||||
|
|
||||||
introduction = new TextColumn<T>() {
|
introduction = new TextColumn<T>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -181,7 +174,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.displayFields.contains(DISPLAY_FIELD.AUTHOR)) {
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.AUTHOR)) {
|
||||||
|
|
||||||
author = new TextColumn<T>() {
|
author = new TextColumn<T>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -212,7 +205,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.displayFields.contains(DISPLAY_FIELD.PROJECT_START_END_DATE)) {
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.PROJECT_START_END_DATE)) {
|
||||||
|
|
||||||
startEndProjectColumn = new TextColumn<T>() {
|
startEndProjectColumn = new TextColumn<T>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -231,7 +224,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.displayFields.contains(DISPLAY_FIELD.CREATED)) {
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.CREATED)) {
|
||||||
|
|
||||||
DateCell date = new DateCell(dtformat);
|
DateCell date = new DateCell(dtformat);
|
||||||
createdColumn = new Column<T, Date>(date) {
|
createdColumn = new Column<T, Date>(date) {
|
||||||
|
@ -275,7 +268,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.displayFields.contains(DISPLAY_FIELD.CREATED_BY)) {
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.CREATED_BY)) {
|
||||||
|
|
||||||
// NAME
|
// NAME
|
||||||
insertedBy = new TextColumn<T>() {
|
insertedBy = new TextColumn<T>() {
|
||||||
|
@ -336,22 +329,22 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
sortedCellTable.addColumn(deleteRecordColumn);
|
sortedCellTable.addColumn(deleteRecordColumn);
|
||||||
sortedCellTable.setColumnWidth(deleteRecordColumn, 80, Unit.PX);
|
sortedCellTable.setColumnWidth(deleteRecordColumn, 80, Unit.PX);
|
||||||
|
|
||||||
GWT.log("startSortByColumn: " + startSortByColumn);
|
GWT.log("currentSortFilter: " + currentSortFilter);
|
||||||
|
|
||||||
if (startSortByColumn != null)
|
if (currentSortFilter != null)
|
||||||
switch (startSortByColumn) {
|
switch (currentSortFilter.getOrderByField()) {
|
||||||
case NAME:
|
case NAME:
|
||||||
if (this.displayFields.contains(DISPLAY_FIELD.NAME)) {
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.NAME)) {
|
||||||
sortedCellTable.setInitialSortColumn(name);
|
sortedCellTable.setInitialSortColumn(name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INTRO:
|
case INTRODUCTION:
|
||||||
if (this.displayFields.contains(DISPLAY_FIELD.INTRO)) {
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.INTRODUCTION)) {
|
||||||
sortedCellTable.setInitialSortColumn(introduction);
|
sortedCellTable.setInitialSortColumn(introduction);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AUTHOR:
|
case AUTHOR:
|
||||||
if (this.displayFields.contains(DISPLAY_FIELD.AUTHOR)) {
|
if (this.displayFields.contains(RECORD_DISPLAY_FIELD.AUTHOR)) {
|
||||||
sortedCellTable.setInitialSortColumn(author);
|
sortedCellTable.setInitialSortColumn(author);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -361,6 +354,12 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To display authors.
|
||||||
|
*
|
||||||
|
* @param authors the authors
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
private String toDisplayAuthors(List<String> authors) {
|
private String toDisplayAuthors(List<String> authors) {
|
||||||
String toDisplay = "";
|
String toDisplay = "";
|
||||||
if (authors == null)
|
if (authors == null)
|
||||||
|
@ -400,9 +399,9 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
*
|
*
|
||||||
* @param fields the new display fields
|
* @param fields the new display fields
|
||||||
*/
|
*/
|
||||||
public void setDisplayFields(DISPLAY_FIELD[] fields) {
|
public void setDisplayFields(RECORD_DISPLAY_FIELD[] fields) {
|
||||||
this.displayFields = fields != null && fields.length > 0 ? Arrays.asList(fields)
|
this.displayFields = fields != null && fields.length > 0 ? Arrays.asList(fields)
|
||||||
: Arrays.asList(DISPLAY_FIELD.values());
|
: Arrays.asList(RECORD_DISPLAY_FIELD.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -421,7 +420,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
*
|
*
|
||||||
* @return the displayFields
|
* @return the displayFields
|
||||||
*/
|
*/
|
||||||
public List<DISPLAY_FIELD> getDisplayFields() {
|
public List<RECORD_DISPLAY_FIELD> getDisplayFields() {
|
||||||
return displayFields;
|
return displayFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.server;
|
package org.gcube.portlets.user.geoportaldataentry.server;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -20,19 +21,23 @@ import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ORDER;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport.STATE;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport.STATE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SearchedData;
|
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -405,19 +410,124 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Override public ResultSetPaginatedData getListConcessioni(Integer start,
|
||||||
|
* Integer limit, SortFilter filter, boolean reloadFromService) throws Exception
|
||||||
|
* { LOG.info("getListConcessioni called wit start: " + start + ", limit: " +
|
||||||
|
* limit + ", filter: " + filter);
|
||||||
|
*
|
||||||
|
* try { List<Concessione> listOfConcessioni =
|
||||||
|
* SessionUtil.getListOfConcessioni(getThreadLocalRequest(), reloadFromService);
|
||||||
|
* int listConcessioniSize = listOfConcessioni.size();
|
||||||
|
*
|
||||||
|
* List<Concessione> toReturn = new ArrayList<Concessione>(); int startIndex;
|
||||||
|
* int limitIndex = 0; if (start == null && limit == null) { startIndex = 0;
|
||||||
|
* limitIndex = listConcessioniSize; } else { startIndex = start; limitIndex =
|
||||||
|
* start + limit; if (limitIndex > listConcessioniSize) { limitIndex =
|
||||||
|
* listConcessioniSize; } }
|
||||||
|
*
|
||||||
|
* ResultSetPaginatedData searchedData = new ResultSetPaginatedData(start,
|
||||||
|
* limit, startIndex, false); searchedData.setTotalItems(listConcessioniSize);
|
||||||
|
*
|
||||||
|
* if (filter == null) { // unsorted list of records toReturn =
|
||||||
|
* listOfConcessioni.subList(startIndex, limitIndex); } else {
|
||||||
|
*
|
||||||
|
* RECORD_FIELD orderBy = filter.getOrderByField(); ORDER order =
|
||||||
|
* filter.getOrder();
|
||||||
|
*
|
||||||
|
* if (orderBy == null) orderBy = RECORD_FIELD.NAME;
|
||||||
|
*
|
||||||
|
* if (order == null) order = ORDER.ASC;
|
||||||
|
*
|
||||||
|
* ResultSetSorted resultSetSorted =
|
||||||
|
* SessionUtil.getLatestResultSetSorted(getThreadLocalRequest()); boolean
|
||||||
|
* latestOrderBy =
|
||||||
|
* resultSetSorted.getSearchFilter().getOrderByField().equals(orderBy); boolean
|
||||||
|
* latestOrder = resultSetSorted.getSearchFilter().getOrder().equals(order);
|
||||||
|
*
|
||||||
|
* //Checking if SortFilter is new (different to previous one used). If yes
|
||||||
|
* sorting again if(resultSetSorted==null || !latestOrderBy || !latestOrder) {
|
||||||
|
*
|
||||||
|
* // CASE INSENSITIVE COMPARATOR Comparator<Concessione> comparator = null;
|
||||||
|
* switch (orderBy) { case NAME: if (order.equals(ORDER.ASC)) { comparator =
|
||||||
|
* Comparator.comparing(Concessione::getNome,
|
||||||
|
* Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER)); } else { comparator =
|
||||||
|
* Comparator .comparing(Concessione::getNome,
|
||||||
|
* Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER)) .reversed(); }
|
||||||
|
*
|
||||||
|
* break; case CREATED: if (order.equals(ORDER.ASC)) { comparator =
|
||||||
|
* Comparator.comparing(Concessione::getCreationTime,
|
||||||
|
* Comparator.nullsLast(Comparator.naturalOrder())); } else { comparator =
|
||||||
|
* Comparator.comparing(Concessione::getCreationTime,
|
||||||
|
* Comparator.nullsLast(Comparator.naturalOrder())).reversed(); } break;
|
||||||
|
*
|
||||||
|
* case CREATED_BY: if (order.equals(ORDER.ASC)) { comparator =
|
||||||
|
* Comparator.comparing(Concessione::getCreationUser,
|
||||||
|
* Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER)); } else { comparator =
|
||||||
|
* Comparator.comparing(Concessione::getCreationUser,
|
||||||
|
* Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER)).reversed(); } break;
|
||||||
|
*
|
||||||
|
* case PROJECT_START: if (order.equals(ORDER.ASC)) { comparator =
|
||||||
|
* Comparator.comparing(Concessione::getDataInizioProgetto,
|
||||||
|
* Comparator.nullsLast(Comparator.naturalOrder())); } else { comparator =
|
||||||
|
* Comparator.comparing(Concessione::getDataInizioProgetto,
|
||||||
|
* Comparator.nullsLast(Comparator.naturalOrder())).reversed(); } break;
|
||||||
|
*
|
||||||
|
* default: break; }
|
||||||
|
*
|
||||||
|
* // sorting with nullsLast
|
||||||
|
* listOfConcessioni.sort(Comparator.nullsLast(comparator));
|
||||||
|
* Log.debug("sorted list: " + listOfConcessioni); //saving in session the
|
||||||
|
* ResultSetSorted with SortFilter and ordered data ResultSetSorted rsSorted =
|
||||||
|
* new ResultSetSorted(new SortFilter(orderBy, order), listOfConcessioni);
|
||||||
|
* SessionUtil.setLatestResultSetSorted(getThreadLocalRequest(),rsSorted);
|
||||||
|
*
|
||||||
|
* }else { //Using the ResultSet sorted at previous request listOfConcessioni =
|
||||||
|
* resultSetSorted.getData(); }
|
||||||
|
*
|
||||||
|
* // pagination toReturn = listOfConcessioni.subList(startIndex, limitIndex); }
|
||||||
|
*
|
||||||
|
* List<ConcessioneDV> toReturnList = new
|
||||||
|
* ArrayList<ConcessioneDV>(toReturn.size());
|
||||||
|
*
|
||||||
|
* for (Concessione concessione : toReturn) { ConcessioneDV concessioneDV =
|
||||||
|
* ConvertToDataViewModel.toBaseConcessione(concessione);
|
||||||
|
* toReturnList.add(concessioneDV); }
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* searchedData.setData(toReturnList);
|
||||||
|
*
|
||||||
|
* if (listConcessioniSize == limit || listConcessioniSize == 0) {
|
||||||
|
* LOG.debug("Page completed returning " + listConcessioniSize + " items"); int
|
||||||
|
* newOffset = startIndex + start;
|
||||||
|
* searchedData.setServerSearchFinished(newOffset > listConcessioniSize ||
|
||||||
|
* listConcessioniSize == 0); LOG.debug("is Search finished: " +
|
||||||
|
* searchedData.isServerSearchFinished()); return searchedData; }
|
||||||
|
*
|
||||||
|
* LOG.debug("Returning: " + toReturnList);
|
||||||
|
* LOG.info("Returning list of concessioni with size: " + toReturnList.size());
|
||||||
|
* return searchedData; } catch (Exception e) {
|
||||||
|
* LOG.error("Error on loading list of concessioni: ", e); throw new
|
||||||
|
* Exception("Error occurred on loading list of Concessioni. Error: " +
|
||||||
|
* e.getMessage()); }
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list concessioni.
|
* Gets the list concessioni.
|
||||||
*
|
*
|
||||||
* @param start the start
|
* @param start the start
|
||||||
* @param limit the limit
|
* @param limit the limit
|
||||||
* @param reloadFromService if true, ignore the concessioni saved in session and
|
* @param filter the filter
|
||||||
* reload them from service
|
* @param reloadFromService the reload from service
|
||||||
* @return the list concessioni
|
* @return the list concessioni
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SearchedData getListConcessioni(Integer start, Integer limit, boolean reloadFromService) throws Exception {
|
public ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SortFilter filter,
|
||||||
LOG.info("getListConcessioni called wit start: " + start + ", limit: " + limit);
|
boolean reloadFromService) throws Exception {
|
||||||
|
LOG.info("getListConcessioni called wit start: " + start + ", limit: " + limit + ", filter: " + filter);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<Concessione> listOfConcessioni = SessionUtil.getListOfConcessioni(getThreadLocalRequest(),
|
List<Concessione> listOfConcessioni = SessionUtil.getListOfConcessioni(getThreadLocalRequest(),
|
||||||
|
@ -428,7 +538,6 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
int startIndex;
|
int startIndex;
|
||||||
int limitIndex = 0;
|
int limitIndex = 0;
|
||||||
if (start == null && limit == null) {
|
if (start == null && limit == null) {
|
||||||
toReturn.addAll(listOfConcessioni);
|
|
||||||
startIndex = 0;
|
startIndex = 0;
|
||||||
limitIndex = listConcessioniSize;
|
limitIndex = listConcessioniSize;
|
||||||
} else {
|
} else {
|
||||||
|
@ -439,10 +548,78 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchedData searchedData = new SearchedData(start, limit, startIndex, false);
|
ResultSetPaginatedData searchedData = new ResultSetPaginatedData(start, limit, startIndex, false);
|
||||||
searchedData.setTotalItems(listConcessioniSize);
|
searchedData.setTotalItems(listConcessioniSize);
|
||||||
|
|
||||||
toReturn = listOfConcessioni.subList(startIndex, limitIndex);
|
if (filter == null) {
|
||||||
|
// unsorted list of records
|
||||||
|
toReturn = listOfConcessioni.subList(startIndex, limitIndex);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
RECORD_FIELD orderBy = filter.getOrderByField();
|
||||||
|
ORDER order = filter.getOrder();
|
||||||
|
|
||||||
|
if (orderBy == null)
|
||||||
|
orderBy = RECORD_FIELD.NAME;
|
||||||
|
|
||||||
|
if (order == null)
|
||||||
|
order = ORDER.ASC;
|
||||||
|
|
||||||
|
// CASE INSENSITIVE COMPARATOR
|
||||||
|
Comparator<Concessione> comparator = null;
|
||||||
|
switch (orderBy) {
|
||||||
|
case NAME:
|
||||||
|
if (order.equals(ORDER.ASC)) {
|
||||||
|
comparator = Comparator.comparing(Concessione::getNome,
|
||||||
|
Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER));
|
||||||
|
} else {
|
||||||
|
comparator = Comparator
|
||||||
|
.comparing(Concessione::getNome, Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER))
|
||||||
|
.reversed();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case CREATED:
|
||||||
|
if (order.equals(ORDER.ASC)) {
|
||||||
|
comparator = Comparator.comparing(Concessione::getCreationTime,
|
||||||
|
Comparator.nullsLast(Comparator.naturalOrder()));
|
||||||
|
} else {
|
||||||
|
comparator = Comparator.comparing(Concessione::getCreationTime,
|
||||||
|
Comparator.nullsLast(Comparator.naturalOrder())).reversed();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CREATED_BY:
|
||||||
|
if (order.equals(ORDER.ASC)) {
|
||||||
|
comparator = Comparator.comparing(Concessione::getCreationUser,
|
||||||
|
Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER));
|
||||||
|
} else {
|
||||||
|
comparator = Comparator.comparing(Concessione::getCreationUser,
|
||||||
|
Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER)).reversed();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROJECT_START:
|
||||||
|
if (order.equals(ORDER.ASC)) {
|
||||||
|
comparator = Comparator.comparing(Concessione::getDataInizioProgetto,
|
||||||
|
Comparator.nullsLast(Comparator.naturalOrder()));
|
||||||
|
} else {
|
||||||
|
comparator = Comparator.comparing(Concessione::getDataInizioProgetto,
|
||||||
|
Comparator.nullsLast(Comparator.naturalOrder())).reversed();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// sorting with nullsLast
|
||||||
|
listOfConcessioni.sort(Comparator.nullsLast(comparator));
|
||||||
|
Log.debug("sorted list: " + listOfConcessioni);
|
||||||
|
|
||||||
|
// pagination
|
||||||
|
toReturn = listOfConcessioni.subList(startIndex, limitIndex);
|
||||||
|
}
|
||||||
|
|
||||||
List<ConcessioneDV> toReturnList = new ArrayList<ConcessioneDV>(toReturn.size());
|
List<ConcessioneDV> toReturnList = new ArrayList<ConcessioneDV>(toReturn.size());
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetSorted;
|
||||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||||
|
@ -154,17 +155,16 @@ public class SessionUtil {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG.debug("Got list of concessioni from client mongo: " + listOfConcessioni);
|
// LOG.debug("Got list of concessioni from client mongo: " + listOfConcessioni);
|
||||||
session.setAttribute(LIST_OF_CONCESSIONI, listOfConcessioni);
|
session.setAttribute(LIST_OF_CONCESSIONI, listOfConcessioni);
|
||||||
LOG.info("Saved in session list of concessioni from client mongo with size: " + listOfConcessioni.size());
|
LOG.info("Saved in session list of concessioni from client mongo with size: " + listOfConcessioni.size());
|
||||||
} else
|
} else
|
||||||
LOG.info("list of concessioni presents in session");
|
LOG.info("list of concessioni presents in session, using it");
|
||||||
|
|
||||||
LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
||||||
return listOfConcessioni;
|
return listOfConcessioni;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the geportal viewer resource profile.
|
* Gets the geportal viewer resource profile.
|
||||||
*
|
*
|
||||||
|
@ -183,8 +183,31 @@ public class SessionUtil {
|
||||||
geoNaDataViewerProfile = gc.getGeoNaDataViewProfile(null);
|
geoNaDataViewerProfile = gc.getGeoNaDataViewProfile(null);
|
||||||
session.setAttribute(GEONA_DATAVIEWER_PROFILE, geoNaDataViewerProfile);
|
session.setAttribute(GEONA_DATAVIEWER_PROFILE, geoNaDataViewerProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return geoNaDataViewerProfile;
|
return geoNaDataViewerProfile;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the latest result set sorted.
|
||||||
|
*
|
||||||
|
* @param httpServletRequest the http servlet request
|
||||||
|
* @return the latest result set sorted
|
||||||
|
*/
|
||||||
|
public static ResultSetSorted getLatestResultSetSorted(HttpServletRequest httpServletRequest) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
return (ResultSetSorted) session.getAttribute("LATEST_RESULT_SET_SORTED");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the latest sort filter.
|
||||||
|
*
|
||||||
|
* @param httpServletRequest the http servlet request
|
||||||
|
* @return the latest sort filter
|
||||||
|
*/
|
||||||
|
public static void setLatestResultSetSorted(HttpServletRequest httpServletRequest, ResultSetSorted rsSorted) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
session.setAttribute("LATEST_RESULT_SET_SORTED", rsSorted);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SearchedFolder.
|
* The Class ResultSetPaginatedData.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Jun 16, 2021
|
* Aug 6, 2021
|
||||||
*/
|
*/
|
||||||
public class SearchedData implements Serializable {
|
public class ResultSetPaginatedData implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -32,18 +32,19 @@ public class SearchedData implements Serializable {
|
||||||
/**
|
/**
|
||||||
* Instantiates a new searched folder.
|
* Instantiates a new searched folder.
|
||||||
*/
|
*/
|
||||||
public SearchedData() {
|
public ResultSetPaginatedData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new searched data.
|
* Instantiates a new result set paginated data.
|
||||||
*
|
*
|
||||||
* @param clientStartIndex the client start index
|
* @param clientStartIndex the client start index
|
||||||
* @param limit the limit
|
* @param limit the limit
|
||||||
* @param serverEndIndex the server end index
|
* @param serverEndIndex the server end index
|
||||||
* @param isServerSearchFinished the is server search finished
|
* @param isServerSearchFinished the is server search finished
|
||||||
*/
|
*/
|
||||||
public SearchedData(int clientStartIndex, int limit, int serverEndIndex, boolean isServerSearchFinished) {
|
public ResultSetPaginatedData(int clientStartIndex, int limit, int serverEndIndex, boolean isServerSearchFinished) {
|
||||||
|
|
||||||
this.clientStartIndex = clientStartIndex;
|
this.clientStartIndex = clientStartIndex;
|
||||||
this.limit = limit;
|
this.limit = limit;
|
||||||
|
@ -159,10 +160,15 @@ public class SearchedData implements Serializable {
|
||||||
this.totalItems = totalItems;
|
this.totalItems = totalItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("SearchedData [data=");
|
builder.append("ResultSetPaginatedData [data=");
|
||||||
builder.append(data);
|
builder.append(data);
|
||||||
builder.append(", clientStartIndex=");
|
builder.append(", clientStartIndex=");
|
||||||
builder.append(clientStartIndex);
|
builder.append(clientStartIndex);
|
|
@ -0,0 +1,56 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
|
||||||
|
public class ResultSetSorted implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 889420364685643758L;
|
||||||
|
|
||||||
|
private SortFilter searchFilter;
|
||||||
|
|
||||||
|
private List<Concessione> data;
|
||||||
|
|
||||||
|
ResultSetSorted() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultSetSorted(SortFilter searchFilter, List<Concessione> data) {
|
||||||
|
super();
|
||||||
|
this.searchFilter = searchFilter;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SortFilter getSearchFilter() {
|
||||||
|
return searchFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Concessione> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearchFilter(SortFilter searchFilter) {
|
||||||
|
this.searchFilter = searchFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<Concessione> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("ResultSetSorted [searchFilter=");
|
||||||
|
builder.append(searchFilter);
|
||||||
|
builder.append(", data=");
|
||||||
|
builder.append(data);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ORDER;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class SortFilter.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Aug 6, 2021
|
||||||
|
*/
|
||||||
|
public class SortFilter implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -4004094263090373626L;
|
||||||
|
|
||||||
|
private RECORD_FIELD orderByField;
|
||||||
|
|
||||||
|
private ORDER order;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new sort filter.
|
||||||
|
*/
|
||||||
|
public SortFilter() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new sort filter.
|
||||||
|
*
|
||||||
|
* @param orderByField the order by field
|
||||||
|
* @param order the order
|
||||||
|
*/
|
||||||
|
public SortFilter(RECORD_FIELD orderByField, ORDER order) {
|
||||||
|
this.orderByField = orderByField;
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the order by field.
|
||||||
|
*
|
||||||
|
* @return the order by field
|
||||||
|
*/
|
||||||
|
public RECORD_FIELD getOrderByField() {
|
||||||
|
return orderByField;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the order.
|
||||||
|
*
|
||||||
|
* @return the order
|
||||||
|
*/
|
||||||
|
public ORDER getOrder() {
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the order by field.
|
||||||
|
*
|
||||||
|
* @param orderByField the new order by field
|
||||||
|
*/
|
||||||
|
public void setOrderByField(RECORD_FIELD orderByField) {
|
||||||
|
this.orderByField = orderByField;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the order.
|
||||||
|
*
|
||||||
|
* @param order the new order
|
||||||
|
*/
|
||||||
|
public void setOrder(ORDER order) {
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("SortFilter [orderByField=");
|
||||||
|
builder.append(orderByField);
|
||||||
|
builder.append(", order=");
|
||||||
|
builder.append(order);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue