public class DefaultElementFactory extends Object implements IElementFactory
IElementFactory
.IElementFactory
Constructor and Description |
---|
DefaultElementFactory()
Creates a new instance of
DefaultElementFactory . |
Modifier and Type | Method and Description |
---|---|
Edge |
createConnectorEdge(LayoutContext context,
Node connector,
Node opposite,
Object origEdgeId,
boolean atTarget)
Callback method for creating an edge of type
EdgeType.CONNECTOR . |
Node |
createConnectorNode(LayoutContext context,
YList edgeIds,
Object representedNodeId)
Callback method for creating a node of type
NodeType.CONNECTOR . |
Edge |
createProxyEdge(LayoutContext context,
Node proxyNode,
Node opposite,
Object replacingEdgeId,
Object origNodeId)
Callback method for creating an edge of type
EdgeType.PROXY . |
Node |
createProxyNode(LayoutContext context,
Object origNodeId)
Callback method for creating a node of type
NodeType.PROXY . |
Edge |
createProxyReferenceEdge(LayoutContext context,
Node proxyReference,
Node opposite,
Object referencingCopyId)
Callback method for creating an edge of type
EdgeType.PROXY_REFERENCE . |
Node |
createProxyReferenceNode(LayoutContext context,
Object referringProxyId)
Callback method for creating a node of type
NodeType.PROXY_REFERENCE . |
protected YDimension |
getDefaultNodeSize(LayoutContext context,
Object id,
byte type)
Returns the default size for nodes created by this factory.
|
public DefaultElementFactory()
DefaultElementFactory
.public Edge createConnectorEdge(LayoutContext context, Node connector, Node opposite, Object origEdgeId, boolean atTarget)
IElementFactory
EdgeType.CONNECTOR
.
Such an edge connects the given connector
and opposite
node.
createConnectorEdge
in interface IElementFactory
context
- an object providing relevant layout information, for example, the current graph as well as various information about the
graph elementsconnector
- the endpoint of the edge that represents the connector nodeopposite
- the other endpoint of the edgeorigEdgeId
- the ID of the edge that is split by the connector edgeatTarget
- true
if the connector node is the target of the edge, false
otherwiseEdgeType.CONNECTOR
,
NodeType.CONNECTOR
,
LayoutContext.createEdge(Node, Node, Object)
public Node createConnectorNode(LayoutContext context, YList edgeIds, Object representedNodeId)
IElementFactory
NodeType.CONNECTOR
.createConnectorNode
in interface IElementFactory
context
- an object providing relevant layout information, for example, the current graph as well as various information about the
graph elementsedgeIds
- a list
that contains the IDs of edges that are split by this connectorrepresentedNodeId
- the ID of the node that is represented by this connectorNodeType.CONNECTOR
,
LayoutContext.createNode(Object)
,
INodeInfo.getRepresentedNode()
public Edge createProxyEdge(LayoutContext context, Node proxyNode, Node opposite, Object replacingEdgeId, Object origNodeId)
IElementFactory
EdgeType.PROXY
.
Such an edge should connect the given proxy
and opposite
node.
createProxyEdge
in interface IElementFactory
context
- an object providing relevant layout information, for example, the current graph as well as various information about the
graph elementsproxyNode
- the endpoint of the edge that represents the proxy nodeopposite
- the other endpoint of the new edgereplacingEdgeId
- the ID of the related edge that is connected to the original nodeorigNodeId
- the ID of the original node to which the proxy node refersEdgeType.PROXY
,
NodeType.PROXY
,
LayoutContext.createEdge(Node, Node, Object)
public Node createProxyNode(LayoutContext context, Object origNodeId)
IElementFactory
NodeType.PROXY
.createProxyNode
in interface IElementFactory
context
- an object providing relevant layout information, for example, the current graph as well as various information about the
graph elementsorigNodeId
- the ID of the node for which a proxy has to be createdLayoutContext.createNode(Object)
,
NodeType.PROXY_REFERENCE
,
NodeType.PROXY
public Edge createProxyReferenceEdge(LayoutContext context, Node proxyReference, Node opposite, Object referencingCopyId)
IElementFactory
EdgeType.PROXY_REFERENCE
.
Such an (undirected) edge should connect the given proxy reference
and opposite node.
createProxyReferenceEdge
in interface IElementFactory
context
- an object providing relevant layout information, for example, the current graph as well as various information about the
graph elementsproxyReference
- the endpoint of the edge that represents the proxy reference nodeopposite
- the other endpoint of the new edgereferencingCopyId
- the ID of the proxy node that is referenced by the proxy reference nodeEdgeType.PROXY_REFERENCE
,
NodeType.PROXY_REFERENCE
,
LayoutContext.createEdge(Node, Node, Object)
public Node createProxyReferenceNode(LayoutContext context, Object referringProxyId)
IElementFactory
NodeType.PROXY_REFERENCE
.createProxyReferenceNode
in interface IElementFactory
context
- an object providing relevant layout information, for example, the current graph as well as various information about the
graph elementsreferringProxyId
- the ID of the proxy to which the created node refersNodeType.PROXY_REFERENCE
,
LayoutContext.createNode(Object)
,
NodeType.PROXY
protected YDimension getDefaultNodeSize(LayoutContext context, Object id, byte type)
This method is called from createConnectorNode(LayoutContext, YList, Object)
,
createProxyReferenceNode(LayoutContext, Object)
, and/or
createProxyNode(LayoutContext, Object)
. It must return a non-null
size with positive width and
height.
Subclasses may implement this method to use custom size values.
context
- an object providing relevant layout information, for example, the current graph as well as various information about the
graph elementsid
- the element IDtype
- the type of the node to be created