com.mxgraph.swing.util
Class mxGraphTransferable
- java.lang.Object
-
- com.mxgraph.swing.util.mxGraphTransferable
-
- All Implemented Interfaces:
- java.awt.datatransfer.Transferable, java.io.Serializable, javax.swing.plaf.UIResource
public class mxGraphTransferable extends java.lang.Object implements java.awt.datatransfer.Transferable, javax.swing.plaf.UIResource, java.io.Serializable- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static java.awt.datatransfer.DataFlavordataFlavorSerialized Data Flavor.static booleanenableImageSupportGlobal switch to disable image support in transferables.
-
Constructor Summary
Constructors Constructor and Description mxGraphTransferable(java.lang.Object[] cells, mxRectangle bounds)mxGraphTransferable(java.lang.Object[] cells, mxRectangle bounds, javax.swing.ImageIcon image)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description mxRectanglegetBounds()Returns the unscaled, untranslated bounding box of the cells.java.lang.Object[]getCells()javax.swing.ImageIcongetImage()java.lang.ObjectgetRicherData(java.awt.datatransfer.DataFlavor flavor)java.lang.ObjectgetTransferData(java.awt.datatransfer.DataFlavor flavor)Returns an object which represents the data to be transferred.java.awt.datatransfer.DataFlavor[]getTransferDataFlavors()booleanisDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)Returns whether or not the specified data flavor is supported for this object.booleanisImageSupported()
-
-
-
Field Detail
-
enableImageSupport
public static boolean enableImageSupport
Global switch to disable image support in transferables. Set this to false as a workaround for Data translation failed: not an image format in Java 1.7 on Mac OS X.
-
dataFlavor
public static java.awt.datatransfer.DataFlavor dataFlavor
Serialized Data Flavor. Use the following code to switch to local reference flavor:try { mxGraphTransferable.dataFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + "; class=com.mxgraph.swing.util.mxGraphTransferable"); } catch (ClassNotFoundException cnfe) { // do nothing }If you get a class not found exception, try the following instead:mxGraphTransferable.dataFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + "; class=com.mxgraph.swing.util.mxGraphTransferable", null, new com.mxgraph.swing.util.mxGraphTransferable(null, null).getClass().getClassLoader());
-
-
Constructor Detail
-
mxGraphTransferable
public mxGraphTransferable(java.lang.Object[] cells, mxRectangle bounds)
-
mxGraphTransferable
public mxGraphTransferable(java.lang.Object[] cells, mxRectangle bounds, javax.swing.ImageIcon image)
-
-
Method Detail
-
getCells
public java.lang.Object[] getCells()
- Returns:
- Returns the cells.
-
getBounds
public mxRectangle getBounds()
Returns the unscaled, untranslated bounding box of the cells.
-
getImage
public javax.swing.ImageIcon getImage()
-
getTransferDataFlavors
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
- Specified by:
getTransferDataFlavorsin interfacejava.awt.datatransfer.Transferable
-
isDataFlavorSupported
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Returns whether or not the specified data flavor is supported for this object.- Specified by:
isDataFlavorSupportedin interfacejava.awt.datatransfer.Transferable- Parameters:
flavor- the requested flavor for the data- Returns:
- boolean indicating whether or not the data flavor is supported
-
getTransferData
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOExceptionReturns an object which represents the data to be transferred. The class of the object returned is defined by the representation class of the flavor.- Specified by:
getTransferDatain interfacejava.awt.datatransfer.Transferable- Parameters:
flavor- the requested flavor for the data- Throws:
java.io.IOException- if the data is no longer available in the requested flavor.java.awt.datatransfer.UnsupportedFlavorException- if the requested data flavor is not supported.- See Also:
DataFlavor.getRepresentationClass()
-
getRicherData
public java.lang.Object getRicherData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException- Parameters:
flavor-- Returns:
- the richer data flavor of this and the specified
- Throws:
java.awt.datatransfer.UnsupportedFlavorException
-
isImageSupported
public boolean isImageSupported()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG