This commit is contained in:
@@ -38,9 +38,10 @@ public class Recovery extends Panel {
|
||||
}
|
||||
|
||||
void updateButton(){
|
||||
buttonRecover.setEnabled((getContext().getState() == State.Ready) &&
|
||||
(!textSegment.getText().trim().isEmpty()) &&
|
||||
(textPosition.getText().trim().isEmpty()) );
|
||||
buttonRecover.setEnabled((getContext().getState() == State.Ready) &&
|
||||
(textPosition.getText().trim().isEmpty()) &&
|
||||
((!textSegment.getText().trim().isEmpty()) || (ledIsInDewar.getColor()==Color.GREEN))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +59,7 @@ public class Recovery extends Panel {
|
||||
textSegment.setText("");
|
||||
ledKnownPosition.setColor(Color.BLACK);
|
||||
textPosition.setText("");
|
||||
ledIsInDewar.setColor(Color.BLACK);
|
||||
} else {
|
||||
if (getState()==State.Ready){
|
||||
String point = null;
|
||||
@@ -90,6 +92,13 @@ public class Recovery extends Panel {
|
||||
textSegment.setText("");
|
||||
textDistance.setText("");
|
||||
}
|
||||
try{
|
||||
Boolean is_in_dewar = (Boolean) eval("is_in_dewar()", true);
|
||||
ledIsInDewar.setColor(is_in_dewar ? Color.GREEN : Color.RED);
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex);
|
||||
ledIsInDewar.setColor(Color.BLACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateButton();
|
||||
@@ -110,6 +119,8 @@ public class Recovery extends Panel {
|
||||
textSegment = new javax.swing.JTextField();
|
||||
textDistance = new javax.swing.JTextField();
|
||||
jLabel8 = new javax.swing.JLabel();
|
||||
ledIsInDewar = new ch.psi.pshell.swing.Led();
|
||||
jLabel9 = new javax.swing.JLabel();
|
||||
|
||||
jLabel6.setText("Known position");
|
||||
|
||||
@@ -139,6 +150,8 @@ public class Recovery extends Panel {
|
||||
|
||||
jLabel8.setText("Distance:");
|
||||
|
||||
jLabel9.setText("Is in Dewar");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -153,9 +166,15 @@ public class Recovery extends Panel {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(textPosition))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(ledValidSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel7)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(ledValidSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel7))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(ledIsInDewar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel9)))
|
||||
.addGap(16, 16, 16)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
@@ -188,11 +207,18 @@ public class Recovery extends Panel {
|
||||
.addComponent(ledValidSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel7)
|
||||
.addComponent(textSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel8)
|
||||
.addComponent(textDistance, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel8)
|
||||
.addComponent(textDistance, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(30, 30, 30)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(ledIsInDewar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel9))))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE)
|
||||
.addComponent(buttonRecover)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(buttonAbort)
|
||||
@@ -246,6 +272,8 @@ public class Recovery extends Panel {
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel jLabel7;
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private javax.swing.JLabel jLabel9;
|
||||
private ch.psi.pshell.swing.Led ledIsInDewar;
|
||||
private ch.psi.pshell.swing.Led ledKnownPosition;
|
||||
private ch.psi.pshell.swing.Led ledValidSegment;
|
||||
private javax.swing.JTextField textDistance;
|
||||
|
||||
Reference in New Issue
Block a user