view.setOnTheFly(currentConfig.isOnTheFly());
view.setEnableActuatorSpeed(currentConfig.isEnableScanSpeed());
view.setDataRecorderConfig(currentConfig.getDataRecorderConfig());
// Behaviour
IPostScanBehaviour postScanBehaviour = getPostScanBehaviour(currentConfig);
if ((postScanBehaviour != null) && (postScanBehaviour.getBehaviour() != null)) {
Behaviour selectedBehaviour = postScanBehaviour.getBehaviour();
int selectedIndex = 0;
view.clearPostScanBehaviour();
Behaviour[] behaviours = Behaviour.values();
for (int i = 0; i < behaviours.length; i++) {
Behaviour b = behaviours[i];
view.addPostScanBehaviour(b.name(), b.getShortDescription());
if (selectedBehaviour == b) {
selectedIndex = i;
view.setDescription(b.getLongDescription());
}
}
view.setPostScanSelected(selectedIndex);
// We enable or not the sensor and actuator combo box.
int nbArgs = selectedBehaviour.getArgumentCount();
view.setSensorsComboEnabled(nbArgs > 0);
view.setActuatorsComboEnabled(nbArgs == 2);
// Sensors
List<ISensor> sensors = config.getSensorsList();
view.clearSensors();
for (int i = 0; i < sensors.size(); i++) {
ISensor s = sensors.get(i);
if (s.isEnabled()) {
view.addSensor(s.getName(), s.getName());
if (i == postScanBehaviour.getSensor()) {
view.setSensorSelected(i);
}
}
}
if (sensors.size() == 0) {
view.addSensor(null, "Not defined");
}
// Actuators
IDimension dimension = currentConfig.getDimensionX();
if (dimension != null) {
List<IActuator> actuators = dimension.getActuatorsList();
view.clearActuators();
if (actuators != null) {
for (int i = 0; i < actuators.size(); i++) {
IActuator a = actuators.get(i);
if (a.isEnabled()) {
view.addActuator(a.getName(), a.getName());
if (i == postScanBehaviour.getActuator()) {
view.setActuatorSelected(i);
}
}
}