Search in sources :

Example 56 with ObservableValue

use of javafx.beans.value.ObservableValue in project Board-Instrumentation-Framework by intel.

the class BaseChartWidget method SetupSeriesSets.

protected void SetupSeriesSets(DataManager dataMgr) {
    for (String key : _SeriesOrder) {
        SeriesSet objSeriesSet = _SeriesMap.get(key);
        if (null == objSeriesSet) {
            return;
        }
        XYChart.Series objSeries = new XYChart.Series();
        String strTitle = objSeriesSet.getTitle();
        if (null == strTitle) {
            return;
        }
        objSeries.setName(strTitle);
        for (SeriesDataSet objDs : objSeriesSet.getSeriesList()) {
            XYChart.Data objChartDataSet;
            if (isHorizontal()) {
                objChartDataSet = new XYChart.Data<>(0, objDs.getTitle());
            } else {
                objChartDataSet = new XYChart.Data<>(objDs.getTitle(), 0);
            }
            objSeries.getData().add(objChartDataSet);
            dataMgr.AddListener(objDs.getID(), objDs.getNamespace(), new ChangeListener() {

                @Override
                public void changed(ObservableValue o, Object oldVal, Object newVal) {
                    if (IsPaused()) {
                        return;
                    }
                    String strVal = newVal.toString();
                    double newValue;
                    try {
                        newValue = Double.parseDouble(strVal);
                    } catch (NumberFormatException ex) {
                        LOGGER.severe("Invalid data for Line Chart received: " + strVal);
                        return;
                    }
                    if (isHorizontal()) {
                        objChartDataSet.XValueProperty().set(newValue);
                    } else {
                        objChartDataSet.YValueProperty().set(newValue);
                    }
                }
            });
        }
        boolean fReturn = ((XYChart) getChart()).getData().add(objSeries);
    }
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) SeriesDataSet(kutch.biff.marvin.utility.SeriesDataSet) SeriesSet(kutch.biff.marvin.utility.SeriesSet) XYChart(javafx.scene.chart.XYChart) ChangeListener(javafx.beans.value.ChangeListener)

Example 57 with ObservableValue

use of javafx.beans.value.ObservableValue in project Board-Instrumentation-Framework by intel.

the class ButtonWidget method Create.

@Override
public boolean Create(GridPane pane, DataManager dataMgr) {
    SetParent(pane);
    _Button.disableProperty().set(!_InitiallyEnabled);
    ConfigureDimentions();
    ConfigureAlignment();
    SetupPeekaboo(dataMgr);
    _Button.setText(getTitle());
    if (false == SetupImage()) {
        return false;
    }
    pane.add(_Button, getColumn(), getRow(), getColumnSpan(), getRowSpan());
    dataMgr.AddListener(getMinionID(), getNamespace(), new ChangeListener() {

        @Override
        public void changed(ObservableValue o, Object oldVal, Object newVal) {
            String strVal = newVal.toString();
            _Button.setText(strVal);
        }
    });
    SetupTaskAction();
    return ApplyCSS();
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener)

Example 58 with ObservableValue

use of javafx.beans.value.ObservableValue in project Board-Instrumentation-Framework by intel.

the class ProgressIndicatorWidget method Create.

@Override
public boolean Create(GridPane pane, DataManager dataMgr) {
    SetParent(pane);
    ConfigureDimentions();
    ConfigureAlignment();
    SetupPeekaboo(dataMgr);
    pane.add(_Indicator, getColumn(), getRow(), getColumnSpan(), getRowSpan());
    dataMgr.AddListener(getMinionID(), getNamespace(), new ChangeListener() {

        @Override
        public void changed(ObservableValue o, Object oldVal, Object newVal) {
            if (IsPaused()) {
                return;
            }
            double newDialValue = 0;
            String strVal = newVal.toString();
            try {
                newDialValue = Double.parseDouble(strVal);
            } catch (Exception ex) {
                LOGGER.severe("Invalid data for Progress Indicator received: " + strVal);
                return;
            }
            if (newDialValue != 100.0) {
                while (newDialValue >= 10) {
                    newDialValue /= 10.0;
                }
            }
            _Indicator.setProgress(newDialValue / 10);
        }
    });
    SetupTaskAction();
    return ApplyCSS();
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener)

