This commit is contained in:
2018-04-23 09:55:43 +02:00
parent 49308cab66
commit 5e7124870c
2 changed files with 80 additions and 28 deletions

View File

@@ -318,12 +318,12 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="led1" min="-2" max="-2" attributes="0"/>
<Component id="ledFillingControl" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="led2" min="-2" max="-2" attributes="0"/>
<Component id="ledFillingDewar" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
</Group>
@@ -338,12 +338,12 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="led1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="ledFillingControl" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="led2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="ledFillingDewar" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
@@ -354,9 +354,9 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.Led" name="led1">
<Component class="ch.psi.pshell.swing.Led" name="ledFillingControl">
</Component>
<Component class="ch.psi.pshell.swing.Led" name="led2">
<Component class="ch.psi.pshell.swing.Led" name="ledFillingDewar">
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
@@ -391,12 +391,12 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="led3" min="-2" max="-2" attributes="0"/>
<Component id="ledLidControlActive" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="led4" min="-2" max="-2" attributes="0"/>
<Component id="ledLidInitialized" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
</Group>
@@ -413,12 +413,12 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="led3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="ledLidControlActive" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="led4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="ledLidInitialized" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
@@ -430,14 +430,14 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.Led" name="led3">
<Component class="ch.psi.pshell.swing.Led" name="ledLidControlActive">
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="Controller Active"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="led4">
<Component class="ch.psi.pshell.swing.Led" name="ledLidInitialized">
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>

View File

@@ -10,6 +10,7 @@ import ch.psi.pshell.device.DeviceListener;
import ch.psi.pshell.imaging.Source;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.awt.Color;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
@@ -40,6 +41,31 @@ public class MainPanel extends Panel {
}
});
updateLevel(((Device) getDevice("dewar_level")).take());
((Device) getDevice("filling_dewar")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateFillingDeware(value);
}
});
updateFillingDeware(((Device) getDevice("filling_dewar")).take());
((Device) getDevice("ln2_main_power")).addListener(new DeviceAdapter() {
@Override
public void onValueChanged(Device device, Object value, Object former) {
updateFillingControl(value);
}
});
updateFillingControl(((Device) getDevice("ln2_main_power")).take());
((Device) getDevice("hexiposi")).addListener(new DeviceAdapter() {
@Override
public void onStateChanged(Device device, State state, State former) {
updateHexiposiState(state);
}
});
updateHexiposiState(((Device) getDevice("hexiposi")).getState());
}
void updateLevel(Object value){
@@ -52,7 +78,33 @@ public class MainPanel extends Panel {
}
}
void updateFillingDeware(Object value){
if ((value == null) || !(value instanceof Boolean)){
ledFillingDewar.setColor(Color.BLACK);
} else if ((Boolean)value){
ledFillingDewar.setColor(Color.GREEN);
} else {
ledFillingDewar.setColor(Color.BLACK);
}
}
void updateFillingControl(Object value){
if ((value == null) || !(value instanceof Boolean)){
ledFillingControl.setColor(Color.BLACK);
} else if ((Boolean)value){
ledFillingControl.setColor(Color.GREEN);
} else {
ledFillingControl.setColor(Color.BLACK);
}
}
void updateHexiposiState(State state){
ledLidControlActive.setColor(state == State.Offline ? Color.BLACK : Color.GREEN);
ledLidInitialized.setColor(state.isNormal() ? Color.GREEN : Color.BLACK);
}
/** This method is called from within the constructor to
* initialize the form.
@@ -79,15 +131,15 @@ public class MainPanel extends Panel {
roomTempBasePlatePanel1 = new ch.psi.mxsc.RoomTempBasePlatePanel();
jPanel5 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
led1 = new ch.psi.pshell.swing.Led();
led2 = new ch.psi.pshell.swing.Led();
ledFillingControl = new ch.psi.pshell.swing.Led();
ledFillingDewar = new ch.psi.pshell.swing.Led();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jToggleButton1 = new javax.swing.JToggleButton();
jPanel6 = new javax.swing.JPanel();
led3 = new ch.psi.pshell.swing.Led();
ledLidControlActive = new ch.psi.pshell.swing.Led();
jLabel6 = new javax.swing.JLabel();
led4 = new ch.psi.pshell.swing.Led();
ledLidInitialized = new ch.psi.pshell.swing.Led();
jLabel7 = new javax.swing.JLabel();
buttonInitHexiposi = new javax.swing.JButton();
jPanel9 = new javax.swing.JPanel();
@@ -266,11 +318,11 @@ public class MainPanel extends Panel {
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(led1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ledFillingControl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(led2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ledFillingDewar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5))
.addComponent(jToggleButton1))
@@ -281,11 +333,11 @@ public class MainPanel extends Panel {
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(led1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ledFillingControl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(led2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ledFillingDewar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jToggleButton1)
@@ -330,11 +382,11 @@ public class MainPanel extends Panel {
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(led3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ledLidControlActive, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel6))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(led4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ledLidInitialized, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel7))
.addComponent(buttonInitHexiposi))
@@ -347,11 +399,11 @@ public class MainPanel extends Panel {
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(led3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ledLidControlActive, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(led4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ledLidInitialized, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonInitHexiposi)
@@ -609,15 +661,15 @@ public class MainPanel extends Panel {
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator3;
private javax.swing.JToggleButton jToggleButton1;
private ch.psi.pshell.swing.Led led1;
private ch.psi.pshell.swing.Led led14;
private ch.psi.pshell.swing.Led led15;
private ch.psi.pshell.swing.Led led2;
private ch.psi.pshell.swing.Led led3;
private ch.psi.pshell.swing.Led led4;
private ch.psi.pshell.swing.Led led5;
private ch.psi.pshell.swing.Led led6;
private ch.psi.pshell.swing.Led led7;
private ch.psi.pshell.swing.Led ledFillingControl;
private ch.psi.pshell.swing.Led ledFillingDewar;
private ch.psi.pshell.swing.Led ledLidControlActive;
private ch.psi.pshell.swing.Led ledLidInitialized;
private ch.psi.pshell.swing.ProcessVariablePanel panelDewar;
private javax.swing.JProgressBar progressLN2;
private javax.swing.JProgressBar progressWater;