public class mxGraphTransferHandler extends TransferHandler
TransferHandler.DropLocation, TransferHandler.TransferSupport
Modifier and Type | Field and Description |
---|---|
static 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 Transferable |
lastImported
Reference to the last imported cell array.
|
protected Point |
location |
protected Point |
offset |
protected Object[] |
originalCells
Reference to the original cells for removal after a move.
|
protected Color |
transferImageBackground
Specifies the background color for the transfer image.
|
protected boolean |
transferImageEnabled
Specifies if a transfer image should be created for the transferable.
|
COPY, COPY_OR_MOVE, LINK, MOVE, NONE
Constructor and Description |
---|
mxGraphTransferHandler() |
Modifier and Type | Method and Description |
---|---|
boolean |
canImport(JComponent comp,
DataFlavor[] flavors) |
mxGraphTransferable |
createGraphTransferable(mxGraphComponent graphComponent,
Object[] cells,
ImageIcon icon) |
mxGraphTransferable |
createGraphTransferable(mxGraphComponent graphComponent,
Object[] cells,
mxRectangle bounds,
ImageIcon icon) |
Transferable |
createTransferable(JComponent c)
(non-Javadoc)
|
ImageIcon |
createTransferableImage(mxGraphComponent graphComponent,
Object[] cells) |
void |
exportDone(JComponent c,
Transferable data,
int action) |
protected Object |
getDropTarget(mxGraphComponent graphComponent,
mxGraphTransferable gt)
Returns the drop target for the given transferable and location.
|
int |
getImportCount() |
int |
getSourceActions(JComponent c) |
Color |
getTransferImageBackground() |
protected 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(JComponent c,
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,
Object[] cells) |
void |
setImportCount(int value) |
void |
setLocation(Point value) |
void |
setOffset(Point value) |
void |
setTransferImageBackground(Color transferImageBackground) |
void |
setTransferImageEnabled(boolean transferImageEnabled) |
protected void |
updateImportCount(Transferable t)
Counts the number of times that the given transferable has been imported.
|
canImport, exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getDragImage, getDragImageOffset, getPasteAction, getVisualRepresentation, importData, setDragImage, setDragImageOffset
public static boolean DEFAULT_TRANSFER_IMAGE_ENABLED
public static Color DEFAULT_BACKGROUNDCOLOR
protected Object[] originalCells
protected Transferable lastImported
protected int initialImportCount
protected int importCount
protected boolean transferImageEnabled
protected Color transferImageBackground
protected Point location
protected Point offset
public int getImportCount()
public void setImportCount(int value)
public void setTransferImageEnabled(boolean transferImageEnabled)
public boolean isTransferImageEnabled()
public void setTransferImageBackground(Color transferImageBackground)
public Color getTransferImageBackground()
public boolean isLocalDrag()
public void setLocation(Point value)
public void setOffset(Point value)
public boolean canImport(JComponent comp, DataFlavor[] flavors)
canImport
in class TransferHandler
public Transferable createTransferable(JComponent c)
createTransferable
in class TransferHandler
TransferHandler.createTransferable(javax.swing.JComponent)
public mxGraphTransferable createGraphTransferable(mxGraphComponent graphComponent, Object[] cells, ImageIcon icon)
public mxGraphTransferable createGraphTransferable(mxGraphComponent graphComponent, Object[] cells, mxRectangle bounds, ImageIcon icon)
public ImageIcon createTransferableImage(mxGraphComponent graphComponent, Object[] cells)
public void exportDone(JComponent c, Transferable data, int action)
exportDone
in class TransferHandler
protected void removeCells(mxGraphComponent graphComponent, Object[] cells)
public int getSourceActions(JComponent c)
getSourceActions
in class TransferHandler
public boolean importData(JComponent c, Transferable t)
importData
in class TransferHandler
protected void updateImportCount(Transferable t)
protected boolean importGraphTransferable(mxGraphComponent graphComponent, mxGraphTransferable gt)
protected Object getDropTarget(mxGraphComponent graphComponent, mxGraphTransferable gt)
protected Object[] importCells(mxGraphComponent graphComponent, mxGraphTransferable gt, double dx, double dy)
Copyright (c) 2010-2017 Gaudenz Alder, JGraph Ltd. All rights reserved.