Tag: treetableview

如何启用对TableView / TreeTableView focusLost提交?

是否有任何简单的方法让TreeTableView(或TableView)尝试提交焦点上的值丢失? 不幸的是,我没有成功实现任何javafx TableCellFactories的默认实现,这就是为什么我尝试了我自己的TreeTableCell实现,还有一些不同的TableCell实现,比如Graham Smith ,它似乎是最直接的,因为它已经实现了一个钩子焦点丢失了,但是这个值永远不会被提交,并且用户改变被重置为原始值。 我的猜测是,每当焦点丢失时,受影响Cell的editingProperty总是已经为false,导致Cell从不在focusLost上提交一个值。 这里从原来的(oracle-)TreeTableCell实现(8u20ea)的相关部分,这导致我的方法失败: @Override public void commitEdit(T newValue) { if (! isEditing()) return; // <– here my approaches are blocked, because on focus lost its not editing anymore. final TreeTableView<S> table = getTreeTableView(); if (table != null) { @SuppressWarnings("unchecked") TreeTablePosition<S,T> editingCell = (TreeTablePosition<S,T>) table.getEditingCell(); // Inform the TableView of the edit […]