Example usage for javafx.collections FXCollections observableList

List of usage examples for javafx.collections FXCollections observableList

Introduction

In this page you can find the example usage for javafx.collections FXCollections observableList.

Prototype

public static <E> ObservableList<E> observableList(List<E> list) 

Source Link

Document

Constructs an ObservableList that is backed by the specified list.

Usage

From source file:com.bekwam.resignator.ActiveConfiguration.java

@Override
public void fromDomain(Configuration domain) {
    jdkHome.setValue(domain.getJDKHome().orElse(""));
    activeProfile.setValue(domain.getActiveProfile().orElse(""));
    recentProfiles.setValue(FXCollections.observableList(domain.getRecentProfiles()));
    hashedPassword.setValue(domain.getHashedPassword().orElse(""));
    //unhashedPassword.set("");
    if (domain.getLastUpdatedDateTime().isPresent()) {
        lastUpdatedDateTime.setValue(domain.getLastUpdatedDateTime().get());
    }/*from w  w w.  j a v  a 2s . co m*/
}

From source file:co.anarquianegra.rockolappServidor.mundo.ListaReproductor.java

/**
 * Constructor de la clase ListaReproductor
 *///from  w  w  w .ja  v  a  2  s .  c om
public ListaReproductor(Main interfaz) {
    playing = false;
    ObservableList<Cancion> ol = FXCollections.observableList(new LinkedList<Cancion>());
    listaReproduccion = new SimpleListProperty<Cancion>(ol);
    listaReproduccion.addListener(interfaz);
    rutasCanciones = new Properties();
    cant = 0;
}

From source file:com.bdb.weather.display.summary.RainSummary.java

/**
 * Load the data into the plot./*from   www . ja  va2 s  . c  o m*/
 * 
 * @param list The summary data
 */
public void loadData(List<SummaryRecord> list) {
    dataTable.setItems(FXCollections.observableList(list));
    TimeSeriesCollection ds = new TimeSeriesCollection();
    TimeSeries etSeries = new TimeSeries(ET_ROW_KEY);
    TimeSeries rainSeries = new TimeSeries(RAIN_ROW_KEY);

    Depth totalRain = new Depth(0.0);
    Depth totalET = new Depth(0.0);

    //
    // Load each record
    //
    for (SummaryRecord rec : list) {
        Depth rain = rec.getTotalRainfall();

        RegularTimePeriod tp = RegularTimePeriod.createInstance(interval.getFreeChartClass(),
                TimeUtils.localDateTimeToDate(rec.getDate()), TimeZone.getDefault());

        if (rain != null) {
            rainSeries.add(tp, rain.get());
            totalRain = totalRain.add(rain);
        }

        Depth et = rec.getTotalET();
        if (et != null) {
            etSeries.add(tp, et.get());
            totalET = totalET.add(et);
        }
    }

    ds.addSeries(etSeries);
    ds.addSeries(rainSeries);
    rainPlot.setDataset(ds);
}

From source file:com.esri.geoevent.test.performance.ui.ProducerController.java

private ObservableList<Protocol> getProtocolList() {
    ArrayList<Protocol> list = new ArrayList<Protocol>();
    list.add(Protocol.ACTIVE_MQ);
    list.add(Protocol.AZURE);/*from   w w  w  .  j a  va  2  s .  c  o  m*/
    list.add(Protocol.KAFKA);
    list.add(Protocol.RABBIT_MQ);
    list.add(Protocol.STREAM_SERVICE);
    list.add(Protocol.TCP);
    list.add(Protocol.TCP_SERVER);
    list.add(Protocol.WEBSOCKETS);
    list.add(Protocol.WEBSOCKET_SERVER);
    return FXCollections.observableList(list);
}

From source file:com.bdb.weather.display.day.ItemRenderer.java

