public void importSFRQSetting(ActionEvent actionEvent) { log.info("Click 导入SFRQ设置"); final UINode uiProject = plus.getService(TreeViewService.class).getCurrentUIProject(); fileChooser.setInitialDirectory(plus.getLastDir()); final File importedSFRQFile = fileChooser.showOpenDialog(plus.getStage()); if (importedSFRQFile == null) { return; } plus.setLastDir(importedSFRQFile.getParentFile()); log.info("import {}", importedSFRQFile.getAbsolutePath()); final BusinessNode businessNode = plus.getService(XMLService.class).parseRootBusinessNode(importedSFRQFile); final UINode sfrqSetting = UINode.findFromChildren(uiProject, UISFRQSetting_NAME); if (sfrqSetting.getBusinessNodeChild().isEmpty()) { sfrqSetting.addBusinessChild(businessNode); } else { sfrqSetting.getFirstBusinessNodeChild().absorb(businessNode); } plus.getService(XMLService.class) .outputBusinessNodeToXML( sfrqSetting.getFirstBusinessNodeChild(), new File(uiProject.getAttribute("path"), SFRQ_Collection_XML_NAME)); sfrqSetting.getBusinessNodeChild().clear(); plus.getService(TreeViewService.class).importBusinessNode(uiProject); }
public void exportSFRQSetting(ActionEvent actionEvent) { log.info("Click 导出SFRQ设置"); final UINode uiProject = plus.getService(TreeViewService.class).getCurrentUIProject(); directoryChooser.setInitialDirectory(plus.getLastDir()); final File outputDir = directoryChooser.showDialog(plus.getStage()); if (outputDir == null || outputDir.isFile()) { return; } if (!outputDir.exists()) { outputDir.mkdirs(); } plus.setLastDir(outputDir); final UINode sfrqSetting = UINode.findFromChildren(uiProject, UISFRQSetting_NAME); plus.getService(XMLService.class) .outputBusinessNodeToXML( sfrqSetting.getFirstBusinessNodeChild(), new File(outputDir, PlusFileUtil.newFileNameWithTimestamp(SFRQ_Collection_XML_NAME))); }
public void importUDSetting(ActionEvent actionEvent) { log.info("Click 导入UD设置"); final UINode uiProject = plus.getService(TreeViewService.class).getCurrentUIProject(); fileChooser.setInitialDirectory(plus.getLastDir()); final File importedUDFile = fileChooser.showOpenDialog(plus.getStage()); if (importedUDFile == null) { return; } plus.setLastDir(importedUDFile.getParentFile()); log.info("import {}", importedUDFile.getAbsolutePath()); final BusinessNode businessNode = plus.getService(XMLService.class).parseRootBusinessNode(importedUDFile); if ("IPM".equals(businessNode.getAttribute("type"))) { final UINode ipms = UINode.findFromChildren(uiProject, UIIPMs_NAME); if (ipms.getBusinessNodeChild().isEmpty()) { ipms.addBusinessChild(businessNode); } else { ipms.getFirstBusinessNodeChild().absorb(businessNode); } plus.getService(XMLService.class) .outputBusinessNodeToXML( ipms.getFirstBusinessNodeChild(), new File(uiProject.getAttribute("path"), IPM_Collection_XML_NAME)); ipms.getBusinessNodeChild().clear(); } else if ("SWITCH".equals(businessNode.getAttribute("type"))) { final UINode switches = UINode.findFromChildren(uiProject, UISwitches_NAME); if (switches.getBusinessNodeChild().isEmpty()) { switches.addBusinessChild(businessNode); } else { switches.getFirstBusinessNodeChild().absorb(businessNode); } plus.getService(XMLService.class) .outputBusinessNodeToXML( switches.getFirstBusinessNodeChild(), new File(uiProject.getAttribute("path"), Switch_Collection_XML_NAME)); switches.getBusinessNodeChild().clear(); } plus.getService(TreeViewService.class).importBusinessNode(uiProject); }