Clover coverage report - clover
Coverage timestamp: Sat Oct 8 2005 22:54:17 EDT
file stats: LOC: 73   Methods: 6
NCLOC: 56   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
StepTransferable.java 0% 33.3% 33.3% 25%
coverage coverage
 1   
 package abbot.editor;
 2   
 
 3   
 import java.awt.datatransfer.*;
 4   
 import java.util.*;
 5   
 
 6   
 import abbot.script.Step;
 7   
 
 8   
 public class StepTransferable implements Transferable {
 9   
 
 10   
     public static final DataFlavor STEP_FLAVOR =
 11   
         new DataFlavor("application/x-java-serialized-object;class=abbot.script.Step", "Abbot script step");
 12   
     public static final DataFlavor STEP_LIST_FLAVOR =
 13   
         new DataFlavor("application/x-java-serialized-object;class=java.util.ArrayList", "List of Abbot script steps");
 14   
 
 15   
     // A single step is available as itself or as a list
 16   
     private static final DataFlavor[] FLAVORS = {
 17   
         STEP_FLAVOR, STEP_LIST_FLAVOR, 
 18   
     };
 19   
 
 20   
     // Can't get a list as a single step
 21   
     private static final DataFlavor[] LIST_FLAVORS = {
 22   
         STEP_LIST_FLAVOR
 23   
     };
 24   
 
 25   
     private static List FLAVOR_LIST = Arrays.asList(FLAVORS);
 26   
     private static List LIST_FLAVOR_LIST = Arrays.asList(LIST_FLAVORS);
 27   
 
 28   
     private Step step;
 29   
     private List steps;
 30   
     private List flavorList;
 31   
     private DataFlavor[] flavors;
 32   
 
 33  1
     public StepTransferable(Step step) {
 34  1
         this.step = step;
 35  1
         this.steps = new ArrayList();
 36  1
         steps.add(step);
 37  1
         flavorList = FLAVOR_LIST;
 38  1
         flavors = FLAVORS;
 39   
     }
 40   
 
 41  0
     public StepTransferable(List steps) {
 42  0
         this.step = null;
 43  0
         this.steps = steps;
 44  0
         flavorList = LIST_FLAVOR_LIST;
 45  0
         flavors = LIST_FLAVORS;
 46   
     }
 47   
 
 48  8
     public DataFlavor[] getTransferDataFlavors() {
 49  8
         return flavors;
 50   
     }
 51   
 
 52  0
     public boolean isDataFlavorSupported(DataFlavor flavor) {
 53  0
         return flavorList.contains(flavor);
 54   
     }
 55   
 
 56  0
     public Object getTransferData(DataFlavor flavor)
 57   
         throws UnsupportedFlavorException {
 58  0
         if (flavor.isMimeTypeEqual(STEP_FLAVOR.getMimeType())) {
 59  0
             if (step != null)
 60  0
                 return step;
 61   
         }
 62  0
         else if (flavor.isMimeTypeEqual(STEP_LIST_FLAVOR.getMimeType())) {
 63  0
             return steps;
 64   
         }
 65  0
         throw new UnsupportedFlavorException(flavor);
 66   
     }
 67   
 
 68  0
     public String toString() { 
 69  0
         return "Transferable "
 70  0
             + (step != null ? step.toString() : "List of Steps");
 71   
     }
 72   
 }
 73