geoportal-data-viewer-app/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/events/ShowDetailsEvent.java

209 lines
5.1 KiB
Java
Raw Normal View History

package org.gcube.portlets.user.geoportaldataviewer.client.events;
2022-10-18 17:32:12 +02:00
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import com.google.gwt.event.shared.GwtEvent;
/**
2020-11-19 15:19:27 +01:00
* The Class ShowDetailsEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
2022-11-14 16:24:49 +01:00
* Nov 14, 2022
*/
public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
public static Type<ShowDetailsEventHandler> TYPE = new Type<ShowDetailsEventHandler>();
private String layerObjectType;
private FeatureRow featureRow;
2020-11-19 15:19:27 +01:00
private String itemName;
private String profileID;
private String projectID;
2022-11-03 17:03:15 +01:00
private boolean loadTimelineRelationships;
2022-12-21 11:00:12 +01:00
private boolean isEventFromTimeline;
private EVENT_SOURCE sourceEvent;
/**
* The Enum EVENT_SOURCE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 22, 2022
*/
public static enum EVENT_SOURCE {
LOCATE_ON_INIT, OPEN_DETAILS, OPEN_PROJECTS, LOCATE_SEARCHED, LOCATE_FROM_TIMELINE, GO_TO_LAYERS
}
/**
2020-11-19 15:19:27 +01:00
* Instantiates a new show details event.
*
2022-11-14 16:24:49 +01:00
* @param layerObjectType the layer object type
* @param profileID the profile ID
* @param projectID the project ID
* @param featureRow the feature row
* @param loadTimelineRelationships the load timeline relationships
* @param sourceEvent the source event
*/
2022-11-14 16:24:49 +01:00
public ShowDetailsEvent(String layerObjectType, String profileID, String projectID, FeatureRow featureRow,
boolean loadTimelineRelationships, EVENT_SOURCE sourceEvent) {
this.layerObjectType = layerObjectType;
this.profileID = profileID;
this.projectID = projectID;
2020-11-19 15:19:27 +01:00
this.featureRow = featureRow;
2022-11-03 17:03:15 +01:00
this.loadTimelineRelationships = loadTimelineRelationships;
this.sourceEvent = sourceEvent;
}
2020-11-19 15:19:27 +01:00
/**
* Instantiates a new show details event.
*
2022-11-14 16:24:49 +01:00
* @param gir the gir
* @param featureRow the feature row
2022-11-03 17:03:15 +01:00
* @param loadTimelineRelationships the load timeline relationships
* @param sourceEvent the source event
2020-11-19 15:19:27 +01:00
*/
public ShowDetailsEvent(GeoportalItemReferences gir, FeatureRow featureRow, boolean loadTimelineRelationships,
boolean goToLayers, EVENT_SOURCE sourceEvent) {
this.layerObjectType = gir.getLayerObjectType();
this.profileID = gir.getProfileID();
this.projectID = gir.getProjectID();
2020-11-19 15:19:27 +01:00
this.featureRow = featureRow;
2022-11-03 17:03:15 +01:00
this.loadTimelineRelationships = loadTimelineRelationships;
this.sourceEvent = sourceEvent;
2020-11-19 15:19:27 +01:00
}
2022-12-21 11:00:12 +01:00
/**
* 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 source event.
*
* @return the source event
*/
public EVENT_SOURCE getSourceEvent() {
return sourceEvent;
}
2022-11-14 16:24:49 +01:00
/**
* Gets the type.
*
* @return the type
*/
public static Type<ShowDetailsEventHandler> getTYPE() {
return TYPE;
}
2022-11-14 16:24:49 +01:00
/**
* Gets the layer object type.
*
* @return the layer object type
*/
public String getLayerObjectType() {
return layerObjectType;
}
2022-11-14 16:24:49 +01:00
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
2022-11-14 16:24:49 +01:00
/**
* Gets the project ID.
*
* @return the project ID
*/
public String getProjectID() {
return projectID;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ShowDetailsEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ShowDetailsEventHandler handler) {
handler.onShowDetails(this);
}
2020-11-19 15:19:27 +01:00
/**
* Gets the feature row.
*
* @return the feature row
*/
public FeatureRow getFeatureRow() {
return featureRow;
}
2020-11-19 15:19:27 +01:00
2022-11-03 17:03:15 +01:00
/**
* Checks if is load timeline relationships.
*
* @return true, if is load timeline relationships
*/
public boolean isLoadTimelineRelationships() {
return loadTimelineRelationships;
}
2020-11-19 15:19:27 +01:00
/**
* Gets the geona item ref.
*
* @return the geona item ref
*/
2022-10-18 17:32:12 +02:00
public GeoportalItemReferences getGeonaItemRef() {
return new GeoportalItemReferences(projectID, profileID, layerObjectType);
2020-11-19 15:19:27 +01:00
}
2022-11-03 17:03:15 +01:00
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowDetailsEvent [layerObjectType=");
builder.append(layerObjectType);
builder.append(", featureRow=");
builder.append(featureRow);
builder.append(", itemName=");
builder.append(itemName);
builder.append(", profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append(", loadTimelineRelationships=");
builder.append(loadTimelineRelationships);
2023-01-12 11:00:09 +01:00
builder.append(", isEventFromTimeline=");
builder.append(isEventFromTimeline);
builder.append(", sourceEvent=");
builder.append(sourceEvent);
2022-11-03 17:03:15 +01:00
builder.append("]");
return builder.toString();
}
}