/*
 * TreeTransfertHandler.java
 *
 * Created on 15 settembre 2004, 2.19
 */

package it.businesslogic.ireport.gui.dnd;
import java.awt.datatransfer.Transferable;
import java.awt.event.InputEvent;
import javax.swing.*;

/**
 *
 * @author  Administrator
 */
public class JListTransfertHandler extends javax.swing.TransferHandler {
        
    public int getSourceActions(JComponent c) 
    {    
        return COPY;       
    }    
    
    protected Transferable createTransferable(JComponent c) 
    {
       
        if (c instanceof JList)
        {
            JList list = (JList)c;

            return new it.businesslogic.ireport.gui.dnd.TransferableObject(list.getSelectedValue());           
        }
        
        return new it.businesslogic.ireport.gui.dnd.TransferableObject(c);
    }
}
