improved behaviour on searching stage

This commit is contained in:
Francesco Mangiacrapa 2022-12-21 11:00:12 +01:00
parent 474832a663
commit c8ad962dfe
4 changed files with 38 additions and 15 deletions

View File

@ -388,6 +388,9 @@ public class GeoportalDataViewer implements EntryPoint {
boolean found = false; boolean found = false;
GWT.log("Product with id: " + projectID + " found? " + found); GWT.log("Product with id: " + projectID + " found? " + found);
if (!showDetailsEvent.isEventFromTimeline())
timelineMS.hideTimelineProjectRelations();
GeoportalDataViewerServiceAsync.Util.getInstance().getProjectViewForId(profileID, projectID, GeoportalDataViewerServiceAsync.Util.getInstance().getProjectViewForId(profileID, projectID,
new AsyncCallback<ProjectView>() { new AsyncCallback<ProjectView>() {
@ -645,8 +648,9 @@ public class GeoportalDataViewer implements EntryPoint {
String layerName = null; String layerName = null;
try { try {
GCubeCollection toOpen = viewerConfig.getAvailableCollections().get(searchPerformedEvent.getProfileID()); GCubeCollection toOpen = viewerConfig.getAvailableCollections()
.get(searchPerformedEvent.getProfileID());
// Check if indexes is empty // Check if indexes is empty
if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) { if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) {
GWT.log("SearchPerformedEvent Unexpected empty indexes in collection " + toOpen); GWT.log("SearchPerformedEvent Unexpected empty indexes in collection " + toOpen);
@ -656,15 +660,15 @@ public class GeoportalDataViewer implements EntryPoint {
// For now we just take the first - only 1 is expected // For now we just take the first - only 1 is expected
IndexLayerDV layer = toOpen.getIndexes().get(0); IndexLayerDV layer = toOpen.getIndexes().get(0);
// Open Index Layer // Open Index Layer
String wmsLink = layer.getLayer().getOgcLinks().get("wms"); String wmsLink = layer.getLayer().getOgcLinks().get("wms");
layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink); layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
}catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
} }
String setCqlFilter = null; //default String setCqlFilter = null; // default
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
String cqlFilter = GeoportalDataViewerConstants.PROJECT_ID_KEY_FEATURE + " IN("; String cqlFilter = GeoportalDataViewerConstants.PROJECT_ID_KEY_FEATURE + " IN(";
for (String projectId : result) { for (String projectId : result) {
@ -676,15 +680,15 @@ public class GeoportalDataViewer implements EntryPoint {
} else { } else {
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null); olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
setCqlFilter = null; //is already null setCqlFilter = null; // is already null
} }
if (searchPerformedEvent.isSearchReset()) { if (searchPerformedEvent.isSearchReset()) {
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null); olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
setCqlFilter = null; //is already null setCqlFilter = null; // is already null
} }
if(layerName!=null) if (layerName != null)
layerManager.setCQLForLayerToIndexLayer(layerName, setCqlFilter); layerManager.setCQLForLayerToIndexLayer(layerName, setCqlFilter);
} }

View File

@ -20,6 +20,7 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
private String profileID; private String profileID;
private String projectID; private String projectID;
private boolean loadTimelineRelationships; private boolean loadTimelineRelationships;
private boolean isEventFromTimeline;
/** /**
* Instantiates a new show details event. * Instantiates a new show details event.
@ -54,6 +55,24 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
this.loadTimelineRelationships = loadTimelineRelationships; this.loadTimelineRelationships = loadTimelineRelationships;
} }
/**
* Event from timeline.
*
* @param bool the bool
*/
public void setEventFromTimeline(boolean bool) {
this.isEventFromTimeline = bool;
}
/**
* Checks if is event from timeline.
*
* @return true, if is event from timeline
*/
public boolean isEventFromTimeline() {
return isEventFromTimeline;
}
/** /**
* Gets the type. * Gets the type.
* *

View File

@ -59,9 +59,8 @@ public class TimelineManagerStatus {
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(true); RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(true);
timelineStatus.getTimelineRP().setTimelineContainerVisible(true); timelineStatus.getTimelineRP().setTimelineContainerVisible(true);
} }
public void hideTimelineProjectRelations() { public void hideTimelineProjectRelations() {
GWT.log("hideTimelineProjectRelations"); GWT.log("hideTimelineProjectRelations");
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(false); RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(false);

View File

@ -144,7 +144,8 @@ public class TimelineRelationPanel extends Composite {
final String theProjectID = references[1]; final String theProjectID = references[1];
GeoportalItemReferences gir = new GeoportalItemReferences(theProjectID, thePofileID); GeoportalItemReferences gir = new GeoportalItemReferences(theProjectID, thePofileID);
ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false); ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false);
GWT.log("fireEvetn: " + showDetailsEvent); showDetailsEvent.setEventFromTimeline(true);
GWT.log("fireEvent: " + showDetailsEvent);
applicationBus.fireEvent(showDetailsEvent); applicationBus.fireEvent(showDetailsEvent);