This commit is contained in:
gac-S_Changer
2018-08-08 16:01:55 +02:00
parent ac65aee710
commit f268369797

View File

@@ -1,5 +1,6 @@
package ch.psi.mxsc;
import ch.psi.pshell.core.DevicePoolListener;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.GenericDevice;
@@ -27,7 +28,7 @@ public class DevicesPanel extends javax.swing.JPanel {
* Creates new form DevicesPanel
*/
public DevicesPanel() {
initComponents();
initComponents();
}
GenericDevice[] getDevices(){
@@ -41,8 +42,21 @@ public class DevicesPanel extends javax.swing.JPanel {
}
};
void initialize(){
Controller.getInstance().getDevicePool().addListener(new DevicePoolListener() {
@Override
public void onDeviceAdded(GenericDevice dev) {
updateDevices();
}
@Override
public void onDeviceRemoved(GenericDevice dev) {
}
});
updateDevices();
}
void updateDevices(){
for (GenericDevice dev : getDevices()){
if (dev!=null){
dev.removeListener(deviceListener);