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

131 lines
2.9 KiB
Java

package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
import com.google.gwt.event.shared.GwtEvent;
import ol.Coordinate;
/**
* The Class QueryDataEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 31, 2021
*/
public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
public static Type<QueryDataEventHandler> TYPE = new Type<QueryDataEventHandler>();
private GeoQuery select;
private Coordinate onFailureCenterTo;
private String mongoItemId;
private boolean onInit;
private MapEventType sourceMapEventType;
/**
* Instantiates a new query data event.
*
* @param select the select
* @param onFailureCenterTo the on failure center to
* @param mongoItemId the mongo item id
* @param onInit the on init
* @param mapEventType the map event type
*/
public QueryDataEvent(GeoQuery select, Coordinate onFailureCenterTo, String mongoItemId, boolean onInit,
MapEventType mapEventType) {
this.select = select;
this.onFailureCenterTo = onFailureCenterTo;
this.mongoItemId = mongoItemId;
this.onInit = onInit;
this.sourceMapEventType = mapEventType;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<QueryDataEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Gets the mongo item id.
*
* @return the mongo item id
*/
public String getMongoItemId() {
return mongoItemId;
}
/**
* Checks if is on init.
*
* @return true, if is on init
*/
public boolean isOnInit() {
return onInit;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(QueryDataEventHandler handler) {
handler.onQueryInteraction(this);
}
/**
* Gets the geo query.
*
* @return the geo query
*/
public GeoQuery getGeoQuery() {
return select;
}
/**
* Gets the on failure center to.
*
* @return the on failure center to
*/
public Coordinate getOnFailureCenterTo() {
return onFailureCenterTo;
}
/**
* Gets the source map event type.
*
* @return the source map event type
*/
public MapEventType getSourceMapEventType() {
return sourceMapEventType;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("QueryDataEvent [select=");
builder.append(select);
builder.append(", onFailureCenterTo=");
builder.append(onFailureCenterTo);
builder.append(", mongoItemId=");
builder.append(mongoItemId);
builder.append(", onInit=");
builder.append(onInit);
builder.append(", sourceMapEventType=");
builder.append(sourceMapEventType);
builder.append("]");
return builder.toString();
}
}