I was looking at another table in the same system and noticed this: when there is no item in the table, no one row is rendered.
but when you add just one row, the table renders empty row until reach the height of the table (repair the light grey rows):
So, it was obvious that the extra rows were added by TableView, this way a simple null check solve the problem:
public class BigDecimalEditingCell extends TableCell {
private BigDecimalField element = new BigDecimalField(new BigDecimal("0.00"));
private ObjectProperty<BigDecimal> campoLigado = null;
@Override
protected void updateItem(Object item, boolean empty) {
super.updateItem(item,empty);
if (getIndex() < getTableView().getItems().size() && !empty) {
createField();
createBind();
setGraphic(element);
setText(null);
} else {
removeBind();
setGraphic(null);
}
}
.
.
.
}