package org.ssgwt.client.ui.datagrid.event;

import java.util.List;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.EventHandler;
import org.ssgwt.client.ui.datagrid.AbstractMultiSelectObject;
import com.google.gwt.event.shared.HasHandlers;

/**
 * Event that is dispatched when a user changes a filter
 * 
 * @author Johannes Gryffenberg<johannes.gryffenberg@gmail.com>
 * @since 9 July 2012
 */
public class DataGridRowSelectionChangedEvent<T> extends GwtEvent<DataGridRowSelectionChangedEvent.DataGridRowSelectionChangedHandler> {

    /**
     * The handler type for the event
     */
    public static Type<DataGridRowSelectionChangedHandler> TYPE = new Type<DataGridRowSelectionChangedHandler>();
    
    /**
     * The data for the rows that was selected or deselected
     */
    private List<T> changedRows;

    /**
     * The event handler interface for the event
     * 
     * @author Johannes Gryffenberg
     * @since 9 July 2012
     */
    public interface DataGridRowSelectionChangedHandler extends EventHandler {
        
        /**
         * Handles the DataGridRowSelectionChangedEvent
         * 
         * @param event - The event that should be handled
         */
        void onDataGridRowSelectionChanged(DataGridRowSelectionChangedEvent event);
    }

    /**
     * The event constructor
     * 
     * @param changedRows - The data for the rows that was selected or deselected
     */
    public DataGridRowSelectionChangedEvent(List<T> changedRows) {
        this.changedRows = changedRows;
    }

    /**
     * Getter to retrieve the data of the rows that was selected or deselected
     * 
     * @return The data of the rows that was selected or deselected
     */
    public List<T> getChangedRows() {
        return changedRows;
    }

    /**
     * Dispatches the event
     * 
     * @param handler - The function that will handle the event
     */
    @Override
    protected void dispatch(DataGridRowSelectionChangedHandler handler) {
        handler.onDataGridRowSelectionChanged(this);
    }

    /**
     * Getter to retrieve the event handler type
     * 
     * @return The event handler
     */
    @Override
    public Type<DataGridRowSelectionChangedHandler> getAssociatedType() {
        return TYPE;
    }

    /**
     * Getter to retrieve the event handler type
     * 
     * @return The event handler
     */
    public static Type<DataGridRowSelectionChangedHandler> getType() {
        return TYPE;
    }

//    This could be implemented at a later stage but for now this can not be used
//    /**
//     * Helper function to make it easier to dispatch an FilterChangeEvent
//     * 
//     * @param source - The object that is dispatching the event
//     * @param rowsData - The data for the rows that was selected or deselected
//     */
//    public static void fire(HasHandlers source, List<?> changedRows) {
//        source.fireEvent(new DataGridRowSelectionChangedEvent(changedRows));
//    }
}

@@ -2496,503 +2496,7 @@
    %7D
-%0A%0A//    This could be implemented at a later stage but for now this can not be used%0A//    /**%0A//     * Helper function to make it easier to dispatch an FilterChangeEvent%0A//     * %0A//     * @param source - The object that is dispatching the event%0A//     * @param rowsData - The data for the rows that was selected or deselected%0A//     */%0A//    public static void fire(HasHandlers source, List%3C?%3E changedRows) %7B%0A//        source.fireEvent(new DataGridRowSelectionChangedEvent(changedRows));%0A//    %7D
 %0A%7D%0A

Remove commented code from DataGridRowSelectionChangedEvent