Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @FXML
- void deleteIngredience(ActionEvent event) {
- Ingredience ingredience = lvIngredience.getSelectionModel().getSelectedItem();
- System.out.println(ingredience);
- int counter = 0;
- for(int i=0; i<recipe.getIngrediences().size();i++) {
- if(ingredience==null) {
- recipe.getIngrediences().remove(i);
- }else if(recipe.getIngrediences().get(i).getId()==ingredience.getId()) {
- recipe.getIngrediences().remove(i);
- break;
- }
- }
- lvIngredience.getItems().remove(ingredience);
- recipe.getIngrediences().removeAll(Collections.singleton(null));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement