This commit is contained in:
root
2018-03-06 08:21:09 +01:00
parent 8d18ec8059
commit 1bcb32c8f2
32 changed files with 1141 additions and 1121 deletions
+51 -27
View File
@@ -20,7 +20,7 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="plot" pref="371" max="32767" attributes="0"/>
<Component id="plot" pref="345" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -50,7 +50,12 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonStart" min="-2" pref="189" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel7" linkSize="3" alignment="1" min="-2" max="-2" attributes="0"/>
@@ -63,23 +68,23 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="textDevX" linkSize="4" alignment="0" pref="250" max="32767" attributes="0"/>
<Component id="textDevY" linkSize="4" alignment="0" pref="250" max="32767" attributes="0"/>
<Component id="textCorrelation" linkSize="4" alignment="0" pref="250" max="32767" attributes="0"/>
<Component id="spinnerInterval" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="spinnerWindow" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="checkBS" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="textLinear" linkSize="4" alignment="0" pref="250" max="32767" attributes="0"/>
<Component id="textQuadratic" linkSize="4" alignment="0" pref="250" max="32767" attributes="0"/>
<Component id="checkLinear" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="checkQuadratic" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="comboTypeY" min="-2" max="-2" attributes="0"/>
<Component id="comboTypeX" min="-2" max="-2" attributes="0"/>
<Component id="textCorrelation" linkSize="4" alignment="0" pref="250" max="32767" attributes="0"/>
<Component id="spinnerInterval" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="spinnerWindow" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="textLinear" linkSize="4" alignment="0" pref="250" max="32767" attributes="0"/>
<Component id="textQuadratic" linkSize="4" alignment="0" pref="250" max="32767" attributes="0"/>
<Component id="checkLinear" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="checkQuadratic" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="26" max="32767" attributes="0"/>
</Group>
<Component id="textDevX" max="32767" attributes="0"/>
<Component id="textDevY" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonStart" min="-2" pref="189" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -92,12 +97,14 @@
<Component id="textDevX" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="comboTypeX" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textDevY" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="checkBS" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Component id="comboTypeY" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
@@ -112,7 +119,7 @@
<Component id="checkLinear" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="checkQuadratic" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="42" max="32767" attributes="0"/>
<EmptySpace pref="22" max="32767" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="textCorrelation" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="2" min="-2" max="-2" attributes="0"/>
@@ -127,7 +134,7 @@
<Component id="jLabel7" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="textQuadratic" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="42" max="32767" attributes="0"/>
<EmptySpace pref="24" max="32767" attributes="0"/>
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="45" max="-2" attributes="0"/>
</Group>
@@ -197,11 +204,6 @@
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkBS">
<Properties>
<Property name="text" type="java.lang.String" value="Beam synchronous"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="horizontalAlignment" type="int" value="4"/>
@@ -237,6 +239,28 @@
<Property name="text" type="java.lang.String" value="Quadratic fit"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboTypeX">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="Channel"/>
<StringItem index="1" value="Stream"/>
<StringItem index="2" value="Camera"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboTypeY">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="Channel"/>
<StringItem index="1" value="Stream"/>
<StringItem index="2" value="Camera"/>
</StringArray>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
+49 -31
View File
@@ -17,7 +17,7 @@ public class Correlation extends Panel {
public Correlation() {
initComponents();
this.setPersistedComponents(new Component[]{textDevX, textDevY, spinnerInterval, spinnerWindow, checkBS});
this.setPersistedComponents(new Component[]{textDevX, textDevY, spinnerInterval, spinnerWindow, comboTypeX, comboTypeY});
plot.getAxis(Plot.AxisId.X).setLabel(null);
plot.getAxis(Plot.AxisId.Y).setLabel(null);
}
@@ -34,8 +34,15 @@ public class Correlation extends Panel {
textDevY.setText(App.getArgumentValue("dy"));
}
try{
if (App.hasArgument("bs")) {
checkBS.setSelected(Boolean.valueOf(App.getArgumentValue("bs")));
if (App.hasArgument("dxtype")) {
comboTypeX.setSelectedIndex(Integer.valueOf(App.getArgumentValue("dxtype")));
}
} catch (Exception ex){
System.err.println(ex.getMessage());
}
try{
if (App.hasArgument("dytype")) {
comboTypeY.setSelectedIndex(Integer.valueOf(App.getArgumentValue("dytype")));
}
} catch (Exception ex){
System.err.println(ex.getMessage());
@@ -110,7 +117,8 @@ 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);
comboTypeX.setEnabled(state==State.Ready);
comboTypeY.setEnabled(state==State.Ready);
checkLinear.setEnabled(state==State.Ready);
checkQuadratic.setEnabled(state==State.Ready);
@@ -153,13 +161,14 @@ public class Correlation extends Panel {
buttonStart = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
textCorrelation = new javax.swing.JTextField();
checkBS = new javax.swing.JCheckBox();
jLabel6 = new javax.swing.JLabel();
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();
comboTypeX = new javax.swing.JComboBox();
comboTypeY = new javax.swing.JComboBox();
plot.setTitle("");
@@ -192,8 +201,6 @@ public class Correlation extends Panel {
textCorrelation.setEditable(false);
textCorrelation.setHorizontalAlignment(javax.swing.JTextField.CENTER);
checkBS.setText("Beam synchronous");
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel6.setText("Liner fit:");
@@ -211,10 +218,18 @@ public class Correlation extends Panel {
checkQuadratic.setText("Quadratic fit");
comboTypeX.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Channel", "Stream", "Camera" }));
comboTypeY.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Channel", "Stream", "Camera" }));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -227,21 +242,20 @@ public class Correlation extends Panel {
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textDevX, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(textDevY, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(textCorrelation, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(spinnerInterval, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.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(checkLinear)
.addComponent(checkQuadratic))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboTypeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(comboTypeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textCorrelation, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(spinnerInterval, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerWindow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textLinear, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(textQuadratic, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(checkLinear)
.addComponent(checkQuadratic))
.addContainerGap())
.addComponent(textDevX)
.addComponent(textDevY)))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3, jLabel4});
@@ -250,7 +264,7 @@ public class Correlation extends Panel {
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel5, jLabel6, jLabel7});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {textCorrelation, textDevX, textDevY, textLinear, textQuadratic});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {textCorrelation, textLinear, textQuadratic});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -260,11 +274,13 @@ public class Correlation extends Panel {
.addComponent(jLabel1)
.addComponent(textDevX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboTypeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.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(3, 3, 3)
.addComponent(comboTypeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
@@ -277,7 +293,7 @@ public class Correlation extends Panel {
.addComponent(checkLinear)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkQuadratic)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, 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))
@@ -289,7 +305,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, 42, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
.addComponent(buttonStart)
.addGap(45, 45, 45))
);
@@ -302,7 +318,7 @@ public class Correlation extends Panel {
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE))
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -331,12 +347,13 @@ public class Correlation extends Panel {
args.put("dy", textDevY.getText());
args.put("interval", spinnerInterval.getValue());
args.put("window", spinnerWindow.getValue());
args.put("bs", checkBS.isSelected());
args.put("dxtype", comboTypeX.getSelectedIndex());
args.put("dytype", comboTypeY.getSelectedIndex());
args.put("linear_fit", checkLinear.isSelected());
args.put("quadratic_fit", checkQuadratic.isSelected());
args.put("p", plot);
runAsync("Correlation/Correlation", args).handle((ok, ex) -> {
runAsync("Correlation/Correlation2", args).handle((ok, ex) -> {
if (ex != null) {
ex.printStackTrace();
}
@@ -352,9 +369,10 @@ 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.JComboBox comboTypeX;
private javax.swing.JComboBox comboTypeY;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
-267
View File
@@ -1,267 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="plot" pref="345" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="plot" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="plot">
<Properties>
<Property name="title" type="java.lang.String" value=""/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonStart" min="-2" pref="189" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel7" linkSize="3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" linkSize="3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" linkSize="3" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" linkSize="1" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="1" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" linkSize="1" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" linkSize="1" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="comboTypeY" min="-2" max="-2" attributes="0"/>
<Component id="comboTypeX" min="-2" max="-2" attributes="0"/>
<Component id="textCorrelation" linkSize="4" alignment="0" pref="250" max="32767" attributes="0"/>
<Component id="spinnerInterval" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="spinnerWindow" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="textLinear" linkSize="4" alignment="0" pref="250" max="32767" attributes="0"/>
<Component id="textQuadratic" linkSize="4" alignment="0" pref="250" max="32767" attributes="0"/>
<Component id="checkLinear" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="checkQuadratic" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="26" max="32767" attributes="0"/>
</Group>
<Component id="textDevX" max="32767" attributes="0"/>
<Component id="textDevY" alignment="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textDevX" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="comboTypeX" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textDevY" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Component id="comboTypeY" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerInterval" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerWindow" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="checkLinear" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="checkQuadratic" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="22" max="32767" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="textCorrelation" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel6" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="textLinear" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel7" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="textQuadratic" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="24" max="32767" attributes="0"/>
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="45" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="X device:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textDevX">
</Component>
<Component class="javax.swing.JTextField" name="textDevY">
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Y device:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Interval (s):"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerInterval">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.1" minimum="0.001" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Window size:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerWindow">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="50" minimum="3" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStartActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="text" type="java.lang.String" value="Correlation:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textCorrelation">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="text" type="java.lang.String" value="Liner fit:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textLinear">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="text" type="java.lang.String" value="Quadratric fit:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textQuadratic">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkLinear">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Linear fit"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkQuadratic">
<Properties>
<Property name="text" type="java.lang.String" value="Quadratic fit"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboTypeX">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="Channel"/>
<StringItem index="1" value="Stream"/>
<StringItem index="2" value="Camera"/>
</StringArray>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboTypeY">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="Channel"/>
<StringItem index="1" value="Stream"/>
<StringItem index="2" value="Camera"/>
</StringArray>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
-393
View File
@@ -1,393 +0,0 @@
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.ui.App;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.awt.Component;
import java.util.HashMap;
import java.util.List;
/**
*
*/
public class Correlation2 extends Panel {
public Correlation2() {
initComponents();
this.setPersistedComponents(new Component[]{textDevX, textDevY, spinnerInterval, spinnerWindow, comboTypeX, comboTypeY});
plot.getAxis(Plot.AxisId.X).setLabel(null);
plot.getAxis(Plot.AxisId.Y).setLabel(null);
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
super.onInitialize(runCount);
this.startTimer(100, 10);
if (App.hasArgument("dx")) {
textDevX.setText(App.getArgumentValue("dx"));
}
if (App.hasArgument("dy")) {
textDevY.setText(App.getArgumentValue("dy"));
}
try{
if (App.hasArgument("dxtype")) {
comboTypeX.setSelectedIndex(Integer.valueOf(App.getArgumentValue("dxtype")));
}
} catch (Exception ex){
System.err.println(ex.getMessage());
}
try{
if (App.hasArgument("dytype")) {
comboTypeY.setSelectedIndex(Integer.valueOf(App.getArgumentValue("dytype")));
}
} catch (Exception ex){
System.err.println(ex.getMessage());
}
try{
if (App.hasArgument("interval")) {
spinnerInterval.setValue(Double.valueOf(App.getArgumentValue("interval")));
}
} catch (Exception ex){
System.err.println(ex.getMessage());
}
try{
if (App.hasArgument("window")) {
spinnerWindow.setValue(Integer.valueOf(App.getArgumentValue("window")));
}
} catch (Exception ex){
System.err.println(ex.getMessage());
}
}
@Override
protected void onTimer(){
if (isRunning()){
updateResults();
}
}
//DecimalFormat formatter = new DecimalFormat("0.##E0");
void updateResults(){
try{
textCorrelation.setText(String.format("%1.4f", Double.valueOf((Double)getContext().getInterpreterVariable("corr"))));
} catch (Exception ex){
textCorrelation.setText("");
}
if (checkLinear.isSelected()){
try{
List pars = (List)getContext().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)getContext().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
public void onStateChange(State state, State former) {
buttonStart.setEnabled((state==State.Ready) || (state==State.Busy));
if (isRunning()){
if (state==State.Ready){
buttonStart.setText("Start");
}
} else {
if (state==State.Busy){
buttonStart.setText("Stop");
}
}
textDevX.setEnabled(state==State.Ready);
textDevY.setEnabled(state==State.Ready);
spinnerInterval.setEnabled(state==State.Ready);
spinnerWindow.setEnabled(state==State.Ready);
comboTypeX.setEnabled(state==State.Ready);
comboTypeY.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")) {
buttonStartActionPerformed(null);
}
}
}
boolean isRunning(){
return buttonStart.getText().equals("Stop");
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
plot = new ch.psi.pshell.plot.LinePlotJFree();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
textDevX = new javax.swing.JTextField();
textDevY = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
spinnerInterval = new javax.swing.JSpinner();
jLabel4 = new javax.swing.JLabel();
spinnerWindow = new javax.swing.JSpinner();
buttonStart = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
textCorrelation = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
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();
comboTypeX = new javax.swing.JComboBox();
comboTypeY = new javax.swing.JComboBox();
plot.setTitle("");
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("X device:");
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel2.setText("Y device:");
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel3.setText("Interval (s):");
spinnerInterval.setModel(new javax.swing.SpinnerNumberModel(Double.valueOf(0.1d), Double.valueOf(0.001d), null, Double.valueOf(1.0d)));
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel4.setText("Window size:");
spinnerWindow.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(50), Integer.valueOf(3), null, Integer.valueOf(1)));
buttonStart.setText("Start");
buttonStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStartActionPerformed(evt);
}
});
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel5.setText("Correlation:");
textCorrelation.setEditable(false);
textCorrelation.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel6.setText("Liner fit:");
textLinear.setEditable(false);
textLinear.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel7.setText("Quadratric fit:");
textQuadratic.setEditable(false);
textQuadratic.setHorizontalAlignment(javax.swing.JTextField.CENTER);
checkLinear.setSelected(true);
checkLinear.setText("Linear fit");
checkQuadratic.setText("Quadratic fit");
comboTypeX.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Channel", "Stream", "Camera" }));
comboTypeY.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Channel", "Stream", "Camera" }));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboTypeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(comboTypeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textCorrelation, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(spinnerInterval, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerWindow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textLinear, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(textQuadratic, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
.addComponent(checkLinear)
.addComponent(checkQuadratic))
.addContainerGap())
.addComponent(textDevX)
.addComponent(textDevY)))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3, jLabel4});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerInterval, spinnerWindow});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel5, jLabel6, jLabel7});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {textCorrelation, textLinear, textQuadratic});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(textDevX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboTypeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(textDevY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(3, 3, 3)
.addComponent(comboTypeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.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))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.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))
.addGap(18, 18, 18)
.addComponent(checkLinear)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkQuadratic)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, 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))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel6)
.addComponent(textLinear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.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, 24, Short.MAX_VALUE)
.addComponent(buttonStart)
.addGap(45, 45, 45))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())))
);
}// </editor-fold>//GEN-END:initComponents
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
try {
if (isRunning()){
abort();
updateResults();
//buttonStart.setText("Start");
} else {
textCorrelation.setText("");
textLinear.setText("");
textQuadratic.setText("");
HashMap args = new HashMap();
args.put("dx", textDevX.getText());
args.put("dy", textDevY.getText());
args.put("interval", spinnerInterval.getValue());
args.put("window", spinnerWindow.getValue());
args.put("dxtype", comboTypeX.getSelectedIndex());
args.put("dytype", comboTypeY.getSelectedIndex());
args.put("linear_fit", checkLinear.isSelected());
args.put("quadratic_fit", checkQuadratic.isSelected());
args.put("p", plot);
runAsync("Correlation/Correlation2", args).handle((ok, ex) -> {
if (ex != null) {
ex.printStackTrace();
}
return ok;
});
///buttonStart.setText("Stop");
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonStartActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonStart;
private javax.swing.JCheckBox checkLinear;
private javax.swing.JCheckBox checkQuadratic;
private javax.swing.JComboBox comboTypeX;
private javax.swing.JComboBox comboTypeY;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private ch.psi.pshell.plot.LinePlotJFree plot;
private javax.swing.JSpinner spinnerInterval;
private javax.swing.JSpinner spinnerWindow;
private javax.swing.JTextField textCorrelation;
private javax.swing.JTextField textDevX;
private javax.swing.JTextField textDevY;
private javax.swing.JTextField textLinear;
private javax.swing.JTextField textQuadratic;
// End of variables declaration//GEN-END:variables
}
+1
View File
@@ -380,6 +380,7 @@
<Component class="javax.swing.JButton" name="buttonPhaseSet">
<Properties>
<Property name="text" type="java.lang.String" value="Set"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPhaseSetActionPerformed"/>
+3 -1
View File
@@ -37,7 +37,7 @@ public class GunEnergyScan extends Panel {
spinnerLatency.setEnabled(enabled);
spinnerDispersion.setEnabled(enabled);
spinnerEnergy.setEnabled(enabled);
buttonPhaseSet.setEnabled(enabled && !buttonPhaseSet.getText().isEmpty());
buttonPhaseSet.setEnabled(enabled && !textRefPhase.getText().trim().isEmpty());
}
@Override
@@ -224,6 +224,7 @@ public class GunEnergyScan extends Panel {
jLabel1.setText("Ref phase:");
buttonPhaseSet.setText("Set");
buttonPhaseSet.setEnabled(false);
buttonPhaseSet.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPhaseSetActionPerformed(evt);
@@ -323,6 +324,7 @@ public class GunEnergyScan extends Panel {
try{
double phase = ((Number)ret).doubleValue();
textRefPhase.setText(String.format("%1.2f",phase));
buttonPhaseSet.setEnabled(true);
} catch (Exception e) {
showException(e);
}
+133 -91
View File
@@ -38,7 +38,7 @@
<Group type="102" alignment="0" attributes="0">
<Component id="sidePanel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="renderer" pref="578" max="32767" attributes="0"/>
<Component id="renderer" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
@@ -68,7 +68,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="jPanel5" max="32767" attributes="0"/>
@@ -78,7 +78,7 @@
<Component id="panelScreen" max="32767" attributes="0"/>
<Component id="panelFilter" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -97,6 +97,7 @@
<Component id="panelScreen" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="panelFilter" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -433,16 +434,27 @@
<Component id="textState" min="-2" pref="80" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="filler1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="56" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonServer" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonDirect" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textState" linkSize="2" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="textState" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="filler1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonServer" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonDirect" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -483,6 +495,16 @@
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.Box$Filler" name="filler1">
<Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 32767]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.VerticalGlue"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelScreen">
@@ -865,19 +887,13 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="toolBar" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="comboCameras" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="comboType" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="pauseSelection" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="panelCameraSelection" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="pauseSelection" min="-2" pref="334" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -885,61 +901,16 @@
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="toolBar" min="-2" pref="25" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboCameras" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboType" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="pauseSelection" alignment="2" min="-2" pref="29" max="-2" attributes="0"/>
<Component id="toolBar" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelCameraSelection" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="pauseSelection" alignment="0" min="-2" pref="29" max="-2" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JComboBox" name="comboCameras">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="1"/>
</Property>
<Property name="maximumRowCount" type="int" value="30"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboCamerasActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Camera:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="Type:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboType">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="1"/>
</Property>
<Property name="maximumRowCount" type="int" value="30"/>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="All"/>
<StringItem index="1" value="Laser"/>
<StringItem index="2" value="Electrons"/>
<StringItem index="3" value="Photonics"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboTypeActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JToolBar" name="toolBar">
<Properties>
<Property name="floatable" type="boolean" value="false"/>
@@ -977,30 +948,6 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStreamDataActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonArgs">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="getIcon(&quot;Data&quot;)" type="code"/>
</Property>
<Property name="text" type="java.lang.String" value=" "/>
<Property name="toolTipText" type="java.lang.String" value="Camera Setup"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonArgsActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToolBar$Separator" name="jSeparator5">
<Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[20, 32767]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[20, 0]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JToggleButton" name="buttonSave">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
@@ -1106,6 +1053,19 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonReticleActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToggleButton" name="buttonTitle">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="getIcon(&quot;Title&quot;)" type="code"/>
</Property>
<Property name="text" type="java.lang.String" value=" "/>
<Property name="toolTipText" type="java.lang.String" value="Show Camera Name"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonTitleActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.swing.ValueSelection" name="pauseSelection">
@@ -1113,6 +1073,88 @@
<Property name="decimals" type="int" value="0"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="panelCameraSelection">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="comboCameras" min="-2" pref="222" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="comboType" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="comboType" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="comboCameras" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Camera:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboCameras">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="1"/>
</Property>
<Property name="maximumRowCount" type="int" value="30"/>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="0"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[127, 27]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboCamerasActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="Type:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboType">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="1"/>
</Property>
<Property name="maximumRowCount" type="int" value="30"/>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="All"/>
<StringItem index="1" value="Laser"/>
<StringItem index="2" value="Electrons"/>
<StringItem index="3" value="Photonics"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboTypeActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.imaging.Renderer" name="renderer">
+338 -169
View File
@@ -18,6 +18,10 @@ import ch.psi.pshell.bs.StreamValue;
import ch.psi.pshell.core.JsonSerializer;
import ch.psi.pshell.data.DataManager;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.Readable.ReadableArray;
import ch.psi.pshell.device.Readable.ReadableNumber;
import ch.psi.pshell.device.ReadableRegister.ReadableRegisterArray;
import ch.psi.pshell.device.ReadableRegister.ReadableRegisterNumber;
import ch.psi.pshell.epics.ChannelInteger;
import ch.psi.pshell.epics.DiscretePositioner;
import ch.psi.pshell.epics.Epics;
@@ -40,11 +44,13 @@ import ch.psi.pshell.imaging.RendererMode;
import ch.psi.pshell.imaging.Source;
import ch.psi.pshell.scripting.InterpreterResult;
import ch.psi.pshell.scripting.ScriptManager;
import ch.psi.pshell.swing.DeviceValueChart;
import ch.psi.pshell.swing.ValueSelection;
import ch.psi.pshell.swing.ValueSelection.ValueSelectionListener;
import ch.psi.utils.Arr;
import ch.psi.utils.ArrayProperties;
import ch.psi.utils.Convert;
import ch.psi.utils.Str;
import ch.psi.utils.swing.Editor.EditorDialog;
import ch.psi.utils.swing.MainFrame;
import ch.psi.utils.swing.StandardDialog;
@@ -52,14 +58,19 @@ import ch.psi.utils.swing.StandardDialog.StandardDialogListener;
import ch.psi.utils.swing.SwingUtils.OptionResult;
import ch.psi.utils.swing.SwingUtils.OptionType;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
@@ -77,7 +88,6 @@ import java.util.Map;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractButton;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
@@ -133,6 +143,9 @@ public class ScreenPanel2 extends Panel {
String serverUrl;
String camServerUrl;
String instanceName;
Overlay titleOv = null;
String pipelineSuffix = "_sp";
Double getServerDouble(String name) {
return (Double) Convert.toDouble(server.getValue(name));
@@ -241,7 +254,7 @@ public class ScreenPanel2 extends Panel {
((JSpinner.DefaultEditor) editor).getTextField().setHorizontalAlignment(JTextField.RIGHT);
}
renderer.setPersistenceFile(Paths.get(getContext().getSetup().getContextPath(), "Renderer_Cameras.bin"));
setPersistedComponents(new Component[]{buttonServer, buttonDirect});
//setPersistedComponents(new Component[]{buttonServer, buttonDirect});
comboCameras.setEnabled(false);
comboType.setEnabled(false);
@@ -288,6 +301,9 @@ public class ScreenPanel2 extends Panel {
if (App.hasArgument("calc")) {
useServerStats = false;
}
if (App.hasArgument("suffix")) {
pipelineSuffix = App.getArgumentValue("suffix");
}
renderer.setProfileNormalized(true);
renderer.setShowProfileLimits(false);
@@ -301,8 +317,8 @@ public class ScreenPanel2 extends Panel {
}
});
JMenuItem menuCameraConfig = new JMenuItem("Renderer Config");
menuCameraConfig.addActionListener((ActionEvent e) -> {
JMenuItem menuRendererConfig = new JMenuItem("Renderer Parameters");
menuRendererConfig.addActionListener((ActionEvent e) -> {
try {
if (camera != null) {
this.showDeviceConfigDialog(camera, false);
@@ -312,6 +328,52 @@ public class ScreenPanel2 extends Panel {
}
});
JMenuItem menuCameraConfig = new JMenuItem("Camera Configurarion");
menuCameraConfig.addActionListener((ActionEvent e) -> {
try {
if (camera != null) {
String cameraConfigJson = null;
if (usingServer) {
String cameraServerUrl = (camServerUrl == null) ? server.getUrl().substring(0, server.getUrl().length() - 1) + "8" : camServerUrl;
try (CameraServer srv = new CameraServer("CamServer", cameraServerUrl)) {
srv.initialize();
//TODO: replace into encodeMultiline
cameraConfigJson = JsonSerializer.encode(srv.getConfig(cameraName), true);
}
} else {
String configFolder = (String) getContext().getClassByName("SfCamera").getMethod("getConfigFolder", new Class[]{}).invoke(null);
Path configFile = Paths.get(configFolder, cameraName + ".json");
cameraConfigJson = configFile.toFile().exists() ? new String(Files.readAllBytes(configFile)) : null;
}
TextEditor configEditor = new TextEditor();
configEditor.setText(cameraConfigJson);
configEditor.setReadOnly(true);
configEditor.setTitle(cameraName);
EditorDialog dlg = configEditor.getDialog(getTopLevel(), false);
dlg.setSize(480, 640);
dlg.setVisible(true);
SwingUtils.centerComponent(getTopLevel(), dlg);
}
} catch (Exception ex) {
showException(ex);
}
});
JMenuItem menuSetImageBufferSize = new JMenuItem("Set Stack Size...");
menuSetImageBufferSize.addActionListener((ActionEvent e) -> {
try {
String ret = SwingUtils.getString(getTopLevel(), "Enter size of image buffer: ", String.valueOf(imageBufferLenght));
if (ret!=null){
this.setImageBufferSize(Integer.valueOf(ret));
}
} catch (Exception ex) {
showException(ex);
}
});
JMenuItem menuSaveStack = new JMenuItem("Save Stack");
menuSaveStack.addActionListener((ActionEvent e) -> {
try {
@@ -319,8 +381,8 @@ public class ScreenPanel2 extends Panel {
} catch (Exception ex) {
showException(ex);
}
});
menuSaveStack.setEnabled(imageBufferLenght > 0);
});
JMenuItem menuSetROI = new JMenuItem("Set ROI...");
menuSetROI.addActionListener((ActionEvent e) -> {
@@ -369,10 +431,13 @@ public class ScreenPanel2 extends Panel {
});
renderer.getPopupMenu().addSeparator();
renderer.getPopupMenu().add(menuRendererConfig);
renderer.getPopupMenu().add(menuCameraConfig);
renderer.getPopupMenu().add(menuCalibrate);
renderer.getPopupMenu().add(menuSetImageBufferSize);
renderer.getPopupMenu().add(menuSaveStack);
renderer.getPopupMenu().addSeparator();
renderer.getPopupMenu().add(menuCalibrate);
renderer.getPopupMenu().addSeparator();
renderer.getPopupMenu().add(menuSetROI);
renderer.getPopupMenu().add(menuResetROI);
renderer.getPopupMenu().addPopupMenuListener(new PopupMenuListener() {
@@ -382,6 +447,8 @@ public class ScreenPanel2 extends Panel {
menuSetROI.setEnabled(server != null);
menuCalibrate.setVisible(server != null);
menuCalibrate.setEnabled((calibrationDialolg == null) || (!calibrationDialolg.isShowing()));
menuSaveStack.setEnabled(imageBufferLenght > 0);
menuSetImageBufferSize.setEnabled(!renderer.isPaused());
}
@Override
@@ -407,9 +474,9 @@ public class ScreenPanel2 extends Panel {
}
}
});
imageBufferOverlay = new Text(renderer.getPenErrorText(), "", new Font("Verdana", Font.PLAIN, 12), new Point(-100, 20));
imageBufferOverlay = new Text(renderer.getPenErrorText(), "", new Font("Verdana", Font.PLAIN, 12), new Point(-100, 42));
imageBufferOverlay.setFixed(true);
imageBufferOverlay.setAnchor(Overlay.ANCHOR_VIEWPORT_TOP_RIGHT);
imageBufferOverlay.setAnchor(Overlay.ANCHOR_VIEWPORT_OR_IMAGE_TOP_RIGHT);
if (MainFrame.isDark()) {
textState.setDisabledTextColor(textState.getForeground());
}
@@ -603,6 +670,21 @@ public class ScreenPanel2 extends Panel {
}
}
void manageTitleOverlay() {
Overlay to = null;
if ((buttonTitle.isSelected()) && (cameraName != null)) {
Font font = new Font("Arial", Font.PLAIN, 28);
to = new Text(renderer.getPenErrorText(), cameraName, font, new Point(-SwingUtils.getTextSize(cameraName, renderer.getGraphics().getFontMetrics(font)).width - 14, 26));
to.setFixed(true);
to.setAnchor(Overlay.ANCHOR_VIEWPORT_OR_IMAGE_TOP_RIGHT);
}
synchronized (lockOverlays) {
renderer.updateOverlays(to, titleOv);
titleOv = to;
}
}
@Override
public void onStateChange(State state, State former) {
@@ -680,16 +762,21 @@ public class ScreenPanel2 extends Panel {
filter.close();
filter = null;
}
if (renderer.isPaused()){
if (renderer.isPaused()) {
renderer.resume();
renderer.removeOverlay(imageBufferOverlay);
pauseSelection.setVisible(false);
panelCameraSelection.setVisible(true);
}
}
}
manageTitleOverlay();
if (App.isDetached()) {
getTopLevel().setTitle(cameraName == null ? "ScreenPanel" : cameraName);
}
if (cameraName == null) {
return;
}
System.out.println("Setting camera: " + cameraName + " [" + (buttonServer.isSelected() ? "server" : "direct") + "]");
try {
if (buttonServer.isSelected()) {
@@ -710,8 +797,8 @@ public class ScreenPanel2 extends Panel {
System.out.println("Camera initialization OK");
if (server != null) {
//server.start(cameraName, false);
String pipelineName = cameraName + "_sp";
instanceName = cameraName + "_sp1";
String pipelineName = cameraName + pipelineSuffix;
instanceName = cameraName + pipelineSuffix +"1";
if (!server.getPipelines().contains(pipelineName)) {
System.out.println("Creating pipeline: " + pipelineName);
HashMap<String, Object> config = new HashMap<>();
@@ -734,7 +821,7 @@ public class ScreenPanel2 extends Panel {
}
camera.setBackgroundEnabled(checkBackground.isSelected());
}
updateButtons();
updateButtons();
camera.getConfig().save();
renderer.setDevice(camera);
renderer.setAutoScroll(true);
@@ -1001,31 +1088,31 @@ public class ScreenPanel2 extends Panel {
}
boolean isCameraStopped() {
if ((server != null) && !server.isStarted()){
if ((server != null) && !server.isStarted()) {
return true;
}
return ((camera == null) || camera.isClosed());
}
boolean updatingButtons;
void updateButtons(){
void updateButtons() {
updatingButtons = true;
try{
boolean active = !isCameraStopped() ;//(camera != null);
buttonArgs.setEnabled(active);
try {
boolean active = !isCameraStopped();//(camera != null);
buttonSave.setEnabled(active);
buttonGrabBackground.setEnabled(active);
buttonMarker.setEnabled(active);
buttonProfile.setEnabled(active);
buttonFit.setEnabled(active);
buttonReticle.setEnabled(active && camera.getConfig().isCalibrated());
buttonStreamData.setEnabled(active && (server!=null));
buttonPause.setEnabled(active);
buttonReticle.setEnabled(active && camera.getConfig().isCalibrated());
buttonStreamData.setEnabled(active && (server != null));
buttonPause.setEnabled(active);
//buttonPause.setIcon(getIcon("Play"));
//buttonPause.setToolTipText("Resume");
//buttonPause.setIcon(getIcon("Pause"));
//buttonPause.setToolTipText("Pause");
if (renderer.isPaused() != buttonPause.isSelected()) {
buttonPause.setSelected(renderer.isPaused());
buttonPauseActionPerformed(null);
@@ -1037,8 +1124,8 @@ public class ScreenPanel2 extends Panel {
buttonMarker.setSelected(false);
}
buttonSave.setSelected(renderer.isSnapshotDialogVisible());
} finally{
} finally {
updatingButtons = false;
}
}
@@ -1051,7 +1138,7 @@ public class ScreenPanel2 extends Panel {
}
}
textState.setText((camera == null) ? "" : camera.getState().toString());
textState.setText((camera == null) ? "" : camera.getState().toString());
if (App.hasArgument("s")) {
try {
((Source) getDevice("image")).initialize();
@@ -1066,7 +1153,7 @@ public class ScreenPanel2 extends Panel {
}
updateZoom();
updateColormap();
updateButtons();
updateButtons();
checkHistogram.setSelected((histogramDialog != null) && (histogramDialog.isShowing()));
}
@@ -1095,6 +1182,17 @@ public class ScreenPanel2 extends Panel {
return null;
}
void setImageBufferSize(int size) {
if (renderer.isPaused()) {
throw new RuntimeException("Cannot change buffer size whn paused");
}
synchronized (imageBuffer) {
imageBufferLenght = size;
imageBuffer.clear();
}
}
Overlay[][] getFitOverlays(Data data) {
Overlays.Polyline hgaussian = null;
Overlays.Polyline vgaussian = null;
@@ -1103,11 +1201,11 @@ public class ScreenPanel2 extends Panel {
Double xMean = null, xSigma = null, xNorm = null, xCom = null, xRms = null;
Double yMean = null, ySigma = null, yNorm = null, yCom = null, yRms = null;
double[] pX = null, pY = null, gX = null, gY = null;
int height = data.getHeight();
int width = data.getWidth();
PointDouble[] sliceCenters = null;
//Double xCom=null, yCom=null;
if (data != null) {
int height = data.getHeight();
int width = data.getWidth();
int profileSize = renderer.getProfileSize();
if ((useServerStats) && (server != null)) {
try {
@@ -1692,6 +1790,9 @@ public class ScreenPanel2 extends Panel {
manageUserOverlays(image, data);
}
}
if ((dataTableDialog != null) && (dataTableDialog.isShowing())) {
updateStreamData();
}
}
void saveSnapshot() throws Exception {
@@ -1936,7 +2037,6 @@ public class ScreenPanel2 extends Panel {
scrollPane.setPreferredSize(new Dimension(300, 400));
dataTableDialog.setContentPane(scrollPane);
dataTableDialog.pack();
SwingUtils.centerComponent(getTopLevel(), dataTableDialog);
dataTableDialog.setVisible(true);
dataTableDialog.addWindowListener(new WindowAdapter() {
@Override
@@ -1944,6 +2044,62 @@ public class ScreenPanel2 extends Panel {
dataTableModel = null;
}
});
dataTable.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
try {
int index = dataTable.getSelectedRow();
dataTable.setToolTipText(null);
if (index>1){
String id = String.valueOf(dataTable.getModel().getValueAt(index, 0));
String locator = String.valueOf(dataTable.getModel().getValueAt(0, 1));
dataTable.setToolTipText(locator + " " + id);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new StringSelection(locator+ " " + id), (Clipboard clipboard1, Transferable contents) -> {});
if ((e.getClickCount() == 2) && (!e.isPopupTrigger())) {
Object obj = getCurrentFrame().cache.getValue(id);
if (id.equals("image")) {
} else if (id.equals("processing_parameters")) {
Map<String, Object> pars = getProcessingParameters(getCurrentFrame().cache);
StringBuilder sb = new StringBuilder();
for (String key : pars.keySet()) {
sb.append(key).append(" = ").append(Str.toString(pars.get(key), 10)).append("\n");
}
SwingUtils.showMessage(dataTableDialog, "Processing Parameters", sb.toString());
} else if ((obj!=null) && (obj.getClass().isArray() || (obj instanceof Number))) {
DeviceValueChart chart = new DeviceValueChart();
Device dev = null;
if (obj.getClass().isArray()){
dev = new ReadableRegisterArray(new ReadableArray() {
@Override
public Object read() throws IOException, InterruptedException {
return Convert.toDouble(getCurrentFrame().cache.getValue(id));
}
@Override
public int getSize() {
return Array.getLength(getCurrentFrame().cache.getValue(id));
}
});
} else {
dev = new ReadableRegisterNumber(new ReadableNumber() {
@Override
public Object read() throws IOException, InterruptedException {
return Convert.toDouble(getCurrentFrame().cache.getValue(id));
}
});
}
dev.setPolling(1000);
chart.setDevice(dev);
JDialog dlg = SwingUtils.showDialog(dataTableDialog, cameraName +" " + id, null, chart);
}
}
}
} catch (Exception ex) {
showException(ex);
}
}
});
SwingUtils.centerComponent(getTopLevel(), dataTableDialog);
}
}
@@ -1969,30 +2125,34 @@ public class ScreenPanel2 extends Panel {
dataTableModel.addRow(new Object[]{id, ""});
}
}
for (int i = 2; i < dataTableModel.getRowCount(); i++) {
String id = String.valueOf(dataTableModel.getValueAt(i, 0));
Object obj = server.getValue(id);
if (obj != null) {
if (obj.getClass().isArray()) {
obj = obj.getClass().getComponentType().getSimpleName() + "[" + Array.getLength(obj) + "]";
} else if (obj instanceof Double) {
obj = Convert.roundDouble((Double) obj, 1);
} else if (obj instanceof Float) {
obj = Convert.roundDouble((Float) obj, 1);
Frame frame = getCurrentFrame();
if ((frame != null) && (frame.cache!=null)){
for (int i = 2; i < dataTableModel.getRowCount(); i++) {
String id = String.valueOf(dataTableModel.getValueAt(i, 0));
//Object obj = server.getValue(id);
Object obj = frame.cache.getValue(id);
if (obj != null) {
if (obj.getClass().isArray()) {
obj = obj.getClass().getComponentType().getSimpleName() + "[" + Array.getLength(obj) + "]";
} else if (obj instanceof Double) {
obj = Convert.roundDouble((Double) obj, 1);
} else if (obj instanceof Float) {
obj = Convert.roundDouble((Float) obj, 1);
}
}
dataTableModel.setValueAt(String.valueOf(obj), i, 1);
}
dataTableModel.setValueAt(String.valueOf(obj), i, 1);
}
}
}
ImageIcon getIcon(String name) {
ImageIcon getIcon(String name) {
ImageIcon ret = null;
try {
//Path path = Paths.get(getClass().getProtectionDomain().getCodeSource().getLocation().getPath(),"resources", name + ".png");
String dir = getClass().getProtectionDomain().getCodeSource().getLocation().getPath() + "resources/";
if (new File(dir + name + ".png").exists()){
ret =new javax.swing.ImageIcon(dir + name + ".png");
String dir = getClass().getProtectionDomain().getCodeSource().getLocation().getPath() + "resources/";
if (new File(dir + name + ".png").exists()) {
ret = new javax.swing.ImageIcon(dir + name + ".png");
} else {
ret = new ImageIcon(ch.psi.pshell.ui.App.class.getResource("/ch/psi/pshell/ui/" + name + ".png"));
if (MainFrame.isDark()) {
@@ -2000,7 +2160,7 @@ public class ScreenPanel2 extends Panel {
ret = new ImageIcon(ch.psi.pshell.ui.App.class.getResource("/ch/psi/pshell/ui/dark/" + name + ".png"));
} catch (Exception e) {
}
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
@@ -2051,6 +2211,7 @@ public class ScreenPanel2 extends Panel {
buttonServer = new javax.swing.JRadioButton();
buttonDirect = new javax.swing.JRadioButton();
textState = new javax.swing.JTextField();
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
panelScreen = new javax.swing.JPanel();
valueScreen = new ch.psi.pshell.swing.DeviceValuePanel();
comboScreen = new javax.swing.JComboBox();
@@ -2075,15 +2236,9 @@ public class ScreenPanel2 extends Panel {
labelSlOrientation = new javax.swing.JLabel();
spinnerSlOrientation = new javax.swing.JSpinner();
topPanel = new javax.swing.JPanel();
comboCameras = new javax.swing.JComboBox();
jLabel1 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
comboType = new javax.swing.JComboBox();
toolBar = new javax.swing.JToolBar();
buttonSidePanel = new javax.swing.JToggleButton();
buttonStreamData = new javax.swing.JButton();
buttonArgs = new javax.swing.JButton();
jSeparator5 = new javax.swing.JToolBar.Separator();
buttonSave = new javax.swing.JToggleButton();
buttonGrabBackground = new javax.swing.JButton();
buttonPause = new javax.swing.JToggleButton();
@@ -2092,7 +2247,13 @@ public class ScreenPanel2 extends Panel {
buttonProfile = new javax.swing.JToggleButton();
buttonFit = new javax.swing.JToggleButton();
buttonReticle = new javax.swing.JToggleButton();
buttonTitle = new javax.swing.JToggleButton();
pauseSelection = new ch.psi.pshell.swing.ValueSelection();
panelCameraSelection = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
comboCameras = new javax.swing.JComboBox();
jLabel5 = new javax.swing.JLabel();
comboType = new javax.swing.JComboBox();
renderer = new ch.psi.pshell.imaging.Renderer();
setPreferredSize(new java.awt.Dimension(873, 600));
@@ -2352,15 +2513,23 @@ public class ScreenPanel2 extends Panel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(56, 56, 56))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonServer)
.addComponent(buttonDirect)
.addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(textState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonServer)
.addComponent(buttonDirect)))
.addContainerGap())
);
@@ -2627,7 +2796,7 @@ public class ScreenPanel2 extends Panel {
.addComponent(panelScreen2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelScreen, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelFilter, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
sidePanelLayout.setVerticalGroup(
sidePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -2643,30 +2812,10 @@ public class ScreenPanel2 extends Panel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelScreen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelFilter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(panelFilter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
comboCameras.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
comboCameras.setMaximumRowCount(30);
comboCameras.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboCamerasActionPerformed(evt);
}
});
jLabel1.setText("Camera:");
jLabel5.setText("Type:");
comboType.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
comboType.setMaximumRowCount(30);
comboType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Laser", "Electrons", "Photonics" }));
comboType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboTypeActionPerformed(evt);
}
});
toolBar.setFloatable(false);
toolBar.setRollover(true);
@@ -2695,22 +2844,6 @@ public class ScreenPanel2 extends Panel {
});
toolBar.add(buttonStreamData);
buttonArgs.setIcon(getIcon("Data"));
buttonArgs.setText(" ");
buttonArgs.setToolTipText("Camera Setup");
buttonArgs.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
buttonArgs.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonArgsActionPerformed(evt);
}
});
toolBar.add(buttonArgs);
jSeparator5.setMaximumSize(new java.awt.Dimension(20, 32767));
jSeparator5.setPreferredSize(new java.awt.Dimension(20, 0));
jSeparator5.setRequestFocusEnabled(false);
toolBar.add(jSeparator5);
buttonSave.setIcon(getIcon("Save"));
buttonSave.setText(" ");
buttonSave.setToolTipText("Save Snapshot");
@@ -2797,42 +2930,90 @@ public class ScreenPanel2 extends Panel {
});
toolBar.add(buttonReticle);
buttonTitle.setIcon(getIcon("Title"));
buttonTitle.setText(" ");
buttonTitle.setToolTipText("Show Camera Name");
buttonTitle.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
buttonTitle.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonTitleActionPerformed(evt);
}
});
toolBar.add(buttonTitle);
pauseSelection.setDecimals(0);
jLabel1.setText("Camera:");
comboCameras.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
comboCameras.setMaximumRowCount(30);
comboCameras.setMinimumSize(new java.awt.Dimension(127, 27));
comboCameras.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboCamerasActionPerformed(evt);
}
});
jLabel5.setText("Type:");
comboType.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
comboType.setMaximumRowCount(30);
comboType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All", "Laser", "Electrons", "Photonics" }));
comboType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboTypeActionPerformed(evt);
}
});
javax.swing.GroupLayout panelCameraSelectionLayout = new javax.swing.GroupLayout(panelCameraSelection);
panelCameraSelection.setLayout(panelCameraSelectionLayout);
panelCameraSelectionLayout.setHorizontalGroup(
panelCameraSelectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCameraSelectionLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(0, 0, 0)
.addComponent(comboCameras, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0))
);
panelCameraSelectionLayout.setVerticalGroup(
panelCameraSelectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCameraSelectionLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(panelCameraSelectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(comboType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)
.addComponent(jLabel1)
.addComponent(comboCameras, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, 0))
);
javax.swing.GroupLayout topPanelLayout = new javax.swing.GroupLayout(topPanel);
topPanel.setLayout(topPanelLayout);
topPanelLayout.setHorizontalGroup(
topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(topPanelLayout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, topPanelLayout.createSequentialGroup()
.addComponent(toolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboCameras, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelCameraSelection, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(pauseSelection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0))
.addComponent(pauseSelection, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
topPanelLayout.setVerticalGroup(
topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(topPanelLayout.createSequentialGroup()
.addGap(1, 1, 1)
.addGroup(topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(toolBar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(comboCameras, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)
.addComponent(comboType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(pauseSelection, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(pauseSelection, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(toolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelCameraSelection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
topPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {comboCameras, comboType, toolBar});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -2842,7 +3023,7 @@ public class ScreenPanel2 extends Panel {
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(sidePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 578, Short.MAX_VALUE))
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(topPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
@@ -3205,24 +3386,32 @@ public class ScreenPanel2 extends Panel {
private void buttonPauseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPauseActionPerformed
try {
renderer.removeOverlay(imageBufferOverlay);
if (camera != null) {
boolean pause = !renderer.isPaused();
synchronized (imageBuffer) {
if (pause) {
renderer.pause();
} else {
imageBuffer.clear();
renderer.resume();
}
pauseSelection.setVisible(pause && (imageBuffer.size() > 1));
if (pauseSelection.isVisible()) {
renderer.addOverlay(imageBufferOverlay);
pauseSelection.setMaxValue(imageBuffer.size());
pauseSelection.setValue(imageBuffer.size());;
if (!updatingButtons){
renderer.removeOverlay(imageBufferOverlay);
if (camera != null) {
boolean pause = !renderer.isPaused();
synchronized (imageBuffer) {
if (pause) {
renderer.pause();
} else {
imageBuffer.clear();
renderer.resume();
}
if (pause && (imageBuffer.size() > 1)) {
panelCameraSelection.setVisible(false);
pauseSelection.setVisible(true);
renderer.addOverlay(imageBufferOverlay);
pauseSelection.setMaxValue(imageBuffer.size());
pauseSelection.setValue(imageBuffer.size());;
updatePause();
} else {
pauseSelection.setVisible(false);
panelCameraSelection.setVisible(true);
}
}
updateStreamData();
}
updateStreamData();
}
} catch (Exception ex) {
showException(ex);
@@ -3273,41 +3462,11 @@ public class ScreenPanel2 extends Panel {
try {
saveSnapshot();
} catch (Exception ex) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, null, ex);
showException(ex);
}
}//GEN-LAST:event_buttonSaveActionPerformed
private void buttonArgsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonArgsActionPerformed
try {
if (camera != null) {
String cameraConfigJson = null;
if (usingServer) {
String cameraServerUrl = (camServerUrl == null) ? server.getUrl().substring(0, server.getUrl().length() - 1) + "8" : camServerUrl;
try (CameraServer srv = new CameraServer("CamServer", cameraServerUrl)) {
srv.initialize();
//TODO: replace into encodeMultiline
cameraConfigJson = JsonSerializer.encode(srv.getConfig(cameraName), true);
}
} else {
String configFolder = (String) getContext().getClassByName("SfCamera").getMethod("getConfigFolder", new Class[]{}).invoke(null);
Path configFile = Paths.get(configFolder, cameraName + ".json");
cameraConfigJson = configFile.toFile().exists() ? new String(Files.readAllBytes(configFile)) : null;
}
TextEditor editor = new TextEditor();
editor.setText(cameraConfigJson);
editor.setReadOnly(true);
editor.setTitle(cameraName);
EditorDialog dlg = editor.getDialog(getTopLevel(), false);
dlg.setSize(480, 640);
dlg.setVisible(true);
SwingUtils.centerComponent(getTopLevel(), dlg);
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonArgsActionPerformed
private void buttonStreamDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStreamDataActionPerformed
try {
showStreamData();
@@ -3331,7 +3490,7 @@ public class ScreenPanel2 extends Panel {
} catch (Exception ex) {
ex.printStackTrace();
} finally{
} finally {
updateButtons();
}
}//GEN-LAST:event_comboTypeActionPerformed
@@ -3377,9 +3536,17 @@ public class ScreenPanel2 extends Panel {
}
}//GEN-LAST:event_comboCamerasActionPerformed
private void buttonTitleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonTitleActionPerformed
try {
manageTitleOverlay();
} catch (Exception ex) {
showException(ex);
} finally {
}
}//GEN-LAST:event_buttonTitleActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btFixColormapRange;
private javax.swing.JButton buttonArgs;
private javax.swing.JRadioButton buttonAutomatic;
private javax.swing.JRadioButton buttonDirect;
private javax.swing.JToggleButton buttonFit;
@@ -3398,6 +3565,7 @@ public class ScreenPanel2 extends Panel {
private javax.swing.JRadioButton buttonServer;
private javax.swing.JToggleButton buttonSidePanel;
private javax.swing.JButton buttonStreamData;
private javax.swing.JToggleButton buttonTitle;
private javax.swing.JRadioButton buttonZoom025;
private javax.swing.JRadioButton buttonZoom05;
private javax.swing.JRadioButton buttonZoom2;
@@ -3414,6 +3582,7 @@ public class ScreenPanel2 extends Panel {
private javax.swing.JComboBox comboFilter;
private javax.swing.JComboBox comboScreen;
private javax.swing.JComboBox comboType;
private javax.swing.Box.Filler filler1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
@@ -3422,7 +3591,6 @@ public class ScreenPanel2 extends Panel {
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel5;
private javax.swing.JProgressBar jProgressBar1;
private javax.swing.JToolBar.Separator jSeparator5;
private javax.swing.JToolBar.Separator jSeparator6;
private javax.swing.JLabel labelGrScale;
private javax.swing.JLabel labelGrThreshold;
@@ -3431,6 +3599,7 @@ public class ScreenPanel2 extends Panel {
private javax.swing.JLabel labelSlNumber;
private javax.swing.JLabel labelSlOrientation;
private javax.swing.JLabel labelSlScale;
private javax.swing.JPanel panelCameraSelection;
private javax.swing.JPanel panelFilter;
private javax.swing.JPanel panelScreen;
private javax.swing.JPanel panelScreen2;
+3 -3
View File
@@ -79,7 +79,7 @@
<Component id="labelPosX" linkSize="4" alignment="0" min="-2" pref="90" max="-2" attributes="0"/>
<Component id="labelPosY" linkSize="4" alignment="0" min="-2" pref="90" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="panelPosition1" linkSize="4" min="-2" pref="92" max="-2" attributes="0"/>
<Component id="panelRepRate" linkSize="4" min="-2" pref="92" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="jLabel12" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
@@ -263,7 +263,7 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel15" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelPosition1" linkSize="11" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelRepRate" linkSize="11" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel12" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledHomed" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="buttonHoming" alignment="2" min="-2" max="-2" attributes="0"/>
@@ -349,7 +349,7 @@
</Property>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="panelPosition1">
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="panelRepRate">
</Component>
<Component class="javax.swing.JLabel" name="labelEndY">
<Properties>
+10 -8
View File
@@ -94,10 +94,10 @@ public class WireScan extends Panel {
}
comboWireScannerActionPerformed(null);
Device dev = new ChannelInteger (null, "SIN-TIMAST-TMA:Evt-15-Freq-I");
Device dev = new ChannelDouble (null, "SIN-TIMAST-TMA:Evt-15-Freq-I");
dev.setMonitored(true);
dev.initialize();
panelPosition1.setDevice(dev);
panelRepRate.setDevice(dev);
} catch (Exception ex) {
showException(ex);
@@ -138,6 +138,7 @@ public class WireScan extends Panel {
homed = false;
}
onStateChange(getState(), getState());
panelRepRate.getDevice().update();
} catch (Exception ex){
}
}
@@ -333,7 +334,7 @@ public class WireScan extends Panel {
ledHomed = new ch.psi.pshell.swing.Led();
comboScanType = new javax.swing.JComboBox();
spinnerCycles = new javax.swing.JSpinner();
panelPosition1 = new ch.psi.pshell.swing.DeviceValuePanel();
panelRepRate = new ch.psi.pshell.swing.DeviceValuePanel();
labelEndY = new javax.swing.JLabel();
comboBlm1 = new javax.swing.JComboBox();
jLabel7 = new javax.swing.JLabel();
@@ -609,7 +610,7 @@ public class WireScan extends Panel {
.addComponent(labelPosX, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelPosY, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(panelLeftLayout.createSequentialGroup()
.addComponent(panelPosition1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelRepRate, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, Short.MAX_VALUE)
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@@ -681,7 +682,7 @@ public class WireScan extends Panel {
panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonMotorPanel, buttonScannerPanel});
panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {labelPosX, labelPosY, panelPosition, panelPosition1});
panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {labelPosX, labelPosY, panelPosition, panelRepRate});
panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerBackground, spinnerCycles, spinnerEndX, spinnerEndY});
@@ -766,7 +767,7 @@ public class WireScan extends Panel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel15)
.addComponent(panelPosition1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelRepRate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12)
.addComponent(ledHomed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonHoming))
@@ -793,7 +794,7 @@ public class WireScan extends Panel {
panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {spinnerCycles, spinnerEndX, spinnerEndY});
panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {panelPosition1, panelStatus});
panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {panelRepRate, panelStatus});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
@@ -948,6 +949,7 @@ public class WireScan extends Panel {
parameters.add(blms);
parameters.add(spinnerBackground.getValue());
parameters.add(plot);
parameters.add(checkSaveRaw.isSelected());
runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> {
if (ex != null) {
@@ -1125,7 +1127,7 @@ public class WireScan extends Panel {
private ch.psi.pshell.swing.Led ledHomed;
private javax.swing.JPanel panelLeft;
private ch.psi.pshell.swing.DeviceValuePanel panelPosition;
private ch.psi.pshell.swing.DeviceValuePanel panelPosition1;
private ch.psi.pshell.swing.DeviceValuePanel panelRepRate;
private ch.psi.pshell.swing.DeviceValuePanel panelStatus;
private ch.psi.pshell.plot.LinePlotJFree plot;
private javax.swing.JSpinner spinnerBackground;
Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B