use of org.opennms.features.topology.api.topo.AbstractEdge in project opennms by OpenNMS.
the class SimpleEdgeBuilder method edge.
public SimpleEdgeBuilder edge(String id, String srcNs, String srcId, String tgtNs, String tgtId) {
VertexRef srcVertex = new DefaultVertexRef(srcNs, srcId);
VertexRef tgtVertex = new DefaultVertexRef(tgtNs, tgtId);
SimpleConnector source = new SimpleConnector(ns(), srcId + "-" + id + "-connector", srcVertex);
SimpleConnector target = new SimpleConnector(ns(), tgtId + "-" + id + "-connector", tgtVertex);
m_currentEdge = new AbstractEdge(ns(), id, source, target);
source.setEdge(m_currentEdge);
target.setEdge(m_currentEdge);
m_edgeProvider.add(m_currentEdge);
return this;
}
use of org.opennms.features.topology.api.topo.AbstractEdge in project opennms by OpenNMS.
the class DefaultEdgeInfoPanelItemProvider method createComponent.
private Component createComponent(EdgeRef ref) {
FormLayout formLayout = new FormLayout();
formLayout.setSpacing(false);
formLayout.setMargin(false);
if (ref instanceof AbstractEdge) {
AbstractEdge edge = (AbstractEdge) ref;
formLayout.addComponent(createLabel("Source", edge.getSource().getVertex().getLabel()));
formLayout.addComponent(createLabel("Target", edge.getTarget().getVertex().getLabel()));
}
return formLayout;
}
use of org.opennms.features.topology.api.topo.AbstractEdge in project opennms by OpenNMS.
the class HierarchyLayoutAlgorithmTest method verifyHierarchyLayoutFallBack.
// NMS-8703
@Test
public void verifyHierarchyLayoutFallBack() {
// Vertices
vertices.add(new TestVertex("root"));
vertices.add(new TestVertex("v1"));
vertices.add(new TestVertex("v2"));
vertices.add(new TestVertex("v3"));
// Edges
edges.add(new AbstractEdge("test", "rootEdge", vertices.get(0), vertices.get(1)));
edges.add(new AbstractEdge("test", "e1", vertices.get(1), vertices.get(2)));
edges.add(new AbstractEdge("test", "e2", vertices.get(2), vertices.get(3)));
// Circle
edges.add(new AbstractEdge("test", "e3", vertices.get(3), vertices.get(1)));
// Update the layouts and ensure no exception is thrown
buildLayout();
}
use of org.opennms.features.topology.api.topo.AbstractEdge in project opennms by OpenNMS.
the class ApplicationTopologyProvider method load.
private void load() {
resetContainer();
for (OnmsApplication application : applicationDao.findAll()) {
ApplicationVertex applicationVertex = new ApplicationVertex(application);
addVertices(applicationVertex);
for (OnmsMonitoredService eachMonitoredService : application.getMonitoredServices()) {
final ApplicationVertex serviceVertex = new ApplicationVertex(eachMonitoredService);
applicationVertex.addChildren(serviceVertex);
addVertices(serviceVertex);
// connect with application
String id = String.format("connection:%s:%s", applicationVertex.getId(), serviceVertex.getId());
Edge edge = new AbstractEdge(getNamespace(), id, applicationVertex, serviceVertex);
addEdges(edge);
}
}
}
use of org.opennms.features.topology.api.topo.AbstractEdge in project opennms by OpenNMS.
the class SimpleGraphBuilder method edge.
public SimpleGraphBuilder edge(String id, String srcId, String tgtId) {
VertexRef srcVertex = m_graphProvider.getVertex(ns(), srcId);
if (srcVertex == null) {
srcVertex = new DefaultVertexRef(ns(), srcId);
}
VertexRef tgtVertex = m_graphProvider.getVertex(ns(), tgtId);
if (tgtVertex == null) {
tgtVertex = new DefaultVertexRef(ns(), tgtId);
}
SimpleConnector source = new SimpleConnector(ns(), srcId + "-" + id + "-connector", srcVertex);
SimpleConnector target = new SimpleConnector(ns(), tgtId + "-" + id + "-connector", tgtVertex);
m_currentEdge = new AbstractEdge(ns(), id, source, target);
source.setEdge(m_currentEdge);
target.setEdge(m_currentEdge);
m_graphProvider.addEdges(m_currentEdge);
return this;
}
Aggregations