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
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
try {
GWT.log("GeoNaDataObject's: "+listGeonaDataObjects);
GeoportalDataViewerConstants.print("GeoNaDataObject's: "+listGeonaDataObjects);
@ -167,24 +165,34 @@ public class LayerManager {
feature = features.get(0);
Map<String, List<String>> entries = feature.getMapProperties();
String nome = "";
String descrizione = "";
String date = "";
for (String key : entries.keySet()) {
String theValue = entries.get(key).get(0);
if(key.equalsIgnoreCase("nome")) {
flex.setHTML(0, 0, new HTML(theValue).toString());
nome = theValue!=null?theValue:"";
}
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 {
reducedValue = StringUtil.ellipsize(theValue, 300);
GWT.log("reduced: "+reducedValue);
descrizione = StringUtil.ellipsize(descrizione, 100);
GWT.log("reduced: "+descrizione);
} catch (Exception e) {
GWT.log("error: "+e.getMessage());
}
flex.setText(1, 0, reducedValue);
}else if(key.equalsIgnoreCase("date_scavo")) {
flex.setHTML(2, 0, new HTML("<code>"+theValue+"</code>").toString());
}
}
GeoportalDataViewerConstants.print("1: "+descrizione);
flex.setText(1, 0, descrizione);
GeoportalDataViewerConstants.print("2: "+date);
flex.setHTML(2, 0, new HTML("<code>"+date+"</code>").toString());
/*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) {
if (input == null || input.length() < maxCharacters) {
if(input==null)
return "";
if (input.length() < maxCharacters)
return input;
}
return input.substring(0, maxCharacters)+"...";
}
}