This commit is contained in:
Francesco Mangiacrapa 2020-11-24 12:58:13 +01:00
parent 8564db4079
commit 6119f81969
2 changed files with 175 additions and 167 deletions

View File

@ -143,8 +143,6 @@ public class LayerManager {
@Override @Override
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) { public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
try {
GWT.log("GeoNaDataObject's: "+listGeonaDataObjects); GWT.log("GeoNaDataObject's: "+listGeonaDataObjects);
GeoportalDataViewerConstants.print("GeoNaDataObject's: "+listGeonaDataObjects); GeoportalDataViewerConstants.print("GeoNaDataObject's: "+listGeonaDataObjects);
@ -167,24 +165,34 @@ public class LayerManager {
feature = features.get(0); feature = features.get(0);
Map<String, List<String>> entries = feature.getMapProperties(); Map<String, List<String>> entries = feature.getMapProperties();
String nome = "";
String descrizione = "";
String date = "";
for (String key : entries.keySet()) { for (String key : entries.keySet()) {
String theValue = entries.get(key).get(0); String theValue = entries.get(key).get(0);
if(key.equalsIgnoreCase("nome")) { if(key.equalsIgnoreCase("nome")) {
flex.setHTML(0, 0, new HTML(theValue).toString()); nome = theValue!=null?theValue:"";
} }
else if(key.equalsIgnoreCase("descrizione")) { else if(key.equalsIgnoreCase("descrizione")) {
String reducedValue = theValue; descrizione = theValue!=null?theValue:"";
}else if(key.equalsIgnoreCase("date_scavo")) {
date = theValue!=null?theValue:"";
}
}
GeoportalDataViewerConstants.print("0: "+nome);
flex.setHTML(0, 0, new HTML(nome).toString());
try { try {
reducedValue = StringUtil.ellipsize(theValue, 300); descrizione = StringUtil.ellipsize(descrizione, 100);
GWT.log("reduced: "+reducedValue); GWT.log("reduced: "+descrizione);
} catch (Exception e) { } catch (Exception e) {
GWT.log("error: "+e.getMessage()); GWT.log("error: "+e.getMessage());
} }
flex.setText(1, 0, reducedValue); GeoportalDataViewerConstants.print("1: "+descrizione);
}else if(key.equalsIgnoreCase("date_scavo")) { flex.setText(1, 0, descrizione);
flex.setHTML(2, 0, new HTML("<code>"+theValue+"</code>").toString()); GeoportalDataViewerConstants.print("2: "+date);
} flex.setHTML(2, 0, new HTML("<code>"+date+"</code>").toString());
}
/*Scheduler.get().scheduleDeferred(new ScheduledCommand() { /*Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@ -317,9 +325,6 @@ public class LayerManager {
} }
}); });
} }
}catch (Exception e) {
GeoportalDataViewerConstants.print(e.getMessage());
}
} }
}); });
} }

View File

@ -23,9 +23,12 @@ public class StringUtil {
*/ */
public static String ellipsize(String input, int maxCharacters) { public static String ellipsize(String input, int maxCharacters) {
if (input == null || input.length() < maxCharacters) { if(input==null)
return "";
if (input.length() < maxCharacters)
return input; return input;
}
return input.substring(0, maxCharacters)+"..."; return input.substring(0, maxCharacters)+"...";
} }
} }