Beispiel #1
0
 /**
  * Create xml dom from the given list of {@link ucar.unidata.idv.ui.ParamInfo}-s
  *
  * @param doc The document to write to
  * @param paramInfos List of param infos
  * @return Root xml element
  */
 private Element createDom(Document doc, List paramInfos) {
   Element root = doc.createElement(TAG_PARAMS);
   for (int i = 0; i < paramInfos.size(); i++) {
     ParamInfo paramInfo = (ParamInfo) paramInfos.get(i);
     if (paramInfo.getName().trim().length() == 0) {
       continue;
     }
     Element node = doc.createElement(TAG_PARAM);
     node.setAttribute(ATTR_NAME, paramInfo.getName());
     if (paramInfo.hasColorTableName()) {
       node.setAttribute(ATTR_COLORTABLE, paramInfo.getColorTableName());
     }
     if (paramInfo.hasRange()) {
       node.setAttribute(ATTR_RANGE_MIN, "" + paramInfo.getRange().getMin());
       node.setAttribute(ATTR_RANGE_MAX, "" + paramInfo.getRange().getMax());
     }
     if (paramInfo.hasDisplayUnit()) {
       node.setAttribute(ATTR_UNIT, "" + paramInfo.getDisplayUnit());
     }
     if (paramInfo.hasContourInfo()) {
       ContourInfo ci = paramInfo.getContourInfo();
       node.setAttribute(ATTR_CI_INTERVAL, "" + ci.getIntervalString(true));
       node.setAttribute(ATTR_CI_BASE, "" + ci.getBase());
       node.setAttribute(ATTR_CI_MIN, "" + ci.getMin());
       node.setAttribute(ATTR_CI_MAX, "" + ci.getMax());
       if (ci.getDashOn() != DFLT_CI_DASH) {
         node.setAttribute(ATTR_CI_DASH, "" + ci.getDashOn());
       }
       if (ci.getIsLabeled() != DFLT_CI_LABEL) {
         node.setAttribute(ATTR_CI_LABEL, "" + ci.getIsLabeled());
       }
       node.setAttribute(ATTR_CI_WIDTH, "" + ci.getLineWidth());
     }
     root.appendChild(node);
   }
   return root;
 }