Startup
This commit is contained in:
@@ -70,25 +70,28 @@ public class Correlation extends Panel {
|
||||
} catch (Exception ex){
|
||||
textCorrelation.setText("");
|
||||
}
|
||||
|
||||
try{
|
||||
List pars = (List)getController().getInterpreterVariable("pars_lin");
|
||||
//textLinear.setText(String.format("%1.3fx%+1.3f", (Double)(pars.get(1)), (Double)(pars.get(0))));
|
||||
textLinear.setText(String.format("%1.6gx%+1.6g",pars.get(1), pars.get(0)));
|
||||
} catch (Exception ex){
|
||||
textLinear.setText("");
|
||||
}
|
||||
|
||||
try{
|
||||
List pars = (List)getController().getInterpreterVariable("pars_quad");
|
||||
//textQuadratic.setText(String.format("%1.2fx\u00B2 %+1.2fx%+1.2f", (Double)(pars.get(0)), (Double)(pars.get(1)), (Double)(pars.get(0))));
|
||||
textQuadratic.setText(String.format("%1.3gx\u00B2%+1.3gx%+1.3g", pars.get(0), pars.get(1), pars.get(0)));
|
||||
//textQuadratic.setText(formatter.format(pars.get(2))+ formatter.format(pars.get(1)) + formatter.format(pars.get(0)));
|
||||
|
||||
} catch (Exception ex){
|
||||
textQuadratic.setText("");
|
||||
}
|
||||
|
||||
if (checkLinear.isSelected()){
|
||||
try{
|
||||
List pars = (List)getController().getInterpreterVariable("pars_lin");
|
||||
//textLinear.setText(String.format("%1.3fx%+1.3f", (Double)(pars.get(1)), (Double)(pars.get(0))));
|
||||
textLinear.setText(String.format("%1.6gx%+1.6g",pars.get(1), pars.get(0)));
|
||||
} catch (Exception ex){
|
||||
textLinear.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
if (checkQuadratic.isSelected()){
|
||||
try{
|
||||
List pars = (List)getController().getInterpreterVariable("pars_quad");
|
||||
//textQuadratic.setText(String.format("%1.2fx\u00B2 %+1.2fx%+1.2f", (Double)(pars.get(0)), (Double)(pars.get(1)), (Double)(pars.get(0))));
|
||||
textQuadratic.setText(String.format("%1.3gx\u00B2%+1.3gx%+1.3g", pars.get(0), pars.get(1), pars.get(0)));
|
||||
//textQuadratic.setText(formatter.format(pars.get(2))+ formatter.format(pars.get(1)) + formatter.format(pars.get(0)));
|
||||
|
||||
} catch (Exception ex){
|
||||
textQuadratic.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,6 +110,9 @@ public class Correlation extends Panel {
|
||||
textDevY.setEnabled(state==State.Ready);
|
||||
spinnerInterval.setEnabled(state==State.Ready);
|
||||
spinnerWindow.setEnabled(state==State.Ready);
|
||||
checkBS.setEnabled(state==State.Ready);
|
||||
checkLinear.setEnabled(state==State.Ready);
|
||||
checkQuadratic.setEnabled(state==State.Ready);
|
||||
|
||||
if ((former==State.Initializing) && (state == State.Ready)){
|
||||
if (App.hasArgument("start")) {
|
||||
@@ -152,6 +158,8 @@ public class Correlation extends Panel {
|
||||
textLinear = new javax.swing.JTextField();
|
||||
jLabel7 = new javax.swing.JLabel();
|
||||
textQuadratic = new javax.swing.JTextField();
|
||||
checkLinear = new javax.swing.JCheckBox();
|
||||
checkQuadratic = new javax.swing.JCheckBox();
|
||||
|
||||
plot.setTitle("");
|
||||
|
||||
@@ -184,7 +192,7 @@ public class Correlation extends Panel {
|
||||
textCorrelation.setEditable(false);
|
||||
textCorrelation.setHorizontalAlignment(javax.swing.JTextField.CENTER);
|
||||
|
||||
checkBS.setText("Beam Synchronous");
|
||||
checkBS.setText("Beam synchronous");
|
||||
|
||||
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
jLabel6.setText("Liner fit:");
|
||||
@@ -198,6 +206,11 @@ public class Correlation extends Panel {
|
||||
textQuadratic.setEditable(false);
|
||||
textQuadratic.setHorizontalAlignment(javax.swing.JTextField.CENTER);
|
||||
|
||||
checkLinear.setSelected(true);
|
||||
checkLinear.setText("Linear fit");
|
||||
|
||||
checkQuadratic.setText("Quadratic fit");
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
@@ -221,7 +234,9 @@ public class Correlation extends Panel {
|
||||
.addComponent(spinnerWindow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(checkBS)
|
||||
.addComponent(textLinear, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
|
||||
.addComponent(textQuadratic, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE))
|
||||
.addComponent(textQuadratic, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
|
||||
.addComponent(checkLinear)
|
||||
.addComponent(checkQuadratic))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
@@ -249,6 +264,8 @@ public class Correlation extends Panel {
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(textDevY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(checkBS)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel3)
|
||||
.addComponent(spinnerInterval, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
@@ -256,9 +273,11 @@ public class Correlation extends Panel {
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel4)
|
||||
.addComponent(spinnerWindow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(checkBS)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(checkLinear)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(checkQuadratic)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(textCorrelation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel5))
|
||||
@@ -270,7 +289,7 @@ public class Correlation extends Panel {
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(jLabel7)
|
||||
.addComponent(textQuadratic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 89, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
|
||||
.addComponent(buttonStart)
|
||||
.addGap(45, 45, 45))
|
||||
);
|
||||
@@ -313,6 +332,8 @@ public class Correlation extends Panel {
|
||||
args.put("interval", spinnerInterval.getValue());
|
||||
args.put("window", spinnerWindow.getValue());
|
||||
args.put("bs", checkBS.isSelected());
|
||||
args.put("linear_fit", checkLinear.isSelected());
|
||||
args.put("quadratic_fit", checkQuadratic.isSelected());
|
||||
|
||||
args.put("p", plot);
|
||||
runAsync("Correlation/Correlation", args).handle((ok, ex) -> {
|
||||
@@ -332,6 +353,8 @@ public class Correlation extends Panel {
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonStart;
|
||||
private javax.swing.JCheckBox checkBS;
|
||||
private javax.swing.JCheckBox checkLinear;
|
||||
private javax.swing.JCheckBox checkQuadratic;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
|
||||
Reference in New Issue
Block a user