// Path: src/main/java/org/hildan/fx/components/ValidatingTextFieldListCell.java
// public class ValidatingTextFieldListCell<T> extends TextFieldListCell<T> {
// 
//     private final Predicate<String> validator;
// 
//     public ValidatingTextFieldListCell(StringConverter<T> converter, Predicate<String> validator) {
//         super(converter);
//         this.validator = validator;
//     }
// 
//     public void commitEdit(T item) {
//         if (!isEditing()) {
//             return;
//         }
// 
//         // the edited text is not in getText() but in the TextField used as Graphic for this cell
//         TextField textField = (TextField) getGraphic();
//         String editedText = textField.getText();
// 
//         boolean itemIsValid = validator.test(editedText);
//         pseudoClassStateChanged(Css.INVALID, !itemIsValid);
//         if (itemIsValid) {
//             // only commit if the item is valid, otherwise we stay in edit state
//             super.commitEdit(item);
//         }
//     }
// }


import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Predicate;
import javafx.scene.control.*;
import javafx.scene.control.cell.TextFieldListCell;
import javafx.util.StringConverter;
import org.hildan.fx.components.ValidatingTextFieldListCell;
package org.hildan.fx.components.list;




public class EditableListView<T> extends ListView<T> {

    private StringConverter<T> converter;

// Path: src/main/java/org/hildan/fx/components/ValidatingTextFieldListCell.java
// public class ValidatingTextFieldListCell<T> extends TextFieldListCell<T> {
// 
//     private final Predicate<String> validator;
// 
//     public ValidatingTextFieldListCell(StringConverter<T> converter, Predicate<String> validator) {
//         super(converter);
//         this.validator = validator;
//     }
// 
//     public void commitEdit(T item) {
//         if (!isEditing()) {
//             return;
//         }
// 
//         // the edited text is not in getText() but in the TextField used as Graphic for this cell
//         TextField textField = (TextField) getGraphic();
//         String editedText = textField.getText();
// 
//         boolean itemIsValid = validator.test(editedText);
//         pseudoClassStateChanged(Css.INVALID, !itemIsValid);
//         if (itemIsValid) {
//             // only commit if the item is valid, otherwise we stay in edit state
//             super.commitEdit(item);
//         }
//     }
// }


// Path: src/main/java/org/hildan/fx/components/list/EditableListView.java
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Predicate;
import javafx.scene.control.*;
import javafx.scene.control.cell.TextFieldListCell;
import javafx.util.StringConverter;
import org.hildan.fx.components.ValidatingTextFieldListCell;

package org.hildan.fx.components.list;




public class EditableListView<T> extends ListView<T> {

    private StringConverter<T> converter;

    public EditableListView() {