private <T> void queryNetwork(String groovyScript, JavaType valueType, Consumer<T> updater, LastTaskOnlyExecutor lastTaskOnlyExecutor) { lastTaskOnlyExecutor.execute(() -> { try { String json = projectCase.queryNetwork(ScriptType.GROOVY, groovyScript); if (json != null) { T obj = mapper.readValue(json, valueType); Platform.runLater(() -> updater.accept(obj)); } } catch (Exception e) { Platform.runLater(() -> { updater.accept(null); GseUtil.showDialogError(e); }); } }); }
NetworkExplorer(ProjectCase projectCase, GseContext context) { this.projectCase = Objects.requireNonNull(projectCase); substationExecutor = new LastTaskOnlyExecutor(context.getExecutor()); substationDetailsExecutor = new LastTaskOnlyExecutor(context.getExecutor()); equipmentExecutor = new LastTaskOnlyExecutor(context.getExecutor());