public class mxGraphTransferable
extends java.lang.Object
implements java.awt.datatransfer.Transferable, javax.swing.plaf.UIResource, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected mxRectangle |
bounds |
protected java.lang.Object[] |
cells |
static java.awt.datatransfer.DataFlavor |
dataFlavor
Serialized Data Flavor.
|
static boolean |
enableImageSupport
Global switch to disable image support in transferables.
|
protected javax.swing.ImageIcon |
image |
Constructor and Description |
---|
mxGraphTransferable(java.lang.Object[] cells,
mxRectangle bounds) |
mxGraphTransferable(java.lang.Object[] cells,
mxRectangle bounds,
javax.swing.ImageIcon image) |
Modifier and Type | Method and Description |
---|---|
mxRectangle |
getBounds()
Returns the unscaled, untranslated bounding box of the cells.
|
java.lang.Object[] |
getCells() |
protected java.lang.String |
getHtmlData()
Fetch the data in a text/html format
|
javax.swing.ImageIcon |
getImage() |
protected java.lang.String |
getPlainData()
Fetch the data in a text/plain format.
|
java.lang.Object |
getRicherData(java.awt.datatransfer.DataFlavor flavor) |
protected java.awt.datatransfer.DataFlavor[] |
getRicherFlavors()
Some subclasses will have flavors that are more descriptive than HTML or
plain text.
|
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor flavor)
Returns an object which represents the data to be transferred.
|
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors() |
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Returns whether or not the specified data flavor is supported for this
object.
|
protected boolean |
isHtmlFlavor(java.awt.datatransfer.DataFlavor flavor)
Returns whether or not the specified data flavor is an HTML flavor that
is supported.
|
protected boolean |
isHtmlSupported()
Whether the HTML flavors are offered.
|
protected boolean |
isImageFlavor(java.awt.datatransfer.DataFlavor flavor) |
boolean |
isImageSupported() |
protected boolean |
isPlainFlavor(java.awt.datatransfer.DataFlavor flavor)
Returns whether or not the specified data flavor is an plain flavor that
is supported.
|
protected boolean |
isPlainSupported()
Whether the plain text flavors are offered.
|
protected boolean |
isRicherFlavor(java.awt.datatransfer.DataFlavor flavor) |
protected boolean |
isStringFlavor(java.awt.datatransfer.DataFlavor flavor)
Returns whether or not the specified data flavor is a String flavor that
is supported.
|
public static boolean enableImageSupport
public static java.awt.datatransfer.DataFlavor dataFlavor
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());
protected java.lang.Object[] cells
protected mxRectangle bounds
protected javax.swing.ImageIcon image
public mxGraphTransferable(java.lang.Object[] cells, mxRectangle bounds)
public mxGraphTransferable(java.lang.Object[] cells, mxRectangle bounds, javax.swing.ImageIcon image)
public java.lang.Object[] getCells()
public mxRectangle getBounds()
public javax.swing.ImageIcon getImage()
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors
in interface java.awt.datatransfer.Transferable
protected java.awt.datatransfer.DataFlavor[] getRicherFlavors()
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
isDataFlavorSupported
in interface java.awt.datatransfer.Transferable
flavor
- the requested flavor for the datapublic java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException
getTransferData
in interface java.awt.datatransfer.Transferable
flavor
- the requested flavor for the datajava.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.DataFlavor.getRepresentationClass()
protected boolean isRicherFlavor(java.awt.datatransfer.DataFlavor flavor)
flavor
- public java.lang.Object getRicherData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException
flavor
- java.awt.datatransfer.UnsupportedFlavorException
protected boolean isHtmlFlavor(java.awt.datatransfer.DataFlavor flavor)
flavor
- the requested flavor for the dataprotected boolean isHtmlSupported()
protected java.lang.String getHtmlData()
protected boolean isImageFlavor(java.awt.datatransfer.DataFlavor flavor)
flavor
- public boolean isImageSupported()
protected boolean isPlainFlavor(java.awt.datatransfer.DataFlavor flavor)
flavor
- the requested flavor for the dataprotected boolean isPlainSupported()
protected java.lang.String getPlainData()
protected boolean isStringFlavor(java.awt.datatransfer.DataFlavor flavor)
flavor
- the requested flavor for the dataCopyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.