Package org.jgraph.graph
Class GraphTransferable
- java.lang.Object
-
- org.jgraph.plaf.basic.BasicGraphTransferable
-
- org.jgraph.graph.GraphTransferable
-
- All Implemented Interfaces:
java.awt.datatransfer.ClipboardOwner,java.awt.datatransfer.Transferable,java.io.Serializable,javax.swing.plaf.UIResource
public class GraphTransferable extends BasicGraphTransferable implements java.io.Serializable, java.awt.datatransfer.ClipboardOwner
An object that represents the clipboard contents for a graph selection. The object has three representations:1. Richer: The cells, view attributes and connections for this selection are stored as separate datastructures, which can be inserted using the GraphModel.insert() method. 2. HTML: If one cell is selected, the userObject is returned as HTML. 3. Plain: The userObject of the selected cell is returned as plain text.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.MapattributeMap(Cell, Map) entries that hold the view attributes for the cells.protected java.awt.geom.Rectangle2DboundsRectangle that defines the former bounds of the views.protected java.lang.Object[]cellsSelected cells.protected ConnectionSetcsObject that describes the connection between cells.static java.awt.datatransfer.DataFlavordataFlavorLocal Machine Reference Data Flavor.protected ParentMappmObject that describes the group structure between cells.
-
Constructor Summary
Constructors Constructor Description GraphTransferable(java.lang.Object[] cells, java.util.Map attrMap, java.awt.geom.Rectangle2D bounds, ConnectionSet cs, ParentMap pm)Constructs a new transferable selection forcells,csandattrMap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.MapgetAttributeMap()Returns a map of (GraphCell, Map)-pairs that represent the view attributes for the respecive cells.java.awt.geom.Rectangle2DgetBounds()java.lang.Object[]getCells()Returns thecellsthat represent the selection.ConnectionSetgetConnectionSet()Returns the connections betweencells(and possibly other, unselected cells).java.lang.StringgetHTMLData()Fetch the data in a text/html format.ParentMapgetParentMap()java.lang.StringgetPlainData()Fetch the data in a text/plain format.java.lang.ObjectgetRicherData(java.awt.datatransfer.DataFlavor flavor)Fetch the data in a jvm-localreference format.java.awt.datatransfer.DataFlavor[]getRicherFlavors()Returns the jvm-localreference flavors of the transferable.booleanisHTMLSupported()Returns true if the transferable support a text/html format.booleanisPlainSupported()Returns true if the transferable support a text/plain format.voidlostOwnership(java.awt.datatransfer.Clipboard clip, java.awt.datatransfer.Transferable contents)-
Methods inherited from class org.jgraph.plaf.basic.BasicGraphTransferable
getTransferData, getTransferDataFlavors, isDataFlavorSupported, isHTMLFlavor, isPlainFlavor, isRicherFlavor, isStringFlavor
-
-
-
-
Field Detail
-
dataFlavor
public static java.awt.datatransfer.DataFlavor dataFlavor
Local Machine Reference Data Flavor.
-
cells
protected java.lang.Object[] cells
Selected cells.
-
cs
protected ConnectionSet cs
Object that describes the connection between cells.
-
pm
protected ParentMap pm
Object that describes the group structure between cells.
-
attributeMap
protected java.util.Map attributeMap
(Cell, Map) entries that hold the view attributes for the cells.
-
bounds
protected java.awt.geom.Rectangle2D bounds
Rectangle that defines the former bounds of the views.
-
-
Constructor Detail
-
GraphTransferable
public GraphTransferable(java.lang.Object[] cells, java.util.Map attrMap, java.awt.geom.Rectangle2D bounds, ConnectionSet cs, ParentMap pm)Constructs a new transferable selection forcells,csandattrMap.
-
-
Method Detail
-
getCells
public java.lang.Object[] getCells()
Returns thecellsthat represent the selection.
-
getConnectionSet
public ConnectionSet getConnectionSet()
Returns the connections betweencells(and possibly other, unselected cells).
-
getParentMap
public ParentMap getParentMap()
-
getAttributeMap
public java.util.Map getAttributeMap()
Returns a map of (GraphCell, Map)-pairs that represent the view attributes for the respecive cells.
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
-
lostOwnership
public void lostOwnership(java.awt.datatransfer.Clipboard clip, java.awt.datatransfer.Transferable contents)- Specified by:
lostOwnershipin interfacejava.awt.datatransfer.ClipboardOwner
-
getRicherFlavors
public java.awt.datatransfer.DataFlavor[] getRicherFlavors()
Returns the jvm-localreference flavors of the transferable.- Overrides:
getRicherFlavorsin classBasicGraphTransferable
-
getRicherData
public java.lang.Object getRicherData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorExceptionFetch the data in a jvm-localreference format.- Overrides:
getRicherDatain classBasicGraphTransferable- Throws:
java.awt.datatransfer.UnsupportedFlavorException
-
isPlainSupported
public boolean isPlainSupported()
Returns true if the transferable support a text/plain format.- Overrides:
isPlainSupportedin classBasicGraphTransferable
-
getPlainData
public java.lang.String getPlainData()
Fetch the data in a text/plain format.- Overrides:
getPlainDatain classBasicGraphTransferable
-
isHTMLSupported
public boolean isHTMLSupported()
Returns true if the transferable support a text/html format.- Overrides:
isHTMLSupportedin classBasicGraphTransferable
-
getHTMLData
public java.lang.String getHTMLData()
Fetch the data in a text/html format.- Overrides:
getHTMLDatain classBasicGraphTransferable
-
-