use of com.willwinder.universalgcodesender.firmware.FirmwareSetting in project Universal-G-Code-Sender by winder.
the class FirmwareSettingsTableModel method setValueAt.
@Override
public void setValueAt(Object value, int rowIndex, int columnIndex) {
if (columnIndex == 1) {
FirmwareSetting oldSetting = settings.get(rowIndex);
FirmwareSetting setting = new FirmwareSetting(oldSetting.getKey(), value.toString(), oldSetting.getUnits(), oldSetting.getDescription(), oldSetting.getShortDescription());
settings.set(rowIndex, setting);
}
}
use of com.willwinder.universalgcodesender.firmware.FirmwareSetting in project Universal-G-Code-Sender by winder.
the class FirmwareSettingsDialog method saveButtonActionPerformed.
private void saveButtonActionPerformed() {
// Make a copy of all settings
java.util.List<FirmwareSetting> settingsToUpdate = new ArrayList<>(firmwareSettingsTableModel.getSettings());
// Loop through them and try to set them in the settings manager
settingsToUpdate.forEach(s -> {
FirmwareSetting updatedSetting = s;
try {
updatedSetting = firmwareSettingsManager.setValue(s.getKey(), s.getValue());
} catch (FirmwareSettingsException ignored) {
logger.log(Level.SEVERE, "Couldn't save setting: " + s.getKey() + "=" + s.getValue());
} finally {
firmwareSettingsTableModel.updateSetting(updatedSetting);
}
});
}
Aggregations