X: NFT - Add regions
This commit is contained in:
@@ -32,6 +32,7 @@ public final class EvelynMissionControlImpl implements
|
||||
EvelynMissionControl,
|
||||
NenjimProcess {
|
||||
|
||||
// region Constructors
|
||||
public EvelynMissionControlImpl(
|
||||
@NotNull EvelynStatusService evelynStatusServiceProd,
|
||||
@NotNull EvelynStatusService evelynStatusServiceTest,
|
||||
@@ -44,13 +45,17 @@ public final class EvelynMissionControlImpl implements
|
||||
"javaFxRuntimeService");
|
||||
refreshTimeline.setCycleCount(Timeline.INDEFINITE);
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Interface implementations
|
||||
@Override
|
||||
public void start() {
|
||||
javaFxRuntimeService.runLater(this::showWindow);
|
||||
}
|
||||
// endregion
|
||||
|
||||
static StatusIndexChart createStatusIndexChart() {
|
||||
// region Private methods
|
||||
private static StatusIndexChart createStatusIndexChart() {
|
||||
NumberAxis xAxis = new NumberAxis(0, 1, 1);
|
||||
xAxis.setLabel("Time");
|
||||
xAxis.setTickLabelFormatter(TIMESTAMP_FORMATTER);
|
||||
@@ -129,43 +134,7 @@ public final class EvelynMissionControlImpl implements
|
||||
updateAxisBounds(statusIndexChart, history);
|
||||
}
|
||||
|
||||
static final class StatusIndexChart {
|
||||
private StatusIndexChart(
|
||||
LineChart<Number, Number> chart,
|
||||
NumberAxis xAxis,
|
||||
NumberAxis yAxis,
|
||||
XYChart.Series<Number, Number> priceIndexSeries
|
||||
) {
|
||||
this.chart = chart;
|
||||
this.xAxis = xAxis;
|
||||
this.yAxis = yAxis;
|
||||
this.priceIndexSeries = priceIndexSeries;
|
||||
}
|
||||
|
||||
LineChart<Number, Number> chart() {
|
||||
return chart;
|
||||
}
|
||||
|
||||
NumberAxis xAxis() {
|
||||
return xAxis;
|
||||
}
|
||||
|
||||
NumberAxis yAxis() {
|
||||
return yAxis;
|
||||
}
|
||||
|
||||
XYChart.Series<Number, Number> priceIndexSeries() {
|
||||
return priceIndexSeries;
|
||||
}
|
||||
|
||||
private final LineChart<Number, Number> chart;
|
||||
private final NumberAxis xAxis;
|
||||
private final NumberAxis yAxis;
|
||||
private final XYChart.Series<Number, Number> priceIndexSeries;
|
||||
private List<EvelynStatusIndexPoint> renderedHistory = List.of();
|
||||
}
|
||||
|
||||
private static BigDecimal max(BigDecimal currentMaximum, BigDecimal candidate) {
|
||||
static BigDecimal max(BigDecimal currentMaximum, BigDecimal candidate) {
|
||||
return currentMaximum.max(candidate.abs());
|
||||
}
|
||||
|
||||
@@ -292,7 +261,47 @@ public final class EvelynMissionControlImpl implements
|
||||
refreshChart(productionChart, evelynStatusProd.getStatusIndexHistory());
|
||||
refreshChart(testChart, evelynStatusTest.getStatusIndexHistory());
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Inner classes
|
||||
static final class StatusIndexChart {
|
||||
private StatusIndexChart(
|
||||
LineChart<Number, Number> chart,
|
||||
NumberAxis xAxis,
|
||||
NumberAxis yAxis,
|
||||
XYChart.Series<Number, Number> priceIndexSeries
|
||||
) {
|
||||
this.chart = chart;
|
||||
this.xAxis = xAxis;
|
||||
this.yAxis = yAxis;
|
||||
this.priceIndexSeries = priceIndexSeries;
|
||||
}
|
||||
|
||||
LineChart<Number, Number> chart() {
|
||||
return chart;
|
||||
}
|
||||
|
||||
NumberAxis xAxis() {
|
||||
return xAxis;
|
||||
}
|
||||
|
||||
NumberAxis yAxis() {
|
||||
return yAxis;
|
||||
}
|
||||
|
||||
XYChart.Series<Number, Number> priceIndexSeries() {
|
||||
return priceIndexSeries;
|
||||
}
|
||||
|
||||
private final LineChart<Number, Number> chart;
|
||||
private final NumberAxis xAxis;
|
||||
private final NumberAxis yAxis;
|
||||
private final XYChart.Series<Number, Number> priceIndexSeries;
|
||||
private List<EvelynStatusIndexPoint> renderedHistory = List.of();
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Constants
|
||||
private static final String PRODUCTION_COLOR = "#ffd6d6";
|
||||
private static final String TEST_COLOR = "#d8f3dc";
|
||||
private static final double EMPTY_Y_BOUND = 1.0;
|
||||
@@ -314,14 +323,21 @@ public final class EvelynMissionControlImpl implements
|
||||
}
|
||||
};
|
||||
|
||||
private final EvelynStatusService evelynStatusProd;
|
||||
private final EvelynStatusService evelynStatusTest;
|
||||
private final JavaFxRuntimeService javaFxRuntimeService;
|
||||
private final Timeline refreshTimeline = new Timeline(new KeyFrame(
|
||||
Duration.seconds(CHART_REFRESH_SECONDS),
|
||||
event -> refreshCharts()
|
||||
));
|
||||
// endregion
|
||||
|
||||
// region Dependencies
|
||||
private final EvelynStatusService evelynStatusProd;
|
||||
private final EvelynStatusService evelynStatusTest;
|
||||
private final JavaFxRuntimeService javaFxRuntimeService;
|
||||
// endregion
|
||||
|
||||
// region State
|
||||
private Stage window;
|
||||
private StatusIndexChart productionChart;
|
||||
private StatusIndexChart testChart;
|
||||
// endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user