public class

StringTransferable

extends Object
implements Transferable
java.lang.Object
   ↳ vars.shared.ui.StringTransferable

Class Overview

This class represents the "transferable" object that is used in a drag and drop operation in the VARS annotation application. It currently only contains a string as the data being transferred, but it has the structure to do more than that in the future.


Summary

Constants
DataFlavor LOCAL_STRING_FLAVOR
DataFlavor[] flavors
Public Constructors
StringTransferable(String string)
The default constructor that simply initializes the instance
Public Methods
synchronized Object getTransferData(DataFlavor flavor)
This is the method that is used to get the transferred data object.
synchronized DataFlavor[] getTransferDataFlavors()
A method to return the data flavors that are being transferred with this transferable class
boolean isDataFlavorSupported(DataFlavor flavor)
A method to use to determine if this class supports a certain data flavor for transfer.
String toString()
Simply overriding the toString() method
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.awt.datatransfer.Transferable

Constants

public static final DataFlavor LOCAL_STRING_FLAVOR

public static final DataFlavor[] flavors

Public Constructors

public StringTransferable (String string)

The default constructor that simply initializes the instance

Parameters
string is the String that will be transferred as data in the operation

Public Methods

public synchronized Object getTransferData (DataFlavor flavor)

This is the method that is used to get the transferred data object. Once the object is retrieved, it should be cast into it appropriate class and then it can be used

Parameters
flavor This is the flavor of data that is being requested from the operation. Usually the caller will call isDataFlavorSupported first to see if the data can be retrieved in that flavor. If it is supported, the user can then call this method with that DataFlavor, get the returned object and cast it into what they were expecting
Returns
  • The Object that contains the data that is transferred
Throws
UnsupportedFlavorException Description of the Exception

public synchronized DataFlavor[] getTransferDataFlavors ()

A method to return the data flavors that are being transferred with this transferable class

Returns
  • An array of DataFlavor classes that tell what kind of data is transferred with this class

public boolean isDataFlavorSupported (DataFlavor flavor)

A method to use to determine if this class supports a certain data flavor for transfer.

Parameters
flavor Is the DataFlavor that is checked for transferrability
Returns
  • a boolean to indicate if the DataFlavor can be transferred (true) or not (false)

public String toString ()

Simply overriding the toString() method

Returns
  • Description of the Return Value