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