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

@ -18,6 +18,7 @@
@ -42,6 +43,7 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -65,6 +67,7 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -88,6 +91,7 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
@ -111,6 +115,7 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -134,6 +139,7 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
@ -160,6 +166,7 @@
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
@ -183,6 +190,7 @@
<property name="context-root" value="geoportal-data-viewer-app"/> <property name="context-root" value="geoportal-data-viewer-app"/>
@ -205,6 +213,7 @@
@ -228,6 +237,7 @@

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.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV; 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.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV; 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.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler; import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerManager; 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.Window;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTML;
@ -149,8 +151,7 @@ public class GeoportalDataViewer implements EntryPoint {
public void onSuccess(List<ItemFieldsResponse> itemFieldsResult) { public void onSuccess(List<ItemFieldsResponse> itemFieldsResult) {
GWT.log("listOfFieldsForSearching: " + itemFieldsResult); GWT.log("listOfFieldsForSearching: " + itemFieldsResult);
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(), mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(), itemFieldsResult);
itemFieldsResult);
RootPanel.get(APP_DIV).add(mainPanel); RootPanel.get(APP_DIV).add(mainPanel);
initApplication(); 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() { private void initApplication() {
@ -225,7 +218,8 @@ public class GeoportalDataViewer implements EntryPoint {
+ paramGeonaItemID); + paramGeonaItemID);
return; return;
} }
GeoportalItemReferences gir = new GeoportalItemReferences(paramGeonaItemID, paramGeonaItemType); GeoportalItemReferences gir = new GeoportalItemReferences(paramGeonaItemID,
paramGeonaItemType);
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null)); applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
} }
@ -259,7 +253,6 @@ public class GeoportalDataViewer implements EntryPoint {
return listBaseMapLayers; return listBaseMapLayers;
} }
/** /**
* Update window size. * 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 { try {
GWT.log("onLayerRendered Timer PART MUST BE REVISITED"); GWT.log("onLayerRendered Timer PART MUST BE REVISITED");
/*
* attempt = 0; attempt = 0;
*
* if (paramGeonaItemID != null) { // waiting for record retrieved by service if (paramGeonaItemID != null) { // waiting for record retrieved by service before calling the WFS
* before calling the WFS final int MAX_RETRY = 15; Timer timer = new final int MAX_RETRY = 15;
* com.google.gwt.user.client.Timer() { Timer timer = new com.google.gwt.user.client.Timer() {
*
* @Override public void run() { attempt++; GWT.log("waiting get record: " + @Override
* attempt); public void run() {
* attempt++;
* GWT.log("waiting get record: " + attempt);
*
* ProjectView record = mainPanel.getDisplayedProject();
* RecordDV record = mainPanel.getDisplayedRecord(); if (record != null) { if (record != null) {
* this.cancel(); GWT.log("cancelled timer"); performWFSQueryOnCentroid(record); this.cancel();
* } GWT.log("cancelled timer");
* performWFSQueryOnCentroid(record);
* if (attempt > MAX_RETRY) { GWT.log("MAX_RETRY reached, cancelled timer"); }
* this.cancel(); }
* if (attempt > MAX_RETRY) {
* } }; timer.scheduleRepeating(1000); GWT.log("MAX_RETRY reached, cancelled timer");
* this.cancel();
* } }
*/
}
};
timer.scheduleRepeating(1000);
}
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
} }
@ -472,7 +449,7 @@ public class GeoportalDataViewer implements EntryPoint {
@Override @Override
public void onZoomOut(ZoomOutOverMinimumEvent zoomOutEvent) { public void onZoomOut(ZoomOutOverMinimumEvent zoomOutEvent) {
if (mainPanel.getDisplayedRecord() == null && !olMapMng.isQueryPointActive()) { if (mainPanel.getDisplayedProject() == null && !olMapMng.isQueryPointActive()) {
olMapMng.hidePopInfo(); olMapMng.hidePopInfo();
layerManager.removeAllDetailLayers(); layerManager.removeAllDetailLayers();
@ -563,16 +540,16 @@ public class GeoportalDataViewer implements EntryPoint {
} }
}); });
applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, new ShowPopupOnCentroiEventHandler() { // applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, new ShowPopupOnCentroiEventHandler() {
//
@Override // @Override
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) { // public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
//
if (showPopupOnCentroiEvent.getRecord() != null) // if (showPopupOnCentroiEvent.getRecord() != null)
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord()); // performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord());
//
} // }
}); // });
applicationBus.addHandler(SearchPerformedEvent.TYPE, new SearchPerformedEventHandler() { applicationBus.addHandler(SearchPerformedEvent.TYPE, new SearchPerformedEventHandler() {
@ -625,16 +602,10 @@ public class GeoportalDataViewer implements EntryPoint {
// //
// }-*/; // }-*/;
private void performWFSQueryOnCentroid(RecordDV record) { private void performWFSQueryOnCentroid(ProjectView project) {
if (record != null) { if (project != null) {
GWT.log("record instanceof ConcessioneDV: " + (record instanceof ConcessioneDV) + " with mongo item id: " Double x = project.getCentroidLong();
+ record.getItemId()); Double y = project.getCentroidLat();
// 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); GWT.log("X: " + x + ", Y:" + y);
if (x != null && y != null) { if (x != null && y != null) {
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y),
@ -644,13 +615,13 @@ public class GeoportalDataViewer implements EntryPoint {
// GeoportalDataViewerConstants.print("fireEvent QueryDataEvent"); // GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(), ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(),
transfCoord.getY()); transfCoord.getY());
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt, record.getItemId(), layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt,
true, MapEventType.ADDED_CENTROID_LAYER_TO_MAP)); project.getTheProjectDV().getId(), true, MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
} else { } else {
GeoportalDataViewerConstants.printJs( GeoportalDataViewerConstants
"I cannot select the point one or both coordiantes are null. X: " + x + ", Y:" + y); .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.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV; 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.IndexLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV; 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.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION; 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 { } else {
// removing all WMS detail layers if the ZOOM level is < // removing all WMS detail layers if the ZOOM level is <
@ -434,10 +408,11 @@ public class LayerManager {
if (productIds != null && productIds.size() > 0) { if (productIds != null && productIds.size() > 0) {
String productId = productIds.get(0); String productId = productIds.get(0);
String itemName = "Dettagli Prodotto"; String itemName = "Dettagli Prodotto";
List<String> listName = fRow.getMapProperties().get("nome"); GWT.log("Dettagli prodotto must be revisited");
if (listName != null && listName.size() > 0) { // List<String> listName = fRow.getMapProperties().get("nome");
itemName = listName.get(0); // if (listName != null && listName.size() > 0) {
} // itemName = listName.get(0);
// }
LayerObjectType layerObjectType = layerObject.getType(); LayerObjectType layerObjectType = layerObject.getType();
return new ShowDetailsEvent(layerObjectType != null ? layerObjectType.name() : null, return new ShowDetailsEvent(layerObjectType != null ? layerObjectType.name() : null,
@ -770,13 +745,21 @@ public class LayerManager {
String newProjectID = lo.getProjectID(); String newProjectID = lo.getProjectID();
if (prevProjectId.compareTo(newProjectID) != 0) { if (prevProjectId.compareTo(newProjectID) != 0) {
String concessioneIntro = newProjectID.length() > 100 // String projectIntro = newProjectID.length() > 100 ? StringUtil.ellipsize(newProjectID, 100)
? StringUtil.ellipsize(newProjectID, 100) // : newProjectID;
: newProjectID; //
Heading heading = new Heading(4, concessioneIntro); ProjectDV projectDV = lo.getProjectDV();
heading.setTitle(newProjectID); 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); heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
flowPanel.add(heading); flowPanel.add(heading);
flowPanel.add(new HTML(projectIntro));
Button buttOpenProject = new Button("Open Project"); Button buttOpenProject = new Button("Open Project");
final String buttId = "open-details-" + Random.nextInt(); final String buttId = "open-details-" + Random.nextInt();

View File

@ -1,10 +1,9 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; 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; import com.google.gwt.event.shared.GwtEvent;
/** /**
* The Class ShowDetailsEvent. * The Class ShowDetailsEvent.
* *
@ -14,22 +13,20 @@ import com.google.gwt.event.shared.GwtEvent;
*/ */
public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHandler> { public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHandler> {
public static Type<ShowPopupOnCentroiEventHandler> TYPE = new Type<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. * Gets the associated type.
@ -52,10 +49,8 @@ public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHan
} }
public RecordDV getRecord() { public DocumentDV getDocument() {
return record; return document;
} }
} }

View File

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

View File

@ -397,7 +397,7 @@ public class GeonaDataViewMainPanel extends Composite {
* *
* @return the displayed record * @return the displayed record
*/ */
public ProjectView getDisplayedRecord() { public ProjectView getDisplayedProject() {
return detailsPanel.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.Window;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite; 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.HTMLPanel;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
@ -43,7 +44,7 @@ public class ProjectViewer extends Composite {
} }
@UiField @UiField
PageHeader pageHeaderTitle; HTMLPanel headerPanel;
@UiField @UiField
HTMLPanel pageViewDetails; HTMLPanel pageViewDetails;
@ -94,7 +95,7 @@ public class ProjectViewer extends Composite {
? projectView.getTheProjectDV().getProfileName() ? projectView.getTheProjectDV().getProfileName()
: projectView.getTheProjectDV().getId(); : projectView.getTheProjectDV().getId();
pageHeaderTitle.setText("Project: " + theTitle); headerPanel.add(new HTML("Project: " + theTitle));
shareButton.setType(ButtonType.LINK); shareButton.setType(ButtonType.LINK);
shareButton.setIcon(IconType.SHARE); shareButton.setIcon(IconType.SHARE);

View File

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

View File

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

View File

@ -1068,6 +1068,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest()); new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
UseCaseDescriptor ucd = GeoportalClientCaller.useCaseDescriptors().getUCDForId(profileID); UseCaseDescriptor ucd = GeoportalClientCaller.useCaseDescriptors().getUCDForId(profileID);
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID); Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true); ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
projectBuilder.relationships(true); projectBuilder.relationships(true);
ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder); ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
@ -1161,7 +1162,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
} }
case PROJECT_LAYER: case PROJECT_LAYER:
case GENERIC_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 // Getting the projectid from WFS features, but limiting to the first one
for (FeatureRow fRow : features) { for (FeatureRow fRow : features) {
if (fRow.getMapProperties() != null) { if (fRow.getMapProperties() != null) {

View File

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