private void styleNameChange(DialogAccess dlg) {
   if (nCurrentFamily > -1) {
     updateStyleMaps(dlg);
     short nStyleNameItem = dlg.getListBoxSelectedItem("StyleName");
     if (nStyleNameItem >= 0) {
       sCurrentStyleName = dlg.getListBoxStringItemList("StyleName")[nStyleNameItem];
       setControls(dlg, styleMap[nCurrentFamily].get(sCurrentStyleName));
     } else {
       sCurrentStyleName = null;
       clearControls(dlg);
     }
   }
 }
 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);
   }
 }
 // Methods to handle user controlled lists
 protected boolean deleteCurrentItem(DialogAccess dlg, String sListName) {
   String[] sItems = dlg.getListBoxStringItemList(sListName);
   short nSelected = dlg.getListBoxSelectedItem(sListName);
   if (nSelected >= 0 && deleteItem(sItems[nSelected])) {
     int nOldLen = sItems.length;
     String[] sNewItems = new String[nOldLen - 1];
     if (nSelected > 0) {
       System.arraycopy(sItems, 0, sNewItems, 0, nSelected);
     }
     if (nSelected < nOldLen - 1) {
       System.arraycopy(sItems, nSelected + 1, sNewItems, nSelected, nOldLen - 1 - nSelected);
     }
     dlg.setListBoxStringItemList(sListName, sNewItems);
     short nNewSelected = nSelected < nOldLen - 1 ? nSelected : (short) (nSelected - 1);
     dlg.setListBoxSelectedItem(sListName, nNewSelected);
     return true;
   }
   return false;
 }
    private void styleFamilyChange(DialogAccess dlg) {
      short nNewFamily = dlg.getListBoxSelectedItem("StyleFamily");
      if (nNewFamily > -1 && nNewFamily != nCurrentFamily) {
        // The user has changed the family; load and display the corresponding style names
        updateStyleMaps(dlg);
        nCurrentFamily = nNewFamily;
        sCurrentStyleName = null;

        String[] sStyleNames = Misc.sortStringSet(styleMap[nNewFamily].keySet());
        dlg.setListBoxStringItemList("StyleName", sStyleNames);
        if (sStyleNames.length > 0) {
          dlg.setListBoxSelectedItem("StyleName", (short) 0);
        } else {
          dlg.setListBoxSelectedItem("StyleName", (short) -1);
        }

        updateStyleControls(dlg);
        styleNameChange(dlg);
      }
    }
 protected void listBoxToConfig(
     DialogAccess dlg, String sListBoxName, String sConfigName, String[] sConfigValues) {
   config.setOption(sConfigName, sConfigValues[dlg.getListBoxSelectedItem(sListBoxName)]);
 }