tcp port reconnect

This commit is contained in:
Alexander Nozik 2016-10-22 09:40:25 +03:00
parent 1faf5b452c
commit 7d56682994
13 changed files with 80 additions and 48 deletions

View File

@ -1,2 +1,13 @@
apply plugin: 'base' // To add "clean" task to the root project.
configurations {
compile.exclude module: 'groovy'
compile.exclude module: 'groovy-all'
compile.exclude module: 'shichimifx'
compile.exclude module: 'zt-zip'
}
dependencies {
compile project(':numass-storage:numass-client')
compile project(':dataforge-plots:plots-jfc')
compile project(':dataforge-control')
compile project(':dataforge-fx')
}

View File

@ -9,19 +9,8 @@ version = "0.1.2";
//mainClassName = "inr.numass.readvac.Main"
configurations {
compile.exclude module: 'groovy'
compile.exclude module: 'groovy-all'
compile.exclude module: 'shichimifx'
compile.exclude module: 'zt-zip'
}
dependencies {
// compile 'commons-cli:commons-cli:1.3'
// compile 'de.jensd:shichimifx:1.0.5'
compile project(':numass-storage:numass-client')
compile project(':dataforge-control')
compile project(':dataforge-plots:plots-jfc')
compile project(':numass-control')
}
task debug(dependsOn: classes, type: JavaExec) {

View File

@ -6,8 +6,8 @@ import hep.dataforge.control.measurements.Measurement;
import hep.dataforge.control.measurements.MeasurementListener;
import hep.dataforge.exceptions.ControlException;
import hep.dataforge.exceptions.MeasurementException;
import hep.dataforge.fx.fragments.ConsoleFragment;
import hep.dataforge.fx.fragments.FragmentWindow;
import hep.dataforge.fx.fragments.LogFragment;
import hep.dataforge.values.Value;
import javafx.application.Platform;
import javafx.event.ActionEvent;
@ -29,7 +29,7 @@ import java.util.ResourceBundle;
public class PKT8Controller implements Initializable, DeviceListener, MeasurementListener<PKT8Result> {
private final PKT8Device device;
private ConsoleFragment consoleFragment;
private LogFragment logFragment;
private PKT8PlotFragment plotFragment;
@FXML
private ToggleButton startStopButton;
@ -59,11 +59,11 @@ public class PKT8Controller implements Initializable, DeviceListener, Measuremen
@Override
public void initialize(URL location, ResourceBundle resources) {
this.consoleFragment = new ConsoleFragment();
consoleFragment.addLogHandler(device.getContext().getLogger());
this.logFragment = new LogFragment();
logFragment.addLogHandler(device.getContext().getLogger());
//TODO to be removed later
consoleFragment.hookStd();
new FragmentWindow(consoleFragment).bindTo(consoleButton);
logFragment.hookStd();
new FragmentWindow(logFragment).bindTo(consoleButton);
plotFragment = new PKT8PlotFragment(device);
new FragmentWindow(plotFragment).bindTo(plotButton);

View File

@ -9,8 +9,5 @@ mainClassName = mainClass
dependencies {
compile project(':numass-storage:numass-client')
compile project(':dataforge-plots:plots-jfc')
compile project(':dataforge-fx')
compile project(':dataforge-control')
compile project(':numass-control')
}

View File

@ -22,8 +22,8 @@ import hep.dataforge.control.connections.StorageConnection;
import hep.dataforge.exceptions.ControlException;
import hep.dataforge.exceptions.PortException;
import hep.dataforge.exceptions.StorageException;
import hep.dataforge.fx.fragments.ConsoleFragment;
import hep.dataforge.fx.fragments.FragmentWindow;
import hep.dataforge.fx.fragments.LogFragment;
import hep.dataforge.io.MetaFileReader;
import hep.dataforge.meta.ConfigChangeListener;
import hep.dataforge.meta.Configuration;
@ -84,7 +84,7 @@ public class MspViewController implements Initializable, MspListener {
private MspDevice device;
private Configuration viewConfig;
private JFreeChartFrame plot;
private ConsoleFragment logArea;
private LogFragment logArea;
private StorageConnection connection;
@FXML
private Slider autoRangeSlider;
@ -124,7 +124,7 @@ public class MspViewController implements Initializable, MspListener {
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
logArea = new ConsoleFragment();
logArea = new LogFragment();
new FragmentWindow(logArea).bindTo(consoleButton);
fillamentSelector.setItems(FXCollections.observableArrayList(1, 2));
fillamentSelector.setConverter(new StringConverter<Integer>() {

View File

@ -0,0 +1,31 @@
package inr.numass.control;
import hep.dataforge.control.devices.Device;
import hep.dataforge.control.devices.DeviceListener;
import hep.dataforge.fx.fragments.Fragment;
import javafx.scene.Parent;
/**
* Created by darksnake on 20-Oct-16.
*/
public abstract class DeviceFragment<T extends Device> extends Fragment implements DeviceListener {
private final T device;
protected DeviceFragment(T device) {
this.device = device;
}
@Override
protected Parent buildRoot() {
return buildRoot(device);
}
protected abstract Parent buildRoot(T device);
@Override
public void evaluateDeviceException(Device device, String message, Throwable exception) {
//do something pretty
}
}

View File

@ -0,0 +1,16 @@
package inr.numass.control;
import hep.dataforge.control.devices.Device;
import hep.dataforge.fx.fragments.Fragment;
import hep.dataforge.fx.fragments.LogFragment;
import hep.dataforge.utils.MetaFactory;
/**
* Created by darksnake on 20-Oct-16.
*/
public interface Framework<T extends Device> {
LogFragment getLogFragment();
Fragment getPlotFragment();
DeviceFragment<T> getDeviceFragment();
MetaFactory<T> getDeviceFactory();
}

View File

@ -7,16 +7,6 @@ if (!hasProperty('mainClass')) {
}
mainClassName = mainClass
configurations {
compile.exclude module: 'groovy'
compile.exclude module: 'groovy-all'
compile.exclude module: 'shichimifx'
compile.exclude module: 'zt-zip'
}
dependencies {
compile project(':numass-storage:numass-client')
compile project(':dataforge-plots:plots-jfc')
compile project(':dataforge-control')
compile project(':dataforge-fx')
compile project(':numass-control')
}

View File

@ -14,8 +14,8 @@ import hep.dataforge.control.measurements.MeasurementListener;
import hep.dataforge.control.measurements.Sensor;
import hep.dataforge.exceptions.ControlException;
import hep.dataforge.exceptions.MeasurementException;
import hep.dataforge.fx.fragments.ConsoleFragment;
import hep.dataforge.fx.fragments.FragmentWindow;
import hep.dataforge.fx.fragments.LogFragment;
import hep.dataforge.meta.Meta;
import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.plots.data.TimePlottable;
@ -71,7 +71,7 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
private final String[] intervalNames = {"1 sec", "5 sec", "10 sec", "30 sec", "1 min"};
private final int[] intervals = {1000, 5000, 10000, 30000, 60000};
private final List<VacuumeterView> views = new ArrayList<>();
private ConsoleFragment consoleWindow;
private LogFragment consoleWindow;
private Logger logger;
private LoaderConnection storageConnection;
private VacCollectorDevice device;
@ -111,7 +111,7 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
}
});
consoleWindow = new ConsoleFragment();
consoleWindow = new LogFragment();
new FragmentWindow(consoleWindow).bindTo(logButton);
consoleWindow.hookStd();
}

View File

@ -19,8 +19,8 @@ import hep.dataforge.exceptions.NameNotFoundException;
import hep.dataforge.fx.FXDataOutputPane;
import hep.dataforge.fx.FXReportListener;
import hep.dataforge.fx.configuration.MetaEditor;
import hep.dataforge.fx.fragments.ConsoleFragment;
import hep.dataforge.fx.fragments.FragmentWindow;
import hep.dataforge.fx.fragments.LogFragment;
import hep.dataforge.fx.work.WorkManagerFragment;
import hep.dataforge.io.IOManager;
import hep.dataforge.io.MetaFileReader;
@ -117,7 +117,7 @@ public class NumassWorkbenchController implements Initializable, StagePaneHolder
logPane = new FXDataOutputPane();
logTab.setContent(logPane.getRoot());
ConsoleFragment consoleWindow = new ConsoleFragment();
LogFragment consoleWindow = new LogFragment();
new FragmentWindow(consoleWindow).bindTo(consoleButton);
consoleWindow.addRootLogHandler();
consoleWindow.hookStd();

View File

@ -1,5 +1,4 @@
dependencies {
compile project(':dataforge-storage')
compile project(':dataforge-grind')
}

View File

@ -21,5 +21,4 @@ dependencies {
compile project(':numass-storage')
compile 'commons-cli:commons-cli:1.3.1'
compile 'org.zeroturnaround:zt-zip:1.9'
compile project(':dataforge-grind')
}

View File

@ -19,8 +19,8 @@ import hep.dataforge.computation.ProgressCallback;
import hep.dataforge.context.Context;
import hep.dataforge.context.GlobalContext;
import hep.dataforge.exceptions.StorageException;
import hep.dataforge.fx.fragments.ConsoleFragment;
import hep.dataforge.fx.fragments.FragmentWindow;
import hep.dataforge.fx.fragments.LogFragment;
import hep.dataforge.fx.work.WorkManagerFragment;
import inr.numass.NumassProperties;
import inr.numass.storage.NumassData;
@ -101,9 +101,9 @@ public class MainViewerController implements Initializable {
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
ConsoleFragment consoleFragment = new ConsoleFragment();
consoleFragment.hookStd();
new FragmentWindow(consoleFragment).bindTo(consoleButton);
LogFragment logFragment = new LogFragment();
logFragment.hookStd();
new FragmentWindow(logFragment).bindTo(consoleButton);
new FragmentWindow(WorkManagerFragment.attachToContext(GlobalContext.instance())).bindTo(processManagerButton);
mspController = new MspViewController(getContext());