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);
}
}
Aggregations