use of org.opennms.features.topology.app.internal.gwt.client.svg.SVGGElement in project opennms by OpenNMS.
the class VTopologyComponent method vertexClickHandler.
private Handler<GWTVertex> vertexClickHandler() {
return new D3Events.Handler<GWTVertex>() {
@Override
public void call(GWTVertex vertex, int index) {
if (D3.eventDefaultPrevented()) {
return;
}
NativeEvent event = D3.getEvent();
SVGGElement vertexElement = event.getCurrentEventTarget().cast();
vertexElement.getParentElement().appendChild(vertexElement);
event.preventDefault();
event.stopPropagation();
final MouseEventDetails mouseDetails = MouseEventDetailsBuilder.buildMouseEventDetails(event, getElement());
m_serverRpc.vertexClicked(vertex.getId(), mouseDetails, Navigator.getPlatform());
}
};
}
use of org.opennms.features.topology.app.internal.gwt.client.svg.SVGGElement in project opennms by OpenNMS.
the class GWTVertex method create.
public static D3Behavior create() {
return new D3Behavior() {
@Override
public D3 run(D3 selection) {
D3 vertex = selection.append("g").attr("class", "vertex");
vertex.attr("opacity", 1e-6).style("cursor", "pointer");
vertex.append("svg:rect").attr("class", "status").attr("fill", "none").attr("stroke-width", 5).attr("stroke-location", "outside").attr("stroke", "blue").attr("opacity", 0);
D3 svgIconContainer = vertex.append("g").attr("class", "icon-container").attr("opacity", 0);
D3 svgIcon = svgIconContainer.append("use");
D3 svgIconRollover = svgIconContainer.append("use");
D3 svgIconActive = svgIconContainer.append("use");
D3 statusCounter = vertex.append("g");
D3 statusBadge = vertex.append("g");
D3 textSelection = vertex.append("text");
D3 navigateTo = vertex.append("g").attr("class", "navigate-to");
vertex.append("svg:rect").attr("class", "svgIconOverlay").attr("width", 100).attr("height", 100).attr("opacity", 0).call(new D3Behavior() {
@Override
public D3 run(D3 selection) {
return selection.on("mouseover", new D3Events.Handler<Object>() {
@Override
public void call(Object o, int index) {
NativeEvent event = D3.getEvent();
SVGRect element = event.getCurrentEventTarget().cast();
SVGGElement parent = element.getParentElement().cast();
D3 selection = D3.d3().select(parent);
selection.select(".overIcon").attr("opacity", 1);
}
}).on("mouseout", new D3Events.Handler<Object>() {
@Override
public void call(Object o, int index) {
NativeEvent event = D3.getEvent();
SVGRect element = event.getCurrentEventTarget().cast();
SVGGElement parent = element.getParentElement().cast();
D3 selection = D3.d3().select(parent);
selection.select(".overIcon").attr("opacity", 0);
}
});
}
});
svgIcon.attr("xlink:href", svgIconId("")).attr("class", "upIcon");
svgIconRollover.attr("xlink:href", svgIconId("_rollover")).attr("class", "overIcon").attr("opacity", 0);
svgIconActive.attr("xlink:href", svgIconId("_active")).attr("class", "activeIcon").attr("opacity", 0);
// Status Counter
statusCounter.attr("class", "node-status-counter").append("svg:rect").attr("height", 20).attr("width", 20).attr("rx", 10).attr("ry", 10);
statusCounter.append("text").attr("x", "6px").attr("y", "14px").attr("class", "status-counter");
// Status Badge
statusBadge.attr("class", "status-badge-container");
statusBadge.append("text").attr("x", "0px").attr("y", "0px").attr("class", "status-badge");
// Navigate To indicator
navigateTo.append("text").attr("class", "text").attr("opacity", 1).attr("x", -23).attr("y", 23).text(// ion-record
"");
textSelection.text(label()).attr("class", "vertex-label").attr("x", "0px").attr("text-anchor", "middle").attr("alignment-baseline", "text-before-edge");
vertex.call(draw());
return vertex;
}
};
}
use of org.opennms.features.topology.app.internal.gwt.client.svg.SVGGElement in project opennms by OpenNMS.
the class TopologyViewImpl method getCenterPos.
@Override
public SVGPoint getCenterPos(GWTBoundingBox box) {
SVGGElement g = getSVGViewPort().cast();
SVGMatrix stateTF = g.getCTM().inverse();
SVGPoint p = getSVGElement().createSVGPoint();
p.setX(getPhysicalWidth() / 2 + getLeftMargin());
p.setY(getPhysicalHeight() / 2);
SVGPoint center = p.matrixTransform(stateTF);
return center;
}
use of org.opennms.features.topology.app.internal.gwt.client.svg.SVGGElement in project opennms by OpenNMS.
the class TopologyViewImpl method getPoint.
@Override
public SVGPoint getPoint(int clientX, int clientY) {
SVGGElement g = getSVGViewPort().cast();
SVGMatrix stateTF = g.getCTM().inverse();
SVGPoint p = getSVGElement().createSVGPoint();
p.setX(clientX + getLeftMargin());
p.setY(clientY);
SVGPoint center = p.matrixTransform(stateTF);
return center;
}
Aggregations