de.fhg.igd.ui
Class ObjectSelection

java.lang.Object
  extended byde.fhg.igd.ui.ObjectSelection
All Implemented Interfaces:
Transferable

public class ObjectSelection
extends Object
implements Transferable

Represents a serialised object that is transfered e.g. by drag & drop.

Author:
Volker Roth "$Id: ObjectSelection.java 1913 2007-08-08 02:41:53Z jpeters $"

Field Summary
private  String className_
          The name of the class that is tranferred.
private  DataFlavor flavor_
          The DataFlavor of this Transferable .
private  byte[] obj_
          The serialized object graph.
 
Constructor Summary
ObjectSelection(Object o)
          Creates an instance with the given object.
 
Method Summary
 Object getTransferData(DataFlavor flavor)
          Deserializes and returns the embedded data object.
 DataFlavor[] getTransferDataFlavors()
          This Transferable supports only serialized object data flavor types.
 boolean isDataFlavorSupported(DataFlavor flavor)
          This transferable supports only serialized object data flavor types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

obj_

private byte[] obj_
The serialized object graph.


className_

private String className_
The name of the class that is tranferred.


flavor_

private DataFlavor flavor_
The DataFlavor of this Transferable .

Constructor Detail

ObjectSelection

public ObjectSelection(Object o)
                throws IOException,
                       NotSerializableException,
                       InvalidClassException
Creates an instance with the given object. The given object must be serializable.

Parameters:
o - The content object.
Method Detail

getTransferDataFlavors

public DataFlavor[] getTransferDataFlavors()
This Transferable supports only serialized object data flavor types.

Specified by:
getTransferDataFlavors in interface Transferable
Returns:
an array with one element, which is of a serialized object data flavor type.

isDataFlavorSupported

public boolean isDataFlavorSupported(DataFlavor flavor)
This transferable supports only serialized object data flavor types.

Specified by:
isDataFlavorSupported in interface Transferable
Returns:
true if the given data flavor is not null and is a serialized object type.

getTransferData

public Object getTransferData(DataFlavor flavor)
                       throws UnsupportedFlavorException,
                              IOException
Deserializes and returns the embedded data object.

Specified by:
getTransferData in interface Transferable
Returns:
The deserialized data object.
Throws:
IOException - if the object cannot be deserialized for some reason.
UnsupportedFlavorException - if the given flavor is not supported. In other words, if the given flavor is not a serialized object flavor type.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.