org.jgraph.graph

Class GraphTransferable

public class GraphTransferable extends BasicGraphTransferable implements Serializable, 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.

Field Summary
protected MapattributeMap
(Cell, Map) entries that hold the view attributes for the cells.
protected Rectangle2Dbounds
Rectangle that defines the former bounds of the views.
protected Object[]cells
Selected cells.
protected ConnectionSetcs
Object that describes the connection between cells.
static DataFlavordataFlavor
Local Machine Reference Data Flavor.
protected ParentMappm
Object that describes the group structure between cells.
Constructor Summary
GraphTransferable(Object[] cells, Map attrMap, Rectangle2D bounds, ConnectionSet cs, ParentMap pm)
Constructs a new transferable selection for cells, csand attrMap.
Method Summary
MapgetAttributeMap()
Returns a map of (GraphCell, Map)-pairs that represent the view attributes for the respecive cells.
Rectangle2DgetBounds()
Object[]getCells()
Returns the cells that represent the selection.
ConnectionSetgetConnectionSet()
Returns the connections between cells (and possibly other, unselected cells).
StringgetHTMLData()
Fetch the data in a text/html format.
ParentMapgetParentMap()
StringgetPlainData()
Fetch the data in a text/plain format.
ObjectgetRicherData(DataFlavor flavor)
Fetch the data in a jvm-localreference format.
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(Clipboard clip, Transferable contents)

Field Detail

attributeMap

protected Map attributeMap
(Cell, Map) entries that hold the view attributes for the cells.

bounds

protected Rectangle2D bounds
Rectangle that defines the former bounds of the views.

cells

protected Object[] cells
Selected cells.

cs

protected ConnectionSet cs
Object that describes the connection between cells.

dataFlavor

public static DataFlavor dataFlavor
Local Machine Reference Data Flavor.

pm

protected ParentMap pm
Object that describes the group structure between cells.

Constructor Detail

GraphTransferable

public GraphTransferable(Object[] cells, Map attrMap, Rectangle2D bounds, ConnectionSet cs, ParentMap pm)
Constructs a new transferable selection for cells, csand attrMap.

Method Detail

getAttributeMap

public Map getAttributeMap()
Returns a map of (GraphCell, Map)-pairs that represent the view attributes for the respecive cells.

getBounds

public Rectangle2D getBounds()

getCells

public Object[] getCells()
Returns the cells that represent the selection.

getConnectionSet

public ConnectionSet getConnectionSet()
Returns the connections between cells (and possibly other, unselected cells).

getHTMLData

public String getHTMLData()
Fetch the data in a text/html format.

getParentMap

public ParentMap getParentMap()

getPlainData

public String getPlainData()
Fetch the data in a text/plain format.

getRicherData

public Object getRicherData(DataFlavor flavor)
Fetch the data in a jvm-localreference format.

getRicherFlavors

public DataFlavor[] getRicherFlavors()
Returns the jvm-localreference flavors of the transferable.

isHTMLSupported

public boolean isHTMLSupported()
Returns true if the transferable support a text/html format.

isPlainSupported

public boolean isPlainSupported()
Returns true if the transferable support a text/plain format.

lostOwnership

public void lostOwnership(Clipboard clip, Transferable contents)
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.