Search in sources :

Example 1 with Strings

use of com.google.common.base.Strings in project opennms by OpenNMS.

the class IconSelectionDialog method getElementsToShow.

private List<String> getElementsToShow() {
    final String opennmsHomeStr = System.getProperty("opennms.home", "");
    final String propertiesFilename = "org.opennms.features.topology.app.icons.list";
    final Path configPath = Paths.get(opennmsHomeStr, "etc", propertiesFilename);
    try {
        List<String> strings = Files.readAllLines(configPath);
        return strings.stream().filter(s -> s != null && s.trim().length() > 0 && !s.trim().startsWith("#")).collect(Collectors.toList());
    } catch (IOException e) {
        LoggerFactory.getLogger(getClass()).error("Could not read icon config file {}", configPath, e);
    }
    return Lists.newArrayList();
}
Also used : Path(java.nio.file.Path) Files(java.nio.file.Files) VerticalLayout(com.vaadin.ui.VerticalLayout) LoggerFactory(org.slf4j.LoggerFactory) Alignment(com.vaadin.ui.Alignment) UI(com.vaadin.ui.UI) IOException(java.io.IOException) Window(com.vaadin.ui.Window) Collectors(java.util.stream.Collectors) Sizeable(com.vaadin.server.Sizeable) Strings(com.google.common.base.Strings) List(java.util.List) Button(com.vaadin.ui.Button) Lists(com.google.common.collect.Lists) Paths(java.nio.file.Paths) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Path(java.nio.file.Path) IOException(java.io.IOException)

Aggregations

Strings (com.google.common.base.Strings)1 Lists (com.google.common.collect.Lists)1 Sizeable (com.vaadin.server.Sizeable)1 Alignment (com.vaadin.ui.Alignment)1 Button (com.vaadin.ui.Button)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 UI (com.vaadin.ui.UI)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 Window (com.vaadin.ui.Window)1 IOException (java.io.IOException)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 LoggerFactory (org.slf4j.LoggerFactory)1