From 6178b38bfaf7e7fb5b11348c72f39a5a27a19ffc Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 23 Sep 2022 12:41:32 +0200 Subject: [PATCH] Improved GUI and layout --- .settings/org.eclipse.wst.common.component | 24 +- .../ConstantsGeoPortalDataEntryApp.java | 17 +- .../client/GeoPortalDataEntryApp.java | 61 ++--- .../client/ui/GeonaMainTabPanel.java | 2 +- .../ui/relation/ViewRelationshipPanel.java | 8 - .../ui/report/LifecycleInformationPanel.java | 23 -- .../client/ui/table/ItemsTable.java | 209 ++++++++---------- src/main/webapp/GeoPortalDataEntryApp.css | 31 ++- 8 files changed, 181 insertions(+), 194 deletions(-) diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 3c45b18..93db1c8 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,6 @@ - + + @@ -46,7 +47,8 @@ - + + @@ -93,7 +95,8 @@ - + + @@ -140,7 +143,8 @@ - + + @@ -196,7 +200,8 @@ uses - + + @@ -243,7 +248,8 @@ - + + @@ -290,7 +296,8 @@ - + + @@ -337,7 +344,8 @@ - + + diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java index 495b55f..516b553 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java @@ -9,6 +9,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescrip import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder; import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.ui.RootPanel; /** * The Class ConstantsGeoPortalDataEntryApp. @@ -18,9 +19,9 @@ import com.google.gwt.core.client.GWT; * Aug 6, 2021 */ public class ConstantsGeoPortalDataEntryApp { - + public static final String DIV_PORTLET_ID = "geoportal-data-entry"; - + public static final String DIV_LOADERS_ID = "geoportal-loaders"; 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 int MAX_COLUMN_DISPLAYED_IN_THE_TABLE = 5; - + public static final int PAGINATION_SIZE = 20; - + 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. * diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java index c03e6ad..d22818f 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java @@ -101,13 +101,6 @@ import com.google.gwt.user.client.ui.VerticalPanel; */ 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 .create(GeoportalDataEntryService.class); @@ -184,15 +177,19 @@ public class GeoPortalDataEntryApp implements EntryPoint { */ 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); geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus); 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() { @@ -202,11 +199,11 @@ public class GeoPortalDataEntryApp implements EntryPoint { Alert alert = new Alert(errorMsg, AlertType.ERROR); alert.setClose(false); try { - RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID).remove(loaderApplication); + ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication); } catch (Exception e) { } - RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID).add(alert); + ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.add(alert); Window.alert(errorMsg); } @@ -232,11 +229,13 @@ public class GeoPortalDataEntryApp implements EntryPoint { Alert alert = new Alert(errorMsg, AlertType.ERROR); alert.setClose(false); 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) { } - RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID).add(alert); + ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.add(alert); Window.alert(errorMsg); } @@ -246,7 +245,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { GWT.log(GNADataEntryExtConfigProfile.class.getSimpleName() + " loaded: " + gNADataEntryConfig); try { - RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID).remove(loaderApplication); + ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication); } catch (Exception e) { } @@ -295,7 +294,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { GWT.log("loading GeoportalConfigsAndBuildCards in the scope: " + scope); // orderedCards = new ArrayList(); try { - RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID).insert(loaderConfigurations, 0); + ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.insert(loaderConfigurations, 0); } catch (Exception e) { } @@ -304,13 +303,18 @@ public class GeoPortalDataEntryApp implements EntryPoint { @Override 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 { - 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) { } - GWT.log("caught: " + caught); - Window.alert(caught.toString()); + ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.add(alert); + Window.alert(errorMsg); } @Override @@ -326,9 +330,11 @@ public class GeoPortalDataEntryApp implements EntryPoint { // After loading of UCD I can instance the "List of Project" view mainTabPanel.instanceAndShowListOfProjects(); try { - RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID).getElement().getStyle() - .setOpacity(1); - RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID).remove(loaderConfigurations); + ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.getElement() + .removeClassName(ConstantsGeoPortalDataEntryApp.CSS_CLASS_ANIMATE_FADE_IN_OUT); + ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderConfigurations); + ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.getElement() + .removeClassName(ConstantsGeoPortalDataEntryApp.CSS_CLASS_GEOPORTAL_LOADERS_CENTER); } catch (Exception e) { } @@ -370,7 +376,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { public void updateSize() { try { - RootPanel workspace = RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID); + RootPanel workspace = ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET; int topBorder = workspace.getAbsoluteTop(); int footer = 85; // footer is bottombar + sponsor int headerSize = 90; @@ -567,6 +573,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { public void onSuccess(CommitReport result) { modalContainerPanel.clear(); modal.setCloseVisible(true); + modal.setTitle("Project Saved!"); LifecycleInformationDV lcDV = result.getLifecycleInformation(); @@ -592,6 +599,8 @@ public class GeoPortalDataEntryApp implements EntryPoint { break; } + savedMap.put(result.getProjectID(), saveGeonaDataFormsEvent.getTreeNode()); + LifecycleInformationPanel lip = new LifecycleInformationPanel(result.getProjectID(), result.getProfileID(), result.getProjectAsJSON(), lcDV, true); @@ -776,17 +785,17 @@ public class GeoPortalDataEntryApp implements EntryPoint { mainTabPanel.setFilteringParameters(seachingFilterParameters); 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 listRelationNames = geoportalCaches.getListRelationNamesForProfileId(profileID); // Loading list of Relation Names for ProfileID if (listRelationNames == null || listRelationNames.isEmpty()) { - + GeoPortalDataEntryApp.geoportalDataEntryService.getRelationshipNames(profileID, new AsyncCallback>() { @Override public void onSuccess(List relationshipNames) { - GWT.log("getRelationshipNames for " + profileID + " are: "+relationshipNames); + GWT.log("getRelationshipNames for " + profileID + " are: " + relationshipNames); geoportalCaches.putListRelationNamesForProfileID(profileID, relationshipNames); mainTabPanel.setVisibleCreateRelationButton( relationshipNames != null && !relationshipNames.isEmpty()); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java index 44b1d6c..f2b11b8 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java @@ -159,7 +159,7 @@ public class GeonaMainTabPanel extends Composite { theDockLayoutPanel.setWidgetHidden(listOfProjectWorkflowActionsPanel, true); detailsPanel.addStyleName("theDetailsPanel"); - theDockLayoutPanel.addEast(detailsPanel, 500); + theDockLayoutPanel.addEast(detailsPanel, 450); theDockLayoutPanel.setWidgetHidden(detailsPanel, true); listOfProjectTablePanel = new ListOfProjectTablePanel(appManagerBus); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java index 33860d3..43653bd 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java @@ -1,23 +1,16 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.relation; import java.util.HashMap; -import java.util.List; 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.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp; 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.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.utils.LoaderIcon; -import com.github.gwtbootstrap.client.ui.Alert; import com.github.gwtbootstrap.client.ui.Button; 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.IconSize; 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.HTML; import com.google.gwt.user.client.ui.HTMLPanel; -import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Widget; public class ViewRelationshipPanel extends Composite { diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/LifecycleInformationPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/LifecycleInformationPanel.java index 90baec1..888d3c2 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/LifecycleInformationPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/LifecycleInformationPanel.java @@ -66,29 +66,6 @@ public class LifecycleInformationPanel extends FlowPanel { } 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(htmlStep); add(lastOperationStatus); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java index a993805..95f4e33 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java @@ -5,7 +5,10 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.table; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Set; 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.project.BasicLifecycleInformationDV.Status; 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 com.github.gwtbootstrap.client.ui.ButtonCell; @@ -53,7 +57,23 @@ public class ItemsTable extends AbstractItemsCellTable private AbstractDataProvider dataProvider; private List displayFields; private boolean isAsyncronusTable; - private boolean showColumnRelationship; + + private Map mapColumns = new HashMap(); + + 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. @@ -66,10 +86,6 @@ public class ItemsTable extends AbstractItemsCellTable this.eventBus = eventBus; this.displayFields = displayFields; } - - public void setShowColumnRelationship(boolean showColumnRelationship) { - this.showColumnRelationship = showColumnRelationship; - } /** * Adds the items. @@ -97,7 +113,7 @@ public class ItemsTable extends AbstractItemsCellTable this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true; setEmptyTableMessage(NO_DATA); - int i = 0; + int i = 1; for (ItemFieldDV itemField : displayFields) { @@ -117,90 +133,19 @@ public class ItemsTable extends AbstractItemsCellTable DocumentDV documentDV = (DocumentDV) object; try { - //removing the '_theDocument.' prefix for searching in the Document Map - String key = itemField.getJsonFields().get(0).replace(ConstantsGeoPortalDataEntryApp.DEFAULT_DOCUMENT_PROJECTION_NAME+".", ""); + // removing the '_theDocument.' prefix for searching in the Document Map + String key = itemField.getJsonFields().get(0) + .replace(ConstantsGeoPortalDataEntryApp.DEFAULT_DOCUMENT_PROJECTION_NAME + ".", ""); return documentDV.getDocumentAsMap().get(key).toString(); } 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(); } - */ - 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(""); -// super.render(context, object, sb); -// sb.appendHtmlConstant(""); -// } 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); - i++; } @@ -227,7 +172,8 @@ public class ItemsTable extends AbstractItemsCellTable }; - sortedCellTable.addColumn(colCreated, "Created", true); + sortedCellTable.addColumn(colCreated, COLUMN_NAME.CREATED.getTitle(), true); + mapColumns.put(COLUMN_NAME.CREATED, colCreated); // COL PUBLISHER TextColumn colPublisher = new TextColumn() { @@ -252,7 +198,8 @@ public class ItemsTable extends AbstractItemsCellTable }; - 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 TextColumn colPublicationPhase = new TextColumn() { @@ -274,7 +221,8 @@ public class ItemsTable extends AbstractItemsCellTable } }; - sortedCellTable.addColumn(colPublicationPhase, "Phase", true); + sortedCellTable.addColumn(colPublicationPhase, COLUMN_NAME.PHASE.getTitle(), true); + mapColumns.put(COLUMN_NAME.PHASE, colPublicationPhase); // COL OPERTION STATUS TextColumn colOperationStatus = new TextColumn() { @@ -316,19 +264,19 @@ public class ItemsTable extends AbstractItemsCellTable } else if (status.equals(Status.ERROR)) { color = "red"; } - sb.appendHtmlConstant(""); + sb.appendHtmlConstant(""); super.render(context, object, sb); sb.appendHtmlConstant(""); - + }; }; - sortedCellTable.addColumn(colOperationStatus, "Status", true); - - + sortedCellTable.addColumn(colOperationStatus, COLUMN_NAME.STATUS.getTitle(), true); + mapColumns.put(COLUMN_NAME.STATUS, colOperationStatus); + // COL OPERTION STATUS - /*TextColumn colRelationship = new TextColumn() { + TextColumn colRelationship = new TextColumn() { @Override public String getValue(T object) { @@ -336,54 +284,75 @@ public class ItemsTable extends AbstractItemsCellTable return ""; ResultDocumentDV documentDV = (ResultDocumentDV) object; - String relationship = "N.A."; - try { - status = documentDV.getListRelationshipDV()!=null? - } catch (Exception e) { - // TODO: handle exception - } - - return status; + String htmlValue = toDisplayClusterOfRelationships(documentDV.getListRelationshipDV()); + return htmlValue; } - + @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) { - + List relations = documentDV.getListRelationshipDV(); + String color = "#333"; + if (relations==null || relations.isEmpty()) { + color = "#555"; } - - 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(""); + + sb.appendHtmlConstant(""); super.render(context, object, sb); sb.appendHtmlConstant(""); - - }; + }; + }; - if(showColumnRelationship) - sortedCellTable.addColumn(colRelationship, "Relationship", true); - */ - + sortedCellTable.addColumn(colRelationship, COLUMN_NAME.RELATIONSHIPS.getTitle(), 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 listRelations) { + + if (listRelations == null || listRelations.isEmpty()) { + return "None"; + } + + LinkedHashMap mapclusterOfRelationships = new LinkedHashMap( + 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; } /** diff --git a/src/main/webapp/GeoPortalDataEntryApp.css b/src/main/webapp/GeoPortalDataEntryApp.css index f8df84f..4330175 100644 --- a/src/main/webapp/GeoPortalDataEntryApp.css +++ b/src/main/webapp/GeoPortalDataEntryApp.css @@ -48,6 +48,7 @@ h1 { padding: 5px; margin-left: 10px; margin-bottom: 10px; + margin-right: 5px; } .my-html-table td { @@ -195,16 +196,38 @@ h1 { margin: auto 0; } -#geoportal-loaders { - text-align: center; - width: 100%; +.geoportal-loaders-center { + position: absolute; + 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 { margin-left: 5px; margin-right: 5px; - /*border-left: 1px solid #cdcdcd;*/ + border-left: 1px solid #cdcdcd; padding-left: 5px; + padding-right: 5px; } .theDetailsPanel .accordion-group {