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); } }
@Override protected void setControls(DialogAccess dlg) { String sText = ""; boolean bUseCustom = false; if (fileExists(sCustomFileName)) { sText = loadFile(sCustomFileName); bUseCustom = true; } else if (fileExists(sCustomFileName + ".bak")) { sText = loadFile(sCustomFileName + ".bak"); } // Currently ignore failure to load the file if (sText == null) { sText = ""; } dlg.setCheckBoxStateAsBoolean("UseCustom" + getSuffix(), bUseCustom); dlg.setTextFieldText("Custom" + getSuffix(), sText); useCustomChange(dlg); }
// Methods to set and get controls based on config protected void checkBoxFromConfig(DialogAccess dlg, String sCheckBoxName, String sConfigName) { dlg.setCheckBoxStateAsBoolean(sCheckBoxName, "true".equals(config.getOption(sConfigName))); }