-
Bug
-
Resolution: Fixed
-
P4
-
8u5
To reproduce, run example below and follow the steps as outlined.
The expected behaviour on ctrl-up/down would be:
- either the focusedCell is updated the same as when navigating with the undecorated nav keys
- or the focusedCell is kept on the cell where the ctrl-nav started (astonishingly the behaviour in win7 explorer)
Either way, the important part from a usability perspective is to _have_ a _cell_ that's focused, that is a target cell for starting an edit f.i. by F2.
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import java.util.Locale;
import java.util.logging.Logger;
/**
* Simple demo to demonstrate the focusedCell bug.
*
* To reproduce:
*
* - click into any cell: focusedCell has both row and column
* - move around with arrow keys: focusedCell changes both row and column
* according to the navigation (expected behaviour)
* - move up/down with ctrl-up/down: focusedCell row
* keeps updating according to navigation, column is set to null (bug)
*/
public class TableFocusedCell extends Application {
private static final Logger LOG = Logger.getLogger(TableFocusedCell.class.getName());
private final ObservableList<Locale> data = FXCollections.observableArrayList(Locale.getAvailableLocales());
private final TableView<Locale> table = new TableView<>(data);
@Override public void start(Stage stage) {
stage.setTitle("Table FocusedCell Bug");
// add a listener to see loosing the column
table.getFocusModel().focusedCellProperty().addListener((p, oldValue, newValue)-> {
LOG.info("old/new " + oldValue + "\n " + newValue);
});
TableColumn<Locale, String> language = new TableColumn<>(
"Language");
language.setCellValueFactory(new PropertyValueFactory<Locale, String>("displayLanguage"));
TableColumn<Locale, String> country = new TableColumn<>("Country");
country.setCellValueFactory(new PropertyValueFactory<>("country"));
table.setItems(data);
table.getColumns().addAll(language, country);
Scene scene = new Scene(new BorderPane(table));
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
The expected behaviour on ctrl-up/down would be:
- either the focusedCell is updated the same as when navigating with the undecorated nav keys
- or the focusedCell is kept on the cell where the ctrl-nav started (astonishingly the behaviour in win7 explorer)
Either way, the important part from a usability perspective is to _have_ a _cell_ that's focused, that is a target cell for starting an edit f.i. by F2.
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import java.util.Locale;
import java.util.logging.Logger;
/**
* Simple demo to demonstrate the focusedCell bug.
*
* To reproduce:
*
* - click into any cell: focusedCell has both row and column
* - move around with arrow keys: focusedCell changes both row and column
* according to the navigation (expected behaviour)
* - move up/down with ctrl-up/down: focusedCell row
* keeps updating according to navigation, column is set to null (bug)
*/
public class TableFocusedCell extends Application {
private static final Logger LOG = Logger.getLogger(TableFocusedCell.class.getName());
private final ObservableList<Locale> data = FXCollections.observableArrayList(Locale.getAvailableLocales());
private final TableView<Locale> table = new TableView<>(data);
@Override public void start(Stage stage) {
stage.setTitle("Table FocusedCell Bug");
// add a listener to see loosing the column
table.getFocusModel().focusedCellProperty().addListener((p, oldValue, newValue)-> {
LOG.info("old/new " + oldValue + "\n " + newValue);
});
TableColumn<Locale, String> language = new TableColumn<>(
"Language");
language.setCellValueFactory(new PropertyValueFactory<Locale, String>("displayLanguage"));
TableColumn<Locale, String> country = new TableColumn<>("Country");
country.setCellValueFactory(new PropertyValueFactory<>("country"));
table.setItems(data);
table.getColumns().addAll(language, country);
Scene scene = new Scene(new BorderPane(table));
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}