Je souhaite désactiver un TableColumn<CustomObject, String> tableColumn
en fonction d'une valeur de zone dans la zone CustomObject
uniquement lorsque la case TableColumn<CustomObject, Boolean> tableColumnTwo
est cochée. Je peux désactiver la zone de texte à l'intérieur mais ne savez pas comment vérifier l'état de case à cocher dans updateItem
Voici l'extrait de code correspondant, apprécierait si quelqu'un peut faire la lumière sur cetteJavaFX Désactiver TableColumn en fonction de l'état de la case à cocher
@FXML
private TableColumn<CustomObject, Boolean> tableColumnTwo;
@FXML
private TableColumn<CustomObject, String> tableColumn;
tableColumn.setCellFactory(
new Callback<TableColumn<CustomObject, String>, TableCell<CustomObject, String>>() {
@Override
public TableCell<CustomObject, String> call(TableColumn<CustomObject, String> paramTableColumn) {
return new TextFieldTableCell<CustomObject, String>(new DefaultStringConverter()) {
@Override
public void updateItem(String s, boolean empty) {
super.updateItem(s, empty);
TableRow<CustomObject> currentRow = getTableRow();
if(currentRow.getItem() != null && !empty) {
if (currentRow.getItem().getPetrified() == false) { // Need to check if checkbox is checked or not
setDisable(true);
setEditable(false);
this.setStyle("-fx-background-color: red");
} else {
setDisable(false);
setEditable(true);
setStyle("");
}
}
}
};
}
});
https://stackoverflow.com/help/how-to-ask – kleopatra