public class mxGraphTransferHandler
extends javax.swing.TransferHandler
Modifier and Type | Field and Description |
---|---|
static java.awt.Color |
DEFAULT_BACKGROUNDCOLOR
Specifies the background color of the transfer image.
|
static boolean |
DEFAULT_TRANSFER_IMAGE_ENABLED
Boolean that specifies if an image of the cells should be created for
each transferable.
|
protected int |
importCount
Counter for the last imported cell array.
|
protected int |
initialImportCount
Sets the value for the initialImportCount.
|
protected java.awt.datatransfer.Transferable |
lastImported
Reference to the last imported cell array.
|
protected java.awt.Point |
location |
protected java.awt.Point |
offset |
protected java.lang.Object[] |
originalCells
Reference to the original cells for removal after a move.
|
protected java.awt.Color |
transferImageBackground
Specifies the background color for the transfer image.
|
protected boolean |
transferImageEnabled
Specifies if a transfer image should be created for the transferable.
|
Constructor and Description |
---|
mxGraphTransferHandler() |
Modifier and Type | Method and Description |
---|---|
boolean |
canImport(javax.swing.JComponent comp,
java.awt.datatransfer.DataFlavor[] flavors) |
mxGraphTransferable |
createGraphTransferable(mxGraphComponent graphComponent,
java.lang.Object[] cells,
javax.swing.ImageIcon icon) |
mxGraphTransferable |
createGraphTransferable(mxGraphComponent graphComponent,
java.lang.Object[] cells,
mxRectangle bounds,
javax.swing.ImageIcon icon) |
java.awt.datatransfer.Transferable |
createTransferable(javax.swing.JComponent c)
(non-Javadoc)
|
javax.swing.ImageIcon |
createTransferableImage(mxGraphComponent graphComponent,
java.lang.Object[] cells) |
void |
exportDone(javax.swing.JComponent c,
java.awt.datatransfer.Transferable data,
int action) |
protected java.lang.Object |
getDropTarget(mxGraphComponent graphComponent,
mxGraphTransferable gt)
Returns the drop target for the given transferable and location.
|
int |
getImportCount() |
int |
getSourceActions(javax.swing.JComponent c) |
java.awt.Color |
getTransferImageBackground() |
protected java.lang.Object[] |
importCells(mxGraphComponent graphComponent,
mxGraphTransferable gt,
double dx,
double dy)
Gets a drop target using getDropTarget and imports the cells using
mxGraph.splitEdge or mxGraphComponent.importCells depending on the
drop target and the return values of mxGraph.isSplitEnabled and
mxGraph.isSplitTarget.
|
boolean |
importData(javax.swing.JComponent c,
java.awt.datatransfer.Transferable t)
Checks if the mxGraphTransferable data flavour is supported and calls
importGraphTransferable if possible.
|
protected boolean |
importGraphTransferable(mxGraphComponent graphComponent,
mxGraphTransferable gt)
Returns true if the cells have been imported using importCells.
|
boolean |
isLocalDrag()
Returns true if the DnD operation started from this handler.
|
boolean |
isTransferImageEnabled() |
protected void |
removeCells(mxGraphComponent graphComponent,
java.lang.Object[] cells) |
void |
setImportCount(int value) |
void |
setLocation(java.awt.Point value) |
void |
setOffset(java.awt.Point value) |
void |
setTransferImageBackground(java.awt.Color transferImageBackground) |
void |
setTransferImageEnabled(boolean transferImageEnabled) |
protected void |
updateImportCount(java.awt.datatransfer.Transferable t)
Counts the number of times that the given transferable has been imported.
|
public static boolean DEFAULT_TRANSFER_IMAGE_ENABLED
public static java.awt.Color DEFAULT_BACKGROUNDCOLOR
protected java.lang.Object[] originalCells
protected java.awt.datatransfer.Transferable lastImported
protected int initialImportCount
protected int importCount
protected boolean transferImageEnabled
protected java.awt.Color transferImageBackground
protected java.awt.Point location
protected java.awt.Point offset
public int getImportCount()
public void setImportCount(int value)
public void setTransferImageEnabled(boolean transferImageEnabled)
public boolean isTransferImageEnabled()
public void setTransferImageBackground(java.awt.Color transferImageBackground)
public java.awt.Color getTransferImageBackground()
public boolean isLocalDrag()
public void setLocation(java.awt.Point value)
public void setOffset(java.awt.Point value)
public boolean canImport(javax.swing.JComponent comp, java.awt.datatransfer.DataFlavor[] flavors)
canImport
in class javax.swing.TransferHandler
public java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent c)
createTransferable
in class javax.swing.TransferHandler
TransferHandler.createTransferable(javax.swing.JComponent)
public mxGraphTransferable createGraphTransferable(mxGraphComponent graphComponent, java.lang.Object[] cells, javax.swing.ImageIcon icon)
public mxGraphTransferable createGraphTransferable(mxGraphComponent graphComponent, java.lang.Object[] cells, mxRectangle bounds, javax.swing.ImageIcon icon)
public javax.swing.ImageIcon createTransferableImage(mxGraphComponent graphComponent, java.lang.Object[] cells)
public void exportDone(javax.swing.JComponent c, java.awt.datatransfer.Transferable data, int action)
exportDone
in class javax.swing.TransferHandler
protected void removeCells(mxGraphComponent graphComponent, java.lang.Object[] cells)
public int getSourceActions(javax.swing.JComponent c)
getSourceActions
in class javax.swing.TransferHandler
public boolean importData(javax.swing.JComponent c, java.awt.datatransfer.Transferable t)
importData
in class javax.swing.TransferHandler
protected void updateImportCount(java.awt.datatransfer.Transferable t)
protected boolean importGraphTransferable(mxGraphComponent graphComponent, mxGraphTransferable gt)
protected java.lang.Object getDropTarget(mxGraphComponent graphComponent, mxGraphTransferable gt)
protected java.lang.Object[] importCells(mxGraphComponent graphComponent, mxGraphTransferable gt, double dx, double dy)
Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.