From 2e0cbaee97d95bd3f2c2224accd4a80359e6e3f5 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 13 Apr 2016 19:28:45 +0300 Subject: [PATCH] [no commit message] --- .../numass/readvac/{test => app}/TestVac.java | 2 +- .../readvac/devices/VacCollectorDevice.java | 3 -- .../readvac/fx/VacCollectorController.java | 29 +++++++++++++++++-- .../src/main/resources/fxml/VacCollector.fxml | 4 +-- .../workbench/NumassWorkbenchController.java | 1 - 5 files changed, 29 insertions(+), 10 deletions(-) rename numass-control/vac/src/main/java/inr/numass/readvac/{test => app}/TestVac.java (96%) diff --git a/numass-control/vac/src/main/java/inr/numass/readvac/test/TestVac.java b/numass-control/vac/src/main/java/inr/numass/readvac/app/TestVac.java similarity index 96% rename from numass-control/vac/src/main/java/inr/numass/readvac/test/TestVac.java rename to numass-control/vac/src/main/java/inr/numass/readvac/app/TestVac.java index c8943eba..ac361afc 100644 --- a/numass-control/vac/src/main/java/inr/numass/readvac/test/TestVac.java +++ b/numass-control/vac/src/main/java/inr/numass/readvac/app/TestVac.java @@ -3,7 +3,7 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package inr.numass.readvac.test; +package inr.numass.readvac.app; import hep.dataforge.control.measurements.Sensor; import hep.dataforge.control.virtual.Virtual; diff --git a/numass-control/vac/src/main/java/inr/numass/readvac/devices/VacCollectorDevice.java b/numass-control/vac/src/main/java/inr/numass/readvac/devices/VacCollectorDevice.java index ea76f426..9370a089 100644 --- a/numass-control/vac/src/main/java/inr/numass/readvac/devices/VacCollectorDevice.java +++ b/numass-control/vac/src/main/java/inr/numass/readvac/devices/VacCollectorDevice.java @@ -11,7 +11,6 @@ import hep.dataforge.control.connections.Roles; import hep.dataforge.control.devices.annotations.RoleDef; import hep.dataforge.control.measurements.AbstractMeasurement; import hep.dataforge.control.measurements.Measurement; -import hep.dataforge.control.measurements.MeasurementListener; import hep.dataforge.control.measurements.Sensor; import hep.dataforge.points.DataPoint; import hep.dataforge.exceptions.ControlException; @@ -28,8 +27,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import java.util.function.BiConsumer; -import org.slf4j.LoggerFactory; /** * diff --git a/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacCollectorController.java b/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacCollectorController.java index 39cfc553..2ed409ae 100644 --- a/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacCollectorController.java +++ b/numass-control/vac/src/main/java/inr/numass/readvac/fx/VacCollectorController.java @@ -5,6 +5,7 @@ */ package inr.numass.readvac.fx; +import de.jensd.shichimifx.utils.ConsoleDude; import hep.dataforge.control.connections.Connection; import hep.dataforge.control.connections.Roles; import hep.dataforge.control.devices.Device; @@ -19,7 +20,6 @@ import hep.dataforge.exceptions.StorageException; import hep.dataforge.meta.Meta; import hep.dataforge.meta.MetaBuilder; import hep.dataforge.plots.PlotFrame; -import hep.dataforge.plots.XYPlottable; import hep.dataforge.plots.data.DynamicPlottable; import hep.dataforge.plots.data.DynamicPlottableSet; import hep.dataforge.plots.fx.PlotContainer; @@ -43,20 +43,22 @@ import java.util.ArrayList; import java.util.List; import java.util.ResourceBundle; import java.util.function.BiFunction; -import java.util.function.Function; -import java.util.logging.Level; import javafx.application.Platform; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; +import javafx.scene.Scene; import javafx.scene.control.ChoiceBox; import javafx.scene.control.Label; +import javafx.scene.control.TextArea; import javafx.scene.control.ToggleButton; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.VBox; import javafx.stage.DirectoryChooser; +import javafx.stage.Stage; +import javafx.stage.WindowEvent; import javafx.util.Duration; import org.controlsfx.control.Notifications; import org.slf4j.Logger; @@ -84,6 +86,9 @@ public class VacCollectorController implements Initializable, DeviceListener, Me private DynamicPlottableSet plottables; private BiFunction loaderFactory; + private TextArea consolePane; + private Stage consoleWindow; + @FXML private AnchorPane plotHolder; @FXML @@ -116,6 +121,17 @@ public class VacCollectorController implements Initializable, DeviceListener, Me } } }); + + consolePane = new TextArea(); + consolePane.setEditable(false); + consolePane.setWrapText(true); + ConsoleDude.hookStdStreams(consolePane); + consoleWindow = new Stage(); + consoleWindow.setTitle("Vacuum measurement console"); + consoleWindow.setScene(new Scene(consolePane, 800, 200)); + consoleWindow.setOnHidden((WindowEvent event) -> { + logButton.setSelected(false); + }); } @Override @@ -156,6 +172,8 @@ public class VacCollectorController implements Initializable, DeviceListener, Me plottables.addPlottable(plot); }); plottables.setEachConfigValue("thickness", 3); + //TODO make history length edittable + plottables.setMaxAge(3*60*60*1000); plotContainer.setPlot(setupPlot(plottables)); } @@ -276,6 +294,11 @@ public class VacCollectorController implements Initializable, DeviceListener, Me @FXML private void onLogToggle(ActionEvent event) { + if (logButton.isSelected() && logButton.isSelected()!=consoleWindow.isShowing()) { + consoleWindow.show(); + } else { + consoleWindow.hide(); + } } /** diff --git a/numass-control/vac/src/main/resources/fxml/VacCollector.fxml b/numass-control/vac/src/main/resources/fxml/VacCollector.fxml index b086a66c..4eec80b5 100644 --- a/numass-control/vac/src/main/resources/fxml/VacCollector.fxml +++ b/numass-control/vac/src/main/resources/fxml/VacCollector.fxml @@ -35,9 +35,9 @@