package org.gcube.portlets.user.workspace.client.event;

import org.gcube.portlets.user.workspace.client.model.FileGridModel;

import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.event.shared.GwtEvent;

/**
 * 
 * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
 *
 */
public class GridElementSelectedEvent extends GwtEvent<GridElementSelectedEventHandler> {
  public static Type<GridElementSelectedEventHandler> TYPE = new Type<GridElementSelectedEventHandler>();

  private FileGridModel targetFile = null;
  
	public GridElementSelectedEvent(ModelData target) {
	this.targetFile = (FileGridModel) target;
	}

	@Override
	public Type<GridElementSelectedEventHandler> getAssociatedType() {
		// TODO Auto-generated method stub
		return TYPE;
	}
	
	@Override
	protected void dispatch(GridElementSelectedEventHandler handler) {
		handler.onGridElementSelected(this);
		
	}

	public FileGridModel getSourceFile() {
		return targetFile;
	}
}