@Override public Worker<ObservableList<T>> retrieve() { final Service<ObservableList<T>> retriever = createService(observableList); return ConcurrentUtils.executeService(executor, retriever); } // private static Map<ObservableList, ListChangeListener> addListeners = new HashMap<ObservableList, ListChangeListener>();
@Override public Worker<T> retrieve() { final Service<T> retriever = createService(objectProperty); return ConcurrentUtils.executeService(executor, retriever); }
return ConcurrentUtils.executeService(executor, ConcurrentUtils.createService(runner));
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 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); } })); }