jsky.util
Class TransferableList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList
              extended by jsky.util.TransferableList
All Implemented Interfaces:
java.awt.datatransfer.Transferable, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

public class TransferableList
extends java.util.ArrayList
implements java.awt.datatransfer.Transferable

An ArrayList that implements the Transferable interface.

This code was developed by NASA, Goddard Space Flight Center, Code 588 for the Scientist's Expert Assistant (SEA) project.

Version:
05/24/99
Author:
J. Jones / 588
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
TransferableList()
          Creates an empty list.
TransferableList(java.util.Collection c)
          Creates a list containing the elements in the specified collection.
TransferableList(int initialCapacity)
          Creates a list with the specified initial capacity.
 
Method Summary
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
          Returns an array of Objects that contains the transfer data for all Transferables within the TransferableList that support the specified DataFlavor.
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
          Returns the set of supported DataFlavors for the Transferables in the list.
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
          Returns true if the DataFlavor is supported by at least one item in the TransferableList.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

TransferableList

public TransferableList()
Creates an empty list.


TransferableList

public TransferableList(java.util.Collection c)
Creates a list containing the elements in the specified collection.


TransferableList

public TransferableList(int initialCapacity)
Creates a list with the specified initial capacity.

Method Detail

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Returns the set of supported DataFlavors for the Transferables in the list. Iterates through the Transferables and adds each Transferable's DataFlavors to the set. The DataFlavors returned by this method are supported by at least one item within the TransferableList, but not necessarily all items.

Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable
Returns:
set of possible DataFlavors

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Returns true if the DataFlavor is supported by at least one item in the TransferableList.

Specified by:
isDataFlavorSupported in interface java.awt.datatransfer.Transferable
Parameters:
flavor - DataFlavor to test
Returns:
true if DataFlavor is supported

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
Returns an array of Objects that contains the transfer data for all Transferables within the TransferableList that support the specified DataFlavor.

Specified by:
getTransferData in interface java.awt.datatransfer.Transferable
Parameters:
flavor - extract data for this DataFlavor
Returns:
array of objects that match the DataFlavor
Throws:
java.awt.datatransfer.UnsupportedFlavorException - thrown if none of the elements in the list support the flavor
java.io.IOException