Properties (Properties predefinedProperties) { Properties result = (Properties) predefinedProperties.clone(); for (Pair<String, JTextField> pair : myAttributes) { result.setProperty(pair.first, pair.second.getText()); } String fileName = getFileName(); if (fileName != null) { result.setProperty(FileTemplate.ATTRIBUTE_NAME, fileName); } return result; }