[no commit message]

This commit is contained in:
Alexander Nozik 2016-04-13 19:28:45 +03:00
parent fef472f22e
commit 2e0cbaee97
5 changed files with 29 additions and 10 deletions

View File

@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * 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.measurements.Sensor;
import hep.dataforge.control.virtual.Virtual; import hep.dataforge.control.virtual.Virtual;

View File

@ -11,7 +11,6 @@ import hep.dataforge.control.connections.Roles;
import hep.dataforge.control.devices.annotations.RoleDef; import hep.dataforge.control.devices.annotations.RoleDef;
import hep.dataforge.control.measurements.AbstractMeasurement; import hep.dataforge.control.measurements.AbstractMeasurement;
import hep.dataforge.control.measurements.Measurement; import hep.dataforge.control.measurements.Measurement;
import hep.dataforge.control.measurements.MeasurementListener;
import hep.dataforge.control.measurements.Sensor; import hep.dataforge.control.measurements.Sensor;
import hep.dataforge.points.DataPoint; import hep.dataforge.points.DataPoint;
import hep.dataforge.exceptions.ControlException; import hep.dataforge.exceptions.ControlException;
@ -28,8 +27,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
import org.slf4j.LoggerFactory;
/** /**
* *

View File

@ -5,6 +5,7 @@
*/ */
package inr.numass.readvac.fx; package inr.numass.readvac.fx;
import de.jensd.shichimifx.utils.ConsoleDude;
import hep.dataforge.control.connections.Connection; import hep.dataforge.control.connections.Connection;
import hep.dataforge.control.connections.Roles; import hep.dataforge.control.connections.Roles;
import hep.dataforge.control.devices.Device; import hep.dataforge.control.devices.Device;
@ -19,7 +20,6 @@ import hep.dataforge.exceptions.StorageException;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
import hep.dataforge.meta.MetaBuilder; import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.plots.PlotFrame; import hep.dataforge.plots.PlotFrame;
import hep.dataforge.plots.XYPlottable;
import hep.dataforge.plots.data.DynamicPlottable; import hep.dataforge.plots.data.DynamicPlottable;
import hep.dataforge.plots.data.DynamicPlottableSet; import hep.dataforge.plots.data.DynamicPlottableSet;
import hep.dataforge.plots.fx.PlotContainer; import hep.dataforge.plots.fx.PlotContainer;
@ -43,20 +43,22 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.logging.Level;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.scene.Scene;
import javafx.scene.control.ChoiceBox; import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.ToggleButton; import javafx.scene.control.ToggleButton;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.stage.DirectoryChooser; import javafx.stage.DirectoryChooser;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import javafx.util.Duration; import javafx.util.Duration;
import org.controlsfx.control.Notifications; import org.controlsfx.control.Notifications;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -84,6 +86,9 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
private DynamicPlottableSet plottables; private DynamicPlottableSet plottables;
private BiFunction<VacCollectorDevice, Storage, PointLoader> loaderFactory; private BiFunction<VacCollectorDevice, Storage, PointLoader> loaderFactory;
private TextArea consolePane;
private Stage consoleWindow;
@FXML @FXML
private AnchorPane plotHolder; private AnchorPane plotHolder;
@FXML @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 @Override
@ -156,6 +172,8 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
plottables.addPlottable(plot); plottables.addPlottable(plot);
}); });
plottables.setEachConfigValue("thickness", 3); plottables.setEachConfigValue("thickness", 3);
//TODO make history length edittable
plottables.setMaxAge(3*60*60*1000);
plotContainer.setPlot(setupPlot(plottables)); plotContainer.setPlot(setupPlot(plottables));
} }
@ -276,6 +294,11 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
@FXML @FXML
private void onLogToggle(ActionEvent event) { private void onLogToggle(ActionEvent event) {
if (logButton.isSelected() && logButton.isSelected()!=consoleWindow.isShowing()) {
consoleWindow.show();
} else {
consoleWindow.hide();
}
} }
/** /**

View File

@ -37,7 +37,7 @@
<Separator orientation="VERTICAL" /> <Separator orientation="VERTICAL" />
<Pane HBox.hgrow="ALWAYS" /> <Pane HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" /> <Separator orientation="VERTICAL" />
<ToggleButton fx:id="logButton" mnemonicParsing="false" onAction="#onLogToggle" text="Log" /> <ToggleButton fx:id="logButton" mnemonicParsing="false" onAction="#onLogToggle" text="Console" />
</items> </items>
</ToolBar> </ToolBar>
<AnchorPane fx:id="plotHolder" VBox.vgrow="ALWAYS" /> <AnchorPane fx:id="plotHolder" VBox.vgrow="ALWAYS" />

View File

@ -31,7 +31,6 @@ import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.plots.PlotFrame; import hep.dataforge.plots.PlotFrame;
import hep.dataforge.plots.PlotHolder; import hep.dataforge.plots.PlotHolder;
import hep.dataforge.plots.PlotsPlugin; import hep.dataforge.plots.PlotsPlugin;
import hep.dataforge.plots.fx.PlotContainer;
import hep.dataforge.utils.MetaFactory; import hep.dataforge.utils.MetaFactory;
import hep.dataforge.values.Value; import hep.dataforge.values.Value;
import inr.numass.NumassIO; import inr.numass.NumassIO;