同步操作将从 ldh123/TestUI 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package ui;import javafx.application.Application;import javafx.application.Platform;import javafx.concurrent.Task;import javafx.scene.Scene;import javafx.stage.Stage;import ldh.common.testui.TestUIMainApp;import ldh.common.testui.component.LogPane;import ldh.common.testui.constant.TestLogType;import ldh.common.testui.constant.TreeNodeType;import ldh.common.testui.dao.TestLogDao;import ldh.common.testui.dao.TestLogDataDao;import ldh.common.testui.model.TestLog;import ldh.common.testui.model.TestLogData;import ldh.common.testui.util.ThreadUtilFactory;import java.sql.SQLException;import java.util.HashMap;import java.util.List;import java.util.Map;import java.util.function.Function;import java.util.function.Supplier;public class LogPaneTest extends Application {@Overridepublic void start(Stage stage) throws Exception {TestUIMainApp.startDb(new String[]{});LogPane logPane = new LogPane();Scene scene = new Scene(logPane, 800, 600);scene.getStylesheets().add(this.getClass().getResource("/css/LogPane.css").toExternalForm());stage.setScene(scene);stage.show();TestLog testLog = TestLogDao.getById(382); // 144, 82, 118, 188, 382if (testLog == null) return;logPane.addTitle(testLog.getName(), null);int type = 1;if (testLog.getType().equals(TreeNodeType.Case.name())) {type = 2;} else if (testLog.getType().equals(TreeNodeType.Test.name())) {type = 3;}int tt = type;Task<Void> task = new Task<Void>() {@Overrideprotected Void call() throws Exception {try {handleTestLog(logPane, testLog, tt, false);} catch (Exception e) {e.printStackTrace();}return null;}};ThreadUtilFactory.getInstance().submit(task);}private void handleTestLog(LogPane logPane, TestLog testLog, int type, boolean isFirst) throws SQLException {if (isFirst) {Platform.runLater(()->logPane.addTitle(testLog.getName(), null));}//处理子节点List<TestLog> testLogs = TestLogDao.getByParentId(testLog.getId());for(TestLog log : testLogs) {TestLog t = log;Platform.runLater(()->logPane.addData(t));handleTestLog(logPane, log, type,false);}// 处理本节点下面的数据List<TestLogData> testLogDataList = TestLogDataDao.getByTestLogId(testLog.getId());for (int i=0, l=testLogDataList.size(); i<l; i++) {TestLogData d1 = testLogDataList.get(i);if (i != l-1) {if (testLogDataList.get(i+1).getName().startsWith(d1.getName())&& (d1.getType() == TestLogType.http || d1.getType() == TestLogType.method)) {TestLogData d2 = testLogDataList.get(i+1);Platform.runLater(()->logPane.addData(d1, d2));i++;continue;}}Platform.runLater(()->logPane.addData(d1));}}private void deday(int time, Supplier<Object> function) {new Thread(()->{try {Thread.sleep(time * 1000L);} catch (InterruptedException e) {e.printStackTrace();}Platform.runLater(()->{function.get();});}).start();}public static void main(String[] args) {launch(args);}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。