/** Open an xml param defaults file */ public void doOpen() { String filename = FileManager.getReadFile(FileManager.FILTER_XML); if (filename == null) { return; } resources.addResource(filename); int index = resources.size() - 1; addList(resources.getRoot(index), index); }
/** * Handle any Gui actions. * * @param ae The <code>ActionEvent</code>. */ public void actionPerformed(ActionEvent ae) { String cmd = ae.getActionCommand(); if (cmd.equals(CMD_BROWSE)) { String filename = FileManager.getReadFile(FILTER_XML); if (filename == null) { return; } urlBox.setSelectedItem(filename); } else if (cmd.equals(GuiUtils.CMD_OK)) { doLoad(); } else { // Here, the base class ChooserPanel will check if this command // is the load or cancel command. super.actionPerformed(ae); } }
/** Import an xml param defaults file */ public void doImport() { try { String filename = FileManager.getReadFile(FileManager.FILTER_XML); if (filename == null) { return; } Element root = XmlUtil.getRoot(IOUtil.readContents(filename)); if (root == null) { return; } List infos = createParamInfoList(root); ParamDefaultsTable table = getCurrentTable(); table.getParamInfoList().addAll(infos); table.tableChanged(); saveData(); } catch (Exception exc) { LogUtil.printException(log_, "Error importing file", exc); } }