Package org.jgraph.graph
Class ConnectionSet
java.lang.Object
org.jgraph.graph.ConnectionSet
- All Implemented Interfaces:
Serializable
An object that represents a set of connections. Connections are equal, if
equals returns true. Connections that are added later replace earlier
connections.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classObject that represents the connection between an edge and a port. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty ConnectionSet.ConnectionSet(Object edge, Object port, boolean source) Constructs a ConnectionSet with one Connection.ConnectionSet(Object edge, Object source, Object target) Constructs a ConnectionSet with two Connections (to the source and target port of the edge).ConnectionSet(Set connections) Constructs a connection set containing the specified connections and updates the set of changed edges. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnections(CellView[] views) Adds the connections inviewsto the connection set.Creates a new connection set based on this connection set, where the edges, and ports are mapped usingmap.voidConnectedgetoportpassed in.voidConnectedgetosourceandtargetin the connection set.protected static voidconnect(ConnectionSet cs, Object edge, Object port, boolean source, boolean disconnect) Connect or disconnectedgefromsourceandtargetincsbased ondisconnect.Returns anIteratorfor the connections in this set.static ConnectionSetcreate(GraphModel m, Object[] cells, boolean disconnect) Returns a connection set that represents the connection or disconnection ofcellsinmodelbased ondisconnect.voiddisconnect(Object edge) Disconnectedgefromsourceandtargetin the connection set.voiddisconnect(Object edge, boolean source) Disconnectedgefromport.Deprecated.Use getEdgesgetEdges()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.booleanisEmpty()Returnstrueif the connection set is empty.voidsetConnections(Set set) voidintsize()Returns the number of (edge, port)-pairs.
-
Field Details
-
connections
Contents of the connection set. -
edges
Set of changed edges for the connection set.
-
-
Constructor Details
-
ConnectionSet
public ConnectionSet()Constructs an empty ConnectionSet. -
ConnectionSet
Constructs a ConnectionSet with one Connection. -
ConnectionSet
Constructs a connection set containing the specified connections and updates the set of changed edges. -
ConnectionSet
Constructs a ConnectionSet with two Connections (to the source and target port of the edge).
-
-
Method Details
-
create
Returns a connection set that represents the connection or disconnection ofcellsinmodelbased ondisconnect. -
connect
protected static void connect(ConnectionSet cs, Object edge, Object port, boolean source, boolean disconnect) Connect or disconnectedgefromsourceandtargetincsbased ondisconnect. -
addConnections
Adds the connections inviewsto the connection set. -
connect
Connectedgetosourceandtargetin the connection set. The previous connections betweenedgeand its source and target are replaced in the set. -
connect
Connectedgetoportpassed in. Thesourceindicates ifportis the source ofedgeobject. The previous connections betweenedgeand its source or target in the set is replaced. -
disconnect
Disconnectedgefromsourceandtargetin the connection set. The previous connections betweenedgeand its source and target are replaced in the set. -
disconnect
Disconnectedgefromport.sourceindicates ifportis the source ofedge. The previous connections betweenedgeand its source or target in the set is replaced. -
isEmpty
public boolean isEmpty()Returnstrueif the connection set is empty. -
size
public int size()Returns the number of (edge, port)-pairs. -
connections
Returns anIteratorfor the connections in this set. -
getChangedEdges
Deprecated.Use getEdgesReturns aSetfor the edges in this connection set. -
getPort
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. -
clone
Creates a new connection set based on this connection set, where the edges, and ports are mapped usingmap. If a port is not found, the old port is used. If both, the edge and the port are not inmap, 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.
-
getConnections
- Returns:
- the set of connections
-
getEdges
- Returns:
- the edges making us this connection set
-
setConnections
- Parameters:
set-
-
setEdges
- Parameters:
set-
-