Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Executor executor;
- static {
- executor = Executors.newCachedThreadPool(new ThreadFactory() {
- public Thread newThread(@NotNull Runnable r) {
- Thread t = new Thread(r);
- t.setDaemon(true);
- return t;
- }
- });
- }
- public void initialize(URL location, ResourceBundle resources) {
- loadCyclesToTableView();
- }
- public void loadCyclesToTableView() {
- final Task<HashMap<String, Cycle>> cyclesGetterTask = new Task<HashMap<String, Cycle>>() {
- @Override
- protected HashMap<String, Cycle> call() throws Exception {
- return Main.dbOperations.getChildren(DbOperations.CYCLES, Ref.class, Cycle.class);
- }
- };
- cyclesGetterTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
- public void handle(WorkerStateEvent event) {
- String[] attributs = {"designation", "nbEtudiants"};
- HashMap<String, Cycle> cyclesHashMap = cyclesGetterTask.getValue();
- GUIutils.loadChildrenToTableView(cyclesTableView, cyclesHashMap, attributs);
- }
- });
- executor.execute(cyclesGetterTask);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement