-
Bug
-
Resolution: Fixed
-
P4
-
8
-
Windows 8 64bit
When the scene root's orientation is set to RIGHT_TO_LEFT, arrow key navigation seems reversed (right arrow moves left and left arrow moves right).
Apparently, this is not a TableView issue, but here is where I encountered it.
Here is my SSCCE:
import javafx.application.Application;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.NodeOrientation;
import javafx.scene.Scene;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class SandBox extends Application {
@Override
public void start(Stage stage) throws Exception {
ObservableList<Person> persons = FXCollections.observableArrayList();
persons.add(new Person("Sami", "Haddad", false));
persons.add(new Person("Ahmed", "Hasan", true));
persons.add(new Person("Rami", "Kassar", true));
persons.add(new Person("Nehad", "Hamad", false));
persons.add(new Person("Jamal", "Raei", true));
persons.add(new Person("Ameer", "Raji", true));
persons.add(new Person("Tahseen", "Muhsen", true));
TableView<Person> tableView = new TableView<>();
tableView.setItems(persons);
tableView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
tableView.getSelectionModel().setCellSelectionEnabled(true);
TableColumn<Person, String> colFirstName = new TableColumn<>("First Name");
colFirstName.setCellValueFactory(p -> p.getValue().firstName);
colFirstName.setCellFactory(TextFieldTableCell.forTableColumn());
colFirstName.setOnEditCommit(event -> event.getTableView().getItems().get(event.getTablePosition().getRow()).firstName.set(event.getNewValue()));
TableColumn<Person, String> colLastName = new TableColumn<>("Last Name");
colLastName.setCellValueFactory(p -> p.getValue().lastName);
colLastName.setCellFactory(TextFieldTableCell.forTableColumn());
colLastName.setOnEditCommit(event -> event.getTableView().getItems().get(event.getTablePosition().getRow()).lastName.set(event.getNewValue()));
TableColumn<Person, Boolean> colInvited = new TableColumn<>("Invited");
colInvited.setCellValueFactory(p -> p.getValue().invited);
colInvited.setCellFactory(javafx.scene.control.cell.CheckBoxTableCell.forTableColumn(colInvited));
tableView.getColumns().addAll(colFirstName, colLastName, colInvited);
tableView.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
stage.setTitle("TableView Selection Bug");
stage.setScene(new Scene(new VBox(tableView)));
stage.show();
}
class Person {
public StringProperty firstName;
public StringProperty lastName;
public BooleanProperty invited;
public Person() {
this.firstName = new SimpleStringProperty("");
this.lastName = new SimpleStringProperty("");
this.invited = new SimpleBooleanProperty(false);
}
public Person(String fname, String lname, boolean invited) {
this();
this.firstName.set(fname);
this.lastName.set(lname);
this.invited.set(invited);
}
}
public static void main(String[] args) {
launch(args);
}
}
To reproduce the bug:
Select a cell in the table view, then navigate cells using arrow keys.
Apparently, this is not a TableView issue, but here is where I encountered it.
Here is my SSCCE:
import javafx.application.Application;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.NodeOrientation;
import javafx.scene.Scene;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class SandBox extends Application {
@Override
public void start(Stage stage) throws Exception {
ObservableList<Person> persons = FXCollections.observableArrayList();
persons.add(new Person("Sami", "Haddad", false));
persons.add(new Person("Ahmed", "Hasan", true));
persons.add(new Person("Rami", "Kassar", true));
persons.add(new Person("Nehad", "Hamad", false));
persons.add(new Person("Jamal", "Raei", true));
persons.add(new Person("Ameer", "Raji", true));
persons.add(new Person("Tahseen", "Muhsen", true));
TableView<Person> tableView = new TableView<>();
tableView.setItems(persons);
tableView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
tableView.getSelectionModel().setCellSelectionEnabled(true);
TableColumn<Person, String> colFirstName = new TableColumn<>("First Name");
colFirstName.setCellValueFactory(p -> p.getValue().firstName);
colFirstName.setCellFactory(TextFieldTableCell.forTableColumn());
colFirstName.setOnEditCommit(event -> event.getTableView().getItems().get(event.getTablePosition().getRow()).firstName.set(event.getNewValue()));
TableColumn<Person, String> colLastName = new TableColumn<>("Last Name");
colLastName.setCellValueFactory(p -> p.getValue().lastName);
colLastName.setCellFactory(TextFieldTableCell.forTableColumn());
colLastName.setOnEditCommit(event -> event.getTableView().getItems().get(event.getTablePosition().getRow()).lastName.set(event.getNewValue()));
TableColumn<Person, Boolean> colInvited = new TableColumn<>("Invited");
colInvited.setCellValueFactory(p -> p.getValue().invited);
colInvited.setCellFactory(javafx.scene.control.cell.CheckBoxTableCell.forTableColumn(colInvited));
tableView.getColumns().addAll(colFirstName, colLastName, colInvited);
tableView.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
stage.setTitle("TableView Selection Bug");
stage.setScene(new Scene(new VBox(tableView)));
stage.show();
}
class Person {
public StringProperty firstName;
public StringProperty lastName;
public BooleanProperty invited;
public Person() {
this.firstName = new SimpleStringProperty("");
this.lastName = new SimpleStringProperty("");
this.invited = new SimpleBooleanProperty(false);
}
public Person(String fname, String lname, boolean invited) {
this();
this.firstName.set(fname);
this.lastName.set(lname);
this.invited.set(invited);
}
}
public static void main(String[] args) {
launch(args);
}
}
To reproduce the bug:
Select a cell in the table view, then navigate cells using arrow keys.
- relates to
-
JDK-8235480 Regression: [RTL] Arrow keys navigation doesn't respect TableView orientation
- Resolved
-
JDK-8092804 [2D traversal, RTL] Some behavior classes are confusing the semantics of left & right in RTL mode.
- Resolved
-
JDK-8089134 [2D traversal, RTL] TraversalEngine only handles left/right key traversal correctly in RTL for top-level engine in ToolBar
- Resolved
-
JDK-8095334 [RTL] Arrow keys navigation are reversed for TreeTableView
- Closed