public void loadData(List<HistoricalRecord> list) {
    windDirSeries.clear();//from  w  ww  . j a  v  a 2 s  . c o m

    List<HistoricalRecord> windy = list.stream()
            .filter((rec) -> rec.getAvgWind() != null && rec.getAvgWind().getSpeed().get() != 0.0)
            .collect(Collectors.toList());

    windy.forEach((rec) -> windDirSeries.add(rec.getAvgWind().getDirection().get(),
            rec.getTime().get(ChronoField.MINUTE_OF_DAY)));

    table.setItems(FXCollections.observableList(windy));
}

From source file:com.esri.geoevent.test.performance.ui.ConsumerController.java

private ObservableList<Protocol> getProtocolList() {
    ArrayList<Protocol> list = new ArrayList<Protocol>();
    list.add(Protocol.ACTIVE_MQ);
    list.add(Protocol.RABBIT_MQ);/* w w w.  j  a  v a  2 s.  com*/
    list.add(Protocol.STREAM_SERVICE);
    list.add(Protocol.TCP);
    list.add(Protocol.TCP_SERVER);
    list.add(Protocol.WEBSOCKETS);
    list.add(Protocol.WEBSOCKET_SERVER);
    list.add(Protocol.KAFKA);
    list.add(Protocol.BDS);
    list.add(Protocol.AZURE);

    return FXCollections.observableList(list);
}

From source file:com.bdb.weather.display.summary.WindSummary.java

/**
 * Load the data into the plot.//w w w  .  java 2s. c  o  m
 * 
 * @param records The summary records
 */
public void loadData(List<SummaryRecord> records) {
    dataTable.setItems(FXCollections.observableList(records));
    TimeSeriesCollection sustainedDataset = new TimeSeriesCollection();
    TimeSeries avgSpeedSeries = new TimeSeries("Average Sustained");
    TimeSeries maxSpeedSeries = new TimeSeries("Maximum Sustained");
    TimeSeriesCollection gustDataset = new TimeSeriesCollection();
    TimeSeries windGustSeries = new TimeSeries("Maximum Gust");

    for (int i = 0; i < records.size(); i++) {
        RegularTimePeriod p = RegularTimePeriod.createInstance(interval.getFreeChartClass(),
                TimeUtils.localDateTimeToDate(records.get(i).getDate().atStartOfDay()), TimeZone.getDefault());
        maxSpeedSeries.add(p, records.get(i).getMaxWindSpeed().get());
        avgSpeedSeries.add(p, records.get(i).getAvgWindSpeed().get());
        Speed gust = records.get(i).getMaxWindGust();

        if (gust != null) {
            windGustSeries.add(p, gust.get());
        }
    }

    sustainedDataset.addSeries(avgSpeedSeries);
    sustainedDataset.addSeries(maxSpeedSeries);
    gustDataset.addSeries(windGustSeries);

    plot.setDataset(SUSTAINED_WIND_SERIES, sustainedDataset);
    plot.setDataset(GUST_SERIES, gustDataset);
}

From source file:com.bdb.weather.display.windrose.WindRosePane.java

/**
 * Load the wind rose data./*www .  j a v  a 2 s .c om*/
 * 
 * @param data The data
 */
