private Worker<List<CrudObjectProperty<S, T>>> innerReload(Callable<List<S>> supplier) { return ConcurrentUtils.executeService(executor, ConcurrentUtils.createService(() -> { try { List<CrudObjectProperty<S, T>> newProperties = FXCollections.observableArrayList(); List<S> dataList = supplier.call(); for (S data : dataList) { newProperties.add(new CrudObjectProperty<S, T>(data, CrudListProperty.this, crudService, executor)); } ConcurrentUtils.runAndWait(() -> setAll(newProperties)); return newProperties; } catch (Exception e) { throw new RuntimeException("TODO", e); } })); }
public void setException(Throwable exception) { if(Platform.isFxApplicationThread()) { exceptionProperty().set(exception); } else { try { ConcurrentUtils.runAndWait(() -> exceptionProperty().set(exception)); } catch (InterruptedException | ExecutionException e) { LOGGER.log(Level.SEVERE, "Can't handle exception in JavaFX Application Thread!", e); LOGGER.log(Level.SEVERE, "Initial exception: ", exception); } } }
public Worker<S> save() { return ConcurrentUtils.executeService(executor, ConcurrentUtils.createService(() -> { try { S updatedData = crudService.save(get()); ConcurrentUtils.runAndWait(() -> set(updatedData)); return updatedData; } catch (Exception e) { throw new RuntimeException("TODO", e); } })); }
public Worker<Void> delete() { return ConcurrentUtils.executeService(executor, ConcurrentUtils.createService(() -> { try { crudService.delete(get()); ConcurrentUtils.runAndWait(() -> { set(null); if (listProperty != null) { listProperty.remove(this); } }); } catch (Exception e) { throw new RuntimeException("TODO", e); } })); }
public Worker<S> update() { return ConcurrentUtils.executeService(executor, ConcurrentUtils.createService(() -> { try { T id = ConcurrentUtils.runCallableAndWait(() -> get().getId()); S updatedData = crudService.getById(id); ConcurrentUtils.runAndWait(() -> set(updatedData)); return updatedData; } catch (Exception e) { throw new RuntimeException("TODO", e); } })); }
ConcurrentUtils.runAndWait(() -> { ObservableList<Consumer<Event>> eventConsumers = consumers.get(address); if (eventConsumers != null) {