From eb8dceb8ff77611092b0f516645f2b1ff0c70a1d Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 12 Oct 2021 17:18:54 +0200 Subject: [PATCH] Edit mode: showing the field "didascalia" instead of "titolo" in case of immagini --- .classpath | 6 ++-- .../com.gwtplugins.gdt.eclipse.core.prefs | 2 +- .../client/ui/edit/EditModeRecord.ui.xml | 6 ++-- .../client/ui/edit/UpdateFileset.java | 3 +- .../client/ui/utils/StringUtil.java | 34 +++++++++++++++++++ 5 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/StringUtil.java diff --git a/.classpath b/.classpath index f66ef9e..75ff1cc 100644 --- a/.classpath +++ b/.classpath @@ -1,12 +1,12 @@ - + - + @@ -35,5 +35,5 @@ - + diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs index 1a6fa73..53eb894 100644 --- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs +++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs @@ -1,5 +1,5 @@ eclipse.preferences.version=1 jarsExcludedFromWebInfLib= -lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT +lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0 warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.ui.xml index a22fb9b..50ffd6b 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.ui.xml @@ -24,9 +24,9 @@ Source Project Editor - You can update the Source Project by editing - its model - data displayed in the following Editor. + You can update the project by editing + the + model data displayed in the following editor.

Be careful not to change the diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateFileset.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateFileset.java index 66de13c..51036f8 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateFileset.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateFileset.java @@ -21,6 +21,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServi import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent; import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogConfirm; import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform; +import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.StringUtil; import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField; import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton; import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.DialogUpload; @@ -326,7 +327,7 @@ public class UpdateFileset extends Composite { } for (UploadedImageDV uploadedImageDV : listImmagini) { - fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, uploadedImageDV.getTitolo(), + fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, StringUtil.ellipsize(uploadedImageDV.getDidascalia(),30), uploadedImageDV.getListWsContent()); posizIndex++; } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/StringUtil.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/StringUtil.java new file mode 100644 index 0000000..1859e79 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/StringUtil.java @@ -0,0 +1,34 @@ +/** + * + */ +package org.gcube.portlets.user.geoportaldataentry.client.ui.utils; + +/** + * The Class StringUtil. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Oct 12, 2021 + */ +public class StringUtil { + + /** + * Ellipsize. + * + * @param input the input string that may be subjected to shortening + * @param maxCharacters the maximum characters that must be returned for the + * input string + * @return the string + */ + public static String ellipsize(String input, int maxCharacters) { + + if (input == null) + return ""; + + if (input.length() < maxCharacters) + return input; + + return input.substring(0, maxCharacters) + "..."; + } + +}