/** * Generate a user interface from the given xml document (derived from the given path). The xml * can be a thredds query capability, any verion of a thredds catalog or an IDV menus xml file. * * @param doc the xml document * @param xmlRoot The root of the xml document to create a display for. * @param path The url path we got the xml from. */ protected void makeUi(Document doc, Element xmlRoot, String path) { this.document = doc; setHaveData(false); if (xmlRoot == null) { return; } setSelected(path); XmlHandler handler = null; String tagName = XmlUtil.getLocalName(xmlRoot); if (tagName.equals(WmsUtil.TAG_WMS1) || tagName.equals(WmsUtil.TAG_WMS2)) { handler = new WmsHandler(this, xmlRoot, path); } else if (tagName.equals(TAG_ERROR)) { final String error = XmlUtil.getAttribute(xmlRoot, "label", "Error"); LogUtil.userErrorMessage("Error: " + error); return; } else if (tagName.equals(CatalogUtil.TAG_CATALOG)) { handler = new ThreddsHandler(this, xmlRoot, path); } else if (tagName.equals("menus")) { handler = new MenuHandler(this, xmlRoot, path); } else { throw new IllegalArgumentException( "Unknown xml:" + ((xmlContents.length() > 100) ? xmlContents.substring(0, 100) : xmlContents) + " ..."); } JComponent contents = handler.getContents(); contents.setPreferredSize(new Dimension(200, 250)); addToContents(contents); addToHistory(handler); updateStatus(); }
/** Display the document defined in the history list by the current historyIdx. */ private void go() { if (haveHandler()) { XmlHandler handler = (XmlHandler) handlers.get(historyIdx); setSelected(handler.getPath()); addToContents(handler.getContents()); checkButtons(); } }
/** _more_ */ protected void updateStatus() { if (haveHandler()) { XmlHandler handler = (XmlHandler) handlers.get(historyIdx); handler.updateStatus(); } else { setStatus(""); } }