private void selectionFocusBinding() { if (selectionFocusItem.isSelected()) { selectionModel.getSelectedItems().addListener(selectionFocusListener); } selectionFocusItem .selectedProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue == oldValue) return; if (newValue && !oldValue) { selectionModel.getSelectedItems().addListener(selectionFocusListener); } else { selectionModel.getSelectedItems().removeListener(selectionFocusListener); } }); }
private void initSelectionListener() { selectionFocusListener = c -> { if (selectionModel.getSelectedItems().isEmpty()) tertiaryRoom.setCameraCenter(rnaSequence3D.computeCenter()); if (selectionModel.getSelectedIndices().size() > 0) selectFocus(); }; }