Search in sources :

Example 61 with ObservableValue

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

the class StackedBarChartWidget method setupListeners.

@Override
@SuppressWarnings("unchecked")
protected void setupListeners(DataManager dataMgr) {
    for (String key : _SeriesOrder) {
        SeriesSet objSeriesSet = _SeriesMap.get(key);
        if (null == objSeriesSet) {
            LOGGER.severe("Invalid Key in setupListeners");
            return;
        }
        XYChart.Series objSeries = new XYChart.Series<>();
        String strTitle = objSeriesSet.getTitle();
        if (null == strTitle) {
            strTitle = "untitled";
        }
        objSeries.setName(strTitle);
        for (SeriesDataSet objDs : objSeriesSet.getSeriesList()) {
            XYChart.Data objData;
            if (isHorizontal()) {
                objData = new XYChart.Data(0, objDs.getTitle());
            } else {
                objData = new XYChart.Data(objDs.getTitle(), 0);
            }
            objSeries.getData().add(objData);
            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 (Exception ex) {
                        LOGGER.severe("Invalid data for Line Chart received: " + strVal);
                        return;
                    }
                    if (isHorizontal()) {
                        objData.XValueProperty().set(newValue);
                    } else {
                        objData.YValueProperty().set(newValue);
                    }
                }
            });
        }
        ((StackedBarChart) getChart()).getData().add(objSeries);
    }
}
Also used : SeriesSet(kutch.biff.marvin.utility.SeriesSet) ObservableValue(javafx.beans.value.ObservableValue) XYChart(javafx.scene.chart.XYChart) ChangeListener(javafx.beans.value.ChangeListener) SeriesDataSet(kutch.biff.marvin.utility.SeriesDataSet)

Example 62 with ObservableValue

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

the class SteelGauge180Widget method Create.

public boolean Create(GridPane pane, DataManager dataMgr) {
    SetParent(pane);
    if (false == SetupGauge()) {
        return false;
    }
    _Gauge.setValue(_InitialValue);
    ConfigureAlignment();
    SetupPeekaboo(dataMgr);
    ConfigureDimentions();
    pane.add(_Gauge, 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 (NumberFormatException ex) {
                LOGGER.severe("Invalid data for 180  Gauge received: " + strVal);
                return;
            }
            _Gauge.setValue(newDialValue);
        }
    });
    return true;
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener)

Example 63 with ObservableValue

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

the class SteelGaugeRadialSteelWidget method Create.

@Override
public boolean Create(GridPane pane, DataManager dataMgr) {
    SetParent(pane);
    if (false == SetupGauge()) {
        return false;
    }
    ConfigureDimentions();
    ConfigureAlignment();
    SetupTaskAction();
    SetupPeekaboo(dataMgr);
    pane.add(_Gauge, getColumn(), getRow(), getColumnSpan(), getRowSpan());
    _Gauge.setValue(_InitialValue);
    dataMgr.AddListener(getMinionID(), getNamespace(), new ChangeListener() {

        @Override
        public void changed(ObservableValue o, Object oldVal, Object newVal) {
            if (IsPaused()) {
                return;
            }
            double newDialValue = 0;
            double oldDialValue = 0;
            String strVal = newVal.toString();
            try {
                newDialValue = Double.parseDouble(strVal);
            // oldDialValue = Double.parseDouble(oldVal.toString());
            } catch (Exception ex) {
                LOGGER.severe("Invalid data for Gauge received: " + strVal);
                return;
            }
            _Gauge.setValue(newDialValue);
        }
    });
    return ApplyCSS();
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener)

Example 64 with ObservableValue

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

the class SteelGaugeWidget method Create.

@Override
public boolean Create(GridPane pane, DataManager dataMgr) {
    SetParent(pane);
    _ParentGridPane = pane;
    if (false == SetupGauge()) {
        return false;
    }
    _Gauge.setValue(_InitialValue);
    ConfigureDimentions();
    ConfigureAlignment();
    // special because Gauge can be interactive
    EventHandler<MouseEvent> eh = SetupTaskAction();
    if (null == eh) {
        eh = new // create a dummy one, because we dont' want interactive
        EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent event) {
            }
        };
    }
    _Gauge.customKnobClickHandlerProperty().set(eh);
    SetupPeekaboo(dataMgr);
    pane.add(_Gauge, 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;
            double oldDialValue = 0;
            String strVal = newVal.toString();
            try {
                newDialValue = Double.parseDouble(strVal);
            // oldDialValue = Double.parseDouble(oldVal.toString());
            } catch (Exception ex) {
                LOGGER.severe("Invalid data for Gauge received: " + strVal);
                return;
            }
            _Gauge.setValue(newDialValue);
        }
    });
    return ApplyCSS();
}
Also used : MouseEvent(javafx.scene.input.MouseEvent) ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener)

Example 65 with ObservableValue

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

the class SteelLCDWidget method Create.

@Override
public boolean Create(GridPane pane, DataManager dataMgr) {
    SetParent(pane);
    if (false == SetupLCD()) {
        return false;
    }
    if (_InitialValue.length() > 0) {
        SetValue(_InitialValue);
    }
    ConfigureAlignment();
    ConfigureDimentions();
    pane.add(_LCD, getColumn(), getRow(), getColumnSpan(), getRowSpan());
    SetupPeekaboo(dataMgr);
    dataMgr.AddListener(getMinionID(), getNamespace(), new ChangeListener() {

        @Override
        public void changed(ObservableValue o, Object oldVal, Object newVal) {
            if (IsPaused()) {
                return;
            }
            SetValue(newVal.toString());
        }
    });
    SetupTaskAction();
    return ApplyCSS();
}
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