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);
}
}
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;
}
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();
}
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();
}
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();
}
Aggregations