public void loadData(WindRoseData data) {
    windRosePlot.clearCornerTextItems();

    if (data == null) {
        windRosePlot.setDataset((WindRoseData) null);
        return;
    }

    init(data.getSpeedBins());

    DateTimeFormatter sdf = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT);
    windRosePlot.setDataset(data);
    float calmPercent = ((float) data.getCalmDuration().getSeconds()
            / (float) data.getTotalDuration().getSeconds()) * 100.0f;
    windRosePlot.addCornerTextItem(String.format("Calm: %.1f%%", calmPercent));
    calmField.setText(String.format("%.1f", calmPercent));
    timeField.setText(sdf.format(data.getTime()));

    Speed maxSpeed = new Speed(0.0);
    Heading maxSpeedHeading = null;
    double speedSum = 0.0;

    //
    // Calculate annotation data
    //
    for (int i = 0; i < data.getNumSlices(); i++) {
        WindSlice slice = data.getSlice(i);

        Heading heading = Heading.headingForSlice(slice.getHeadingIndex(), data.getNumSlices());

        if (slice.getMaxSpeed().get() > maxSpeed.get()) {
            maxSpeed = slice.getMaxSpeed();
            maxSpeedHeading = heading;
        }

        speedSum += slice.getAvgSpeed().get() * slice.getSliceDuration().getSeconds();
    }

    //
    // Add annotations to the panel
    //
    if (maxSpeedHeading != null) {
        windRosePlot
                .addCornerTextItem(String.format("Max: %s@%s", maxSpeedHeading.getCompassLabel(), maxSpeed));
        Speed avgSpeed = new Speed(speedSum / data.getTotalDuration().getSeconds());
        windRosePlot.addCornerTextItem(String.format("Avg: %s", avgSpeed));
    }

    dataTable.setItems(FXCollections.observableList(data.getSlices()));
}

From source file:com.bdb.weather.display.summary.HighLowPanel.java

private void loadData(OHLCSeries series, SeriesInfo<T> info, List<SummaryRecord> records, int seriesIndex) {
    ObservableList<SummaryRecord> dataModel = FXCollections.observableList(records);
    dataTable.setItems(dataModel);/* w ww.  ja v a 2  s. co  m*/
    for (SummaryRecord record : records) {
        T avg = info.getAvgValue(record);
        T min = info.getMinValue(record);
        T max = info.getMaxValue(record);

        LocalDate date = record.getDate();
        // TODO: Figure out how to create a time period based on the specified interval
        RegularTimePeriod period = null;
        switch (interval) {
        case DAY_INTERVAL:
            period = new Hour(seriesIndex * 4, date.getDayOfMonth(), date.getMonth().getValue(),
                    date.getYear());
            break;
        case MONTH_INTERVAL:
            period = new Day(seriesIndex * 4 + 1, date.getMonth().getValue(), date.getYear());
            break;
        case YEAR_INTERVAL:
            period = new Year(date.getYear());
            break;
        default:
            period = null;
            break;
        }

        if (avg != null && min != null && max != null) {
            series.add(period, avg.get(), max.get(), min.get(), min.get());
        }
    }
}

From source file:com.SignalDiagram.FXMLDocumentController.java

@Override
public void initialize(URL url, ResourceBundle rb) {
    radBtn_amplitude.setToggleGroup(radioAnalogGroup);
    radBtn_frequence.setToggleGroup(radioAnalogGroup);
    radBtn_phase.setToggleGroup(radioAnalogGroup);

    txtField_bits.setText("1");
    txtField_seed.setText("0");

    m_analogSerieList = new ArrayList<>();

    m_digitalSignal = new DigitalSignal(exampleMessage, modulationType.NRZ_L, false);
    m_analogSignal = new AnalogSignal(exampleMessage, AnalogSignal.analogType.AMPLITUDE);

    m_digitalChartData = FXCollections.observableArrayList();
    m_analogChartData = FXCollections.observableArrayList();

    m_digitalSerie = new LineChart.Series<>();
    m_digitalSerie = updatePoints(m_digitalSignal.getPoints());

    m_analogSignal.getPoints().stream().forEach((lp) -> {
        m_analogSerieList.add(updatePoints(lp));
    });//  w w w  .j  a  va  2s. co m

    m_digitalChartData.add(m_digitalSerie);
    m_digitalChart.setData(m_digitalChartData);

    //FIX
    m_analogChartData.addAll(m_analogSerieList);
    m_analogChart.setData(m_analogChartData);

    cmbBox_DigitalType.setItems(FXCollections.observableList(m_digitalSignal.getModulationTypes()));
    txtField_binaryInput.setText(m_digitalSignal.getMessage());

    initListeners();
    cmbBox_DigitalType.valueProperty().set("nrz-m");
    m_analogChart.setTitle("Analog Signal");

}