Class mxGraphTransferHandler
java.lang.Object
javax.swing.TransferHandler
com.mxgraph.swing.handler.mxGraphTransferHandler
- All Implemented Interfaces:
Serializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class TransferHandler
TransferHandler.DropLocation, TransferHandler.TransferSupport -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic ColorSpecifies the background color of the transfer image.static booleanBoolean that specifies if an image of the cells should be created for each transferable.protected intCounter for the last imported cell array.protected intSets the value for the initialImportCount.protected TransferableReference to the last imported cell array.protected Pointprotected Pointprotected Object[]Reference to the original cells for removal after a move.protected ColorSpecifies the background color for the transfer image.protected booleanSpecifies if a transfer image should be created for the transferable.Fields inherited from class TransferHandler
COPY, COPY_OR_MOVE, LINK, MOVE, NONE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanImport(JComponent comp, DataFlavor[] flavors) createGraphTransferable(mxGraphComponent graphComponent, Object[] cells, mxRectangle bounds, ImageIcon icon) createGraphTransferable(mxGraphComponent graphComponent, Object[] cells, ImageIcon icon) (non-Javadoc)createTransferableImage(mxGraphComponent graphComponent, Object[] cells) voidexportDone(JComponent c, Transferable data, int action) protected ObjectgetDropTarget(mxGraphComponent graphComponent, mxGraphTransferable gt) Returns the drop target for the given transferable and location.intintprotected 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.booleanimportData(JComponent c, Transferable t) Checks if the mxGraphTransferable data flavour is supported and calls importGraphTransferable if possible.protected booleanimportGraphTransferable(mxGraphComponent graphComponent, mxGraphTransferable gt) Returns true if the cells have been imported using importCells.booleanReturns true if the DnD operation started from this handler.booleanprotected voidremoveCells(mxGraphComponent graphComponent, Object[] cells) voidsetImportCount(int value) voidsetLocation(Point value) voidvoidsetTransferImageBackground(Color transferImageBackground) voidsetTransferImageEnabled(boolean transferImageEnabled) protected voidCounts the number of times that the given transferable has been imported.Methods inherited from class TransferHandler
canImport, exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getDragImage, getDragImageOffset, getPasteAction, getVisualRepresentation, importData, setDragImage, setDragImageOffset
-
Field Details
-
DEFAULT_TRANSFER_IMAGE_ENABLED
public static boolean DEFAULT_TRANSFER_IMAGE_ENABLEDBoolean that specifies if an image of the cells should be created for each transferable. Default is true. -
DEFAULT_BACKGROUNDCOLOR
Specifies the background color of the transfer image. If no color is given here then the background color of the enclosing graph component is used. Default is Color.WHITE. -
originalCells
Reference to the original cells for removal after a move. -
lastImported
Reference to the last imported cell array. -
initialImportCount
protected int initialImportCountSets the value for the initialImportCount. Default is 1. Updated in exportDone to contain 0 after a cut and 1 after a copy. -
importCount
protected int importCountCounter for the last imported cell array. -
transferImageEnabled
protected boolean transferImageEnabledSpecifies if a transfer image should be created for the transferable. Default is DEFAULT_TRANSFER_IMAGE. -
transferImageBackground
Specifies the background color for the transfer image. Default is DEFAULT_BACKGROUNDCOLOR. -
location
-
offset
-
-
Constructor Details
-
mxGraphTransferHandler
public mxGraphTransferHandler()
-
-
Method Details
-
getImportCount
public int getImportCount() -
setImportCount
public void setImportCount(int value) -
setTransferImageEnabled
public void setTransferImageEnabled(boolean transferImageEnabled) -
isTransferImageEnabled
public boolean isTransferImageEnabled() -
setTransferImageBackground
-
getTransferImageBackground
-
isLocalDrag
public boolean isLocalDrag()Returns true if the DnD operation started from this handler. -
setLocation
-
setOffset
-
canImport
- Overrides:
canImportin classTransferHandler
-
createTransferable
(non-Javadoc)- Overrides:
createTransferablein classTransferHandler- See Also:
-
createGraphTransferable
public mxGraphTransferable createGraphTransferable(mxGraphComponent graphComponent, Object[] cells, ImageIcon icon) -
createGraphTransferable
public mxGraphTransferable createGraphTransferable(mxGraphComponent graphComponent, Object[] cells, mxRectangle bounds, ImageIcon icon) -
createTransferableImage
-
exportDone
- Overrides:
exportDonein classTransferHandler
-
removeCells
-
getSourceActions
- Overrides:
getSourceActionsin classTransferHandler
-
importData
Checks if the mxGraphTransferable data flavour is supported and calls importGraphTransferable if possible.- Overrides:
importDatain classTransferHandler
-
updateImportCount
Counts the number of times that the given transferable has been imported. -
importGraphTransferable
Returns true if the cells have been imported using importCells. -
getDropTarget
Returns the drop target for the given transferable and location. -
importCells
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. Selects and returns the cells that have been imported.
-