Search in sources :

Example 1 with TopologyProviderInfo

use of org.opennms.features.topology.api.topo.TopologyProviderInfo in project opennms by OpenNMS.

the class ToolbarPanel method handleLayerButton.

private void handleLayerButton(GraphContainer graphContainer) {
    // Toggle layer button
    boolean enableLayerButton = graphContainer.getTopologyServiceClient().getGraphProviders().size() > 1;
    layerButton.setEnabled(enableLayerButton);
    // update the layer layout
    layerLayout.removeAllComponents();
    if (enableLayerButton) {
        graphContainer.getTopologyServiceClient().getGraphProviders().forEach(topologyProvider -> {
            boolean selected = topologyProvider.getNamespace().equals(graphContainer.getTopologyServiceClient().getNamespace());
            final TopologyProviderInfo topologyProviderInfo = topologyProvider.getTopologyProviderInfo();
            final Label nameLabel = new Label(topologyProviderInfo.getName());
            VerticalLayout verticalLayout = new VerticalLayout();
            verticalLayout.addComponent(nameLabel);
            verticalLayout.addStyleName(Styles.LAYOUT);
            if (selected) {
                verticalLayout.addStyleName(Styles.SELECTED);
            }
            verticalLayout.addLayoutClickListener((event) -> graphContainer.selectTopologyProvider(topologyProvider, Callbacks.applyDefaults()));
            layerLayout.addComponent(verticalLayout);
        });
    } else {
        setLayerLayoutVisible(false);
    }
}
Also used : Label(com.vaadin.ui.Label) TopologyProviderInfo(org.opennms.features.topology.api.topo.TopologyProviderInfo) VerticalLayout(com.vaadin.ui.VerticalLayout)

Aggregations

Label (com.vaadin.ui.Label)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 TopologyProviderInfo (org.opennms.features.topology.api.topo.TopologyProviderInfo)1