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

175 lines
3.6 KiB
Java
Raw Normal View History

package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class DoActionOnDetailLayersEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 12, 2021
*/
public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayersEventHandler> {
public static Type<DoActionOnDetailLayersEventHandler> TYPE = new Type<DoActionOnDetailLayersEventHandler>();
/**
* The Enum DO_LAYER_ACTION.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 12, 2021
*/
public static enum DO_LAYER_ACTION {
VISIBILITY, SWAP, OPACITY
}
private DO_LAYER_ACTION doAction;
private LayerItem layerItem;
private double opacity;
private boolean visibility;
private LayerItem sourceLayerSwap;
private LayerItem targetLayerSwap;
/**
* Instantiates a new do action on detail layers event.
*
* @param action the action
* @param layerItem the layer item
*/
public DoActionOnDetailLayersEvent(DO_LAYER_ACTION action, LayerItem layerItem) {
this.layerItem = layerItem;
this.doAction = action;
}
/**
* Sets the swap layers.
*
* @param sourceLayerItem the source layer item
* @param targetLayerItem the target layer item
*/
public void setSwapLayers(LayerItem sourceLayerItem, LayerItem targetLayerItem) {
this.sourceLayerSwap = sourceLayerItem;
this.targetLayerSwap = targetLayerItem;
}
/**
* Sets the opacity.
*
* @param opacity the new opacity
*/
public void setOpacity(double opacity) {
this.opacity = opacity;
}
/**
* Sets the visibility.
*
* @param visibility the new visibility
*/
public void setVisibility(boolean visibility) {
this.visibility = visibility;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<DoActionOnDetailLayersEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(DoActionOnDetailLayersEventHandler handler) {
handler.onDoActionOnDetailLayers(this);
}
/**
* Gets the do action.
*
* @return the do action
*/
public DO_LAYER_ACTION getDoAction() {
return doAction;
}
/**
* Gets the layer item.
*
* @return the layer item
*/
public LayerItem getLayerItem() {
return layerItem;
}
/**
* Gets the source layer swap.
*
* @return the source layer swap
*/
public LayerItem getSourceLayerSwap() {
return sourceLayerSwap;
}
/**
* Gets the target layer swap.
*
* @return the target layer swap
*/
public LayerItem getTargetLayerSwap() {
return targetLayerSwap;
}
/**
* Gets the opacity.
*
* @return the opacity
*/
public double getOpacity() {
return opacity;
}
/**
* Gets the visibility.
*
* @return the visibility
*/
public boolean getVisibility() {
return visibility;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DoActionOnDetailLayersEvent [doAction=");
builder.append(doAction);
builder.append(", layerItem=");
builder.append(layerItem);
builder.append(", opacity=");
builder.append(opacity);
builder.append(", visibility=");
builder.append(visibility);
builder.append(", sourceLayerSwap=");
builder.append(sourceLayerSwap);
builder.append(", targetLayerSwap=");
builder.append(targetLayerSwap);
builder.append("]");
return builder.toString();
}
}