private void formattingAttributeChange(DialogAccess dlg) {
   updateAttributeMaps(dlg);
   short nNewAttribute = dlg.getListBoxSelectedItem("FormattingAttribute");
   if (nNewAttribute > -1 && nNewAttribute != nCurrentAttribute) {
     nCurrentAttribute = nNewAttribute;
     String sName = sAttributeNames[nCurrentAttribute];
     if (!attributeMap.containsKey(sName)) {
       attributeMap.put(sName, new HashMap<String, String>());
       attributeMap.get(sName).put("deleted", "true");
     }
     Map<String, String> attr = attributeMap.get(sName);
     dlg.setCheckBoxStateAsBoolean(
         "CustomAttribute", !attr.containsKey("deleted") || attr.get("deleted").equals("false"));
     customAttributeChange(dlg);
     setControls(dlg, attr);
   }
 }
 private void copyStyles(
     ComplexOption source, ComplexOption target, Map<String, String> nameTranslation) {
   for (String sName : source.keySet()) {
     String sNewName = sName;
     if (nameTranslation != null && nameTranslation.containsKey(sName)) {
       sNewName = nameTranslation.get(sName);
     }
     target.copy(sNewName, source.get(sName));
   }
 }
 // Internal methods
 private void updateAttributeMaps(DialogAccess dlg) {
   // Save the current attribute map, if any
   if (nCurrentAttribute > -1) {
     String sName = sAttributeNames[nCurrentAttribute];
     if (!attributeMap.containsKey(sName)) {
       attributeMap.put(sName, new HashMap<String, String>());
     }
     Map<String, String> attr = attributeMap.get(sName);
     attr.put("deleted", Boolean.toString(!dlg.getCheckBoxStateAsBoolean("CustomAttribute")));
     getControls(dlg, attr);
     attributeMap.put(sName, attr);
   }
 }
    protected void getControls(DialogAccess dlg) {
      updateAttributeMaps(dlg);

      // Save attribute maps to config
      ComplexOption configMap = config.getComplexOption("text-attribute-map");
      configMap.clear();
      for (String s : attributeMap.keySet()) {
        Map<String, String> attr = attributeMap.get(s);
        if (!attr.containsKey("deleted") || attr.get("deleted").equals("false")) {
          configMap.copy(s, attr);
        }
      }
    }