int quality = Integer.parseInt(getQualityREd().getText());
if (quality < MIN_QUALITY) {
throw new Exception("Quality must be at least " + MIN_QUALITY);
}
QualityProfile profile;
if (editStatus == EditStatus.NEW) {
profile = new QualityProfile();
}
else {
profile = (QualityProfile) getProfileCmb().getSelectedItem();
}
profile.setCaption(caption);
profile.setQuality(quality);
profile.setWithHDR(getWithHDRCBx().isSelected());
profile.setWithHDRIntensityMap(getWithHdrIntensityMapCBx().isSelected());
profile.setDefaultProfile(getDefaultCBx().isSelected());
if (editStatus == EditStatus.NEW) {
refreshing = true;
try {
getProfileCmb().addItem(profile);
getProfileCmb().setSelectedItem(profile);
}
finally {
refreshing = false;
}
}
if (profile.isDefaultProfile()) {
for (int i = 0; i < getProfileCmb().getItemCount(); i++) {
QualityProfile lProfile = (QualityProfile) getProfileCmb().getItemAt(i);
if (lProfile != profile) {
lProfile.setDefaultProfile(false);
}
}
}
getProfileCmb().requestFocus();
editStatus = EditStatus.BROWSE;