Possibility to add/remove devices to the pool without initializing/closing them.
This commit is contained in:
@@ -97,7 +97,10 @@ public class Controller {
|
||||
instance = this;
|
||||
clearPuckStates();
|
||||
|
||||
basePlate.addListener(new DeviceAdapter() {
|
||||
basePlate.addListener(basePlateListener);
|
||||
}
|
||||
|
||||
final DeviceListener basePlateListener = new DeviceAdapter() {
|
||||
@Override
|
||||
public void onValueChanged(Device device, Object value, Object former) {
|
||||
if (value!=null){
|
||||
@@ -109,8 +112,7 @@ public class Controller {
|
||||
Controller.this.mainFrame.onSelectionChanged(null,null,null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
String getCurrentSelection(){
|
||||
Object value = basePlate.take();
|
||||
@@ -145,18 +147,8 @@ public class Controller {
|
||||
}
|
||||
|
||||
void onInitialize(int runCount) {
|
||||
//GenericDevice former = getDevice("BasePlate");
|
||||
//if (former != null) {
|
||||
//getMainFrame().removeDevice(former);
|
||||
// if (basePlate.getState() == State.Closing){
|
||||
// try {
|
||||
// basePlate.initialize();
|
||||
// } catch (Exception ex) {
|
||||
// Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
getMainFrame().addDevice(basePlate);
|
||||
basePlate.addListener(basePlateListener);
|
||||
System.out.println(basePlate.getState());
|
||||
|
||||
|
||||
@@ -200,11 +192,18 @@ public class Controller {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void onStateChange(State state, State former) {
|
||||
if (state == State.Initializing){
|
||||
getMainFrame().removeDevice(basePlate);
|
||||
}
|
||||
}
|
||||
|
||||
void onTimer(){
|
||||
try {
|
||||
Controller.getInstance().setPuckLoading(Controller.getInstance().isPuckLoading());
|
||||
setPuckLoading(Controller.getInstance().isPuckLoading());
|
||||
} catch (Exception ex) {
|
||||
Controller.getInstance().setPuckLoading(false);
|
||||
setPuckLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,7 +561,7 @@ public class Controller {
|
||||
System.out.println("Setting to: " + puck.getName() + " datamatrix: " + datamatrix);
|
||||
|
||||
puck.setId(datamatrix);
|
||||
getMainFrame().refresh();
|
||||
getMainFrame().refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user