mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8226653: [accessibility] Can edit text cell correctly, but Accessibility Tool reads nothing about editor
Reviewed-by: prr
This commit is contained in:
parent
530176f933
commit
768ef3cd20
3 changed files with 112 additions and 21 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -5278,7 +5278,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
|||
// Don't start when just a modifier is pressed
|
||||
int code = e.getKeyCode();
|
||||
if (code == KeyEvent.VK_SHIFT || code == KeyEvent.VK_CONTROL ||
|
||||
code == KeyEvent.VK_ALT) {
|
||||
code == KeyEvent.VK_ALT || code == KeyEvent.VK_META ||
|
||||
code == KeyEvent.VK_ALT_GRAPH) {
|
||||
return false;
|
||||
}
|
||||
// Try to install the editor
|
||||
|
@ -5302,7 +5303,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
|||
// If we have started an editor as a result of the user
|
||||
// pressing a key and the surrendersFocusOnKeystroke property
|
||||
// is true, give the focus to the new editor.
|
||||
if (getSurrendersFocusOnKeystroke()) {
|
||||
Object prop = getClientProperty("JTable.forceAutoStartsEdit");
|
||||
if (getSurrendersFocusOnKeystroke()
|
||||
|| Boolean.TRUE.equals(prop)) {
|
||||
editorComponent.requestFocus();
|
||||
}
|
||||
}
|
||||
|
@ -6668,6 +6671,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
|||
*/
|
||||
protected AccessibleJTable() {
|
||||
super();
|
||||
JTable.this.putClientProperty("JTable.forceAutoStartsEdit", true);
|
||||
JTable.this.addPropertyChangeListener(this);
|
||||
JTable.this.getSelectionModel().addListSelectionListener(this);
|
||||
TableColumnModel tcm = JTable.this.getColumnModel();
|
||||
|
@ -7104,15 +7108,12 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
|||
int row = rowAtPoint(p);
|
||||
|
||||
if ((column != -1) && (row != -1)) {
|
||||
TableColumn aColumn = getColumnModel().getColumn(column);
|
||||
TableCellRenderer renderer = aColumn.getCellRenderer();
|
||||
if (renderer == null) {
|
||||
Class<?> columnClass = getColumnClass(column);
|
||||
renderer = getDefaultRenderer(columnClass);
|
||||
if (row == getEditingRow() && column == getEditingColumn()) {
|
||||
Component editor = getEditorComponent();
|
||||
if (editor instanceof Accessible) {
|
||||
return (Accessible) editor;
|
||||
}
|
||||
}
|
||||
Component component = renderer.getTableCellRendererComponent(
|
||||
JTable.this, null, false, false,
|
||||
row, column);
|
||||
return new AccessibleJTableCell(JTable.this, row, column,
|
||||
getAccessibleIndexAt(row, column));
|
||||
}
|
||||
|
@ -7145,15 +7146,12 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
|||
int column = getAccessibleColumnAtIndex(i);
|
||||
int row = getAccessibleRowAtIndex(i);
|
||||
|
||||
TableColumn aColumn = getColumnModel().getColumn(column);
|
||||
TableCellRenderer renderer = aColumn.getCellRenderer();
|
||||
if (renderer == null) {
|
||||
Class<?> columnClass = getColumnClass(column);
|
||||
renderer = getDefaultRenderer(columnClass);
|
||||
if (row == getEditingRow() && column == getEditingColumn()) {
|
||||
Component editor = getEditorComponent();
|
||||
if (editor instanceof Accessible) {
|
||||
return (Accessible) editor;
|
||||
}
|
||||
}
|
||||
Component component = renderer.getTableCellRendererComponent(
|
||||
JTable.this, null, false, false,
|
||||
row, column);
|
||||
return new AccessibleJTableCell(JTable.this, row, column,
|
||||
getAccessibleIndexAt(row, column));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue