private final JPanel noConfigPanel = new JPanel();
private final JLabel noConfiguration = new JLabel("Please select at least 2 scan configurations");
public ConfigurationManagerBean() {
// Init panel
IGenericDeviceListListener sensorListener = new IGenericDeviceListListener() {
@Override
public void deviceRenamed(String oldName, String newName) {
configManager.renameSensor(oldName, newName);
}
@Override
public void deviceRemoved(String device) {
configManager.deleteSensor(device);
}
@Override
public void deviceEnabled(String device, boolean enabled) {
configManager.setSensorEnable(device, enabled);
}
@Override
public void deviceAdded(String device) {
configManager.addSensor(device);
sensorListController.setDeviceList(configManager.getSensorsList());
}
@Override
public void devicesAdded(List<String> devices) {
if (devices != null) {
for (String device : devices) {
configManager.addSensor(device);
}
sensorListController.setDeviceList(configManager.getSensorsList());
}
}
@Override
public void deviceSwap(String device1, String device2) {
configManager.swapSensor(device1, device2);
}
};
sensorListController.setManagerMode(true);
sensorListController.addGenericDeviceListListener(sensorListener);
sensorPanel = sensorListController.getView();
IGenericDeviceListListener timeBaseListener = new IGenericDeviceListListener() {
@Override
public void deviceRenamed(String oldName, String newName) {
configManager.renameTimeBase(oldName, newName);
}
@Override
public void deviceRemoved(String device) {
configManager.deleteTimeBase(device);
}
@Override
public void deviceEnabled(String device, boolean enabled) {
configManager.setTimeBaseEnable(device, enabled);
}
@Override
public void deviceAdded(String device) {
configManager.addTimeBase(device);
timeBaseListController.setDeviceList(configManager.getTimebaseList());
}
@Override
public void devicesAdded(List<String> devices) {
if (devices != null) {
for (String device : devices) {
configManager.addTimeBase(device);
}
timeBaseListController.setDeviceList(configManager.getTimebaseList());
}
}
@Override
public void deviceSwap(String device1, String device2) {
configManager.swapTimeBase(device1, device2);
}
};
timeBaseListController.setManagerMode(true);
timeBaseListController.addGenericDeviceListListener(timeBaseListener);
timeBasePanel = timeBaseListController.getView();
IGenericDeviceListListener actuatorXListener = new IGenericDeviceListListener() {
@Override
public void deviceRenamed(String oldName, String newName) {
configManager.renameActuator(oldName, newName);
}
@Override
public void deviceRemoved(String device) {
configManager.deleteActuator(device);
}
@Override
public void deviceEnabled(String device, boolean enabled) {
configManager.setActuatorEnable(device, enabled);
}
@Override
public void deviceAdded(String device) {
configManager.addActuator(device, false);
List<IDimension> dimensionList = configManager.getDimensionList();
IDimension tmpDimension = null;
if ((dimensionList != null) && !dimensionList.isEmpty()) {
tmpDimension = dimensionList.get(0);
actuatorXController.setDeviceList(tmpDimension.getActuatorsList());
}
}
@Override
public void devicesAdded(List<String> devices) {
if (devices != null) {
for (String device : devices) {
configManager.addActuator(device, false);
}
List<IDimension> dimensionList = configManager.getDimensionList();
IDimension tmpDimension = null;
if ((dimensionList != null) && !dimensionList.isEmpty()) {
tmpDimension = dimensionList.get(0);
actuatorXController.setDeviceList(tmpDimension.getActuatorsList());
}
}
}
@Override
public void deviceSwap(String device1, String device2) {
configManager.swapActuator(device1, device2, false);
}
};
actuatorXController.setManagerMode(true);
actuatorXController.addGenericDeviceListListener(actuatorXListener);
actuatorXPanel = actuatorXController.getView();
IGenericDeviceListListener actuatorYListener = new IGenericDeviceListListener() {
@Override
public void deviceRenamed(String oldName, String newName) {
configManager.renameActuator(oldName, newName);
}