public class ConnectionSet
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
ConnectionSet.Connection
Object that represents the connection between an edge and a port.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Set |
connections
Contents of the connection set.
|
protected java.util.Set |
edges
Set of changed edges for the connection set.
|
Constructor and Description |
---|
ConnectionSet()
Constructs an empty ConnectionSet.
|
ConnectionSet(java.lang.Object edge,
java.lang.Object port,
boolean source)
Constructs a ConnectionSet with one Connection.
|
ConnectionSet(java.lang.Object edge,
java.lang.Object source,
java.lang.Object target)
Constructs a ConnectionSet with two Connections (to the source and target
port of the edge).
|
ConnectionSet(java.util.Set connections)
Constructs a connection set containing the specified connections and
updates the set of changed edges.
|
Modifier and Type | Method and Description |
---|---|
void |
addConnections(CellView[] views)
Adds the connections in
views to the connection set. |
ConnectionSet |
clone(java.util.Map map)
Creates a new connection set based on this connection set, where the
edges, and ports are mapped using
map . |
protected static void |
connect(ConnectionSet cs,
java.lang.Object edge,
java.lang.Object port,
boolean source,
boolean disconnect)
Connect or disconnect
edge from source and
target in cs based on
disconnect . |
void |
connect(java.lang.Object edge,
java.lang.Object port,
boolean source)
Connect
edge to port passed in. |
void |
connect(java.lang.Object edge,
java.lang.Object source,
java.lang.Object target)
Connect
edge to source and
target in the connection set. |
java.util.Iterator |
connections()
Returns an
Iterator for the connections in this set. |
static ConnectionSet |
create(GraphModel m,
java.lang.Object[] cells,
boolean disconnect)
Returns a connection set that represents the connection or disconnection
of
cells in model based on
disconnect . |
void |
disconnect(java.lang.Object edge)
Disconnect
edge from source and
target in the connection set. |
void |
disconnect(java.lang.Object edge,
boolean source)
Disconnect
edge from port . |
java.util.Set |
getChangedEdges()
Deprecated.
Use getEdges
|
java.util.Set |
getConnections() |
java.util.Set |
getEdges() |
java.lang.Object |
getPort(java.lang.Object edge,
boolean source)
Returns the source or target of the specified edge in this connection set
or null if the connection set contains no corresponding entry for the
edge.
|
boolean |
isEmpty()
Returns
true if the connection set is empty. |
void |
setConnections(java.util.Set set) |
void |
setEdges(java.util.Set set) |
int |
size()
Returns the number of (edge, port)-pairs.
|
protected java.util.Set connections
protected java.util.Set edges
public ConnectionSet()
public ConnectionSet(java.lang.Object edge, java.lang.Object port, boolean source)
public ConnectionSet(java.util.Set connections)
public ConnectionSet(java.lang.Object edge, java.lang.Object source, java.lang.Object target)
public static ConnectionSet create(GraphModel m, java.lang.Object[] cells, boolean disconnect)
cells
in model
based on
disconnect
.protected static void connect(ConnectionSet cs, java.lang.Object edge, java.lang.Object port, boolean source, boolean disconnect)
edge
from source
and
target
in cs
based on
disconnect
.public void addConnections(CellView[] views)
views
to the connection set.public void connect(java.lang.Object edge, java.lang.Object source, java.lang.Object target)
edge
to source
and
target
in the connection set. The previous connections
between edge
and its source and target are replaced in the
set.public void connect(java.lang.Object edge, java.lang.Object port, boolean source)
edge
to port
passed in. The
source
indicates if port
is the source of
edge
object. The previous connections between
edge
and its source or target in the set is replaced.public void disconnect(java.lang.Object edge)
edge
from source
and
target
in the connection set. The previous connections
between edge
and its source and target are replaced in the
set.public void disconnect(java.lang.Object edge, boolean source)
edge
from port
.
source
indicates if port
is the source of
edge
. The previous connections between edge
and its source or target in the set is replaced.public boolean isEmpty()
true
if the connection set is empty.public int size()
public java.util.Iterator connections()
Iterator
for the connections in this set.public java.util.Set getChangedEdges()
Set
for the edges in this connection set.public java.lang.Object getPort(java.lang.Object edge, boolean source)
public ConnectionSet clone(java.util.Map map)
map
. If a port is not
found, the old port is used. If both, the edge and the port are not in
map
, the entry is ignored.
Note: Consequently, unselected edges are only reconnected at the first "paste" after a "cut", because in this case the ConnectionSet is not cloned.
public java.util.Set getConnections()
public java.util.Set getEdges()
public void setConnections(java.util.Set set)
set
- public void setEdges(java.util.Set set)
set
- Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.