yext.export.datatransfer
Class VisualTransferable

java.lang.Object
  extended by yext.export.datatransfer.VisualTransferable
All Implemented Interfaces:
ClipboardOwner, Transferable

public class VisualTransferable
extends Object
implements ClipboardOwner, Transferable

A transferable implementation for transferring a Graph2DView's contents EMF representation. This transferable can be used to copy a graph to the System Clipboard for convenient transfer to applications which can display EMF content. For example, on Windows an EMF depicting a graph can be easily imported into Word using this approach.

Additionally, DataFlavor.imageFlavor is supported to retrieve the transfer data as a Image object.

Optionally, several additional fallback data formats are provided for EMF unaware use cases. To use these fallback data formats property fallbackFlavorsEnabled has to be set to true by using the two argument constructor VisualTransferable(y.view.Graph2DView, boolean) appropriately. The available fallback data formats depend on the version of the Java Runtime Environment used. Method getTransferDataFlavors() should be used to check for supported data formats in this case.

 

Field Summary
static DataFlavor emfFlavor
          The DataFlavor representing a EMF Image, where: mimeType = "image/x-emf"
 
Constructor Summary
VisualTransferable(Graph2DView view)
          Constructs a new VisualTransferable for the given view.
VisualTransferable(Graph2DView view, boolean fallbackFlavorsEnabled)
          Constructs a new VisualTransferable for the given view.
 
Method Summary
 void addRenderingHint(RenderingHints.Key key, Object value)
          Adds a rendering hint key-value-pair, that is passed to the underlying rendering subsystem.
 Object getTransferData(DataFlavor dataFlavor)
           
 DataFlavor[] getTransferDataFlavors()
           
 boolean isDataFlavorSupported(DataFlavor dataFlavor)
           
 boolean isFallbackFlavorsEnabled()
          Returns true iff this transferable is configured to support several image based data flavors for EMF unaware use cases.
 void lostOwnership(Clipboard clipboard, Transferable transferable)
           
 void removeRenderingHint(RenderingHints.Key key)
          Removes a rendering hint key-value-pair, so that it is no longer passed to the underlying rendering subsystem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

emfFlavor

public static final DataFlavor emfFlavor
The DataFlavor representing a EMF Image, where:
   mimeType            = "image/x-emf"
 

Constructor Detail

VisualTransferable

public VisualTransferable(Graph2DView view)
Constructs a new VisualTransferable for the given view.

Parameters:
view - the Graph2DView whose visible rectangle is to be represented as transfer data

VisualTransferable

public VisualTransferable(Graph2DView view,
                          boolean fallbackFlavorsEnabled)
Constructs a new VisualTransferable for the given view.

Parameters:
view - the Graph2DView whose visible rectangle is to be represented as transfer data
fallbackFlavorsEnabled - if true, additional image based data flavors are supported for EMF unaware use cases.
Method Detail

getTransferData

public Object getTransferData(DataFlavor dataFlavor)
                       throws UnsupportedFlavorException,
                              IOException
Specified by:
getTransferData in interface Transferable
Throws:
UnsupportedFlavorException
IOException

getTransferDataFlavors

public DataFlavor[] getTransferDataFlavors()
Specified by:
getTransferDataFlavors in interface Transferable

isDataFlavorSupported

public boolean isDataFlavorSupported(DataFlavor dataFlavor)
Specified by:
isDataFlavorSupported in interface Transferable

lostOwnership

public void lostOwnership(Clipboard clipboard,
                          Transferable transferable)
Specified by:
lostOwnership in interface ClipboardOwner

isFallbackFlavorsEnabled

public boolean isFallbackFlavorsEnabled()
Returns true iff this transferable is configured to support several image based data flavors for EMF unaware use cases. The available fallback data flavors depend on the version of the Java Runtime Environment used. Method getTransferDataFlavors() should be used to check for supported data flavors.

Returns:
true iff this transferable is configured to support several image based DataFlavors for EMF unaware use cases.

addRenderingHint

public void addRenderingHint(RenderingHints.Key key,
                             Object value)
Adds a rendering hint key-value-pair, that is passed to the underlying rendering subsystem.

Parameters:
key - the key of the hint to be set
value - the value indicating preferences for the specified hint category

removeRenderingHint

public void removeRenderingHint(RenderingHints.Key key)
Removes a rendering hint key-value-pair, so that it is no longer passed to the underlying rendering subsystem.

Parameters:
key - the key of the hint to be remove


© Copyright 2007-2015,
yWorks GmbH.
All rights reserved.