org.jgraph.graph

Class GraphTransferHandler

public class GraphTransferHandler extends TransferHandler

Field Summary
protected booleanalwaysReceiveAsCopyAction
Controls if all inserts should be handled as external drops even if all cells are already in the graph model.
protected Objectin
protected intinCount
protected Objectout
Method Summary
booleancanImport(JComponent comp, DataFlavor[] flavors)
protected GraphTransferablecreate(JGraph graph, Object[] cells, Map viewAttributes, Rectangle2D bounds, ConnectionSet cs, ParentMap pm)
protected TransferablecreateTransferable(JComponent c)
protected TransferablecreateTransferable(JGraph graph, Object[] cells)
TransferablecreateTransferableForGraph(JGraph graph)
protected voidexportDone(JComponent comp, Transferable data, int action)
protected Point2DgetInsertionOffset(JGraph graph, int inCount, Rectangle2D bounds)
Hook method to determine offset of cells cloned via the clipboard
intgetSourceActions(JComponent c)
protected voidhandleExternalDrop(JGraph graph, Object[] cells, Map nested, ConnectionSet cs, ParentMap pm, double dx, double dy)
booleanimportData(JComponent comp, Transferable t)
protected booleanimportDataImpl(JComponent comp, Transferable t)
booleanisAlwaysReceiveAsCopyAction()
voidsetAlwaysReceiveAsCopyAction(boolean alwaysReceiveAsCopyAction)

Field Detail

alwaysReceiveAsCopyAction

protected boolean alwaysReceiveAsCopyAction
Controls if all inserts should be handled as external drops even if all cells are already in the graph model. This is useful if the enclosing component does not allow moving.

in

protected Object in

inCount

protected int inCount

out

protected Object out

Method Detail

canImport

public boolean canImport(JComponent comp, DataFlavor[] flavors)

create

protected GraphTransferable create(JGraph graph, Object[] cells, Map viewAttributes, Rectangle2D bounds, ConnectionSet cs, ParentMap pm)

createTransferable

protected Transferable createTransferable(JComponent c)

createTransferable

protected Transferable createTransferable(JGraph graph, Object[] cells)

createTransferableForGraph

public Transferable createTransferableForGraph(JGraph graph)

exportDone

protected void exportDone(JComponent comp, Transferable data, int action)

getInsertionOffset

protected Point2D getInsertionOffset(JGraph graph, int inCount, Rectangle2D bounds)
Hook method to determine offset of cells cloned via the clipboard

Parameters: graph the graph the insertion is occurring on inCount the number of time the insert has been applied bounds the bounds of the transferred graph

Returns: the offset from the cloned cell(s)

getSourceActions

public int getSourceActions(JComponent c)

handleExternalDrop

protected void handleExternalDrop(JGraph graph, Object[] cells, Map nested, ConnectionSet cs, ParentMap pm, double dx, double dy)

importData

public boolean importData(JComponent comp, Transferable t)

importDataImpl

protected boolean importDataImpl(JComponent comp, Transferable t)

isAlwaysReceiveAsCopyAction

public boolean isAlwaysReceiveAsCopyAction()

Returns: Returns the alwaysReceiveAsCopyAction.

setAlwaysReceiveAsCopyAction

public void setAlwaysReceiveAsCopyAction(boolean alwaysReceiveAsCopyAction)

Parameters: alwaysReceiveAsCopyAction The alwaysReceiveAsCopyAction to set.

Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.