Search in sources :

Example 6 with VertexHopCriteria

use of org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria in project opennms by OpenNMS.

the class SearchBox method updateTokenFieldList.

private void updateTokenFieldList(GraphContainer graphContainer) {
    final List<SearchSuggestion> suggestions = Lists.newArrayList();
    final Criteria[] criterium = graphContainer.getCriteria();
    for (Criteria criteria : criterium) {
        try {
            CollapsibleCriteria crit = (CollapsibleCriteria) criteria;
            SearchSuggestion suggestion = new SearchSuggestion(crit.getNamespace(), crit.getId(), crit.getLabel());
            suggestion.setCollapsible(true);
            suggestion.setCollapsed(crit.isCollapsed());
            suggestions.add(suggestion);
            continue;
        } catch (ClassCastException e) {
        }
        try {
            VertexHopCriteria crit = (VertexHopCriteria) criteria;
            SearchSuggestion suggestion = new SearchSuggestion(crit.getNamespace(), crit.getId(), crit.getLabel());
            suggestions.add(suggestion);
            continue;
        } catch (ClassCastException e) {
        }
    }
    getState().setFocused(suggestions);
}
Also used : SearchSuggestion(org.opennms.features.topology.app.internal.gwt.client.SearchSuggestion) CollapsibleCriteria(org.opennms.features.topology.api.topo.CollapsibleCriteria) CollapsibleCriteria(org.opennms.features.topology.api.topo.CollapsibleCriteria) DefaultVertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.DefaultVertexHopCriteria) VertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria) Criteria(org.opennms.features.topology.api.topo.Criteria) DefaultVertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.DefaultVertexHopCriteria) VertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria)

Example 7 with VertexHopCriteria

use of org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria in project opennms by OpenNMS.

the class SearchBox method removeIfSuggMapEmpty.

private void removeIfSuggMapEmpty(SearchResult searchResult, GraphContainer graphContainer) {
    Criteria[] criterias = graphContainer.getCriteria();
    for (Criteria criteria : criterias) {
        if (criteria == null || !(criteria instanceof VertexHopCriteria)) {
            continue;
        }
        VertexHopCriteria crit = (VertexHopCriteria) criteria;
        String critNameSpace = crit.getNamespace();
        if (critNameSpace == null) {
            continue;
        }
        String critId = crit.getId();
        if (critId == null) {
            continue;
        }
        String critLabel = crit.getLabel();
        if (critLabel == null) {
            continue;
        }
        String resultNameSpace = searchResult.getNamespace();
        String resultId = searchResult.getId();
        String resultLabel = searchResult.getLabel();
        if (critNameSpace.equals(resultNameSpace) && critId.equals(resultId) && critLabel.equals(resultLabel)) {
            graphContainer.removeCriteria(crit);
        }
    }
}
Also used : CollapsibleCriteria(org.opennms.features.topology.api.topo.CollapsibleCriteria) DefaultVertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.DefaultVertexHopCriteria) VertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria) Criteria(org.opennms.features.topology.api.topo.Criteria) DefaultVertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.DefaultVertexHopCriteria) VertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria)

Example 8 with VertexHopCriteria

use of org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria in project opennms by OpenNMS.

the class GraphPainter method visitGraph.

@Override
public void visitGraph(Graph graph) throws PaintException {
    m_focusVertices.clear();
    Criteria[] criterias = m_graphContainer.getCriteria();
    for (Criteria criteria : criterias) {
        try {
            VertexHopCriteria c = (VertexHopCriteria) criteria;
            m_focusVertices.addAll(c.getVertices());
        } catch (ClassCastException e) {
        }
    }
    m_statusMap.clear();
    m_statusMap.putAll(graph.getVertexStatus());
    m_edgeStatusMap.clear();
    m_edgeStatusMap.putAll(graph.getEdgeStatus());
}
Also used : VertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria) Criteria(org.opennms.features.topology.api.topo.Criteria) VertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria)

Aggregations

VertexHopCriteria (org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria)8 Criteria (org.opennms.features.topology.api.topo.Criteria)5 VertexRef (org.opennms.features.topology.api.topo.VertexRef)3 GraphContainer (org.opennms.features.topology.api.GraphContainer)2 DefaultVertexHopCriteria (org.opennms.features.topology.api.support.VertexHopGraphProvider.DefaultVertexHopCriteria)2 WrappedVertexHopCriteria (org.opennms.features.topology.api.support.VertexHopGraphProvider.WrappedVertexHopCriteria)2 CollapsibleCriteria (org.opennms.features.topology.api.topo.CollapsibleCriteria)2 VertexHopGraphProvider.getWrappedVertexHopCriteria (org.opennms.features.topology.api.support.VertexHopGraphProvider.getWrappedVertexHopCriteria)1 SearchSuggestion (org.opennms.features.topology.app.internal.gwt.client.SearchSuggestion)1 CategoryHopCriteria (org.opennms.features.topology.app.internal.support.CategoryHopCriteria)1