Search in sources :

Example 1 with FetchingDataFromAdapterException

use of eu.fthevenet.binjr.data.exceptions.FetchingDataFromAdapterException in project selenium_java by sergueik.

the class CsvFileAdapter method getBindingTree.

@Override
public TreeItem<TimeSeriesBinding<Double>> getBindingTree() throws DataAdapterException {
    TreeItem<TimeSeriesBinding<Double>> tree = new TreeItem<>(new TimeSeriesBinding<>("", "/", null, getSourceName(), UnitPrefixes.METRIC, ChartType.STACKED, "-", "/" + getSourceName(), this));
    try (InputStream in = Files.newInputStream(csvPath)) {
        this.headers = getDecoder().getDataColumnHeaders(in);
        for (String header : headers) {
            TimeSeriesBinding<Double> b = new TimeSeriesBinding<>(header, header, null, header, UnitPrefixes.METRIC, ChartType.STACKED, "-", "/" + getSourceName() + "/" + header, this);
            tree.getChildren().add(new TreeItem<>(b));
        }
    } catch (IOException e) {
        throw new FetchingDataFromAdapterException(e);
    }
    return tree;
}
Also used : TimeSeriesBinding(eu.fthevenet.binjr.data.adapters.TimeSeriesBinding) TreeItem(javafx.scene.control.TreeItem) FetchingDataFromAdapterException(eu.fthevenet.binjr.data.exceptions.FetchingDataFromAdapterException) InputStream(java.io.InputStream) IOException(java.io.IOException)

Aggregations

TimeSeriesBinding (eu.fthevenet.binjr.data.adapters.TimeSeriesBinding)1 FetchingDataFromAdapterException (eu.fthevenet.binjr.data.exceptions.FetchingDataFromAdapterException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 TreeItem (javafx.scene.control.TreeItem)1