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

View File

@ -20,6 +20,7 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
private String profileID;
private String projectID;
private boolean loadTimelineRelationships;
private boolean isEventFromTimeline;
/**
* Instantiates a new show details event.
@ -54,6 +55,24 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
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.
*

View File

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

View File

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