Improved GUI and layout

This commit is contained in:
Francesco Mangiacrapa 2022-09-23 12:41:32 +02:00
parent f110ae1685
commit 6178b38bfa
8 changed files with 181 additions and 194 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -46,7 +47,8 @@
<wb-module deploy-name="geoportal-data-entry-app-3.0.0-SNAPSHOT"> <wb-module deploy-name="geoportal-data-entry-app-3.0.0-SNAPSHOT">
@ -93,7 +95,8 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -140,7 +143,8 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -196,7 +200,8 @@
<dependent-module archiveName="geoportal-data-common-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common"> <dependent-module archiveName="geoportal-data-common-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
@ -243,7 +248,8 @@
<property name="context-root" value="geoportal-data-entry-app"/> <property name="context-root" value="geoportal-data-entry-app"/>
@ -290,7 +296,8 @@
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -337,7 +344,8 @@
</wb-module> </wb-module>

View File

@ -9,6 +9,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescrip
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder; import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.RootPanel;
/** /**
* The Class ConstantsGeoPortalDataEntryApp. * The Class ConstantsGeoPortalDataEntryApp.
@ -18,9 +19,9 @@ import com.google.gwt.core.client.GWT;
* Aug 6, 2021 * Aug 6, 2021
*/ */
public class ConstantsGeoPortalDataEntryApp { public class ConstantsGeoPortalDataEntryApp {
public static final String DIV_PORTLET_ID = "geoportal-data-entry"; public static final String DIV_PORTLET_ID = "geoportal-data-entry";
public static final String DIV_LOADERS_ID = "geoportal-loaders"; public static final String DIV_LOADERS_ID = "geoportal-loaders";
public static final String DATE_FORMAT = ConstantsMPFormBuilder.DATE_FORMAT; public static final String DATE_FORMAT = ConstantsMPFormBuilder.DATE_FORMAT;
@ -30,11 +31,19 @@ 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; public static final int MAX_COLUMN_DISPLAYED_IN_THE_TABLE = 5;
public static final int PAGINATION_SIZE = 20; public static final int PAGINATION_SIZE = 20;
public static final String DEFAULT_DOCUMENT_PROJECTION_NAME = "_theDocument"; public static final String DEFAULT_DOCUMENT_PROJECTION_NAME = "_theDocument";
public static final String CSS_CLASS_ANIMATE_FADE_IN_OUT = "animate-fadeInOut";
public static final RootPanel ROOT_PANEL_DIV_LOADERS = RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID);
public static final RootPanel ROOT_PANEL_DIV_PORTLET = RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID);
public static final String CSS_CLASS_GEOPORTAL_LOADERS_CENTER = "geoportal-loaders-center";
/** /**
* The Enum RECORD_TYPE. * The Enum RECORD_TYPE.
* *

View File

@ -101,13 +101,6 @@ import com.google.gwt.user.client.ui.VerticalPanel;
*/ */
public class GeoPortalDataEntryApp implements EntryPoint { public class GeoPortalDataEntryApp implements EntryPoint {
/**
* The message displayed to the user when the server cannot be reached or
* returns an error.
*/
private static final String SERVER_ERROR = "An error occurred while "
+ "attempting to contact the server. Please check your network " + "connection and try again.";
public static final GeoportalDataEntryServiceAsync geoportalDataEntryService = GWT public static final GeoportalDataEntryServiceAsync geoportalDataEntryService = GWT
.create(GeoportalDataEntryService.class); .create(GeoportalDataEntryService.class);
@ -184,15 +177,19 @@ public class GeoPortalDataEntryApp implements EntryPoint {
*/ */
geoportalCaches = new GeoPortalClientCaches(); geoportalCaches = new GeoPortalClientCaches();
RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID).add(loaderApplication); ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.getElement()
.addClassName(ConstantsGeoPortalDataEntryApp.CSS_CLASS_GEOPORTAL_LOADERS_CENTER);
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.add(loaderApplication);
mainTabPanel = new GeonaMainTabPanel(appManagerBus); mainTabPanel = new GeonaMainTabPanel(appManagerBus);
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus); geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
mainTabPanel.addFormPanel(geoNaMainForm); mainTabPanel.addFormPanel(geoNaMainForm);
RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID).add(mainTabPanel); ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.add(mainTabPanel);
RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID).getElement().getStyle().setOpacity(0.4); // ROOT_PANEL_DIV_PORTLET.getElement().getStyle().setOpacity(0.3);
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.getElement()
.addClassName(ConstantsGeoPortalDataEntryApp.CSS_CLASS_ANIMATE_FADE_IN_OUT);
GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() { GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
@ -202,11 +199,11 @@ 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(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID).remove(loaderApplication); ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication);
} catch (Exception e) { } catch (Exception e) {
} }
RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID).add(alert); ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.add(alert);
Window.alert(errorMsg); Window.alert(errorMsg);
} }
@ -232,11 +229,13 @@ 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(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID).remove(loaderApplication); ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication);
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.getElement()
.removeClassName(ConstantsGeoPortalDataEntryApp.CSS_CLASS_ANIMATE_FADE_IN_OUT);
} catch (Exception e) { } catch (Exception e) {
} }
RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID).add(alert); ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.add(alert);
Window.alert(errorMsg); Window.alert(errorMsg);
} }
@ -246,7 +245,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
GWT.log(GNADataEntryExtConfigProfile.class.getSimpleName() + " loaded: " + gNADataEntryConfig); GWT.log(GNADataEntryExtConfigProfile.class.getSimpleName() + " loaded: " + gNADataEntryConfig);
try { try {
RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID).remove(loaderApplication); ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication);
} catch (Exception e) { } catch (Exception e) {
} }
@ -295,7 +294,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
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 { try {
RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID).insert(loaderConfigurations, 0); ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.insert(loaderConfigurations, 0);
} catch (Exception e) { } catch (Exception e) {
} }
@ -304,13 +303,18 @@ public class GeoPortalDataEntryApp implements EntryPoint {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
String errorMsg = "Sorry, an error occurrend on loading configurations. Please, contact the support";
Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false);
try { try {
RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID).remove(loaderConfigurations); ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderConfigurations);
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.getElement()
.removeClassName(ConstantsGeoPortalDataEntryApp.CSS_CLASS_ANIMATE_FADE_IN_OUT);
} catch (Exception e) { } catch (Exception e) {
} }
GWT.log("caught: " + caught); ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.add(alert);
Window.alert(caught.toString()); Window.alert(errorMsg);
} }
@Override @Override
@ -326,9 +330,11 @@ public class GeoPortalDataEntryApp implements EntryPoint {
// After loading of UCD I can instance the "List of Project" view // After loading of UCD I can instance the "List of Project" view
mainTabPanel.instanceAndShowListOfProjects(); mainTabPanel.instanceAndShowListOfProjects();
try { try {
RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID).getElement().getStyle() ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.getElement()
.setOpacity(1); .removeClassName(ConstantsGeoPortalDataEntryApp.CSS_CLASS_ANIMATE_FADE_IN_OUT);
RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID).remove(loaderConfigurations); ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderConfigurations);
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.getElement()
.removeClassName(ConstantsGeoPortalDataEntryApp.CSS_CLASS_GEOPORTAL_LOADERS_CENTER);
} catch (Exception e) { } catch (Exception e) {
} }
@ -370,7 +376,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
public void updateSize() { public void updateSize() {
try { try {
RootPanel workspace = RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID); RootPanel workspace = ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET;
int topBorder = workspace.getAbsoluteTop(); int topBorder = workspace.getAbsoluteTop();
int footer = 85; // footer is bottombar + sponsor int footer = 85; // footer is bottombar + sponsor
int headerSize = 90; int headerSize = 90;
@ -567,6 +573,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
public void onSuccess(CommitReport result) { public void onSuccess(CommitReport result) {
modalContainerPanel.clear(); modalContainerPanel.clear();
modal.setCloseVisible(true); modal.setCloseVisible(true);
modal.setTitle("Project Saved!");
LifecycleInformationDV lcDV = result.getLifecycleInformation(); LifecycleInformationDV lcDV = result.getLifecycleInformation();
@ -592,6 +599,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
break; break;
} }
savedMap.put(result.getProjectID(), saveGeonaDataFormsEvent.getTreeNode());
LifecycleInformationPanel lip = new LifecycleInformationPanel(result.getProjectID(), LifecycleInformationPanel lip = new LifecycleInformationPanel(result.getProjectID(),
result.getProfileID(), result.getProjectAsJSON(), lcDV, true); result.getProfileID(), result.getProjectAsJSON(), lcDV, true);
@ -776,17 +785,17 @@ public class GeoPortalDataEntryApp implements EntryPoint {
mainTabPanel.setFilteringParameters(seachingFilterParameters); mainTabPanel.setFilteringParameters(seachingFilterParameters);
searchingFilter = mainTabPanel.getCurrentProjectsSearchingFilter(); searchingFilter = mainTabPanel.getCurrentProjectsSearchingFilter();
//Searching in the cache if the list of relation names is present // Searching in the cache if the list of relation names is present
List<String> listRelationNames = geoportalCaches.getListRelationNamesForProfileId(profileID); List<String> listRelationNames = geoportalCaches.getListRelationNamesForProfileId(profileID);
// Loading list of Relation Names for ProfileID // Loading list of Relation Names for ProfileID
if (listRelationNames == null || listRelationNames.isEmpty()) { if (listRelationNames == null || listRelationNames.isEmpty()) {
GeoPortalDataEntryApp.geoportalDataEntryService.getRelationshipNames(profileID, GeoPortalDataEntryApp.geoportalDataEntryService.getRelationshipNames(profileID,
new AsyncCallback<List<String>>() { new AsyncCallback<List<String>>() {
@Override @Override
public void onSuccess(List<String> relationshipNames) { public void onSuccess(List<String> relationshipNames) {
GWT.log("getRelationshipNames for " + profileID + " are: "+relationshipNames); GWT.log("getRelationshipNames for " + profileID + " are: " + relationshipNames);
geoportalCaches.putListRelationNamesForProfileID(profileID, relationshipNames); geoportalCaches.putListRelationNamesForProfileID(profileID, relationshipNames);
mainTabPanel.setVisibleCreateRelationButton( mainTabPanel.setVisibleCreateRelationButton(
relationshipNames != null && !relationshipNames.isEmpty()); relationshipNames != null && !relationshipNames.isEmpty());

View File

@ -159,7 +159,7 @@ public class GeonaMainTabPanel extends Composite {
theDockLayoutPanel.setWidgetHidden(listOfProjectWorkflowActionsPanel, true); theDockLayoutPanel.setWidgetHidden(listOfProjectWorkflowActionsPanel, true);
detailsPanel.addStyleName("theDetailsPanel"); detailsPanel.addStyleName("theDetailsPanel");
theDockLayoutPanel.addEast(detailsPanel, 500); theDockLayoutPanel.addEast(detailsPanel, 450);
theDockLayoutPanel.setWidgetHidden(detailsPanel, true); theDockLayoutPanel.setWidgetHidden(detailsPanel, true);
listOfProjectTablePanel = new ListOfProjectTablePanel(appManagerBus); listOfProjectTablePanel = new ListOfProjectTablePanel(appManagerBus);

View File

@ -1,23 +1,16 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.relation; package org.gcube.portlets.user.geoportaldataentry.client.ui.relation;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV; import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync; import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelationGUIEvent; import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelationGUIEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateRelationHandlerEvent;
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML; import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon; import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Label; import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.constants.ButtonType; import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconSize; import com.github.gwtbootstrap.client.ui.constants.IconSize;
import com.github.gwtbootstrap.client.ui.constants.IconType; import com.github.gwtbootstrap.client.ui.constants.IconType;
@ -35,7 +28,6 @@ import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
public class ViewRelationshipPanel extends Composite { public class ViewRelationshipPanel extends Composite {

View File

@ -66,29 +66,6 @@ public class LifecycleInformationPanel extends FlowPanel {
} }
lastOperationStatus.setHTML(lastOperationMsg); lastOperationStatus.setHTML(lastOperationMsg);
// switch (lcDV.getLastOperationStatus()) {
// case OK: {
// String success = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "32CD32", null, "SUCCESS");
// String msg = lcDV.getLastInvokedStep() + " terminated with: " + success;
// lastOperationStatus.setHTML(msg);
// break;
// }
// case WARNING: {
// String warning = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF8000", null, "WARNING");
// String msg = lcDV.getLastInvokedStep() + " terminated with: " + warning;
// lastOperationStatus.setHTML(msg);
// break;
// }
// case ERROR: {
// String error = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF0000", "bold", "ERROR");
// String msg = lcDV.getLastInvokedStep() + " terminated with: " + error;
// lastOperationStatus.setHTML(msg);
// break;
// }
// default:
// break;
// }
add(htmlPhase); add(htmlPhase);
add(htmlStep); add(htmlStep);
add(lastOperationStatus); add(lastOperationStatus);

View File

@ -5,7 +5,10 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.table;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import org.gcube.application.geoportalcommon.ConvertToDataViewModel; import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
@ -14,6 +17,7 @@ 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.geoportal.project.BasicLifecycleInformationDV.Status; import org.gcube.application.geoportalcommon.shared.geoportal.project.BasicLifecycleInformationDV.Status;
import org.gcube.application.geoportalcommon.shared.geoportal.project.PublicationInfoDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.PublicationInfoDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
import com.github.gwtbootstrap.client.ui.ButtonCell; import com.github.gwtbootstrap.client.ui.ButtonCell;
@ -53,7 +57,23 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
private AbstractDataProvider<T> dataProvider; private AbstractDataProvider<T> dataProvider;
private List<ItemFieldDV> displayFields; private List<ItemFieldDV> displayFields;
private boolean isAsyncronusTable; private boolean isAsyncronusTable;
private boolean showColumnRelationship;
private Map<COLUMN_NAME, Column> mapColumns = new HashMap<COLUMN_NAME, Column>();
public enum COLUMN_NAME {
CREATED("Created"), CREATED_BY("Created by"), PHASE("Phase"), STATUS("Status"), RELATIONSHIPS("Relationships");
String title;
COLUMN_NAME(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
}
/** /**
* Instantiates a new items table. * Instantiates a new items table.
@ -66,10 +86,6 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
this.eventBus = eventBus; this.eventBus = eventBus;
this.displayFields = displayFields; this.displayFields = displayFields;
} }
public void setShowColumnRelationship(boolean showColumnRelationship) {
this.showColumnRelationship = showColumnRelationship;
}
/** /**
* Adds the items. * Adds the items.
@ -97,7 +113,7 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true; this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true;
setEmptyTableMessage(NO_DATA); setEmptyTableMessage(NO_DATA);
int i = 0; int i = 1;
for (ItemFieldDV itemField : displayFields) { for (ItemFieldDV itemField : displayFields) {
@ -117,90 +133,19 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
DocumentDV documentDV = (DocumentDV) object; DocumentDV documentDV = (DocumentDV) object;
try { try {
//removing the '_theDocument.' prefix for searching in the Document Map // removing the '_theDocument.' prefix for searching in the Document Map
String key = itemField.getJsonFields().get(0).replace(ConstantsGeoPortalDataEntryApp.DEFAULT_DOCUMENT_PROJECTION_NAME+".", ""); String key = itemField.getJsonFields().get(0)
.replace(ConstantsGeoPortalDataEntryApp.DEFAULT_DOCUMENT_PROJECTION_NAME + ".", "");
return documentDV.getDocumentAsMap().get(key).toString(); return documentDV.getDocumentAsMap().get(key).toString();
} catch (Exception e) { } catch (Exception e) {
GWT.log("Error e: " + 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(); }
*/
return ""; 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);
//
// };
}; };
// if(i==0) {
// //name
// sortedCellTable.setColumnWidth(col, 20, Unit.PCT);
// }else if (i == 1) {
// // intro
// sortedCellTable.setColumnWidth(col, 30, Unit.PCT);
// } else if (i == 2) {
// sortedCellTable.setColumnWidth(col, 15, Unit.PCT);
// }else if(i==displayFields.size()-1) {
// sortedCellTable.setColumnWidth(col, 120, Unit.PX);
// }
sortedCellTable.addColumn(col, displayName, true); sortedCellTable.addColumn(col, displayName, true);
i++; i++;
} }
@ -227,7 +172,8 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
}; };
sortedCellTable.addColumn(colCreated, "Created", true); sortedCellTable.addColumn(colCreated, COLUMN_NAME.CREATED.getTitle(), true);
mapColumns.put(COLUMN_NAME.CREATED, colCreated);
// COL PUBLISHER // COL PUBLISHER
TextColumn<T> colPublisher = new TextColumn<T>() { TextColumn<T> colPublisher = new TextColumn<T>() {
@ -252,7 +198,8 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
}; };
sortedCellTable.addColumn(colPublisher, "Created by", true); sortedCellTable.addColumn(colPublisher, COLUMN_NAME.CREATED_BY.getTitle(), true);
mapColumns.put(COLUMN_NAME.CREATED_BY, colPublisher);
// COL PUBLICATION PHASE // COL PUBLICATION PHASE
TextColumn<T> colPublicationPhase = new TextColumn<T>() { TextColumn<T> colPublicationPhase = new TextColumn<T>() {
@ -274,7 +221,8 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
} }
}; };
sortedCellTable.addColumn(colPublicationPhase, "Phase", true); sortedCellTable.addColumn(colPublicationPhase, COLUMN_NAME.PHASE.getTitle(), true);
mapColumns.put(COLUMN_NAME.PHASE, colPublicationPhase);
// COL OPERTION STATUS // COL OPERTION STATUS
TextColumn<T> colOperationStatus = new TextColumn<T>() { TextColumn<T> colOperationStatus = new TextColumn<T>() {
@ -316,19 +264,19 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
} else if (status.equals(Status.ERROR)) { } else if (status.equals(Status.ERROR)) {
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>");
}; };
}; };
sortedCellTable.addColumn(colOperationStatus, "Status", true); sortedCellTable.addColumn(colOperationStatus, COLUMN_NAME.STATUS.getTitle(), true);
mapColumns.put(COLUMN_NAME.STATUS, colOperationStatus);
// COL OPERTION STATUS // COL OPERTION STATUS
/*TextColumn<T> colRelationship = new TextColumn<T>() { TextColumn<T> colRelationship = new TextColumn<T>() {
@Override @Override
public String getValue(T object) { public String getValue(T object) {
@ -336,54 +284,75 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
return ""; return "";
ResultDocumentDV documentDV = (ResultDocumentDV) object; ResultDocumentDV documentDV = (ResultDocumentDV) object;
String relationship = "N.A."; String htmlValue = toDisplayClusterOfRelationships(documentDV.getListRelationshipDV());
try { return htmlValue;
status = documentDV.getListRelationshipDV()!=null?
} catch (Exception e) {
// TODO: handle exception
}
return status;
} }
@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;
ResultDocumentDV documentDV = (ResultDocumentDV) object; ResultDocumentDV documentDV = (ResultDocumentDV) object;
Status status = null; List<RelationshipDV> relations = documentDV.getListRelationshipDV();
try { String color = "#333";
status = documentDV.getLifecycleInfo().getLastOperationStatus(); if (relations==null || relations.isEmpty()) {
} catch (Exception e) { color = "#555";
} }
String color = "#000"; sb.appendHtmlConstant("<span style='color:" + color + "; font-style: italic;'>");
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); super.render(context, object, sb);
sb.appendHtmlConstant("</span>"); sb.appendHtmlConstant("</span>");
};
};
}; };
if(showColumnRelationship) sortedCellTable.addColumn(colRelationship, COLUMN_NAME.RELATIONSHIPS.getTitle(), true);
sortedCellTable.addColumn(colRelationship, "Relationship", true); mapColumns.put(COLUMN_NAME.RELATIONSHIPS, colRelationship);
*/
} }
public void enableWriteOperations() { public void removeColumn(COLUMN_NAME columnName) {
try {
Column theColumn = mapColumns.get(columnName);
if (theColumn != null) {
sortedCellTable.removeColumn(theColumn);
}
} catch (Exception e) {
}
}
private String toDisplayClusterOfRelationships(List<RelationshipDV> listRelations) {
if (listRelations == null || listRelations.isEmpty()) {
return "None";
}
LinkedHashMap<String, Integer> mapclusterOfRelationships = new LinkedHashMap<String, Integer>(
listRelations.size());
for (RelationshipDV relationshipDV : listRelations) {
Integer count = mapclusterOfRelationships.get(relationshipDV.getRelationshipName());
if (count == null)
count = 0;
count++;
mapclusterOfRelationships.put(relationshipDV.getRelationshipName(), count);
}
String html = "";
for (String relationName : mapclusterOfRelationships.keySet()) {
html += mapclusterOfRelationships.get(relationName) + " - " +relationName + "\n";
}
return html;
} }
/** /**

View File

@ -48,6 +48,7 @@ h1 {
padding: 5px; padding: 5px;
margin-left: 10px; margin-left: 10px;
margin-bottom: 10px; margin-bottom: 10px;
margin-right: 5px;
} }
.my-html-table td { .my-html-table td {
@ -195,16 +196,38 @@ h1 {
margin: auto 0; margin: auto 0;
} }
#geoportal-loaders { .geoportal-loaders-center {
text-align: center; position: absolute;
width: 100%; left:40%;
padding: 200px 0;
z-index: 1000;
}
.geoportal-loaders-center table {
margin-bottom: 20px;
}
@keyframes fadeInOutAnimation {
0% {
opacity: 0.2;
}
100% {
opacity: 0.5;
}
}
.animate-fadeInOut {
animation: fadeInOutAnimation 1s infinite;
animation-direction: alternate;
animation-timing-function: linear;
} }
.theDetailsPanel { .theDetailsPanel {
margin-left: 5px; margin-left: 5px;
margin-right: 5px; margin-right: 5px;
/*border-left: 1px solid #cdcdcd;*/ border-left: 1px solid #cdcdcd;
padding-left: 5px; padding-left: 5px;
padding-right: 5px;
} }
.theDetailsPanel .accordion-group { .theDetailsPanel .accordion-group {