Migrated the Search facility

This commit is contained in:
Francesco Mangiacrapa 2022-10-24 12:23:52 +02:00
parent 0fb238f0b4
commit 0a5cd91c55
11 changed files with 264 additions and 263 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -22,7 +23,8 @@
<wb-module deploy-name="geoportal-data-viewer-app-3.0.0-SNAPSHOT">
@ -45,7 +47,8 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -68,7 +71,8 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -91,7 +95,8 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
@ -114,7 +119,8 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -140,7 +146,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">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -163,7 +170,8 @@
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
@ -186,7 +194,8 @@
<property name="context-root" value="geoportal-data-viewer-app"/>
@ -209,7 +218,8 @@
</wb-module>

View File

@ -8,6 +8,7 @@ import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
@ -59,6 +60,7 @@ import com.google.gwt.core.client.ScriptInjector;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
@ -149,8 +151,7 @@ public class GeoportalDataViewer implements EntryPoint {
public void onSuccess(List<ItemFieldsResponse> itemFieldsResult) {
GWT.log("listOfFieldsForSearching: " + itemFieldsResult);
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),
itemFieldsResult);
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(), itemFieldsResult);
RootPanel.get(APP_DIV).add(mainPanel);
initApplication();
@ -158,14 +159,6 @@ public class GeoportalDataViewer implements EntryPoint {
}
});
// GWT.log("listOfFieldsForSearching: " + mapOfSearchingFilterForUCD);
//
// mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),
// mapOfSearchingFilterForUCD);
// RootPanel.get(APP_DIV).add(mainPanel);
//
// initApplication();
}
private void initApplication() {
@ -225,7 +218,8 @@ public class GeoportalDataViewer implements EntryPoint {
+ paramGeonaItemID);
return;
}
GeoportalItemReferences gir = new GeoportalItemReferences(paramGeonaItemID, paramGeonaItemType);
GeoportalItemReferences gir = new GeoportalItemReferences(paramGeonaItemID,
paramGeonaItemType);
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
}
@ -259,7 +253,6 @@ public class GeoportalDataViewer implements EntryPoint {
return listBaseMapLayers;
}
/**
* Update window size.
*/
@ -383,28 +376,6 @@ public class GeoportalDataViewer implements EntryPoint {
}
});
// if (!found) {
//
// if (showDetailsEvent.getGeonaItemType().equalsIgnoreCase("Concessione")) {
//
// GeoportalDataViewerServiceAsync.Util.getInstance().getConcessioneForId(geonaMongoId,
// new AsyncCallback<ConcessioneDV>() {
//
// @Override
// public void onFailure(Throwable caught) {
// Window.alert(caught.getMessage());
// mainPanel.hidePanelDetails();
//
// }
//
// @Override
// public void onSuccess(ConcessioneDV concessioneDV) {
// GWT.log("Showing: " + concessioneDV);
// mainPanel.showAsDetails(concessioneDV, showDetailsEvent.getGeonaItemRef());
// }
// });
// }
// }
}
});
@ -419,30 +390,36 @@ public class GeoportalDataViewer implements EntryPoint {
try {
GWT.log("onLayerRendered Timer PART MUST BE REVISITED");
/*
* attempt = 0;
*
* if (paramGeonaItemID != null) { // waiting for record retrieved by service
* before calling the WFS final int MAX_RETRY = 15; Timer timer = new
* com.google.gwt.user.client.Timer() {
*
* @Override public void run() { attempt++; GWT.log("waiting get record: " +
* attempt);
*
*
*
*
* RecordDV record = mainPanel.getDisplayedRecord(); if (record != null) {
* this.cancel(); GWT.log("cancelled timer"); performWFSQueryOnCentroid(record);
* }
*
* if (attempt > MAX_RETRY) { GWT.log("MAX_RETRY reached, cancelled timer");
* this.cancel(); }
*
* } }; timer.scheduleRepeating(1000);
*
* }
*/
attempt = 0;
if (paramGeonaItemID != null) { // waiting for record retrieved by service before calling the WFS
final int MAX_RETRY = 15;
Timer timer = new com.google.gwt.user.client.Timer() {
@Override
public void run() {
attempt++;
GWT.log("waiting get record: " + attempt);
ProjectView record = mainPanel.getDisplayedProject();
if (record != null) {
this.cancel();
GWT.log("cancelled timer");
performWFSQueryOnCentroid(record);
}
if (attempt > MAX_RETRY) {
GWT.log("MAX_RETRY reached, cancelled timer");
this.cancel();
}
}
};
timer.scheduleRepeating(1000);
}
} catch (Exception e) {
// TODO: handle exception
}
@ -472,7 +449,7 @@ public class GeoportalDataViewer implements EntryPoint {
@Override
public void onZoomOut(ZoomOutOverMinimumEvent zoomOutEvent) {
if (mainPanel.getDisplayedRecord() == null && !olMapMng.isQueryPointActive()) {
if (mainPanel.getDisplayedProject() == null && !olMapMng.isQueryPointActive()) {
olMapMng.hidePopInfo();
layerManager.removeAllDetailLayers();
@ -563,16 +540,16 @@ public class GeoportalDataViewer implements EntryPoint {
}
});
applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, new ShowPopupOnCentroiEventHandler() {
@Override
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
if (showPopupOnCentroiEvent.getRecord() != null)
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord());
}
});
// applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, new ShowPopupOnCentroiEventHandler() {
//
// @Override
// public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
//
// if (showPopupOnCentroiEvent.getRecord() != null)
// performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord());
//
// }
// });
applicationBus.addHandler(SearchPerformedEvent.TYPE, new SearchPerformedEventHandler() {
@ -625,32 +602,26 @@ public class GeoportalDataViewer implements EntryPoint {
//
// }-*/;
private void performWFSQueryOnCentroid(RecordDV record) {
if (record != null) {
GWT.log("record instanceof ConcessioneDV: " + (record instanceof ConcessioneDV) + " with mongo item id: "
+ record.getItemId());
// GeoportalDataViewerConstants.print("record instanceof ConcessioneDV: "
// +(record instanceof ConcessioneDV));
if (record instanceof ConcessioneDV) {
ConcessioneDV concessioneDV = (ConcessioneDV) record;
Double x = concessioneDV.getCentroidLong();
Double y = concessioneDV.getCentroidLat();
GWT.log("X: " + x + ", Y:" + y);
if (x != null && y != null) {
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y),
MAP_PROJECTION.EPSG_4326.getName(), MAP_PROJECTION.EPSG_3857.getName());
GeoQuery select = olMapMng.toDataPointQuery(transfCoord, false);
GWT.log("GeoQuery: " + select);
// GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(),
transfCoord.getY());
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt, record.getItemId(),
true, MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
} else {
GeoportalDataViewerConstants.printJs(
"I cannot select the point one or both coordiantes are null. X: " + x + ", Y:" + y);
}
private void performWFSQueryOnCentroid(ProjectView project) {
if (project != null) {
Double x = project.getCentroidLong();
Double y = project.getCentroidLat();
GWT.log("X: " + x + ", Y:" + y);
if (x != null && y != null) {
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y),
MAP_PROJECTION.EPSG_4326.getName(), MAP_PROJECTION.EPSG_3857.getName());
GeoQuery select = olMapMng.toDataPointQuery(transfCoord, false);
GWT.log("GeoQuery: " + select);
// GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(),
transfCoord.getY());
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt,
project.getTheProjectDV().getId(), true, MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
} else {
GeoportalDataViewerConstants
.printJs("I cannot select the point one or both coordiantes are null. X: " + x + ", Y:" + y);
}
}
}

