@Override public int hashCode() { return getLabel().hashCode(); } @Override public boolean equals(Object o) { Vertex v = (Vertex)o; return v.getLabel().equals(this.getLabel()); } @Override public String toString() { return getLabel(); }
private static String getTooltipText(Vertex vertex) { String tooltipText = vertex.getTooltipText(); // If the tooltip text is null, use the label tooltipText = (tooltipText == null ? vertex.getLabel() : tooltipText); // If the label is null, use a blank string return (tooltipText == null ? "" : tooltipText); }
protected static String getLabelValue(final OperationContext operationContext, final VertexRef target) { Vertex vertex = getVertexItem(operationContext, target); return vertex == null ? null : vertex.getLabel(); }
protected static String getLabelValue(final OperationContext operationContext, final VertexRef target) { Vertex vertex = getVertexItem(operationContext, target); return vertex == null ? null : vertex.getLabel(); }
private static String getTooltipText(Vertex vertex) { String tooltipText = vertex.getTooltipText(); // If the tooltip text is null, use the label tooltipText = (tooltipText == null ? vertex.getLabel() : tooltipText); // If the label is null, use a blank string return (tooltipText == null ? "" : tooltipText); }
protected static String getLabelValue(final OperationContext operationContext, final VertexRef target) { Vertex vertex = getVertexItem(operationContext, target); return vertex == null ? null : vertex.getLabel(); }
@Override public List<? extends VertexRef> queryVertices(SearchQuery searchQuery, GraphContainer container) { final List<Vertex> vertices = vmwareTopologyProvider.getVertices(); return vertices.stream().filter(v -> searchQuery.matches(v.getLabel())).collect(Collectors.toList()); } }
@Override public List<? extends VertexRef> queryVertices(SearchQuery searchQuery, GraphContainer container) { final List<Vertex> vertices = vmwareTopologyProvider.getVertices(); return vertices.stream().filter(v -> searchQuery.matches(v.getLabel())).collect(Collectors.toList()); } }
public AbstractEdge(String namespace, String id, Vertex source, Vertex target) { super(namespace, id); if (source == null) { throw new IllegalArgumentException("Source is null"); } else if (target == null) { throw new IllegalArgumentException("Target is null"); } m_source = new SimpleConnector(namespace, id + "::" + source.getId(), source.getLabel() + " Connector", source, this); m_target = new SimpleConnector(namespace, id + "::" + target.getId(), target.getLabel() + " Connector", target, this); m_styleName = "edge"; }
@Override public List<SearchResult> query(SearchQuery searchQuery, GraphContainer graphContainer) { LOG.debug("SearchProvider->query: called with search query: '{}'", searchQuery); List<Vertex> vertices = m_delegate.getVertices(); List<SearchResult> searchResults = Lists.newArrayList(); for(Vertex vertex : vertices){ if(searchQuery.matches(vertex.getLabel())) { searchResults.add(new SearchResult(vertex, false, false)); } if(searchResults.size() > 50) { break; // make sure we don't display too many results => its slows the display down and makes it unusuable } } LOG.debug("SearchProvider->query: found {} search results.", searchResults.size()); return searchResults; }
@Override public void execute(final List<VertexRef> targets, final OperationContext operationContext) { final VertexRef target = targets.get(0); final Vertex vertex = getVertexItem(operationContext, target); final Optional<OnmsNode> node = getNodeIfAvailable(vertex); final List<String> locations = monitoringLocationDao.findAll().stream().map(OnmsMonitoringLocation::getLocationName).collect(Collectors.toList()); final String defaultLocation = node.isPresent() ? node.get().getLocation().getLocationName() : MonitoringLocationDao.DEFAULT_MONITORING_LOCATION_ID; final List<String> ipAddresses = node.isPresent() ? Lists.newArrayList(node.get().getIpInterfaces()).stream().map(eachInterface -> InetAddressUtils.str(eachInterface.getIpAddress())).collect(Collectors.toList()) : Lists.newArrayList(vertex.getIpAddress()); final String defaultIp = getDefaultIp(vertex, node); final String caption = String.format("Ping - %s (%s)", vertex.getLabel(), vertex.getIpAddress()); new PingWindow(pingClient, locations, ipAddresses, defaultLocation, defaultIp, caption) .open(); }
@Override public void execute(final List<VertexRef> targets, final OperationContext operationContext) { final VertexRef target = targets.get(0); final Vertex vertex = getVertexItem(operationContext, target); final Optional<OnmsNode> node = getNodeIfAvailable(vertex); final List<String> locations = monitoringLocationDao.findAll().stream().map(OnmsMonitoringLocation::getLocationName).collect(Collectors.toList()); final String defaultLocation = node.isPresent() ? node.get().getLocation().getLocationName() : MonitoringLocationDao.DEFAULT_MONITORING_LOCATION_ID; final List<String> ipAddresses = node.isPresent() ? Lists.newArrayList(node.get().getIpInterfaces()).stream().map(eachInterface -> InetAddressUtils.str(eachInterface.getIpAddress())).collect(Collectors.toList()) : Lists.newArrayList(vertex.getIpAddress()); final String defaultIp = getDefaultIp(vertex, node); final String caption = String.format("Ping - %s (%s)", vertex.getLabel(), vertex.getIpAddress()); new PingWindow(pingClient, locations, ipAddresses, defaultLocation, defaultIp, caption) .open(); }
private String createTooltip(Vertex vertex, AddressInfo addressInfo) { final StringBuilder tooltip = new StringBuilder(); tooltip.append(String.format("<b>%s</b>", vertex.getLabel())); if (addressInfo != null) { append(tooltip, "City", addressInfo.getCity()); append(tooltip, "Zip", addressInfo.getZip()); append(tooltip, "Address", addressInfo.getAddress1()); append(tooltip, "", addressInfo.getAddress2()); append(tooltip, "State", addressInfo.getState()); append(tooltip, "Country", addressInfo.getCountry()); } return tooltip.toString(); }
private String createTooltip(Vertex vertex, AddressInfo addressInfo) { final StringBuilder tooltip = new StringBuilder(); tooltip.append(String.format("<b>%s</b>", vertex.getLabel())); if (addressInfo != null) { append(tooltip, "City", addressInfo.getCity()); append(tooltip, "Zip", addressInfo.getZip()); append(tooltip, "Address", addressInfo.getAddress1()); append(tooltip, "", addressInfo.getAddress2()); append(tooltip, "State", addressInfo.getState()); append(tooltip, "Country", addressInfo.getCountry()); } return tooltip.toString(); }
final Status edgeStatus = stateMachine.getOperationalStatus(edge); rootLayout.addComponent(createStatusLabel(childVertex.getLabel(), edgeStatus, String.format("%s × %d <i class=\"pull-right glyphicon %s\"></i>",
@Override public void visitVertex(Vertex vertex) throws PaintException { boolean selected = isSelected(m_graphContainer.getSelectionManager(), vertex); Point initialLocation = m_layout.getInitialLocation(vertex); Point location = m_layout.getLocation(vertex); SharedVertex v = new SharedVertex(); v.setKey(vertex.getKey()); //TODO cast to int for now v.setInitialX((int)initialLocation.getX()); v.setInitialY((int)initialLocation.getY()); v.setX((int)location.getX()); v.setY((int) location.getY()); v.setSelected(selected); v.setStatus(getStatus(vertex)); v.setStatusCount(getStatusCount(vertex)); v.setSVGIconId(getIconId(vertex)); v.setLabel(vertex.getLabel()); v.setTooltipText(getTooltipText(vertex)); v.setStyleName(getVertexStyle(vertex, selected)); v.setTargets(getTargets(vertex)); v.setEdgePathOffset(getEdgePathOffset(vertex)); m_vertices.add(v); }
@Override public void visitVertex(Vertex vertex) throws PaintException { boolean selected = isSelected(m_graphContainer.getSelectionManager(), vertex); Point initialLocation = m_layout.getInitialLocation(vertex); Point location = m_layout.getLocation(vertex); SharedVertex v = new SharedVertex(); v.setKey(vertex.getKey()); //TODO cast to int for now v.setInitialX((int)initialLocation.getX()); v.setInitialY((int)initialLocation.getY()); v.setX((int)location.getX()); v.setY((int) location.getY()); v.setSelected(selected); v.setStatus(getStatus(vertex)); v.setStatusCount(getStatusCount(vertex)); v.setSVGIconId(getIconId(vertex)); v.setLabel(vertex.getLabel()); v.setTooltipText(getTooltipText(vertex)); v.setStyleName(getVertexStyle(vertex, selected)); v.setTargets(getTargets(vertex)); v.setEdgePathOffset(getEdgePathOffset(vertex)); m_vertices.add(v); }
setCaption(String.format("Ping - %s (%s)", vertex.getLabel(), vertex.getIpAddress())); setResizable(false); setModal(true);