I am trying to get 'Active' value from 'Information' class and set it to TableView Column as Checkbox, so user can edit. I have following in my controller:
activeColumn.setCellValueFactory(new PropertyValueFactory<Information, Boolean>("Active"));
activeColumn.setCellValueFactory(new PropertyValueFactory<Information, Boolean>("Active"));
final Callback<TableColumn<Information, Boolean>, TableCell<Information, Boolean>> cellFactory = CheckBoxTableCell.forTableColumn(activeColumn);
activeColumn.setCellFactory(new Callback<TableColumn<Information, Boolean>, TableCell<Information, Boolean>>() {
@Override
public TableCell<Information, Boolean> call(TableColumn<Information, Boolean> column) {
TableCell<Information, Boolean> cell = cellFactory.call(column);
cell.setAlignment(Pos.CENTER);
return cell ;
}
});
activeColumn.setCellFactory(cellFactory);
activeColumn.setEditable(true);
Here is my 'Information' class where I'm getting Active value as true/false
public Information(Hashtable information) {
:::
String strActive = cvtStr(information.get("Active"));
if (strActive.equals("1"))
this.active = true;
else if (strActive.equals("0"))
this.active = false;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
When I run it I'm not getting the Checkbox checked where 'Active' is true. Here is the screenshot:
Would any one tell me where am I doing wrong? Or is there any other ways to get this done?
Any help would be greatly appreciated
Aucun commentaire:
Enregistrer un commentaire