View File

@ -8,11 +8,13 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
@ -347,34 +349,6 @@ public class LayerManager {
}
});
// GeoportalDataViewerServiceAsync.Util.getInstance().getLayersForId(
// "concessione", theProductID,
// new AsyncCallback<List<LayerConcessioneDV>>() {
//
// @Override
// public void onFailure(Throwable caught) {
// // TODO Auto-generated method stub
//
// }
//
// @Override
// public void onSuccess(List<LayerConcessioneDV> result) {
//
// for (LayerConcessioneDV layer : result) {
// GWT.log("Adding layer: "
// + layer.getLayerName());
// addLayer("concessione", layer.getLayerName(),
// layer.getLayerName(),
// layer.getWmsLink(), false, false,
// layer.getLayerUUID(), true,
// OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
// OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
// layer.getRefersTo());
// }
//
// }
// });
}
} else {
// removing all WMS detail layers if the ZOOM level is <
@ -434,10 +408,11 @@ public class LayerManager {
if (productIds != null && productIds.size() > 0) {
String productId = productIds.get(0);
String itemName = "Dettagli Prodotto";
List<String> listName = fRow.getMapProperties().get("nome");
if (listName != null && listName.size() > 0) {
itemName = listName.get(0);
}
GWT.log("Dettagli prodotto must be revisited");
// List<String> listName = fRow.getMapProperties().get("nome");
// if (listName != null && listName.size() > 0) {
// itemName = listName.get(0);
// }
LayerObjectType layerObjectType = layerObject.getType();
return new ShowDetailsEvent(layerObjectType != null ? layerObjectType.name() : null,
@ -770,13 +745,21 @@ public class LayerManager {
String newProjectID = lo.getProjectID();
if (prevProjectId.compareTo(newProjectID) != 0) {
String concessioneIntro = newProjectID.length() > 100
? StringUtil.ellipsize(newProjectID, 100)
: newProjectID;
Heading heading = new Heading(4, concessioneIntro);
heading.setTitle(newProjectID);
// String projectIntro = newProjectID.length() > 100 ? StringUtil.ellipsize(newProjectID, 100)
// : newProjectID;
//
ProjectDV projectDV = lo.getProjectDV();
Entry<String, Object> firstEntry = projectDV.getTheDocument().getFirstEntryOfMap();
String htmlMsg = firstEntry.getKey()+": " +firstEntry.getValue();
String projectIntro = htmlMsg.length() > 100 ? StringUtil.ellipsize(htmlMsg, 100)
: htmlMsg;
Heading heading = new Heading(4, lo.getProjectDV().getProfileName());
heading.setTitle("Project ID:"+newProjectID);
heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
flowPanel.add(heading);
flowPanel.add(new HTML(projectIntro));
Button buttOpenProject = new Button("Open Project");
final String buttId = "open-details-" + Random.nextInt();

View File

@ -1,35 +1,32 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ShowDetailsEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jul 30, 2021
* Jul 30, 2021
*/
public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHandler> {
public static Type<ShowPopupOnCentroiEventHandler> TYPE = new Type<ShowPopupOnCentroiEventHandler>();
private RecordDV record;
private DocumentDV document;
/**
* Instantiates a new show details event.
*
* @param geonaItemType the geona item type
* @param geonaMongoID the geona mongo ID
* @param itemName the item name
* @param featureRow the feature row
*/
public ShowPopupOnCentroiEvent(DocumentDV document) {
this.document = document;
// /**
// * Instantiates a new show details event.
// *
// * @param geonaItemType the geona item type
// * @param geonaMongoID the geona mongo ID
// * @param itemName the item name
// * @param featureRow the feature row
// */
// public ShowPopupOnCentroiEvent(RecordDV record) {
// this.record = record;
//
// }
}
/**
* Gets the associated type.
@ -51,11 +48,9 @@ public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHan
handler.onShowPopup(this);
}
public RecordDV getRecord() {
return record;
public DocumentDV getDocument() {
return document;
}
}

View File

@ -8,7 +8,7 @@
}
.to-align-right{
position: absolute;
top: 10px;
top: 40px;
right: 10px;
}
</ui:style>

View File

@ -397,7 +397,7 @@ public class GeonaDataViewMainPanel extends Composite {
*
* @return the displayed record
*/
public ProjectView getDisplayedRecord() {
public ProjectView getDisplayedProject() {
return detailsPanel.getDisplayedProject();
}

View File

@ -30,6 +30,7 @@ import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
@ -43,7 +44,7 @@ public class ProjectViewer extends Composite {
}
@UiField
PageHeader pageHeaderTitle;
HTMLPanel headerPanel;
@UiField
HTMLPanel pageViewDetails;
@ -94,7 +95,7 @@ public class ProjectViewer extends Composite {
? projectView.getTheProjectDV().getProfileName()
: projectView.getTheProjectDV().getId();
pageHeaderTitle.setText("Project: " + theTitle);
headerPanel.add(new HTML("Project: " + theTitle));
shareButton.setType(ButtonType.LINK);
shareButton.setIcon(IconType.SHARE);

View File

@ -15,10 +15,15 @@
.align-to-right {
right: 20px;
position: absolute;
top: 20px !important;
}
.the-title h1 {
font-size: 28px;
.the-title {
background-color: rgba(0,60,136,.7);
color: white;
font-style: italic;
padding: 5px 10px;
font-size: 14px;
}
.margin-bottom-10 {
@ -29,18 +34,20 @@
width: 100%;
}
</ui:style>
<g:HTMLPanel ui:field="pageViewDetails">
<g:HTMLPanel>
<!-- <g:HTMLPanel ui:field="sharePanel" -->
<!-- addStyleNames="{style.align-to-right}"> -->
<!-- </g:HTMLPanel> -->
<b:PageHeader ui:field="pageHeaderTitle"
addStyleNames="{style.the-title}"></b:PageHeader>
<g:HorizontalPanel
addStyleNames="{style.margin-bottom-10}">
<b:Button ui:field="shareButton">Share</b:Button>
<b:Button ui:field="expandButton">Expand</b:Button>
<b:Button ui:field="relationshipsButton">Relationships</b:Button>
</g:HorizontalPanel>
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
<g:HTMLPanel ui:field="headerPanel"
addStyleNames="{style.the-title}"></g:HTMLPanel>
<g:HTMLPanel ui:field="pageViewDetails">
<g:HorizontalPanel
addStyleNames="{style.margin-bottom-10}">
<b:Button ui:field="shareButton">Share</b:Button>
<b:Button ui:field="expandButton">Expand</b:Button>
<b:Button ui:field="relationshipsButton">Relationships</b:Button>
</g:HorizontalPanel>
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -6,15 +6,20 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.WhereClause;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
@ -24,6 +29,7 @@ import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
@ -32,11 +38,14 @@ import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.cellview.client.TextColumn;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
@ -55,6 +64,8 @@ public class SearchFacilityUI extends Composite {
protected static final int MIN_LENGHT_SERCHING_STRING = 3;
public static final String DEFAULT_DOCUMENT_PROJECTION_NAME = "_theDocument";
@UiField
ListBox listBoxSortBy;
@ -86,6 +97,10 @@ public class SearchFacilityUI extends Composite {
private static final String LABEL_FILTER_SEPARATOR = " - ";
protected static final int MAX_TEXT_DIMENSION = 100;
protected static final int MAX_COLUMNS_RESULTS = 3;
private ResultSetPaginatedData latestResult;
private DropdownButton searchFacilityButton;
@ -261,86 +276,105 @@ public class SearchFacilityUI extends Composite {
@Override
public void onSuccess(ResultSetPaginatedData result) {
Window.alert("searchConcessioni must be revisited");
/*
* appManagerBus.fireEvent(new SearchPerformedEvent(result.getData(),false));
*
*
* setSearchEnabled(true); latestResult = result;
*
* panelResults.clear(); panelResults.add(new HTML("<hr>"));
*
* if (result.getData().size() == 0) { panelResults.add(new
* HTML("No result found")); return; }
*
* FlexTable ft = new FlexTable();
* ft.getElement().setClassName("table-results");
*
* for (ItemFieldDV itemField : searchForFields) {
*
* }
*
*
* int i = 1; ft.setWidget(0, i, new HTML("Nome Progetto"));
*
* String selValue = listBoxSearchFor.getSelectedValue().toLowerCase();
*
* boolean addIntroduction = false; if(selValue.startsWith("proj") ||
* selValue.startsWith("any")) { ft.setWidget(0, ++i, new HTML("Introduzione"));
* addIntroduction = true; }
*
* boolean addStaff = false; if(selValue.startsWith("director")) {
* ft.setWidget(0, ++i, new HTML("Autori")); ft.setWidget(0, ++i, new
* HTML("Responsabile")); ft.setWidget(0, ++i, new HTML("Editore"));
* ft.setWidget(0, ++i, new HTML("Titolari")); ft.setWidget(0, ++i, new
* HTML("Contributore")); addStaff = true; } boolean addParole = false;
* if(selValue.startsWith("keyword")) { ft.setWidget(0, ++i, new
* HTML("Parole Libere")); ft.setWidget(0, ++i, new HTML("Parole Cronologia"));
* addParole = true; }
*
* i = 1; for (DocumentDV concessione : result.getData()) { int j = -1;
*
* NavLink locateOnMap = new NavLink("Show");
* locateOnMap.setTitle("Locate on the Map and show details");
* locateOnMap.setIcon(IconType.MAP_MARKER);
*
* locateOnMap.addClickHandler(new ClickHandler() {
*
* @Override public void onClick(ClickEvent event) { GeoportalItemReferences gir = new
* GeoportalItemReferences(concessione.getItemId(),
* GeoportalDataViewerConstants.RECORD_TYPE.CONCESSIONE.toString());
* appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, null));
* appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(concessione));
*
* } });
*
* ft.setWidget(i, ++j, locateOnMap);
*
*
* ft.setWidget(i, ++j, new HTML(concessione.getNome())); if(addIntroduction)
* ft.setWidget(i, ++j, new
* HTML(StringUtil.ellipsize(concessione.getIntroduzione(), 200)));
*
* if(addStaff) { ft.setWidget(i, ++j, new
* HTML(toDisplayList(concessione.getAuthors()))); ft.setWidget(i, ++j, new
* HTML(toDisplayList(Arrays.asList(concessione.getResponsabile()))));
* ft.setWidget(i, ++j, new
* HTML(toDisplayList(Arrays.asList(concessione.getEditore()))));
* ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getTitolari())));
* ft.setWidget(i, ++j, new
* HTML(toDisplayList(Arrays.asList(concessione.getContributore())))); }
*
* if(addParole) { ft.setWidget(i, ++j, new
* HTML(toDisplayList(concessione.getParoleChiaveLibere()))); ft.setWidget(i,
* ++j, new HTML(toDisplayList(concessione.getParoleChiaveICCD()))); }
*
*
*
* i++; }
*
* panelResults.add(ft);
*
*/
appManagerBus.fireEvent(new SearchPerformedEvent(result.getData(), false));
setSearchEnabled(true);
latestResult = result;
panelResults.clear();
panelResults.add(new HTML("<hr>"));
if (result.getData().size() == 0) {
panelResults.add(new HTML("No result found"));
return;
}
FlexTable ft = new FlexTable();
ft.getElement().setClassName("table-results");
int i = 0;
// Table headers
for (ItemFieldDV itemField : searchForFields) {
if (i > MAX_COLUMNS_RESULTS) {
break;
}
i++;
String displayName = itemField.getDisplayName();
ft.setWidget(0, i, new HTML(displayName));
}
// From the Second row
i = 1;
for (DocumentDV documentDV : result.getData()) {
NavLink locateOnMap = new NavLink("Show");
locateOnMap.setTitle("Locate on the Map and show details");
locateOnMap.setIcon(IconType.MAP_MARKER);
locateOnMap.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GeoportalItemReferences gir = new GeoportalItemReferences(documentDV.getProjectID(),
profileID);
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, null));
appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(documentDV));
}
});
//First column
ft.setWidget(i, 0, locateOnMap);
int j = 0;
//Other columns
for (ItemFieldDV itemField : searchForFields) {
if (j > MAX_COLUMNS_RESULTS) {
break;
}
String firstJsonField = itemField.getJsonFields().get(0);
GWT.log("The json fields is: "+firstJsonField);
String key = firstJsonField.replace(DEFAULT_DOCUMENT_PROJECTION_NAME + ".", "");
Object value = documentDV.getDocumentAsMap().get(key);
String objectToRender = "";
String toTitle = "";
if (value == null) {
objectToRender = "N.A.";
toTitle = objectToRender;
} else if (value instanceof ArrayList) {
ArrayList<Object> arrayValues = (ArrayList<Object>) value;
String toReturn = "<ul>";
String toDisplayTitle = "";
for (Object arrayValue : arrayValues) {
toReturn += "<li>" + arrayValue + "</li>";
toDisplayTitle += arrayValue + "; ";
}
toReturn += "</ul>";
GWT.log("Array returning: " + key + " is instance of: " + value.getClass()
+ " to return: " + toReturn);
toTitle = toDisplayTitle;
objectToRender = StringUtil.ellipsize(toReturn, MAX_TEXT_DIMENSION);
} else {
String valueStr = value.toString();
toTitle = valueStr;
objectToRender = StringUtil.ellipsize(valueStr, MAX_TEXT_DIMENSION);
}
GWT.log("The key is: "+key+" objectToRender is: "+objectToRender);
HTML htmlValue = new HTML(objectToRender);
htmlValue.setTitle(toTitle);
ft.setWidget(i, ++j, htmlValue);
}
i++;
}
panelResults.add(ft);
}
});
@ -352,12 +386,12 @@ public class SearchFacilityUI extends Composite {
* @param listValues the list values
* @return the string
*/
private String toDisplayList(List<String> listValues) {
private String toDisplayList(List<Object> listValues) {
String toDisplay = "";
if (listValues == null)
return toDisplay;
for (String author : listValues) {
for (Object author : listValues) {
toDisplay += author + "; ";
}
return toDisplay;

View File

@ -1068,6 +1068,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
UseCaseDescriptor ucd = GeoportalClientCaller.useCaseDescriptors().getUCDForId(profileID);
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
projectBuilder.relationships(true);
ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
@ -1161,7 +1162,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
}
case PROJECT_LAYER:
case GENERIC_LAYER: {
LOG.debug("The LayerObject is a of kind: "+layerObject.getType());
// Getting the projectid from WFS features, but limiting to the first one
for (FeatureRow fRow : features) {
if (fRow.getMapProperties() != null) {

View File

@ -177,7 +177,6 @@ body {
background: #FFF;
width: 725px;
/*margin-top: 30px;*/
padding-left: 5px;
overflow-y: auto;
transition: width 0.5s;
z-index: 100;