Example 59 with ObservableValue

use of javafx.beans.value.ObservableValue in project Board-Instrumentation-Framework by intel.

the class QuickViewLCDWidget method Create.

@Override
public boolean Create(GridPane pane, DataManager dataMgr) {
    SetParent(pane);
    _dataMgr = dataMgr;
    getGridPane().setAlignment(getPosition());
    pane.add(getGridPane(), getColumn(), getRow(), getColumnSpan(), getRowSpan());
    if (gethGap() > -1) {
        getGridPane().setHgap(gethGap());
    }
    if (getvGap() > -1) {
        getGridPane().setVgap(getvGap());
    }
    dataMgr.AddWildcardListener(getMinionID(), getNamespace(), new ChangeListener() {

        @Override
        public void changed(ObservableValue o, Object oldVal, Object newVal) {
            if (IsPaused()) {
                return;
            }
            String strVal = newVal.toString();
            String[] parts = strVal.split(":");
            if (parts.length > 1) {
                String ID = parts[0];
                String Value = parts[1];
                if (_DataPointMap.containsKey(ID.toLowerCase())) {
                    // already  made one for this!
                    return;
                }
                if (_ExclusionList.containsKey(ID.toLowerCase())) {
                    // not wanted
                    return;
                }
                // add the key to the map don't care about the stored value, just the key
                _DataPointMap.put(ID.toLowerCase(), ID);
                // didn't find it, so go make one
                CreateDataWidget(ID, Value);
            }
        }
    });
    SetupPeekaboo(dataMgr);
    SetupTaskAction();
    return true;
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener)

Example 60 with ObservableValue

use of javafx.beans.value.ObservableValue in project Board-Instrumentation-Framework by intel.

the class QuickViewWidget method Create.

@Override
public boolean Create(GridPane pane, DataManager dataMgr) {
    SetParent(pane);
    _dataMgr = dataMgr;
    getGridPane().setAlignment(getPosition());
    pane.add(getGridPane(), getColumn(), getRow(), getColumnSpan(), getRowSpan());
    if (gethGap() > -1) {
        getGridPane().setHgap(gethGap());
    }
    if (getvGap() > -1) {
        getGridPane().setVgap(getvGap());
    }
    dataMgr.AddWildcardListener(getMinionID(), getNamespace(), new ChangeListener() {

        @Override
        public void changed(ObservableValue o, Object oldVal, Object newVal) {
            if (IsPaused()) {
                return;
            }
            String strVal = newVal.toString();
            String[] parts = strVal.split(":");
            if (// check to see if we have already created the widget
            parts.length > 1) {
                String ID = parts[0];
                String Value = parts[1];
                if (_DataPointMap.containsKey(ID.toLowerCase())) {
                    // already  made one for this!
                    return;
                }
                if (_ExclusionList.containsKey(ID.toLowerCase())) {
                    // not wanted
                    return;
                }
                // add the key to the map don't care about the stored value, just the key
                _DataPointMap.put(ID.toLowerCase(), ID);
                // didn't find it, so go make one
                CreateDataWidget(ID, Value);
            }
        }
    });
    SetupPeekaboo(dataMgr);
    SetupTaskAction();
    return true;
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener)

Aggregations

ObservableValue (javafx.beans.value.ObservableValue)85 ChangeListener (javafx.beans.value.ChangeListener)53 FXML (javafx.fxml.FXML)13 Scene (javafx.scene.Scene)13 ImageView (javafx.scene.image.ImageView)13 KeyEvent (javafx.scene.input.KeyEvent)11 ArrayList (java.util.ArrayList)10 Label (javafx.scene.control.Label)10 TableColumn (javafx.scene.control.TableColumn)10 TableView (javafx.scene.control.TableView)10 ActionEvent (javafx.event.ActionEvent)9 MouseEvent (javafx.scene.input.MouseEvent)9 TextField (javafx.scene.control.TextField)8 Color (javafx.scene.paint.Color)8 ObservableList (javafx.collections.ObservableList)7 MenuItem (javafx.scene.control.MenuItem)7 CellDataFeatures (javafx.scene.control.TableColumn.CellDataFeatures)7 List (java.util.List)6 Set (java.util.Set)6 Platform (javafx.application.Platform)6