Startup
This commit is contained in:
@@ -32,6 +32,7 @@ public class HoloScan extends Panel {
|
||||
persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JToggleButton.class)));
|
||||
persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JSpinner.class)));
|
||||
setPersistedComponents(persistedComponents.toArray(new Component[0]));
|
||||
startTimer(1000);
|
||||
}
|
||||
|
||||
//Overridable callbacks
|
||||
@@ -43,22 +44,6 @@ public class HoloScan extends Panel {
|
||||
motorPanelPhi.setDevice(phi);
|
||||
motorPanelTheta.setDevice(theta);
|
||||
dvpAcqTime.setDevice(scienta.getAcquisitionTime());
|
||||
scienta.getAcquisitionTime().addListener(new DeviceAdapter() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
try{
|
||||
int steps = (radioSteps.isSelected() ?
|
||||
(Integer)spinnerStepsPhi.getValue() * (Integer)spinnerStepsTheta.getValue() :
|
||||
(int)(Math.abs((Double)spinnerToPhi.getValue() - (Double)spinnerFromPhi.getValue()) / (Integer)spinnerStepSizePhi.getValue() + 1) *
|
||||
(int)(Math.abs((Double)spinnerToTheta.getValue() - (Double)spinnerFromTheta.getValue()) / (Integer)spinnerStepSizeTheta.getValue() +1));
|
||||
int seconds = (int) ((Double)value * steps);
|
||||
LocalTime time = LocalTime.ofSecondOfDay(seconds);
|
||||
textTotalTime.setText(time.toString());
|
||||
} catch (Exception ex){
|
||||
textTotalTime.setText("");
|
||||
}
|
||||
}
|
||||
});
|
||||
try{
|
||||
spinnerFromPhi.setModel(new SpinnerNumberModel(Math.max(phi.getMinValue(),(Double)spinnerFromPhi.getValue()), phi.getMinValue(), phi.getMaxValue(), 1.0));
|
||||
spinnerToPhi.setModel(new SpinnerNumberModel(Math.min(phi.getMaxValue(),(Double)spinnerToPhi.getValue()), phi.getMinValue(), phi.getMaxValue(), 1.0));
|
||||
@@ -74,6 +59,21 @@ public class HoloScan extends Panel {
|
||||
spinnerToTheta.setModel(new SpinnerNumberModel(theta.getMaxValue(), theta.getMinValue(), theta.getMaxValue(), 1.0));
|
||||
}
|
||||
}
|
||||
|
||||
protected void onTimer(){
|
||||
try{
|
||||
int steps = (radioSteps.isSelected() ?
|
||||
(Integer)spinnerStepsPhi.getValue() * (Integer)spinnerStepsTheta.getValue() :
|
||||
(int)(Math.abs((Double)spinnerToPhi.getValue() - (Double)spinnerFromPhi.getValue()) / (Integer)spinnerStepSizePhi.getValue() + 1) *
|
||||
(int)(Math.abs((Double)spinnerToTheta.getValue() - (Double)spinnerFromTheta.getValue()) / (Integer)spinnerStepSizeTheta.getValue() +1));
|
||||
int seconds = (int) ((Double)scienta.getAcquisitionTime().take() * steps);
|
||||
LocalTime time = LocalTime.ofSecondOfDay(seconds);
|
||||
textTotalTime.setText(time.toString());
|
||||
} catch (Exception ex){
|
||||
textTotalTime.setText("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChange(State state, State former) {
|
||||
|
||||
Reference in New Issue
Block a user