package editor.gui.ccp.data;

import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

import editor.collection.deck.CategorySpec;
import editor.database.card.Card;
import editor.gui.editor.EditorFrame;

public class CategoryTransferData extends EntryTransferData
{
    public final CategorySpec spec;

    public CategoryTransferData(EditorFrame e, CategorySpec d, Map<Card, Integer> cards)
    {
        super(e, 0, cards); // Only main deck can have categories
        spec = d;
    }

    public CategoryTransferData(CategorySpec d)
    {
        this(null, d, Collections.emptyMap());
    }

    @Override
    public DataFlavor[] getTransferDataFlavors()
    {
        DataFlavor[] superFlavors = super.getTransferDataFlavors();
        DataFlavor[] flavors = new DataFlavor[superFlavors.length + 1];
        flavors[0] = DataFlavors.categoryFlavor;
        for (int i = 0; i < superFlavors.length; i++)
            flavors[i + 1] = superFlavors[i];
        return flavors;
    }

    @Override
    public boolean isDataFlavorSupported(DataFlavor flavor)
    {
        return Arrays.asList(getTransferDataFlavors()).contains(flavor);
    }

    @Override
    public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException
    {
        if (flavor.equals(DataFlavors.categoryFlavor))
            return this;
        else
            return super.getTransferData(flavor);
    }
}
@@ -320,106 +320,603 @@
 e;%0A%0A
-public class CategoryTransferData extends EntryTransferData%0A%7B%0A    public final CategorySpec spec;%0A
+/**%0A * This class contains the specification for a category to transfer using cut,%0A * copy, and paste.%0A */%0Apublic class CategoryTransferData extends EntryTransferData%0A%7B%0A    /** Category specification to transfer. */%0A    public final CategorySpec spec;%0A%0A    /**%0A     * Create a new category transfer data for data from a deck. This constructor%0A     * is only a placeholder until how to handle the cards that may be in the%0A     * categories is determined.%0A     * %0A     * @param e reserved for future use%0A     * @param d specification to transfer%0A     * @param cards reserved for future use%0A     */
 %0A   
@@ -1094,24 +1094,134 @@
 = d;%0A    %7D%0A%0A
+    /**%0A     * Create a new category transfer data.%0A     * %0A     * @param d specification to transfer%0A     */%0A
     public C

Add documentation to category transfer data