On Thu, 24 Feb 2022 12:02:00 GMT, Anton Litvinov <alitvi...@openjdk.org> wrote:

>>> The reason of the issue is the fact that when the assistive technology 
>>> software tries to do "AccessibleAction" on "AccessibleContext" associated 
>>> with a cell with boolean data type in "JTable" component through Java 
>>> Access Bridge (JAB), the JDK executes this "AccessibleAction" on 
>>> "AccessibleContext" of a renderer, which is an instance of the class 
>>> "javax.swing.JTable.BooleanRenderer" which is a derivative of "JCheckBox" 
>>> class, and the instance of this renderer is single and common for all cells 
>>> of boolean data type. Therefore execution of "click" "AccessibleAction" on 
>>> this renderer component which is not permanently bound to any particular 
>>> cell in the table does not lead to update of the table cell value.
>> 
>> But how do the real mouse clicks trigger selection/deselection of the 
>> checkbox state, I guess that the "table.setValueAt()" should be called 
>> somewhere, can we do something similar from the "doAccessibleAction()"?
>
> Hi Sergey. When real mouse click happens "MOUSE_PRESSED", "MOUSE_RELEASED" 
> AWT events are generated and properly handled by code in "JTable" and in 
> other related to "JTable" classes, for example 
> "javax.swing.plaf.basic.BasicTableUI". In the process of handling "JTable" 
> switches to the editing mode and starts considering that at this moment the 
> mouse events are related to not "BooleanRenderer" but to the editor component 
> "BooleanEditor". All these focus/selection/deselection happens during 
> processing of the "MOUSE_PRESSED" event in the methods:
> - "javax.swing.plaf.basic.BasicTableUI.Handler.mousePressed(MouseEvent e)"
> - "javax.swing.plaf.basic.BasicTableUI.Handler.adjustSelection(MouseEvent e)"
> - "javax.swing.JTable.editCellAt(int row, int column, EventObject e)"
> - "javax.swing.JTable.changeSelection(int rowIndex, int columnIndex, boolean 
> toggle, boolean extend)"
> 
> So real mouse click is not a simple call of some one generic click method, 
> which does everything.
> 
> My position is that "selection/deselection" should not happen as a result of 
> "doAccessibleAction(int)" on "AccessibleAction" of "BooleanRenderer". 
> "selection/deselection" must also include setting of focus to the edited 
> cell. Regarding focus I repeat what I said in my prior comment above:
> 
>> I checked the behavior of "doAccessibleAction" on JCheckBox, JButton located 
>> outside JTable and I confirm that it does not lead to setting of focus to 
>> these components, hence there is no need to set focus to this "JCheckBox" 
>> "BooleanRenderer" when it is in table cell and no need to change selection 
>> in JTable.
> 
> I do not see the need in imitating calls to the methods of 
> "BasicTableUI.Handler", "JTable", which are listed upper and involved in real 
> mouse clicks, in handling of "doAccessibleAction". To my mind execution of 
> accessible action "click" in any "JToggleButton" including "JCheckBox" IS NOT 
> EQUAL to real mouse click on them and therefore there is no need to aim to 
> make "doAccessibleAction" on "BooleanRenderer" to be equal to real mouse 
> click on it.

I agree we shouldn't try to repeat the same actions that are caused by mouse 
click. It aligns with the behaviour of a stand-alone checkbox.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7416

Reply via email to