Migrated the Sort facility
This commit is contained in:
parent
ca4e0bf2d0
commit
5d9ab67261
|
@ -4,8 +4,12 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ConstantsGeoPortalDataEntryApp.
|
* The Class ConstantsGeoPortalDataEntryApp.
|
||||||
*
|
*
|
||||||
|
@ -21,6 +25,8 @@ public class ConstantsGeoPortalDataEntryApp {
|
||||||
|
|
||||||
public static final String HOURS_MINUTES_SEPARATOR = ConstantsMPFormBuilder.HOURS_MINUTES_SEPARATOR;
|
public static final String HOURS_MINUTES_SEPARATOR = ConstantsMPFormBuilder.HOURS_MINUTES_SEPARATOR;
|
||||||
|
|
||||||
|
public static final int MAX_COLUMN_DISPLAYED_IN_THE_TABLE = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum RECORD_TYPE.
|
* The Enum RECORD_TYPE.
|
||||||
*
|
*
|
||||||
|
@ -45,4 +51,16 @@ public class ConstantsGeoPortalDataEntryApp {
|
||||||
|
|
||||||
public static final List<String> HANDLERS_IDS = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_list.getId(),
|
public static final List<String> HANDLERS_IDS = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_list.getId(),
|
||||||
GEOPORTAL_DATA_HANDLER.geoportal_data_entry.getId());
|
GEOPORTAL_DATA_HANDLER.geoportal_data_entry.getId());
|
||||||
|
|
||||||
|
public static void printUCDs(List<UseCaseDescriptorDV> listUCDescriptors) {
|
||||||
|
GWT.log("print - UCDs");
|
||||||
|
for (UseCaseDescriptorDV useCaseDescriptorDV : listUCDescriptors) {
|
||||||
|
GWT.log("print UCD name: " + useCaseDescriptorDV.getName() + ", profileID: "
|
||||||
|
+ useCaseDescriptorDV.getProfileID());
|
||||||
|
for (HandlerDeclarationDV handler : useCaseDescriptorDV.getHandlers()) {
|
||||||
|
GWT.log("\t print handler getDataHandlerType: " + handler.getDataHandlerType() + ", type: "
|
||||||
|
+ handler.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,194 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class GeoPortalClientCaches.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Aug 11, 2022
|
||||||
|
*/
|
||||||
|
public class GeoPortalClientCaches {
|
||||||
|
|
||||||
|
private TreeMap<String, List<GeoNaFormCardModel>> mapGcubeProfilePerItemType;
|
||||||
|
|
||||||
|
private Map<String, List<ConfigurationDV<?>>> mapHandlersConfigurationsForProfileId;
|
||||||
|
|
||||||
|
private Map<String, CacheSearchingFilterParametersFromConfig> mapSearchingFitlerParametersorForProfileId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new geo portal client caches.
|
||||||
|
*/
|
||||||
|
public GeoPortalClientCaches() {
|
||||||
|
mapGcubeProfilePerItemType = new TreeMap<String, List<GeoNaFormCardModel>>();
|
||||||
|
mapHandlersConfigurationsForProfileId = new HashMap<String, List<ConfigurationDV<?>>>();
|
||||||
|
mapSearchingFitlerParametersorForProfileId = new HashMap<String, GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put handler configurations for profile id.
|
||||||
|
*
|
||||||
|
* @param profileId the profile id
|
||||||
|
* @param lsitConfigurations the lsit configurations
|
||||||
|
*/
|
||||||
|
public void putHandlerConfigurationsForProfileId(String profileId, List<ConfigurationDV<?>> lsitConfigurations) {
|
||||||
|
mapHandlersConfigurationsForProfileId.put(profileId, lsitConfigurations);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the handler configurations for profile id.
|
||||||
|
*
|
||||||
|
* @param profileId the profile id
|
||||||
|
* @return the handler configurations for profile id
|
||||||
|
*/
|
||||||
|
public List<ConfigurationDV<?>> getHandlerConfigurationsForProfileId(String profileId) {
|
||||||
|
return mapHandlersConfigurationsForProfileId.get(profileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put gcube profile per item type.
|
||||||
|
*
|
||||||
|
* @param itemType the item type
|
||||||
|
* @param listGcubeProfiles the list gcube profiles
|
||||||
|
*/
|
||||||
|
public void putGcubeProfilePerItemType(String itemType, List<GeoNaFormCardModel> listGcubeProfiles) {
|
||||||
|
mapGcubeProfilePerItemType.put(itemType, listGcubeProfiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the gcube profile per item type.
|
||||||
|
*
|
||||||
|
* @param itemType the item type
|
||||||
|
* @return the gcube profile per item type
|
||||||
|
*/
|
||||||
|
public List<GeoNaFormCardModel> getGcubeProfilePerItemType(String itemType) {
|
||||||
|
return mapGcubeProfilePerItemType.get(itemType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CacheSearchingFilterParametersFromConfig getFilterParametersForProfileId(String profileID) {
|
||||||
|
GWT.log("getFilterParametersForProfileId for: " + profileID);
|
||||||
|
|
||||||
|
CacheSearchingFilterParametersFromConfig searchingFilterParameters = mapSearchingFitlerParametersorForProfileId
|
||||||
|
.get(profileID);
|
||||||
|
|
||||||
|
if (searchingFilterParameters == null) {
|
||||||
|
|
||||||
|
searchingFilterParameters = new CacheSearchingFilterParametersFromConfig();
|
||||||
|
|
||||||
|
List<ConfigurationDV<?>> config = mapHandlersConfigurationsForProfileId.get(profileID);
|
||||||
|
|
||||||
|
GWT.log("For profileID " + profileID + ", read config for : " + config);
|
||||||
|
|
||||||
|
for (ConfigurationDV<?> configurationDV : config) {
|
||||||
|
switch (configurationDV.getConfigurationType()) {
|
||||||
|
case item_fields: {
|
||||||
|
List<ItemFieldDV> listItemFields = (List<ItemFieldDV>) configurationDV.getConfiguration();
|
||||||
|
for (ItemFieldDV itemField : listItemFields) {
|
||||||
|
if (itemField.isDisplayAsResult()) {
|
||||||
|
searchingFilterParameters.addDisplayField(itemField);
|
||||||
|
// adding to projection for filtering
|
||||||
|
for (String jsonField : itemField.getJsonFields()) {
|
||||||
|
searchingFilterParameters.putMongoProjection("_theDocument." + jsonField, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemField.isSearchable()) {
|
||||||
|
searchingFilterParameters.addSearchByField(itemField);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemField.isSortable()) {
|
||||||
|
searchingFilterParameters.addOrderByField(itemField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case gcube_profiles:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mapSearchingFitlerParametersorForProfileId.put(profileID, searchingFilterParameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
return searchingFilterParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DEBUGGING
|
||||||
|
public void printCacheHandlerConfigurations() {
|
||||||
|
GWT.log("print - mapHandlersConfigurationsForProfileId is:");
|
||||||
|
for (String key : mapHandlersConfigurationsForProfileId.keySet()) {
|
||||||
|
GWT.log("print - key: " + key + ", value: " + mapHandlersConfigurationsForProfileId.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DEBUGGING
|
||||||
|
public void printCacheGcubeProfilePerItemType() {
|
||||||
|
GWT.log("print - mapGcubeProfilePerItemType is:");
|
||||||
|
for (String key : mapGcubeProfilePerItemType.keySet()) {
|
||||||
|
GWT.log("print - key: " + key + ", value: " + mapGcubeProfilePerItemType.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CacheSearchingFilterParametersFromConfig {
|
||||||
|
|
||||||
|
List<ItemFieldDV> displayFields;
|
||||||
|
List<ItemFieldDV> searchByFields;
|
||||||
|
List<ItemFieldDV> orderByFields;
|
||||||
|
|
||||||
|
// The projection
|
||||||
|
LinkedHashMap<String, Object> projection;
|
||||||
|
|
||||||
|
public CacheSearchingFilterParametersFromConfig() {
|
||||||
|
displayFields = new ArrayList<ItemFieldDV>();
|
||||||
|
searchByFields = new ArrayList<ItemFieldDV>();
|
||||||
|
orderByFields = new ArrayList<ItemFieldDV>();
|
||||||
|
projection = new LinkedHashMap<String, Object>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void putMongoProjection(String keyField, Object value) {
|
||||||
|
projection.put(keyField, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDisplayField(ItemFieldDV itemField) {
|
||||||
|
displayFields.add(itemField);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addSearchByField(ItemFieldDV itemField) {
|
||||||
|
searchByFields.add(itemField);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOrderByField(ItemFieldDV itemField) {
|
||||||
|
orderByFields.add(itemField);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemFieldDV> getDisplayFields() {
|
||||||
|
return displayFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemFieldDV> getSearchByFields() {
|
||||||
|
return searchByFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemFieldDV> getOrderByFields() {
|
||||||
|
return orderByFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinkedHashMap<String, Object> getProjection() {
|
||||||
|
return projection;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,22 +3,18 @@ package org.gcube.portlets.user.geoportaldataentry.client;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.config.ACTION_ON_ITEM;
|
import org.gcube.application.geoportalcommon.shared.config.ACTION_ON_ITEM;
|
||||||
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
|
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
|
||||||
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
||||||
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
|
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
|
||||||
|
@ -26,6 +22,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclara
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
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_PERFORMED_ON_ITEM;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig;
|
||||||
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;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEvent;
|
||||||
|
@ -120,14 +117,12 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
private UserRights myRights = null;
|
private UserRights myRights = null;
|
||||||
|
|
||||||
private LoaderIcon loader = new LoaderIcon("Loading Application... please wait");
|
private LoaderIcon loaderApplication = new LoaderIcon("Loading Application... please wait");
|
||||||
|
|
||||||
|
private LoaderIcon loaderConfigurations = new LoaderIcon("Loading Configurations... please wait");
|
||||||
|
|
||||||
private GeonaISConfig geonaISConfig;
|
private GeonaISConfig geonaISConfig;
|
||||||
|
|
||||||
private TreeMap<String, List<GeoNaFormCardModel>> mapGcubeProfilePerItemType = new TreeMap<String, List<GeoNaFormCardModel>>();
|
|
||||||
|
|
||||||
private Map<String, List<ConfigurationDV<?>>> mapHandlersForProfileId = new HashMap<String, List<ConfigurationDV<?>>>();
|
|
||||||
|
|
||||||
private int numberOfCards = 0;
|
private int numberOfCards = 0;
|
||||||
|
|
||||||
private int expectedCards = 0;
|
private int expectedCards = 0;
|
||||||
|
@ -140,12 +135,14 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
return numberOfCards;
|
return numberOfCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<UseCaseDescriptorDV> listUCDescriptors;
|
// private List<UseCaseDescriptorDV> listUCDescriptors;
|
||||||
|
|
||||||
private boolean dataEntryProjectCreated = false;
|
private boolean dataEntryProjectCreated = false;
|
||||||
|
|
||||||
private TreeItemPanel treeItemPanel;
|
private TreeItemPanel treeItemPanel;
|
||||||
|
|
||||||
|
private GeoPortalClientCaches geoportalCaches;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
*/
|
*/
|
||||||
|
@ -172,8 +169,15 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
* TreeItemPanel tip = new TreeItemPanel("Concessione", gnaCardsModels);
|
* TreeItemPanel tip = new TreeItemPanel("Concessione", gnaCardsModels);
|
||||||
* RootPanel.get(GeoPortalDataEntryApp.DIV_PORTLET_ID).add(tip.getTree());
|
* RootPanel.get(GeoPortalDataEntryApp.DIV_PORTLET_ID).add(tip.getTree());
|
||||||
*/
|
*/
|
||||||
|
geoportalCaches = new GeoPortalClientCaches();
|
||||||
|
|
||||||
RootPanel.get(DIV_PORTLET_ID).add(loader);
|
RootPanel.get(DIV_PORTLET_ID).add(loaderApplication);
|
||||||
|
|
||||||
|
mainTabPanel = new GeonaMainTabPanel(appManagerBus);
|
||||||
|
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
||||||
|
mainTabPanel.addFormPanel(geoNaMainForm);
|
||||||
|
|
||||||
|
RootPanel.get(DIV_PORTLET_ID).add(mainTabPanel);
|
||||||
|
|
||||||
GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
|
GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
|
||||||
|
|
||||||
|
@ -183,7 +187,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
||||||
alert.setClose(false);
|
alert.setClose(false);
|
||||||
try {
|
try {
|
||||||
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
RootPanel.get(DIV_PORTLET_ID).remove(loaderApplication);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -213,7 +217,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
||||||
alert.setClose(false);
|
alert.setClose(false);
|
||||||
try {
|
try {
|
||||||
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
RootPanel.get(DIV_PORTLET_ID).remove(loaderApplication);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -224,52 +228,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(GNADataEntryExtConfigProfile gNADataEntryConfig) {
|
public void onSuccess(GNADataEntryExtConfigProfile gNADataEntryConfig) {
|
||||||
GWT.log(GNADataEntryExtConfigProfile.class.getSimpleName() + " loaded: "+gNADataEntryConfig);
|
GWT.log(GNADataEntryExtConfigProfile.class.getSimpleName() + " loaded: " + gNADataEntryConfig);
|
||||||
|
|
||||||
try {
|
|
||||||
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// List<ItemFieldDV> itemFields = gNADataEntryConfig.getListItemFields();
|
|
||||||
//
|
|
||||||
// for (ItemFieldDV itemField : itemFields) {
|
|
||||||
// if (itemField.isDisplayAsResult()) {
|
|
||||||
// displayFields.add(itemField);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (itemField.isSearchable()) {
|
|
||||||
// searchByFields.add(itemField);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (itemField.isSortable()) {
|
|
||||||
// sortByFields.add(itemField);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// GWT.log("List display fields: " + itemFields);
|
|
||||||
// SearchingFilter initialSortFilter = new SearchingFilter();
|
|
||||||
// initialSortFilter.setOrder(ORDER.ASC);
|
|
||||||
// initialSortFilter.setOrderByFields(
|
|
||||||
// Arrays.asList(new ItemFieldDV("Name", Arrays.asList("name"), null, true, true, true)));
|
|
||||||
//
|
|
||||||
// displayFields = itemFields;
|
|
||||||
// mainTabPanel = new GeonaMainTabPanel(appManagerBus);
|
|
||||||
//
|
|
||||||
// mainTabPanel.setFilteringParameters(displayFields, sortByFields, searchByFields, initialSortFilter);
|
|
||||||
//
|
|
||||||
// // TWICE BECAUSE THE MAIN PANEL COULD BE NULL BEFORE
|
|
||||||
// setListUseCaseDescriptors(listUCDescriptors);
|
|
||||||
|
|
||||||
SearchingFilter initialSortFilter = new SearchingFilter();
|
|
||||||
List<ItemFieldDV> defaultItemField = Arrays
|
|
||||||
.asList(new ItemFieldDV("Name", Arrays.asList("name"), null, true, true, true));
|
|
||||||
initialSortFilter.setOrder(ORDER.ASC);
|
|
||||||
initialSortFilter.setOrderByFields(defaultItemField);
|
|
||||||
mainTabPanel = new GeonaMainTabPanel(appManagerBus, defaultItemField, initialSortFilter);
|
|
||||||
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
|
||||||
mainTabPanel.addFormPanel(geoNaMainForm);
|
|
||||||
|
|
||||||
// PERMISSIONS
|
// PERMISSIONS
|
||||||
myRights = gNADataEntryConfig.getUserRights();
|
myRights = gNADataEntryConfig.getUserRights();
|
||||||
|
@ -293,17 +252,22 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
mainTabPanel.removeTab(0);
|
mainTabPanel.removeTab(0);
|
||||||
// activating Tab "List of Project"
|
// activating Tab "List of Project"
|
||||||
mainTabPanel.setTabActive(0);
|
mainTabPanel.setTabActive(0);
|
||||||
mainTabPanel.instanceAndShowListOfConcessioni();
|
mainTabPanel.instanceAndShowListOfProjects();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
RootPanel.get(DIV_PORTLET_ID).remove(loaderApplication);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initGUI() {
|
private void initGUI() {
|
||||||
bindEvents();
|
bindEvents();
|
||||||
RootPanel.get(DIV_PORTLET_ID).add(mainTabPanel);
|
|
||||||
Window.addResizeHandler(new ResizeHandler() {
|
Window.addResizeHandler(new ResizeHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onResize(ResizeEvent event) {
|
public void onResize(ResizeEvent event) {
|
||||||
|
@ -322,88 +286,69 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
private void loadGeoportalConfigs(final String scope) {
|
private void loadGeoportalConfigs(final String scope) {
|
||||||
GWT.log("loading GeoportalConfigsAndBuildCards in the scope: " + scope);
|
GWT.log("loading GeoportalConfigsAndBuildCards in the scope: " + scope);
|
||||||
// orderedCards = new ArrayList<GeoNaFormCardModel>();
|
// orderedCards = new ArrayList<GeoNaFormCardModel>();
|
||||||
|
try {
|
||||||
|
RootPanel.get(DIV_PORTLET_ID).insert(loaderConfigurations, 0);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
GeoportalDataEntryServiceAsync.Util.getInstance().getListUseCaseDescriptors(
|
GeoportalDataEntryServiceAsync.Util.getInstance().getListUseCaseDescriptors(
|
||||||
ConstantsGeoPortalDataEntryApp.HANDLERS_IDS, new AsyncCallback<List<UseCaseDescriptorDV>>() {
|
ConstantsGeoPortalDataEntryApp.HANDLERS_IDS, new AsyncCallback<List<UseCaseDescriptorDV>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
try {
|
||||||
|
RootPanel.get(DIV_PORTLET_ID).remove(loaderConfigurations);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
GWT.log("caught: " + caught);
|
GWT.log("caught: " + caught);
|
||||||
Window.alert(caught.toString());
|
Window.alert(caught.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<UseCaseDescriptorDV> result) {
|
public void onSuccess(List<UseCaseDescriptorDV> result) {
|
||||||
GWT.log("UseCaseDescriptorDV loaded: "+result);
|
GWT.log("ListUseCaseDescriptors loaded: " + result);
|
||||||
listUCDescriptors = result;
|
|
||||||
GWT.log("List<UseCaseDescriptorDV>: " + listUCDescriptors);
|
|
||||||
listUCDescriptors = result;
|
|
||||||
GWT.log("List<DocumentConfigDV>: " + result);
|
|
||||||
|
|
||||||
if (result == null || result.size() == 0) {
|
if (result == null || result.size() == 0) {
|
||||||
Window.alert("No Configuration found in this scope. Please contact the support");
|
Window.alert("No Configuration found in this scope. Please contact the support");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setListUseCaseDescriptors(listUCDescriptors);
|
initDataEntryAppForListUseCaseDescriptors(result);
|
||||||
|
try {
|
||||||
|
RootPanel.get(DIV_PORTLET_ID).remove(loaderConfigurations);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void setListUseCaseDescriptors(List<UseCaseDescriptorDV> listUCDescriptors) {
|
private void initDataEntryAppForListUseCaseDescriptors(List<UseCaseDescriptorDV> listUCDescriptors) {
|
||||||
GWT.log("Setting listUCDescriptors: " + listUCDescriptors);
|
GWT.log("initDataEntryAppForListUseCaseDescriptors with size: " + listUCDescriptors.size());
|
||||||
if (listUCDescriptors != null) {
|
ConstantsGeoPortalDataEntryApp.printUCDs(listUCDescriptors);
|
||||||
|
|
||||||
if (mainTabPanel != null) {
|
mainTabPanel.initMainAccordingToListUseCaseDescriptors(listUCDescriptors);
|
||||||
// Just to be sure that its set once
|
|
||||||
if (mainTabPanel.getListUCDescriptors() == null) {
|
|
||||||
mainTabPanel.setListUseCaseDescriptors(listUCDescriptors);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (UseCaseDescriptorDV useCaseDescriptorDV : listUCDescriptors) {
|
for (UseCaseDescriptorDV ucdDV : listUCDescriptors) {
|
||||||
|
|
||||||
List<ConfigurationDV<?>> listConfigurations = mapHandlersForProfileId
|
List<ConfigurationDV<?>> listConfigurations = geoportalCaches
|
||||||
.get(useCaseDescriptorDV.getProfileID());
|
.getHandlerConfigurationsForProfileId(ucdDV.getProfileID());
|
||||||
if (listConfigurations == null) {
|
|
||||||
listConfigurations = new ArrayList<ConfigurationDV<?>>();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (HandlerDeclarationDV handler : useCaseDescriptorDV.getHandlers()) {
|
|
||||||
ConfigurationDV<?> config = handler.getConfiguration();
|
|
||||||
listConfigurations.add(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
mapHandlersForProfileId.put(useCaseDescriptorDV.getProfileID(), listConfigurations);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for (ItemFieldDV itemField : itemFields) {
|
|
||||||
// if (itemField.isDisplayAsResult()) {
|
|
||||||
// displayFields.add(itemField);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (itemField.isSearchable()) {
|
|
||||||
// searchByFields.add(itemField);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (itemField.isSortable()) {
|
|
||||||
// sortByFields.add(itemField);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// GWT.log("List display fields: " + itemFields);
|
|
||||||
// SearchingFilter initialSortFilter = new SearchingFilter();
|
|
||||||
// initialSortFilter.setOrder(ORDER.ASC);
|
|
||||||
// initialSortFilter.setOrderByFields(
|
|
||||||
// Arrays.asList(new ItemFieldDV("Name", Arrays.asList("name"), null, true, true, true)));
|
|
||||||
//
|
|
||||||
// displayFields = itemFields;
|
|
||||||
// mainTabPanel = new GeonaMainTabPanel(appManagerBus);
|
|
||||||
//
|
|
||||||
// mainTabPanel.setFilteringParameters(displayFields, sortByFields, searchByFields, initialSortFilter);
|
|
||||||
|
|
||||||
|
if (listConfigurations == null) {
|
||||||
|
listConfigurations = new ArrayList<ConfigurationDV<?>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (HandlerDeclarationDV handler : ucdDV.getHandlers()) {
|
||||||
|
ConfigurationDV<?> config = handler.getConfiguration();
|
||||||
|
listConfigurations.add(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
geoportalCaches.putHandlerConfigurationsForProfileId(ucdDV.getProfileID(), listConfigurations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
geoportalCaches.printCacheHandlerConfigurations();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -437,7 +382,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
// orderedCards.clear();
|
// orderedCards.clear();
|
||||||
resetUI();
|
resetUI();
|
||||||
|
|
||||||
List<GeoNaFormCardModel> cardsPerIT = mapGcubeProfilePerItemType.get(handlerDeclarationDV.getItemType());
|
List<GeoNaFormCardModel> cardsPerIT = geoportalCaches
|
||||||
|
.getGcubeProfilePerItemType(handlerDeclarationDV.getItemType());
|
||||||
mainTabPanel.setPageHeader(handlerDeclarationDV);
|
mainTabPanel.setPageHeader(handlerDeclarationDV);
|
||||||
|
|
||||||
if (cardsPerIT != null) {
|
if (cardsPerIT != null) {
|
||||||
|
@ -484,7 +430,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
// ordered values
|
// ordered values
|
||||||
Collection<GeoNaFormCardModel> gnaCardsModels = treemapOrderedGNAProfiles.values();
|
Collection<GeoNaFormCardModel> gnaCardsModels = treemapOrderedGNAProfiles.values();
|
||||||
GWT.log("TreeMap values: " + gnaCardsModels);
|
GWT.log("TreeMap values: " + gnaCardsModels);
|
||||||
mapGcubeProfilePerItemType.put(handlerDeclarationDV.getItemType(),
|
geoportalCaches.putGcubeProfilePerItemType(handlerDeclarationDV.getItemType(),
|
||||||
new ArrayList<GeoNaFormCardModel>(gnaCardsModels));
|
new ArrayList<GeoNaFormCardModel>(gnaCardsModels));
|
||||||
// orderedCards.addAll(new ArrayList<GeoNaFormCardModel>(gnaCardsModels));
|
// orderedCards.addAll(new ArrayList<GeoNaFormCardModel>(gnaCardsModels));
|
||||||
buildNewCards(profileID, handlerDeclarationDV.getItemType(),
|
buildNewCards(profileID, handlerDeclarationDV.getItemType(),
|
||||||
|
@ -872,66 +818,31 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
|
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
|
||||||
|
GWT.log("Fired: " + getListOfRecordsEvent);
|
||||||
SearchingFilter sortFilter = getListOfRecordsEvent.getSortFilter();
|
SearchingFilter searchingFilter = getListOfRecordsEvent.getSearchingFilter();
|
||||||
List<ItemFieldDV> displayFields = mainTabPanel.getDisplayFields();
|
|
||||||
|
CacheSearchingFilterParametersFromConfig seachingFilterParameters = geoportalCaches
|
||||||
if (sortFilter == null) {
|
.getFilterParametersForProfileId(getListOfRecordsEvent.getProfileID());
|
||||||
sortFilter = mainTabPanel.getCurrentSortFilter();
|
|
||||||
|
if (searchingFilter == null || getListOfRecordsEvent.isOnApplicationInit()) {
|
||||||
|
mainTabPanel.setFilteringParameters(seachingFilterParameters);
|
||||||
|
searchingFilter = mainTabPanel.getCurrentSearchingFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO MUST MANAGE getListOfRecordsEvent.isReloadFilteringParameters()
|
||||||
|
|
||||||
|
|
||||||
|
searchingFilter.setProjection(seachingFilterParameters.getProjection());
|
||||||
|
|
||||||
|
List<ItemFieldDV> displayFields = seachingFilterParameters.getDisplayFields();
|
||||||
|
|
||||||
String profileID = getListOfRecordsEvent.getProfileID();
|
String profileID = getListOfRecordsEvent.getProfileID();
|
||||||
if (profileID == null) {
|
if (profileID == null) {
|
||||||
new DialogInform(null, "Error", "No user case descriptor selected").center();
|
new DialogInform(null, "Error", "No user case descriptor selected").center();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resetting filtering parameters (e.g. search for, order by, etc.)
|
grpw = new GeonaRecordsPaginatedView(appManagerBus, profileID, displayFields, searchingFilter);
|
||||||
if (getListOfRecordsEvent.isReloadFilteringParameters()) {
|
|
||||||
|
|
||||||
displayFields = new ArrayList<ItemFieldDV>();
|
|
||||||
List<ItemFieldDV> searchByFields = new ArrayList<ItemFieldDV>();
|
|
||||||
List<ItemFieldDV> sortByFields = new ArrayList<ItemFieldDV>();
|
|
||||||
List<ConfigurationDV<?>> config = mapHandlersForProfileId.get(getListOfRecordsEvent.getProfileID());
|
|
||||||
|
|
||||||
for (ConfigurationDV<?> configurationDV : config) {
|
|
||||||
switch (configurationDV.getConfigurationType()) {
|
|
||||||
case item_fields:
|
|
||||||
List<ItemFieldDV> listItemFields = (List<ItemFieldDV>) configurationDV.getConfiguration();
|
|
||||||
|
|
||||||
// The projection
|
|
||||||
LinkedHashMap<String, Object> projection = new LinkedHashMap<String, Object>();
|
|
||||||
|
|
||||||
for (ItemFieldDV itemField : listItemFields) {
|
|
||||||
if (itemField.isDisplayAsResult()) {
|
|
||||||
displayFields.add(itemField);
|
|
||||||
// adding to projection for filtering
|
|
||||||
for (String jsonField : itemField.getJsonFields()) {
|
|
||||||
projection.put("_theDocument." + jsonField, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemField.isSearchable()) {
|
|
||||||
searchByFields.add(itemField);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemField.isSortable()) {
|
|
||||||
sortByFields.add(itemField);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sortFilter.setProjection(projection);
|
|
||||||
|
|
||||||
mainTabPanel.setFilteringParameters(displayFields, sortByFields, searchByFields, sortFilter);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grpw = new GeonaRecordsPaginatedView(appManagerBus, profileID, displayFields, sortFilter);
|
|
||||||
|
|
||||||
mainTabPanel.showListOfConcessioniView(grpw);
|
mainTabPanel.showListOfConcessioniView(grpw);
|
||||||
|
|
||||||
|
@ -973,8 +884,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
// actionPerformedOnItemEvent.getProfileID(), null,
|
// actionPerformedOnItemEvent.getProfileID(), null,
|
||||||
// mainTabPanel.getCurrentSortFilter()));
|
// mainTabPanel.getCurrentSortFilter()));
|
||||||
|
|
||||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(null, grpw.getProfileID(),
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, null, grpw.getProfileID(),
|
||||||
mainTabPanel.getCurrentSortFilter(), false));
|
mainTabPanel.getCurrentSearchingFilter(), false));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,20 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
||||||
private String profileID;
|
private String profileID;
|
||||||
private String projectName;
|
private String projectName;
|
||||||
private Boolean reloadFilteringParameters = false;
|
private Boolean reloadFilteringParameters = false;
|
||||||
|
private boolean onApplicationInit = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new cancel upload event.
|
* Instantiates a new cancel upload event.
|
||||||
*
|
*
|
||||||
* @param projectName the project name
|
* @param onApplicationInit the on application init
|
||||||
* @param profileID the profile ID
|
* @param projectName the project name
|
||||||
* @param sortFilter the sort filter
|
* @param profileID the profile ID
|
||||||
|
* @param sortFilter the sort filter
|
||||||
* @param reloadFilteringParameters the reload filtering parameters
|
* @param reloadFilteringParameters the reload filtering parameters
|
||||||
*/
|
*/
|
||||||
public GetListOfRecordsEvent(String projectName, String profileID, SearchingFilter sortFilter,
|
public GetListOfRecordsEvent(boolean onApplicationInit, String projectName, String profileID,
|
||||||
Boolean reloadFilteringParameters) {
|
SearchingFilter sortFilter, Boolean reloadFilteringParameters) {
|
||||||
|
this.onApplicationInit = onApplicationInit;
|
||||||
this.sortFilter = sortFilter;
|
this.sortFilter = sortFilter;
|
||||||
this.profileID = profileID;
|
this.profileID = profileID;
|
||||||
this.projectName = projectName;
|
this.projectName = projectName;
|
||||||
|
@ -69,11 +72,11 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the sort filter.
|
* Gets the searching filter.
|
||||||
*
|
*
|
||||||
* @return the sort filter
|
* @return the searching filter
|
||||||
*/
|
*/
|
||||||
public SearchingFilter getSortFilter() {
|
public SearchingFilter getSearchingFilter() {
|
||||||
return sortFilter;
|
return sortFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +89,15 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
||||||
return profileID;
|
return profileID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is on application init.
|
||||||
|
*
|
||||||
|
* @return true, if is on application init
|
||||||
|
*/
|
||||||
|
public boolean isOnApplicationInit() {
|
||||||
|
return onApplicationInit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the project name.
|
* Gets the project name.
|
||||||
*
|
*
|
||||||
|
@ -104,4 +116,24 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
||||||
return reloadFilteringParameters;
|
return reloadFilteringParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("GetListOfRecordsEvent [sortFilter=");
|
||||||
|
builder.append(sortFilter);
|
||||||
|
builder.append(", profileID=");
|
||||||
|
builder.append(profileID);
|
||||||
|
builder.append(", projectName=");
|
||||||
|
builder.append(projectName);
|
||||||
|
builder.append(", reloadFilteringParameters=");
|
||||||
|
builder.append(reloadFilteringParameters);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -16,6 +17,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig;
|
||||||
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;
|
||||||
|
@ -119,6 +121,9 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
Alert alertSortBy;
|
Alert alertSortBy;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Alert alertProjectType;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Alert alertSearchFor;
|
Alert alertSearchFor;
|
||||||
|
|
||||||
|
@ -157,36 +162,33 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
|
|
||||||
private HandlerManager appManagerBus;
|
private HandlerManager appManagerBus;
|
||||||
|
|
||||||
private List<ItemFieldDV> sortByFields;
|
private SearchingFilter currentSearchingFilter;
|
||||||
|
|
||||||
private List<ItemFieldDV> searchForFields;
|
|
||||||
|
|
||||||
private SearchingFilter currentSortFilter;
|
|
||||||
|
|
||||||
private GeonaRecordsPaginatedView grpw = null;
|
private GeonaRecordsPaginatedView grpw = null;
|
||||||
|
|
||||||
private List<ItemFieldDV> displayFields;
|
private List<UseCaseDescriptorDV> ucdProjectTypesForListingDataView = new ArrayList<UseCaseDescriptorDV>();
|
||||||
|
|
||||||
private List<UseCaseDescriptorDV> listUCDescriptors;
|
private CacheSearchingFilterParametersFromConfig cacheSearchingFilterParameters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geona main tab panel.
|
* Instantiates a new geona main tab panel.
|
||||||
*
|
*
|
||||||
* @param appManagerBus the first name
|
* @param appManagerBus the app manager bus
|
||||||
* @param initialSortFilter
|
|
||||||
* @param defaultItemField
|
|
||||||
*/
|
*/
|
||||||
public GeonaMainTabPanel(HandlerManager appManagerBus, List<ItemFieldDV> defaultItemField,
|
public GeonaMainTabPanel(HandlerManager appManagerBus) {
|
||||||
SearchingFilter initialSortFilter) {
|
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.appManagerBus = appManagerBus;
|
this.appManagerBus = appManagerBus;
|
||||||
setFilteringParameters(defaultItemField, defaultItemField, defaultItemField, initialSortFilter);
|
// setFilteringParameters(defaultItemField, defaultItemField, defaultItemField,
|
||||||
|
// initialSortFilter);
|
||||||
alertSortBy.setType(AlertType.INFO);
|
alertSortBy.setType(AlertType.INFO);
|
||||||
alertSortBy.setClose(false);
|
alertSortBy.setClose(false);
|
||||||
|
|
||||||
alertSearchFor.setType(AlertType.INFO);
|
alertSearchFor.setType(AlertType.INFO);
|
||||||
alertSearchFor.setClose(false);
|
alertSearchFor.setClose(false);
|
||||||
|
|
||||||
|
alertProjectType.setType(AlertType.INFO);
|
||||||
|
alertProjectType.setClose(false);
|
||||||
|
|
||||||
bindEvents();
|
bindEvents();
|
||||||
resetSearch.setIconSize(IconSize.TWO_TIMES);
|
resetSearch.setIconSize(IconSize.TWO_TIMES);
|
||||||
resetSearch.setType(ButtonType.LINK);
|
resetSearch.setType(ButtonType.LINK);
|
||||||
|
@ -196,23 +198,22 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
/**
|
/**
|
||||||
* Sets the filtering parameters.
|
* Sets the filtering parameters.
|
||||||
*
|
*
|
||||||
* @param displayFields the display fields
|
* @param sfp the sfp
|
||||||
* @param sortByFields the sort by fields
|
* @param searchingFilter the searching filter
|
||||||
* @param searchForFields the search for fields
|
|
||||||
* @param initialSortFilter the initial sort filter
|
|
||||||
*/
|
*/
|
||||||
public void setFilteringParameters(List<ItemFieldDV> displayFields, List<ItemFieldDV> sortByFields,
|
public void setFilteringParameters(CacheSearchingFilterParametersFromConfig sfp) {
|
||||||
List<ItemFieldDV> searchForFields, SearchingFilter sortFilter) {
|
GWT.log("setFilteringParameters instancied");
|
||||||
this.displayFields = displayFields;
|
this.cacheSearchingFilterParameters = sfp;
|
||||||
this.sortByFields = sortByFields;
|
List<ItemFieldDV> sortByFields = sfp.getOrderByFields();
|
||||||
this.searchForFields = searchForFields;
|
List<ItemFieldDV> searchForFields = sfp.getSearchByFields();
|
||||||
this.currentSortFilter = sortFilter;
|
// currentSearchingFilter = new SearchingFilter(sortByFields, null);
|
||||||
|
|
||||||
alertSearchFor.clear();
|
alertSearchFor.clear();
|
||||||
dropdownSearchFor.clear();
|
dropdownSearchFor.clear();
|
||||||
//alertSearchFor.setText(searchForFields.get(0).getDisplayName());
|
|
||||||
alertSortBy.setText(toLabelFilter((sortFilter.getOrderByFields().get(0)), sortFilter.getOrder()));
|
alertSearchFor.setText(searchForFields.get(0).getDisplayName());
|
||||||
|
alertSortBy.setText(toLabelFilter((sortByFields.get(0)), SearchingFilter.ORDER.ASC));
|
||||||
|
|
||||||
for (ItemFieldDV record_FIELD : searchForFields) {
|
for (ItemFieldDV record_FIELD : searchForFields) {
|
||||||
|
|
||||||
NavLink nav = new NavLink(record_FIELD.getDisplayName());
|
NavLink nav = new NavLink(record_FIELD.getDisplayName());
|
||||||
|
@ -231,52 +232,66 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
dropdownSortBy.clear();
|
dropdownSortBy.clear();
|
||||||
|
|
||||||
for (ItemFieldDV record_FIELD : sortByFields) {
|
for (ItemFieldDV record_FIELD : sortByFields) {
|
||||||
|
|
||||||
// if (record_FIELD.equals(RECORD_FIELD.RECORD_STATUS))
|
// if (record_FIELD.equals(RECORD_FIELD.RECORD_STATUS))
|
||||||
// continue;
|
// continue;
|
||||||
|
|
||||||
// ASC
|
// ASC
|
||||||
String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
final String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
||||||
NavLink nav = new NavLink(labelASC);
|
final NavLink nav = new NavLink(labelASC);
|
||||||
dropdownSortBy.add(nav);
|
dropdownSortBy.add(nav);
|
||||||
|
|
||||||
nav.addClickHandler(new ClickHandler() {
|
nav.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
GWT.log("Sort by: "+labelASC);
|
||||||
alertSortBy.setText(labelASC);
|
alertSortBy.setText(labelASC);
|
||||||
Window.alert("ASC MUST BE REVISITED");
|
UseCaseDescriptorDV singleUCD = getSelectProjectType();
|
||||||
/*
|
if (singleUCD != null) {
|
||||||
* appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getName(), singleUCD.getProfileID(),
|
||||||
* getCurrentSortFilter()));
|
getCurrentSearchingFilter(), false));
|
||||||
*/
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// //DESC
|
// //DESC
|
||||||
String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
final String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
||||||
NavLink nav2 = new NavLink(labelDESC);
|
final NavLink nav2 = new NavLink(labelDESC);
|
||||||
dropdownSortBy.add(nav2);
|
dropdownSortBy.add(nav2);
|
||||||
|
|
||||||
nav2.addClickHandler(new ClickHandler() {
|
nav2.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
GWT.log("Sort by: "+labelDESC);
|
||||||
alertSortBy.setText(labelDESC);
|
alertSortBy.setText(labelDESC);
|
||||||
Window.alert("DESC MUST BE REVISITED");
|
UseCaseDescriptorDV singleUCD = getSelectProjectType();
|
||||||
/*
|
if (singleUCD != null) {
|
||||||
* appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getName(), singleUCD.getProfileID(),
|
||||||
* getCurrentSortFilter()));
|
getCurrentSearchingFilter(), false));
|
||||||
*/
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UseCaseDescriptorDV getSelectProjectType() {
|
||||||
|
String projectName = alertProjectType.getText();
|
||||||
|
for (UseCaseDescriptorDV usdDV : ucdProjectTypesForListingDataView) {
|
||||||
|
if (usdDV.getName().compareTo(projectName) == 0) {
|
||||||
|
GWT.log("Selected project type is: "+usdDV);
|
||||||
|
return usdDV;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the internal height.
|
* Sets the internal height.
|
||||||
*
|
*
|
||||||
|
@ -292,15 +307,6 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
*/
|
*/
|
||||||
private void bindEvents() {
|
private void bindEvents() {
|
||||||
|
|
||||||
// buttCreateNewProject.addClickHandler(new ClickHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onClick(ClickEvent event) {
|
|
||||||
// appManagerBus.fireEvent(new CreateNewProjectEvent());
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
buttonReloadConcessioni.addClickHandler(new ClickHandler() {
|
buttonReloadConcessioni.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -319,71 +325,10 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
instanceAndShowListOfConcessioni();
|
instanceAndShowListOfProjects();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// for (ItemFieldDV record_FIELD : sortByFields) {
|
|
||||||
//
|
|
||||||
//// if (record_FIELD.equals(RECORD_FIELD.RECORD_STATUS))
|
|
||||||
//// continue;
|
|
||||||
//
|
|
||||||
// // ASC
|
|
||||||
// String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
|
||||||
// NavLink nav = new NavLink(labelASC);
|
|
||||||
// dropdownSortBy.add(nav);
|
|
||||||
//
|
|
||||||
// nav.addClickHandler(new ClickHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onClick(ClickEvent event) {
|
|
||||||
// alertSortBy.setText(labelASC);
|
|
||||||
// Window.alert("ASC MUST BE REVISITED");
|
|
||||||
// /*
|
|
||||||
// * appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
|
||||||
// * getCurrentSortFilter()));
|
|
||||||
// */
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
//// //DESC
|
|
||||||
// String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
|
||||||
// NavLink nav2 = new NavLink(labelDESC);
|
|
||||||
// dropdownSortBy.add(nav2);
|
|
||||||
//
|
|
||||||
// nav2.addClickHandler(new ClickHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onClick(ClickEvent event) {
|
|
||||||
// alertSortBy.setText(labelDESC);
|
|
||||||
// Window.alert("DESC MUST BE REVISITED");
|
|
||||||
// /*
|
|
||||||
// * appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
|
||||||
// * getCurrentSortFilter()));
|
|
||||||
// */
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for (ItemFieldDV record_FIELD : searchForFields) {
|
|
||||||
//
|
|
||||||
// NavLink nav = new NavLink(record_FIELD.getDisplayName());
|
|
||||||
// dropdownSearchFor.add(nav);
|
|
||||||
//
|
|
||||||
// nav.addClickHandler(new ClickHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onClick(ClickEvent event) {
|
|
||||||
// alertSearchFor.setText(record_FIELD.getDisplayName());
|
|
||||||
//
|
|
||||||
// if (searchField.getText().length() >= MIN_LENGHT_SERCHING_STRING) {
|
|
||||||
// doSearchEvent();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
navShowOnMap.addClickHandler(new ClickHandler() {
|
navShowOnMap.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -571,21 +516,23 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
GWT.log("toSortFilter for label " + labelFilter);
|
GWT.log("toSortFilter for label " + labelFilter);
|
||||||
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
||||||
|
|
||||||
|
GWT.log("label filter: "+array[0]);
|
||||||
SearchingFilter sortFilter = null;
|
SearchingFilter sortFilter = null;
|
||||||
try {
|
try {
|
||||||
ItemFieldDV recordField = null;
|
ItemFieldDV recordField = null;
|
||||||
for (ItemFieldDV value : sortByFields) {
|
GWT.log("cacheSearchingFilterParameters.getOrderByFields() is: "+cacheSearchingFilterParameters.getOrderByFields());
|
||||||
if (array[0].equalsIgnoreCase(value.getDisplayName())) {
|
for (ItemFieldDV value : cacheSearchingFilterParameters.getOrderByFields()) {
|
||||||
|
if (array[0].trim().compareTo(value.getDisplayName())==0) {
|
||||||
recordField = value;
|
recordField = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ORDER orderField = ORDER.valueOf(array[1]);
|
ORDER orderField = ORDER.valueOf(array[1].trim());
|
||||||
sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
|
sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
GWT.log("toSortFilter Got " + sortFilter);
|
GWT.log("toSortFilter got " + sortFilter);
|
||||||
return sortFilter;
|
return sortFilter;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -603,7 +550,7 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
|
|
||||||
String searchForField = "";
|
String searchForField = "";
|
||||||
|
|
||||||
for (ItemFieldDV recordField : searchForFields) {
|
for (ItemFieldDV recordField : cacheSearchingFilterParameters.getSearchByFields()) {
|
||||||
if (recordField.getDisplayName().equals(alertSearchFor.getText())) {
|
if (recordField.getDisplayName().equals(alertSearchFor.getText())) {
|
||||||
searchForField = recordField.getJsonFields().get(0);
|
searchForField = recordField.getJsonFields().get(0);
|
||||||
continue;
|
continue;
|
||||||
|
@ -615,6 +562,7 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
where.setOperator(LOGICAL_OP.OR);
|
where.setOperator(LOGICAL_OP.OR);
|
||||||
searchingFilter.setConditions(Arrays.asList(where));
|
searchingFilter.setConditions(Arrays.asList(where));
|
||||||
}
|
}
|
||||||
|
|
||||||
return searchingFilter;
|
return searchingFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,10 +571,12 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
*
|
*
|
||||||
* @return the current sort filter
|
* @return the current sort filter
|
||||||
*/
|
*/
|
||||||
public SearchingFilter getCurrentSortFilter() {
|
public SearchingFilter getCurrentSearchingFilter() {
|
||||||
currentSortFilter = builtSearchingFilter();
|
currentSearchingFilter = builtSearchingFilter();
|
||||||
GWT.log("currentSortFilter: " + currentSortFilter);
|
|
||||||
return currentSortFilter;
|
// currentSearchingFilter.setProjection(cacheSearchingFilterParameters.getProjection());
|
||||||
|
GWT.log("getCurrentSearchingFilter: " + currentSearchingFilter);
|
||||||
|
return currentSearchingFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -652,23 +602,30 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
* event for Tab element
|
* event for Tab element
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void instanceAndShowListOfConcessioni() {
|
public void instanceAndShowListOfProjects() {
|
||||||
Window.alert("instanceAndShowListOfConcessioni MUST BE REVISITED");
|
|
||||||
/*
|
// If only one UCD is available for DATA_LIST_GUI.. FIRE THE EVENT OF SELECTION
|
||||||
* grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE,
|
if (ucdProjectTypesForListingDataView.size() == 1) {
|
||||||
* displayFields, currentSortFilter); showListOfConcessioniView(grpw);
|
UseCaseDescriptorDV singleUCD = ucdProjectTypesForListingDataView.get(0);
|
||||||
*/
|
alertProjectType.setText(singleUCD.getName());
|
||||||
|
// setFilteringParameters(displayFields, sortByFields, searchForFields,
|
||||||
|
// currentSearchingFilter);
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(true, singleUCD.getName(), singleUCD.getProfileID(),
|
||||||
|
getCurrentSearchingFilter(), true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the list use case descriptors.
|
* Inits the main according to list use case descriptors.
|
||||||
*
|
*
|
||||||
* @param listUCDescriptors the new list use case descriptors
|
* @param listUCDescriptors the list UC descriptors
|
||||||
*/
|
*/
|
||||||
public void setListUseCaseDescriptors(List<UseCaseDescriptorDV> listUCDescriptors) {
|
public void initMainAccordingToListUseCaseDescriptors(List<UseCaseDescriptorDV> listUCDescriptors) {
|
||||||
GWT.log("Setting listUCDescriptors: " + listUCDescriptors);
|
GWT.log("initMainAccordingToListUseCaseDescriptors: " + listUCDescriptors);
|
||||||
this.listUCDescriptors = listUCDescriptors;
|
// this.listUCDescriptors = listUCDescriptors;
|
||||||
ddCreateNewProject.clear();
|
ddCreateNewProject.clear();
|
||||||
|
ddProjectType.clear();
|
||||||
|
ucdProjectTypesForListingDataView.clear();
|
||||||
|
|
||||||
for (final UseCaseDescriptorDV ucd : listUCDescriptors) {
|
for (final UseCaseDescriptorDV ucd : listUCDescriptors) {
|
||||||
|
|
||||||
|
@ -714,11 +671,11 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(ucd.getName(), ucd.getProfileID(),
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, ucd.getName(), ucd.getProfileID(),
|
||||||
getCurrentSortFilter(), true));
|
getCurrentSearchingFilter(), true));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ucdProjectTypesForListingDataView.add(ucd);
|
||||||
ddProjectType.add(link);
|
ddProjectType.add(link);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -797,17 +754,4 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
this.pageHeaderDataEntry.setSubtext("New: " + hDV.getItemType());
|
this.pageHeaderDataEntry.setSubtext("New: " + hDV.getItemType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the list UC descriptors.
|
|
||||||
*
|
|
||||||
* @return the list UC descriptors
|
|
||||||
*/
|
|
||||||
public List<UseCaseDescriptorDV> getListUCDescriptors() {
|
|
||||||
return listUCDescriptors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ItemFieldDV> getDisplayFields() {
|
|
||||||
return displayFields;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,10 @@
|
||||||
ui:field="ddProjectType" icon="BUILDING">
|
ui:field="ddProjectType" icon="BUILDING">
|
||||||
</b:Dropdown>
|
</b:Dropdown>
|
||||||
</b:Nav>
|
</b:Nav>
|
||||||
|
<b:Nav>
|
||||||
|
<b:Alert ui:field="alertProjectType"
|
||||||
|
addStyleNames="alert_box_nav"></b:Alert>
|
||||||
|
</b:Nav>
|
||||||
<b:Nav>
|
<b:Nav>
|
||||||
<b:Dropdown text="Sort by" ui:field="dropdownSortBy">
|
<b:Dropdown text="Sort by" ui:field="dropdownSortBy">
|
||||||
</b:Dropdown>
|
</b:Dropdown>
|
||||||
|
|
|
@ -50,21 +50,21 @@ public class GeonaRecordsPaginatedView {
|
||||||
private LoaderIcon loadingPanel = new LoaderIcon("Loading data...");
|
private LoaderIcon loadingPanel = new LoaderIcon("Loading data...");
|
||||||
// private int serverStartIndex;
|
// private int serverStartIndex;
|
||||||
private HandlerManager eventBus;
|
private HandlerManager eventBus;
|
||||||
private SearchingFilter currentSortFilter;
|
private SearchingFilter currentSearchingFilter;
|
||||||
private String profileID;
|
private String profileID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 profileID the profile ID
|
||||||
* @param displayFields the display fields
|
* @param displayFields the display fields
|
||||||
* @param currentSortFilter the sort by field
|
* @param currentSearchingFilter the current searching filter
|
||||||
*/
|
*/
|
||||||
public GeonaRecordsPaginatedView(HandlerManager eventbus, String profileID, List<ItemFieldDV> displayFields,
|
public GeonaRecordsPaginatedView(HandlerManager eventbus, String profileID, List<ItemFieldDV> displayFields,
|
||||||
SearchingFilter currentSortFilter) {
|
SearchingFilter currentSearchingFilter) {
|
||||||
this.profileID = profileID;
|
this.profileID = profileID;
|
||||||
this.currentSortFilter = currentSortFilter;
|
this.currentSearchingFilter = currentSearchingFilter;
|
||||||
this.initClassFirstRangeChanged = true;
|
this.initClassFirstRangeChanged = true;
|
||||||
this.eventBus = eventbus;
|
this.eventBus = eventbus;
|
||||||
itemsTable = new ItemsTable<DocumentDV>(eventbus, displayFields);
|
itemsTable = new ItemsTable<DocumentDV>(eventbus, displayFields);
|
||||||
|
@ -115,6 +115,7 @@ public class GeonaRecordsPaginatedView {
|
||||||
/**
|
/**
|
||||||
* Load new page.
|
* Load new page.
|
||||||
*
|
*
|
||||||
|
* @param profileID the profile ID
|
||||||
* @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
|
||||||
|
@ -144,12 +145,12 @@ public class GeonaRecordsPaginatedView {
|
||||||
/**
|
/**
|
||||||
* Load items for type.
|
* Load items for type.
|
||||||
*
|
*
|
||||||
* @param recordType the record type
|
* @param profileID the profile ID
|
||||||
*/
|
*/
|
||||||
private void loadItemsForType(String profileID) {
|
private void loadItemsForType(String profileID) {
|
||||||
this.profileID = profileID;
|
this.profileID = profileID;
|
||||||
getCellTable().setVisibleRangeAndClearData(new Range(ITEM_START_INDEX, ITEMS_PER_PAGE), false);
|
getCellTable().setVisibleRangeAndClearData(new Range(ITEM_START_INDEX, ITEMS_PER_PAGE), false);
|
||||||
loadNewPage(profileID, ITEM_START_INDEX, ITEMS_PER_PAGE, true, currentSortFilter, true);
|
loadNewPage(profileID, ITEM_START_INDEX, ITEMS_PER_PAGE, true, currentSearchingFilter, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,7 +174,7 @@ public class GeonaRecordsPaginatedView {
|
||||||
getTableDataProvider().updateRowCount((int) result.getTotalItems(), true);
|
getTableDataProvider().updateRowCount((int) result.getTotalItems(), true);
|
||||||
|
|
||||||
// TODO MUST USE PROJECT
|
// TODO MUST USE PROJECT
|
||||||
getTableDataProvider().updateRowData(result.getClientStartIndex(),(List<DocumentDV>) result.getData());
|
getTableDataProvider().updateRowData(result.getClientStartIndex(), (List<DocumentDV>) result.getData());
|
||||||
|
|
||||||
if (result.getData().size() == 0) {
|
if (result.getData().size() == 0) {
|
||||||
getCellTable().setLoadingIndicator(new Label("No data"));
|
getCellTable().setLoadingIndicator(new Label("No data"));
|
||||||
|
@ -193,15 +194,21 @@ public class GeonaRecordsPaginatedView {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To list document DV.
|
||||||
|
*
|
||||||
|
* @param data the data
|
||||||
|
* @return the list
|
||||||
|
*/
|
||||||
private List<DocumentDV> toListDocumentDV(List<ProjectDV> data) {
|
private List<DocumentDV> toListDocumentDV(List<ProjectDV> data) {
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
List<DocumentDV> listDocuments = new ArrayList<DocumentDV>(data.size());
|
List<DocumentDV> listDocuments = new ArrayList<DocumentDV>(data.size());
|
||||||
for (ProjectDV projectDV : data) {
|
for (ProjectDV projectDV : data) {
|
||||||
listDocuments.add(projectDV.getTheDocument());
|
listDocuments.add(projectDV.getTheDocument());
|
||||||
}
|
}
|
||||||
|
|
||||||
return listDocuments;
|
return listDocuments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,8 +266,6 @@ public class GeonaRecordsPaginatedView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the select items.
|
* Gets the select items.
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*
|
*
|
||||||
* @return the select items
|
* @return the select items
|
||||||
*/
|
*/
|
||||||
|
@ -310,7 +315,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(profileID, start, length, false, currentSortFilter, false);
|
loadNewPage(profileID, start, length, false, currentSearchingFilter, false);
|
||||||
// eventBus.fireEvent(new TableRangeViewChangedEvent<T>(start, length));
|
// eventBus.fireEvent(new TableRangeViewChangedEvent<T>(start, length));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -344,6 +349,11 @@ public class GeonaRecordsPaginatedView {
|
||||||
return pagerPanel;
|
return pagerPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the profile ID.
|
||||||
|
*
|
||||||
|
* @return the profile ID
|
||||||
|
*/
|
||||||
public String getProfileID() {
|
public String getProfileID() {
|
||||||
return profileID;
|
return profileID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,11 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.BasicLifecycleInformationDV.Status;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.PublicationInfoDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.ButtonCell;
|
import com.github.gwtbootstrap.client.ui.ButtonCell;
|
||||||
import com.github.gwtbootstrap.client.ui.Pagination;
|
import com.github.gwtbootstrap.client.ui.Pagination;
|
||||||
|
@ -92,101 +95,89 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (ItemFieldDV itemField : displayFields) {
|
for (ItemFieldDV itemField : displayFields) {
|
||||||
|
|
||||||
|
if (i > ConstantsGeoPortalDataEntryApp.MAX_COLUMN_DISPLAYED_IN_THE_TABLE) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
String displayName = itemField.getDisplayName();
|
String displayName = itemField.getDisplayName();
|
||||||
// NAME
|
|
||||||
TextColumn<T> col = new TextColumn<T>() {
|
TextColumn<T> col = new TextColumn<T>() {
|
||||||
@Override
|
@Override
|
||||||
public String getValue(T object) {
|
public String getValue(T object) {
|
||||||
|
|
||||||
if (object == null)
|
if (object == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
DocumentDV documentDV = (DocumentDV) object;
|
DocumentDV documentDV = (DocumentDV) object;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return documentDV.getDocumentAsMap().get(itemField.getJsonFields().get(0)).toString();
|
return documentDV.getDocumentAsMap().get(itemField.getJsonFields().get(0)).toString();
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GWT.log("Error e: "+e);
|
GWT.log("Error e: " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (displayName.equalsIgnoreCase("Name")) {
|
* if (displayName.equalsIgnoreCase("Name")) { return ((ConcessioneDV)
|
||||||
return ((ConcessioneDV) object).getNome();
|
* object).getNome(); } else if (displayName.equalsIgnoreCase("Introduction")) {
|
||||||
} else if (displayName.equalsIgnoreCase("Introduction")) {
|
* return ((ConcessioneDV) object).getIntroduzione(); } else if
|
||||||
return ((ConcessioneDV) object).getIntroduzione();
|
* (displayName.equalsIgnoreCase("Author/s")) {
|
||||||
} else if (displayName.equalsIgnoreCase("Author/s")) {
|
*
|
||||||
|
* String toDisplay = ""; if (object.getAuthors() != null) { toDisplay =
|
||||||
String toDisplay = "";
|
* toDisplayAuthors(((ConcessioneDV) object).getAuthors()); } return toDisplay;
|
||||||
if (object.getAuthors() != null) {
|
* } else if (displayName.equalsIgnoreCase("Project Start/End Date")) {
|
||||||
toDisplay = toDisplayAuthors(((ConcessioneDV) object).getAuthors());
|
*
|
||||||
}
|
* Date dS = null; Date dE = null; if (object.getDataInizioProgetto() != null) {
|
||||||
return toDisplay;
|
* dS = (((ConcessioneDV) object).getDataInizioProgetto()); }
|
||||||
} else if (displayName.equalsIgnoreCase("Project Start/End Date")) {
|
*
|
||||||
|
* if (object.getDataFineProgetto() != null) { dE = (((ConcessioneDV)
|
||||||
Date dS = null;
|
* object).getDataFineProgetto()); }
|
||||||
Date dE = null;
|
*
|
||||||
if (object.getDataInizioProgetto() != null) {
|
* String dateFormat = ""; if (dS != null) { dateFormat += dtformat.format(dS);
|
||||||
dS = (((ConcessioneDV) object).getDataInizioProgetto());
|
* }
|
||||||
}
|
*
|
||||||
|
* dateFormat += " / ";
|
||||||
if (object.getDataFineProgetto() != null) {
|
*
|
||||||
dE = (((ConcessioneDV) object).getDataFineProgetto());
|
* if (dE != null) { dateFormat += dtformat.format(dE); }
|
||||||
}
|
*
|
||||||
|
* return dateFormat; } else if (displayName.equalsIgnoreCase("Published with"))
|
||||||
String dateFormat = "";
|
* { ValidationReportDV vr = ((ConcessioneDV) object).getValidationReport(); if
|
||||||
if (dS != null) {
|
* (vr != null && vr.getStatus() != null) return vr.getStatus().getLabel();
|
||||||
dateFormat += dtformat.format(dS);
|
* return ""; } else if (displayName.equalsIgnoreCase("Created")) { Date cd =
|
||||||
}
|
* ((ConcessioneDV) object).getCreationTime(); return dtformat.format(cd); }
|
||||||
|
* else if (displayName.equalsIgnoreCase("Created by")) { return
|
||||||
dateFormat += " / ";
|
* ((ConcessioneDV) object).getCreationUser(); }else if
|
||||||
|
* (displayName.toLowerCase().contains("unpub")) { ValidationReportDV vr =
|
||||||
if (dE != null) {
|
* ((ConcessioneDV) object).getValidationReport(); if (vr != null &&
|
||||||
dateFormat += dtformat.format(dE);
|
* vr.getObjectName() != null) return vr.getObjectName(); }
|
||||||
}
|
*/
|
||||||
|
|
||||||
return dateFormat;
|
|
||||||
} else if (displayName.equalsIgnoreCase("Published with")) {
|
|
||||||
ValidationReportDV vr = ((ConcessioneDV) object).getValidationReport();
|
|
||||||
if (vr != null && vr.getStatus() != null)
|
|
||||||
return vr.getStatus().getLabel();
|
|
||||||
return "";
|
|
||||||
} else if (displayName.equalsIgnoreCase("Created")) {
|
|
||||||
Date cd = ((ConcessioneDV) object).getCreationTime();
|
|
||||||
return dtformat.format(cd);
|
|
||||||
} else if (displayName.equalsIgnoreCase("Created by")) {
|
|
||||||
return ((ConcessioneDV) object).getCreationUser();
|
|
||||||
}else if (displayName.toLowerCase().contains("unpub")) {
|
|
||||||
ValidationReportDV vr = ((ConcessioneDV) object).getValidationReport();
|
|
||||||
if (vr != null && vr.getObjectName() != null)
|
|
||||||
return vr.getObjectName();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ADDING TOOLTIP
|
// // ADDING TOOLTIP
|
||||||
@Override
|
// @Override
|
||||||
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
// public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
||||||
if (object == null)
|
// if (object == null)
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
if (displayName.equalsIgnoreCase("Published with")) {
|
// if (displayName.equalsIgnoreCase("Published with")) {
|
||||||
String value = getValue(object);
|
// String value = getValue(object);
|
||||||
String color = "#000";
|
// String color = "#000";
|
||||||
if (value.compareTo(ValidationStatus.PASSED.getLabel()) == 0) {
|
// if (value.compareTo(ValidationStatus.PASSED.getLabel()) == 0) {
|
||||||
color = "#32CD32";
|
// color = "#32CD32";
|
||||||
} else if (value.compareTo(ValidationStatus.WARNING.getLabel()) == 0) {
|
// } else if (value.compareTo(ValidationStatus.WARNING.getLabel()) == 0) {
|
||||||
color = "#FF8000";
|
// color = "#FF8000";
|
||||||
} else if (value.compareTo(ValidationStatus.ERROR.getLabel()) == 0) {
|
// } else if (value.compareTo(ValidationStatus.ERROR.getLabel()) == 0) {
|
||||||
color = "red";
|
// color = "red";
|
||||||
}
|
// }
|
||||||
sb.appendHtmlConstant("<span style=\"color:" + color + "\";>");
|
// sb.appendHtmlConstant("<span style=\"color:" + color + "\";>");
|
||||||
super.render(context, object, sb);
|
// super.render(context, object, sb);
|
||||||
sb.appendHtmlConstant("</span>");
|
// sb.appendHtmlConstant("</span>");
|
||||||
} else
|
// } else
|
||||||
super.render(context, object, sb);
|
// super.render(context, object, sb);
|
||||||
|
//
|
||||||
};
|
// };
|
||||||
};
|
};
|
||||||
|
|
||||||
// if(i==0) {
|
// if(i==0) {
|
||||||
|
@ -200,11 +191,118 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
|
||||||
// }else if(i==displayFields.size()-1) {
|
// }else if(i==displayFields.size()-1) {
|
||||||
// sortedCellTable.setColumnWidth(col, 120, Unit.PX);
|
// sortedCellTable.setColumnWidth(col, 120, Unit.PX);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
sortedCellTable.addColumn(col, itemField.getDisplayName(), true);
|
sortedCellTable.addColumn(col, displayName, true);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// COL CREATED
|
||||||
|
TextColumn<T> colCreated = new TextColumn<T>() {
|
||||||
|
@Override
|
||||||
|
public String getValue(T object) {
|
||||||
|
|
||||||
|
if (object == null)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
ResultDocumentDV documentDV = (ResultDocumentDV) object;
|
||||||
|
|
||||||
|
PublicationInfoDV publicationInfoDV = documentDV.getPublicationInfoDV();
|
||||||
|
String created = "N.A.";
|
||||||
|
try {
|
||||||
|
created = publicationInfoDV.getCreationInfo().getLocalDate();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
return created;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
sortedCellTable.addColumn(colCreated, "Created", true);
|
||||||
|
|
||||||
|
// COL PUBLISHER
|
||||||
|
TextColumn<T> colPublisher = new TextColumn<T>() {
|
||||||
|
@Override
|
||||||
|
public String getValue(T object) {
|
||||||
|
|
||||||
|
if (object == null)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
ResultDocumentDV documentDV = (ResultDocumentDV) object;
|
||||||
|
|
||||||
|
PublicationInfoDV publicationInfoDV = documentDV.getPublicationInfoDV();
|
||||||
|
String username = "N.A.";
|
||||||
|
try {
|
||||||
|
username = publicationInfoDV.getCreationInfo().getUsername();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
return username;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
sortedCellTable.addColumn(colPublisher, "Publisher", true);
|
||||||
|
|
||||||
|
// COL PUBLICATION PHASE/STATUS
|
||||||
|
TextColumn<T> colPublicationPhaseStatus = new TextColumn<T>() {
|
||||||
|
@Override
|
||||||
|
public String getValue(T object) {
|
||||||
|
|
||||||
|
if (object == null)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
ResultDocumentDV documentDV = (ResultDocumentDV) object;
|
||||||
|
String phase = "N.A.";
|
||||||
|
try {
|
||||||
|
phase = documentDV.getLifecycleInfo().getPhase();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
String status = "N.A.";
|
||||||
|
try {
|
||||||
|
status = documentDV.getLifecycleInfo().getLastOperationStatus().toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
|
||||||
|
return phase + " / " + status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
||||||
|
if (object == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ResultDocumentDV documentDV = (ResultDocumentDV) object;
|
||||||
|
Status status = null;
|
||||||
|
try {
|
||||||
|
status = documentDV.getLifecycleInfo().getLastOperationStatus();
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
String color = "#000";
|
||||||
|
if (status.equals(Status.OK)) {
|
||||||
|
color = "#32CD32";
|
||||||
|
} else if (status.equals(Status.WARNING)) {
|
||||||
|
color = "#FF8000";
|
||||||
|
} else if (status.equals(Status.ERROR)) {
|
||||||
|
color = "red";
|
||||||
|
}
|
||||||
|
sb.appendHtmlConstant("<span style=\"color:" + color + "\";>");
|
||||||
|
super.render(context, object, sb);
|
||||||
|
sb.appendHtmlConstant("</span>");
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
sortedCellTable.addColumn(colPublicationPhaseStatus, "Publ. Phase / Status", true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableWriteOperations() {
|
public void enableWriteOperations() {
|
||||||
|
|
Loading…
Reference in New Issue