geoportal-data-entry-app/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEvent.java

96 lines
2.1 KiB
Java
Raw Normal View History

2021-08-04 17:11:46 +02:00
package org.gcube.portlets.user.geoportaldataentry.client.events;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
2021-08-05 11:21:39 +02:00
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
2021-08-04 17:11:46 +02:00
import com.google.gwt.event.shared.GwtEvent;
/**
2021-08-05 11:21:39 +02:00
* The Class ActionOnItemEvent.
2021-08-04 17:11:46 +02:00
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 15, 2021
2021-08-04 17:11:46 +02:00
* @param <T> the generic type
*/
public class ActionOnItemEvent<T extends RecordDV> extends GwtEvent<ActionOnItemEventHandler> {
2021-08-05 11:21:39 +02:00
public static Type<ActionOnItemEventHandler> TYPE = new Type<ActionOnItemEventHandler>();
2021-08-04 17:11:46 +02:00
private List<T> selectItems;
2021-08-05 11:21:39 +02:00
private ACTION_ON_ITEM action;
2021-08-04 17:11:46 +02:00
/**
* Instantiates a new click item event.
*
* @param selectItems the select items
* @param doAction the do action
2021-08-04 17:11:46 +02:00
*/
2021-08-05 11:21:39 +02:00
public ActionOnItemEvent(List<T> selectItems, ACTION_ON_ITEM doAction) {
2021-08-04 17:11:46 +02:00
this.selectItems = selectItems;
2021-08-05 11:21:39 +02:00
this.action = doAction;
2021-08-04 17:11:46 +02:00
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
2021-08-05 11:21:39 +02:00
public Type<ActionOnItemEventHandler> getAssociatedType() {
2021-08-04 17:11:46 +02:00
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler)
*/
@Override
2021-08-05 11:21:39 +02:00
protected void dispatch(ActionOnItemEventHandler handler) {
handler.onDoActionFired(this);
2021-08-04 17:11:46 +02:00
}
/**
* Gets the select items.
*
* @return the select items
*/
public List<T> getSelectItems() {
return selectItems;
}
2021-08-05 11:21:39 +02:00
/**
* Gets the action.
*
* @return the action
*/
2021-08-05 11:21:39 +02:00
public ACTION_ON_ITEM getAction() {
return action;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ActionOnItemEvent [selectItems=");
builder.append(selectItems);
builder.append(", action=");
builder.append(action);
builder.append("]");
return builder.toString();
}
2021-08-04 17:11:46 +02:00
}