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 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 com.google.gwt.core.client.GWT;
|
||||
|
||||
/**
|
||||
* The Class ConstantsGeoPortalDataEntryApp.
|
||||
*
|
||||
|
@ -21,6 +25,8 @@ public class ConstantsGeoPortalDataEntryApp {
|
|||
|
||||
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.
|
||||
*
|
||||
|
@ -45,4 +51,16 @@ public class ConstantsGeoPortalDataEntryApp {
|
|||
|
||||
public static final List<String> HANDLERS_IDS = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_list.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.Arrays;
|
||||
import java.util.Collection;
|
||||
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.GeoNaItemRef;
|
||||
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.GcubeUserRole;
|
||||
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
||||
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.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.ItemFieldDV;
|
||||
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.products.ConcessioneDV;
|
||||
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.ActionOnItemEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEvent;
|
||||
|
@ -120,14 +117,12 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
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 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 expectedCards = 0;
|
||||
|
@ -140,12 +135,14 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
return numberOfCards;
|
||||
}
|
||||
|
||||
private List<UseCaseDescriptorDV> listUCDescriptors;
|
||||
// private List<UseCaseDescriptorDV> listUCDescriptors;
|
||||
|
||||
private boolean dataEntryProjectCreated = false;
|
||||
|
||||
private TreeItemPanel treeItemPanel;
|
||||
|
||||
private GeoPortalClientCaches geoportalCaches;
|
||||
|
||||
/**
|
||||
* This is the entry point method.
|
||||
*/
|
||||
|
@ -172,8 +169,15 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
* TreeItemPanel tip = new TreeItemPanel("Concessione", gnaCardsModels);
|
||||
* 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>() {
|
||||
|
||||
|
@ -183,7 +187,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
try {
|
||||
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
||||
RootPanel.get(DIV_PORTLET_ID).remove(loaderApplication);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
@ -213,7 +217,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
try {
|
||||
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
||||
RootPanel.get(DIV_PORTLET_ID).remove(loaderApplication);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
@ -224,52 +228,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
@Override
|
||||
public void onSuccess(GNADataEntryExtConfigProfile 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);
|
||||
GWT.log(GNADataEntryExtConfigProfile.class.getSimpleName() + " loaded: " + gNADataEntryConfig);
|
||||
|
||||
// PERMISSIONS
|
||||
myRights = gNADataEntryConfig.getUserRights();
|
||||
|
@ -293,17 +252,22 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
mainTabPanel.removeTab(0);
|
||||
// activating Tab "List of Project"
|
||||
mainTabPanel.setTabActive(0);
|
||||
mainTabPanel.instanceAndShowListOfConcessioni();
|
||||
mainTabPanel.instanceAndShowListOfProjects();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
RootPanel.get(DIV_PORTLET_ID).remove(loaderApplication);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initGUI() {
|
||||
bindEvents();
|
||||
RootPanel.get(DIV_PORTLET_ID).add(mainTabPanel);
|
||||
Window.addResizeHandler(new ResizeHandler() {
|
||||
@Override
|
||||
public void onResize(ResizeEvent event) {
|
||||
|
@ -322,88 +286,69 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
private void loadGeoportalConfigs(final String scope) {
|
||||
GWT.log("loading GeoportalConfigsAndBuildCards in the scope: " + scope);
|
||||
// orderedCards = new ArrayList<GeoNaFormCardModel>();
|
||||
try {
|
||||
RootPanel.get(DIV_PORTLET_ID).insert(loaderConfigurations, 0);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().getListUseCaseDescriptors(
|
||||
ConstantsGeoPortalDataEntryApp.HANDLERS_IDS, new AsyncCallback<List<UseCaseDescriptorDV>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
try {
|
||||
RootPanel.get(DIV_PORTLET_ID).remove(loaderConfigurations);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
GWT.log("caught: " + caught);
|
||||
Window.alert(caught.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<UseCaseDescriptorDV> result) {
|
||||
GWT.log("UseCaseDescriptorDV loaded: "+result);
|
||||
listUCDescriptors = result;
|
||||
GWT.log("List<UseCaseDescriptorDV>: " + listUCDescriptors);
|
||||
listUCDescriptors = result;
|
||||
GWT.log("List<DocumentConfigDV>: " + result);
|
||||
GWT.log("ListUseCaseDescriptors loaded: " + result);
|
||||
|
||||
if (result == null || result.size() == 0) {
|
||||
Window.alert("No Configuration found in this scope. Please contact the support");
|
||||
return;
|
||||
}
|
||||
|
||||
setListUseCaseDescriptors(listUCDescriptors);
|
||||
initDataEntryAppForListUseCaseDescriptors(result);
|
||||
try {
|
||||
RootPanel.get(DIV_PORTLET_ID).remove(loaderConfigurations);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private synchronized void setListUseCaseDescriptors(List<UseCaseDescriptorDV> listUCDescriptors) {
|
||||
GWT.log("Setting listUCDescriptors: " + listUCDescriptors);
|
||||
if (listUCDescriptors != null) {
|
||||
private void initDataEntryAppForListUseCaseDescriptors(List<UseCaseDescriptorDV> listUCDescriptors) {
|
||||
GWT.log("initDataEntryAppForListUseCaseDescriptors with size: " + listUCDescriptors.size());
|
||||
ConstantsGeoPortalDataEntryApp.printUCDs(listUCDescriptors);
|
||||
|
||||
if (mainTabPanel != null) {
|
||||
// Just to be sure that its set once
|
||||
if (mainTabPanel.getListUCDescriptors() == null) {
|
||||
mainTabPanel.setListUseCaseDescriptors(listUCDescriptors);
|
||||
}
|
||||
mainTabPanel.initMainAccordingToListUseCaseDescriptors(listUCDescriptors);
|
||||
|
||||
for (UseCaseDescriptorDV useCaseDescriptorDV : listUCDescriptors) {
|
||||
for (UseCaseDescriptorDV ucdDV : listUCDescriptors) {
|
||||
|
||||
List<ConfigurationDV<?>> listConfigurations = mapHandlersForProfileId
|
||||
.get(useCaseDescriptorDV.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);
|
||||
List<ConfigurationDV<?>> listConfigurations = geoportalCaches
|
||||
.getHandlerConfigurationsForProfileId(ucdDV.getProfileID());
|
||||
|
||||
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();
|
||||
resetUI();
|
||||
|
||||
List<GeoNaFormCardModel> cardsPerIT = mapGcubeProfilePerItemType.get(handlerDeclarationDV.getItemType());
|
||||
List<GeoNaFormCardModel> cardsPerIT = geoportalCaches
|
||||
.getGcubeProfilePerItemType(handlerDeclarationDV.getItemType());
|
||||
mainTabPanel.setPageHeader(handlerDeclarationDV);
|
||||
|
||||
if (cardsPerIT != null) {
|
||||
|
@ -484,7 +430,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
// ordered values
|
||||
Collection<GeoNaFormCardModel> gnaCardsModels = treemapOrderedGNAProfiles.values();
|
||||
GWT.log("TreeMap values: " + gnaCardsModels);
|
||||
mapGcubeProfilePerItemType.put(handlerDeclarationDV.getItemType(),
|
||||
geoportalCaches.putGcubeProfilePerItemType(handlerDeclarationDV.getItemType(),
|
||||
new ArrayList<GeoNaFormCardModel>(gnaCardsModels));
|
||||
// orderedCards.addAll(new ArrayList<GeoNaFormCardModel>(gnaCardsModels));
|
||||
buildNewCards(profileID, handlerDeclarationDV.getItemType(),
|
||||
|
@ -872,66 +818,31 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
@Override
|
||||
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
|
||||
|
||||
SearchingFilter sortFilter = getListOfRecordsEvent.getSortFilter();
|
||||
List<ItemFieldDV> displayFields = mainTabPanel.getDisplayFields();
|
||||
|
||||
if (sortFilter == null) {
|
||||
sortFilter = mainTabPanel.getCurrentSortFilter();
|
||||
GWT.log("Fired: " + getListOfRecordsEvent);
|
||||
SearchingFilter searchingFilter = getListOfRecordsEvent.getSearchingFilter();
|
||||
|
||||
CacheSearchingFilterParametersFromConfig seachingFilterParameters = geoportalCaches
|
||||
.getFilterParametersForProfileId(getListOfRecordsEvent.getProfileID());
|
||||
|
||||
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();
|
||||
if (profileID == null) {
|
||||
new DialogInform(null, "Error", "No user case descriptor selected").center();
|
||||
return;
|
||||
}
|
||||
|
||||
// Resetting filtering parameters (e.g. search for, order by, etc.)
|
||||
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);
|
||||
grpw = new GeonaRecordsPaginatedView(appManagerBus, profileID, displayFields, searchingFilter);
|
||||
|
||||
mainTabPanel.showListOfConcessioniView(grpw);
|
||||
|
||||
|
@ -973,8 +884,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
// actionPerformedOnItemEvent.getProfileID(), null,
|
||||
// mainTabPanel.getCurrentSortFilter()));
|
||||
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(null, grpw.getProfileID(),
|
||||
mainTabPanel.getCurrentSortFilter(), false));
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, null, grpw.getProfileID(),
|
||||
mainTabPanel.getCurrentSearchingFilter(), false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,17 +19,20 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
|||
private String profileID;
|
||||
private String projectName;
|
||||
private Boolean reloadFilteringParameters = false;
|
||||
private boolean onApplicationInit = false;
|
||||
|
||||
/**
|
||||
* Instantiates a new cancel upload event.
|
||||
*
|
||||
* @param projectName the project name
|
||||
* @param profileID the profile ID
|
||||
* @param sortFilter the sort filter
|
||||
* @param onApplicationInit the on application init
|
||||
* @param projectName the project name
|
||||
* @param profileID the profile ID
|
||||
* @param sortFilter the sort filter
|
||||
* @param reloadFilteringParameters the reload filtering parameters
|
||||
*/
|
||||
public GetListOfRecordsEvent(String projectName, String profileID, SearchingFilter sortFilter,
|
||||
Boolean reloadFilteringParameters) {
|
||||
public GetListOfRecordsEvent(boolean onApplicationInit, String projectName, String profileID,
|
||||
SearchingFilter sortFilter, Boolean reloadFilteringParameters) {
|
||||
this.onApplicationInit = onApplicationInit;
|
||||
this.sortFilter = sortFilter;
|
||||
this.profileID = profileID;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -86,6 +89,15 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
|||
return profileID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is on application init.
|
||||
*
|
||||
* @return true, if is on application init
|
||||
*/
|
||||
public boolean isOnApplicationInit() {
|
||||
return onApplicationInit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the project name.
|
||||
*
|
||||
|
@ -104,4 +116,24 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
|||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
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.HandlerDeclarationDV;
|
||||
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.GetListOfRecordsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
||||
|
@ -119,6 +121,9 @@ public class GeonaMainTabPanel extends Composite {
|
|||
@UiField
|
||||
Alert alertSortBy;
|
||||
|
||||
@UiField
|
||||
Alert alertProjectType;
|
||||
|
||||
@UiField
|
||||
Alert alertSearchFor;
|
||||
|
||||
|
@ -157,36 +162,33 @@ public class GeonaMainTabPanel extends Composite {
|
|||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
private List<ItemFieldDV> sortByFields;
|
||||
|
||||
private List<ItemFieldDV> searchForFields;
|
||||
|
||||
private SearchingFilter currentSortFilter;
|
||||
private SearchingFilter currentSearchingFilter;
|
||||
|
||||
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.
|
||||
*
|
||||
* @param appManagerBus the first name
|
||||
* @param initialSortFilter
|
||||
* @param defaultItemField
|
||||
* @param appManagerBus the app manager bus
|
||||
*/
|
||||
public GeonaMainTabPanel(HandlerManager appManagerBus, List<ItemFieldDV> defaultItemField,
|
||||
SearchingFilter initialSortFilter) {
|
||||
public GeonaMainTabPanel(HandlerManager appManagerBus) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.appManagerBus = appManagerBus;
|
||||
setFilteringParameters(defaultItemField, defaultItemField, defaultItemField, initialSortFilter);
|
||||
// setFilteringParameters(defaultItemField, defaultItemField, defaultItemField,
|
||||
// initialSortFilter);
|
||||
alertSortBy.setType(AlertType.INFO);
|
||||
alertSortBy.setClose(false);
|
||||
|
||||
alertSearchFor.setType(AlertType.INFO);
|
||||
alertSearchFor.setClose(false);
|
||||
|
||||
alertProjectType.setType(AlertType.INFO);
|
||||
alertProjectType.setClose(false);
|
||||
|
||||
bindEvents();
|
||||
resetSearch.setIconSize(IconSize.TWO_TIMES);
|
||||
resetSearch.setType(ButtonType.LINK);
|
||||
|
@ -196,23 +198,22 @@ public class GeonaMainTabPanel extends Composite {
|
|||
/**
|
||||
* Sets the filtering parameters.
|
||||
*
|
||||
* @param displayFields the display fields
|
||||
* @param sortByFields the sort by fields
|
||||
* @param searchForFields the search for fields
|
||||
* @param initialSortFilter the initial sort filter
|
||||
* @param sfp the sfp
|
||||
* @param searchingFilter the searching filter
|
||||
*/
|
||||
public void setFilteringParameters(List<ItemFieldDV> displayFields, List<ItemFieldDV> sortByFields,
|
||||
List<ItemFieldDV> searchForFields, SearchingFilter sortFilter) {
|
||||
this.displayFields = displayFields;
|
||||
this.sortByFields = sortByFields;
|
||||
this.searchForFields = searchForFields;
|
||||
this.currentSortFilter = sortFilter;
|
||||
public void setFilteringParameters(CacheSearchingFilterParametersFromConfig sfp) {
|
||||
GWT.log("setFilteringParameters instancied");
|
||||
this.cacheSearchingFilterParameters = sfp;
|
||||
List<ItemFieldDV> sortByFields = sfp.getOrderByFields();
|
||||
List<ItemFieldDV> searchForFields = sfp.getSearchByFields();
|
||||
// currentSearchingFilter = new SearchingFilter(sortByFields, null);
|
||||
|
||||
alertSearchFor.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) {
|
||||
|
||||
NavLink nav = new NavLink(record_FIELD.getDisplayName());
|
||||
|
@ -231,52 +232,66 @@ public class GeonaMainTabPanel extends Composite {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
dropdownSortBy.clear();
|
||||
|
||||
|
||||
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);
|
||||
final String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
||||
final NavLink nav = new NavLink(labelASC);
|
||||
dropdownSortBy.add(nav);
|
||||
|
||||
nav.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GWT.log("Sort by: "+labelASC);
|
||||
alertSortBy.setText(labelASC);
|
||||
Window.alert("ASC MUST BE REVISITED");
|
||||
/*
|
||||
* appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||
* getCurrentSortFilter()));
|
||||
*/
|
||||
UseCaseDescriptorDV singleUCD = getSelectProjectType();
|
||||
if (singleUCD != null) {
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getName(), singleUCD.getProfileID(),
|
||||
getCurrentSearchingFilter(), false));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// //DESC
|
||||
String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
||||
NavLink nav2 = new NavLink(labelDESC);
|
||||
final String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
||||
final NavLink nav2 = new NavLink(labelDESC);
|
||||
dropdownSortBy.add(nav2);
|
||||
|
||||
nav2.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GWT.log("Sort by: "+labelDESC);
|
||||
alertSortBy.setText(labelDESC);
|
||||
Window.alert("DESC MUST BE REVISITED");
|
||||
/*
|
||||
* appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||
* getCurrentSortFilter()));
|
||||
*/
|
||||
UseCaseDescriptorDV singleUCD = getSelectProjectType();
|
||||
if (singleUCD != null) {
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getName(), singleUCD.getProfileID(),
|
||||
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.
|
||||
*
|
||||
|
@ -292,15 +307,6 @@ public class GeonaMainTabPanel extends Composite {
|
|||
*/
|
||||
private void bindEvents() {
|
||||
|
||||
// buttCreateNewProject.addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// appManagerBus.fireEvent(new CreateNewProjectEvent());
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
buttonReloadConcessioni.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -319,71 +325,10 @@ public class GeonaMainTabPanel extends Composite {
|
|||
@Override
|
||||
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() {
|
||||
|
||||
@Override
|
||||
|
@ -571,21 +516,23 @@ public class GeonaMainTabPanel extends Composite {
|
|||
GWT.log("toSortFilter for label " + labelFilter);
|
||||
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
||||
|
||||
GWT.log("label filter: "+array[0]);
|
||||
SearchingFilter sortFilter = null;
|
||||
try {
|
||||
ItemFieldDV recordField = null;
|
||||
for (ItemFieldDV value : sortByFields) {
|
||||
if (array[0].equalsIgnoreCase(value.getDisplayName())) {
|
||||
GWT.log("cacheSearchingFilterParameters.getOrderByFields() is: "+cacheSearchingFilterParameters.getOrderByFields());
|
||||
for (ItemFieldDV value : cacheSearchingFilterParameters.getOrderByFields()) {
|
||||
if (array[0].trim().compareTo(value.getDisplayName())==0) {
|
||||
recordField = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ORDER orderField = ORDER.valueOf(array[1]);
|
||||
ORDER orderField = ORDER.valueOf(array[1].trim());
|
||||
sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
GWT.log("toSortFilter Got " + sortFilter);
|
||||
GWT.log("toSortFilter got " + sortFilter);
|
||||
return sortFilter;
|
||||
|
||||
}
|
||||
|
@ -603,7 +550,7 @@ public class GeonaMainTabPanel extends Composite {
|
|||
|
||||
String searchForField = "";
|
||||
|
||||
for (ItemFieldDV recordField : searchForFields) {
|
||||
for (ItemFieldDV recordField : cacheSearchingFilterParameters.getSearchByFields()) {
|
||||
if (recordField.getDisplayName().equals(alertSearchFor.getText())) {
|
||||
searchForField = recordField.getJsonFields().get(0);
|
||||
continue;
|
||||
|
@ -615,6 +562,7 @@ public class GeonaMainTabPanel extends Composite {
|
|||
where.setOperator(LOGICAL_OP.OR);
|
||||
searchingFilter.setConditions(Arrays.asList(where));
|
||||
}
|
||||
|
||||
return searchingFilter;
|
||||
}
|
||||
|
||||
|
@ -623,10 +571,12 @@ public class GeonaMainTabPanel extends Composite {
|
|||
*
|
||||
* @return the current sort filter
|
||||
*/
|
||||
public SearchingFilter getCurrentSortFilter() {
|
||||
currentSortFilter = builtSearchingFilter();
|
||||
GWT.log("currentSortFilter: " + currentSortFilter);
|
||||
return currentSortFilter;
|
||||
public SearchingFilter getCurrentSearchingFilter() {
|
||||
currentSearchingFilter = builtSearchingFilter();
|
||||
|
||||
// currentSearchingFilter.setProjection(cacheSearchingFilterParameters.getProjection());
|
||||
GWT.log("getCurrentSearchingFilter: " + currentSearchingFilter);
|
||||
return currentSearchingFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -652,23 +602,30 @@ public class GeonaMainTabPanel extends Composite {
|
|||
* event for Tab element
|
||||
*
|
||||
*/
|
||||
public void instanceAndShowListOfConcessioni() {
|
||||
Window.alert("instanceAndShowListOfConcessioni MUST BE REVISITED");
|
||||
/*
|
||||
* grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE,
|
||||
* displayFields, currentSortFilter); showListOfConcessioniView(grpw);
|
||||
*/
|
||||
public void instanceAndShowListOfProjects() {
|
||||
|
||||
// If only one UCD is available for DATA_LIST_GUI.. FIRE THE EVENT OF SELECTION
|
||||
if (ucdProjectTypesForListingDataView.size() == 1) {
|
||||
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) {
|
||||
GWT.log("Setting listUCDescriptors: " + listUCDescriptors);
|
||||
this.listUCDescriptors = listUCDescriptors;
|
||||
public void initMainAccordingToListUseCaseDescriptors(List<UseCaseDescriptorDV> listUCDescriptors) {
|
||||
GWT.log("initMainAccordingToListUseCaseDescriptors: " + listUCDescriptors);
|
||||
// this.listUCDescriptors = listUCDescriptors;
|
||||
ddCreateNewProject.clear();
|
||||
ddProjectType.clear();
|
||||
ucdProjectTypesForListingDataView.clear();
|
||||
|
||||
for (final UseCaseDescriptorDV ucd : listUCDescriptors) {
|
||||
|
||||
|
@ -714,11 +671,11 @@ public class GeonaMainTabPanel extends Composite {
|
|||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(ucd.getName(), ucd.getProfileID(),
|
||||
getCurrentSortFilter(), true));
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, ucd.getName(), ucd.getProfileID(),
|
||||
getCurrentSearchingFilter(), true));
|
||||
}
|
||||
});
|
||||
|
||||
ucdProjectTypesForListingDataView.add(ucd);
|
||||
ddProjectType.add(link);
|
||||
|
||||
}
|
||||
|
@ -797,17 +754,4 @@ public class GeonaMainTabPanel extends Composite {
|
|||
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">
|
||||
</b:Dropdown>
|
||||
</b:Nav>
|
||||
<b:Nav>
|
||||
<b:Alert ui:field="alertProjectType"
|
||||
addStyleNames="alert_box_nav"></b:Alert>
|
||||
</b:Nav>
|
||||
<b:Nav>
|
||||
<b:Dropdown text="Sort by" ui:field="dropdownSortBy">
|
||||
</b:Dropdown>
|
||||
|
|
|
@ -50,21 +50,21 @@ public class GeonaRecordsPaginatedView {
|
|||
private LoaderIcon loadingPanel = new LoaderIcon("Loading data...");
|
||||
// private int serverStartIndex;
|
||||
private HandlerManager eventBus;
|
||||
private SearchingFilter currentSortFilter;
|
||||
private SearchingFilter currentSearchingFilter;
|
||||
private String profileID;
|
||||
|
||||
/**
|
||||
* Instantiates a new geona records paginated view.
|
||||
*
|
||||
* @param eventbus the eventbus
|
||||
* @param recordType the record type
|
||||
* @param displayFields the display fields
|
||||
* @param currentSortFilter the sort by field
|
||||
* @param eventbus the eventbus
|
||||
* @param profileID the profile ID
|
||||
* @param displayFields the display fields
|
||||
* @param currentSearchingFilter the current searching filter
|
||||
*/
|
||||
public GeonaRecordsPaginatedView(HandlerManager eventbus, String profileID, List<ItemFieldDV> displayFields,
|
||||
SearchingFilter currentSortFilter) {
|
||||
SearchingFilter currentSearchingFilter) {
|
||||
this.profileID = profileID;
|
||||
this.currentSortFilter = currentSortFilter;
|
||||
this.currentSearchingFilter = currentSearchingFilter;
|
||||
this.initClassFirstRangeChanged = true;
|
||||
this.eventBus = eventbus;
|
||||
itemsTable = new ItemsTable<DocumentDV>(eventbus, displayFields);
|
||||
|
@ -115,6 +115,7 @@ public class GeonaRecordsPaginatedView {
|
|||
/**
|
||||
* Load new page.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param startIdx the start idx
|
||||
* @param limit the limit
|
||||
* @param resetStore the reset store
|
||||
|
@ -144,12 +145,12 @@ public class GeonaRecordsPaginatedView {
|
|||
/**
|
||||
* Load items for type.
|
||||
*
|
||||
* @param recordType the record type
|
||||
* @param profileID the profile ID
|
||||
*/
|
||||
private void loadItemsForType(String profileID) {
|
||||
this.profileID = profileID;
|
||||
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);
|
||||
|
||||
// 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) {
|
||||
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) {
|
||||
if (data == null)
|
||||
return null;
|
||||
|
||||
|
||||
List<DocumentDV> listDocuments = new ArrayList<DocumentDV>(data.size());
|
||||
for (ProjectDV projectDV : data) {
|
||||
listDocuments.add(projectDV.getTheDocument());
|
||||
}
|
||||
|
||||
|
||||
return listDocuments;
|
||||
}
|
||||
|
||||
|
@ -259,8 +266,6 @@ public class GeonaRecordsPaginatedView {
|
|||
|
||||
/**
|
||||
* Gets the select items.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @return the select items
|
||||
*/
|
||||
|
@ -310,7 +315,7 @@ public class GeonaRecordsPaginatedView {
|
|||
return;
|
||||
}
|
||||
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));
|
||||
|
||||
}
|
||||
|
@ -344,6 +349,11 @@ public class GeonaRecordsPaginatedView {
|
|||
return pagerPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the profile ID.
|
||||
*
|
||||
* @return the profile ID
|
||||
*/
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,11 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||
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.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.Pagination;
|
||||
|
@ -92,101 +95,89 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
|
|||
int i = 0;
|
||||
|
||||
for (ItemFieldDV itemField : displayFields) {
|
||||
|
||||
if (i > ConstantsGeoPortalDataEntryApp.MAX_COLUMN_DISPLAYED_IN_THE_TABLE) {
|
||||
break;
|
||||
}
|
||||
|
||||
String displayName = itemField.getDisplayName();
|
||||
// NAME
|
||||
|
||||
TextColumn<T> col = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
|
||||
if (object == null)
|
||||
return "";
|
||||
|
||||
|
||||
DocumentDV documentDV = (DocumentDV) object;
|
||||
|
||||
|
||||
try {
|
||||
return documentDV.getDocumentAsMap().get(itemField.getJsonFields().get(0)).toString();
|
||||
}catch (Exception e) {
|
||||
GWT.log("Error e: "+e);
|
||||
} catch (Exception e) {
|
||||
GWT.log("Error e: " + e);
|
||||
}
|
||||
|
||||
/*
|
||||
if (displayName.equalsIgnoreCase("Name")) {
|
||||
return ((ConcessioneDV) object).getNome();
|
||||
} else if (displayName.equalsIgnoreCase("Introduction")) {
|
||||
return ((ConcessioneDV) object).getIntroduzione();
|
||||
} else if (displayName.equalsIgnoreCase("Author/s")) {
|
||||
|
||||
String toDisplay = "";
|
||||
if (object.getAuthors() != null) {
|
||||
toDisplay = toDisplayAuthors(((ConcessioneDV) object).getAuthors());
|
||||
}
|
||||
return toDisplay;
|
||||
} else if (displayName.equalsIgnoreCase("Project Start/End Date")) {
|
||||
|
||||
Date dS = null;
|
||||
Date dE = null;
|
||||
if (object.getDataInizioProgetto() != null) {
|
||||
dS = (((ConcessioneDV) object).getDataInizioProgetto());
|
||||
}
|
||||
|
||||
if (object.getDataFineProgetto() != null) {
|
||||
dE = (((ConcessioneDV) object).getDataFineProgetto());
|
||||
}
|
||||
|
||||
String dateFormat = "";
|
||||
if (dS != null) {
|
||||
dateFormat += dtformat.format(dS);
|
||||
}
|
||||
|
||||
dateFormat += " / ";
|
||||
|
||||
if (dE != null) {
|
||||
dateFormat += dtformat.format(dE);
|
||||
}
|
||||
|
||||
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();
|
||||
}*/
|
||||
* if (displayName.equalsIgnoreCase("Name")) { return ((ConcessioneDV)
|
||||
* object).getNome(); } else if (displayName.equalsIgnoreCase("Introduction")) {
|
||||
* return ((ConcessioneDV) object).getIntroduzione(); } else if
|
||||
* (displayName.equalsIgnoreCase("Author/s")) {
|
||||
*
|
||||
* String toDisplay = ""; if (object.getAuthors() != null) { toDisplay =
|
||||
* toDisplayAuthors(((ConcessioneDV) object).getAuthors()); } return toDisplay;
|
||||
* } else if (displayName.equalsIgnoreCase("Project Start/End Date")) {
|
||||
*
|
||||
* Date dS = null; Date dE = null; if (object.getDataInizioProgetto() != null) {
|
||||
* dS = (((ConcessioneDV) object).getDataInizioProgetto()); }
|
||||
*
|
||||
* if (object.getDataFineProgetto() != null) { dE = (((ConcessioneDV)
|
||||
* object).getDataFineProgetto()); }
|
||||
*
|
||||
* String dateFormat = ""; if (dS != null) { dateFormat += dtformat.format(dS);
|
||||
* }
|
||||
*
|
||||
* dateFormat += " / ";
|
||||
*
|
||||
* if (dE != null) { dateFormat += dtformat.format(dE); }
|
||||
*
|
||||
* 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 "";
|
||||
}
|
||||
|
||||
// ADDING TOOLTIP
|
||||
@Override
|
||||
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
||||
if (object == null)
|
||||
return;
|
||||
|
||||
if (displayName.equalsIgnoreCase("Published with")) {
|
||||
String value = getValue(object);
|
||||
String color = "#000";
|
||||
if (value.compareTo(ValidationStatus.PASSED.getLabel()) == 0) {
|
||||
color = "#32CD32";
|
||||
} else if (value.compareTo(ValidationStatus.WARNING.getLabel()) == 0) {
|
||||
color = "#FF8000";
|
||||
} else if (value.compareTo(ValidationStatus.ERROR.getLabel()) == 0) {
|
||||
color = "red";
|
||||
}
|
||||
sb.appendHtmlConstant("<span style=\"color:" + color + "\";>");
|
||||
super.render(context, object, sb);
|
||||
sb.appendHtmlConstant("</span>");
|
||||
} else
|
||||
super.render(context, object, sb);
|
||||
|
||||
};
|
||||
// // ADDING TOOLTIP
|
||||
// @Override
|
||||
// public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
||||
// if (object == null)
|
||||
// return;
|
||||
//
|
||||
// if (displayName.equalsIgnoreCase("Published with")) {
|
||||
// String value = getValue(object);
|
||||
// String color = "#000";
|
||||
// if (value.compareTo(ValidationStatus.PASSED.getLabel()) == 0) {
|
||||
// color = "#32CD32";
|
||||
// } else if (value.compareTo(ValidationStatus.WARNING.getLabel()) == 0) {
|
||||
// color = "#FF8000";
|
||||
// } else if (value.compareTo(ValidationStatus.ERROR.getLabel()) == 0) {
|
||||
// color = "red";
|
||||
// }
|
||||
// sb.appendHtmlConstant("<span style=\"color:" + color + "\";>");
|
||||
// super.render(context, object, sb);
|
||||
// sb.appendHtmlConstant("</span>");
|
||||
// } else
|
||||
// super.render(context, object, sb);
|
||||
//
|
||||
// };
|
||||
};
|
||||
|
||||
// if(i==0) {
|
||||
|
@ -200,11 +191,118 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
|
|||
// }else if(i==displayFields.size()-1) {
|
||||
// sortedCellTable.setColumnWidth(col, 120, Unit.PX);
|
||||
// }
|
||||
|
||||
sortedCellTable.addColumn(col, itemField.getDisplayName(), true);
|
||||
|
||||
sortedCellTable.addColumn(col, displayName, true);
|
||||
|
||||
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() {
|
||||
|
|
Loading…
Reference in New Issue