private void initMenu() { getMenu() .getItems() .addAll( createItem( lang.format("gui.export", "gui.stroke"), isSelected, event -> { throw new OutOfCoffeeException("Not implemented Yet"); }), new SeparatorMenuItem(), createItem(lang.format("gui.new", "gui.stroke"), null, event1 -> onNew()), createItem(lang.format("gui.edit", "gui.stroke"), isSelected, event2 -> onEdit()), createItem(lang.format("gui.delete", "gui.stroke"), isSelected, event3 -> onDelete())); }
private void populate() { try { allStrokes = new FilteredList<>( FXCollections.observableArrayList(db.getTblSetStroke().getAllStrokes())); strokes.setItems(allStrokes); } catch (Exception e) { ExceptionAlert.showError(LOGGER, lang.format("error.load", "error.subj.stroke"), e); } }
private void onDelete() { SetStroke item = strokes.getSelectionModel().getSelectedItem(); if (item != null) { try { db.getTblSetStroke().deleteSetStroke(item); } catch (Exception e) { ExceptionAlert.showError(LOGGER, lang.format("error.load", "error.subj.stroke"), e); } eventBus.post(new StrokeEvent.StrokeDeleteEvent(item)); } }