com.mxgraph.swing.handler
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 Object[] |
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) |
int |
getSourceActions(JComponent c) |
Color |
getTransferImageBackground() |
protected Object[] |
importCells(mxGraphComponent graphComponent,
Object[] cells,
double dx,
double dy,
Object target,
Point location) |
protected boolean |
importCells(mxGraphComponent graphComponent,
Object[] cells,
mxRectangle bounds)
Returns true if the cells have been imported.
|
boolean |
importData(JComponent c,
Transferable t) |
boolean |
isLocalDrag()
Returns true if the DnD operation started from this handler.
|
boolean |
isTransferImageEnabled() |
protected void |
removeCells(mxGraphComponent graphComponent,
Object[] cells) |
void |
setLocation(Point value) |
void |
setOffset(Point value) |
void |
setTransferImageBackground(Color transferImageBackground) |
void |
setTransferImageEnabled(boolean transferImageEnabled) |
canImport, exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation, importData
public static boolean DEFAULT_TRANSFER_IMAGE_ENABLED
public static Color DEFAULT_BACKGROUNDCOLOR
protected Object[] originalCells
protected Object[] lastImported
protected int importCount
protected boolean transferImageEnabled
protected Color transferImageBackground
protected Point location
protected Point offset
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 boolean importCells(mxGraphComponent graphComponent, Object[] cells, mxRectangle bounds)
protected Object[] importCells(mxGraphComponent graphComponent, Object[] cells, double dx, double dy, Object target, Point location)
Copyright (c) 2010 Gaudenz Alder. All rights reserved.