use of com.cas.circuit.vo.Archive in project TeachingInSimulation by ScOrPiOzzy.
the class JaxbTest method testName.
@Test
public void testName() throws Exception {
File file = new File("src/main/resources/config/");
// File[] subFiles = file.listFiles();
// for (int i = 0; i < subFiles.length; i++) {
// File xml = subFiles[i];
// if(xml.getName().endsWith("xml")) {
// ElecCompDef eleccomp = JaxbUtil.converyToJavaBean(new String(Files.readAllBytes(xml.toPath())), ElecCompDef.class);
// System.out.println(JaxbUtil.convertToXml(eleccomp));
// eleccomp.build();
// }
// }
ElecCompDef eleccomp = JaxbUtil.converyToJavaBean(new String(Files.readAllBytes(new File(file, "DZ47-63C16.xml").toPath())), ElecCompDef.class);
System.out.println(JaxbUtil.convertToXml(eleccomp));
// Archive archive = JaxbUtil.converyToJavaBean(new File(file, "Test.xml").toURI().toURL(), Archive.class);
Archive archive = JaxbUtil.converyToJavaBean(new URL("http://192.168.1.123:8082/archives/Test.xml"), Archive.class);
Assert.assertNotNull(archive);
System.out.println(archive);
}
use of com.cas.circuit.vo.Archive in project TeachingInSimulation by ScOrPiOzzy.
the class CircuitState method save.
public void save() {
Archive archive = new Archive();
// 保存元器件列表
saveEleccomps(archive);
// 保存导线
saveWires(archive);
SpringUtil.getBean(TypicalCaseAction.class).save(typicalCase, archive);
}
use of com.cas.circuit.vo.Archive in project TeachingInSimulation by ScOrPiOzzy.
the class TypicalCaseState method setupCase.
public void setupCase(TypicalCase typicalCase) {
// 1、清理垃圾
if (circuitState != null) {
stateManager.detach(circuitState);
}
// 创建新的circuitState
circuitState = new CircuitState(typicalCase, root);
stateManager.attach(circuitState);
// 尝试解析出存档对象
Archive archive = SpringUtil.getBean(ArchiveAction.class).parse(typicalCase.getArchivePath());
if (archive == null) {
// 结束加载界面
Platform.runLater(() -> SpringUtil.getBean(PageController.class).hideLoading());
return;
}
circuitState.read(archive);
// 结束加载界面
Platform.runLater(() -> SpringUtil.getBean(PageController.class).hideLoading());
}
Aggregations