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 boolean
Controls if all inserts should be handled as external drops even if all cells are already in the graph model.protected Object
protected int
protected Object
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, LINK, MOVE, NONE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canImport
(JComponent comp, DataFlavor[] flavors) protected GraphTransferable
create
(JGraph graph, Object[] cells, Map viewAttributes, Rectangle2D bounds, ConnectionSet cs, ParentMap pm) protected Transferable
protected Transferable
createTransferable
(JGraph graph, Object[] cells) createTransferableForGraph
(JGraph graph) protected void
exportDone
(JComponent comp, Transferable data, int action) protected Point2D
getInsertionOffset
(JGraph graph, int inCount, Rectangle2D bounds) Hook method to determine offset of cells cloned via the clipboardint
protected void
handleExternalDrop
(JGraph graph, Object[] cells, Map nested, ConnectionSet cs, ParentMap pm, double dx, double dy) boolean
importData
(JComponent comp, Transferable t) protected boolean
importDataImpl
(JComponent comp, Transferable t) boolean
void
setAlwaysReceiveAsCopyAction
(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:
canImport
in classTransferHandler
-
createTransferableForGraph
-
createTransferable
- Overrides:
createTransferable
in classTransferHandler
-
createTransferable
-
create
protected GraphTransferable create(JGraph graph, Object[] cells, Map viewAttributes, Rectangle2D bounds, ConnectionSet cs, ParentMap pm) -
exportDone
- Overrides:
exportDone
in classTransferHandler
-
getSourceActions
- Overrides:
getSourceActions
in classTransferHandler
-
importData
- Overrides:
importData
in 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.
-