Package org.jgraph.graph
Class GraphTransferHandler
java.lang.Object
javax.swing.TransferHandler
org.jgraph.graph.GraphTransferHandler
- All Implemented Interfaces:
Serializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.TransferHandler
TransferHandler.DropLocation, TransferHandler.TransferSupport -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanControls if all inserts should be handled as external drops even if all cells are already in the graph model.protected Objectprotected intprotected ObjectFields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, LINK, MOVE, NONE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanImport(JComponent comp, DataFlavor[] flavors) protected GraphTransferablecreate(JGraph graph, Object[] cells, Map viewAttributes, Rectangle2D bounds, ConnectionSet cs, ParentMap pm) protected Transferableprotected TransferablecreateTransferable(JGraph graph, Object[] cells) createTransferableForGraph(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 clipboardintprotected 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) booleanvoidsetAlwaysReceiveAsCopyAction(boolean alwaysReceiveAsCopyAction) Methods inherited from class javax.swing.TransferHandler
canImport, exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getDragImage, getDragImageOffset, getPasteAction, getVisualRepresentation, importData, setDragImage, setDragImageOffset
-
Field Details
-
alwaysReceiveAsCopyAction
protected boolean alwaysReceiveAsCopyActionControls 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. -
out
-
in
-
inCount
protected int inCount
-
-
Constructor Details
-
GraphTransferHandler
public GraphTransferHandler()
-
-
Method Details
-
canImport
- Overrides:
canImportin classTransferHandler
-
createTransferableForGraph
-
createTransferable
- Overrides:
createTransferablein classTransferHandler
-
createTransferable
-
create
protected GraphTransferable create(JGraph graph, Object[] cells, Map viewAttributes, Rectangle2D bounds, ConnectionSet cs, ParentMap pm) -
exportDone
- Overrides:
exportDonein classTransferHandler
-
getSourceActions
- Overrides:
getSourceActionsin classTransferHandler
-
importData
- Overrides:
importDatain classTransferHandler
-
getInsertionOffset
Hook method to determine offset of cells cloned via the clipboard- Parameters:
graph- the graph the insertion is occurring oninCount- the number of time the insert has been appliedbounds- the bounds of the transferred graph- Returns:
- the offset from the cloned cell(s)
-
handleExternalDrop
protected void handleExternalDrop(JGraph graph, Object[] cells, Map nested, ConnectionSet cs, ParentMap pm, double dx, double dy) -
importDataImpl
-
isAlwaysReceiveAsCopyAction
public boolean isAlwaysReceiveAsCopyAction()- Returns:
- Returns the alwaysReceiveAsCopyAction.
-
setAlwaysReceiveAsCopyAction
public void setAlwaysReceiveAsCopyAction(boolean alwaysReceiveAsCopyAction) - Parameters:
alwaysReceiveAsCopyAction- The alwaysReceiveAsCopyAction to set.
-