RFR: 6465404: some problems in CellEditor related API docs [v5]

Sergey Bylokhov serb at openjdk.java.net
Tue Dec 21 02:03:15 UTC 2021


On Fri, 17 Dec 2021 19:04:56 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>>> > The object that implements the interface is not necessarily the editor for values. DefaultCellEditor is the perfect example: it's not an editor itself, it's not even a component, all it does is configures a delegate, a JComponent, which serves as the editor.
>>> 
>>> My thoughts about this. The object which implements the interface is always the "editor", even if it is not a component. I guess you are mixing it with the other classes like "JEditorPane/JTextField/etc".
>> 
>> No, I don't mix them. It's called CellEditor, however, it's actually CellEditor-provider: the implementation of the interface *provides a component* which is used as the editor for cell values. Or do I miss anything?
>> 
>> What I mean is that this editor object defines the implementation of how an instance of `JTable` acquires an editor component. In that sense it's an editor.
>> 
>> Probably, this part of the discussion is off-topic as we're discussing the terms.
>> 
>> Let's discuss the spec.
>> 
>>> The current spec:
>>> 
>>> > This interface defines the method any object that would like to be
>>> > an editor of values for components such as `JListBox`,
>>> > `JComboBox`, `JTree`, or `JTable`
>>> > needs to implement.
>>> 
>>> This means that the application may have some values/data stored in the JComboBox/JTree/JTable and the application may create a cell editor by implementing the TableCellEditor. That editor then could be used as a cell editor in the "main" JTable.
>> 
>> Why does the interface reference this? The application can store and display data in any component.
>> 
>> Moreover the statement in the Javadoc is wrong: This interface defines the method that can create an editor for `JTable` only. The returned component is of type `Component`, therefore it can be any component.
>> 
>>> So the next statement in the description of this PR is not completely right:
>>> 
>>> > "CellTableEditor Interface doesn't support JComboBox and JTree components"
>>> 
>>> The JComboBox and other classes do not have to implement/support that interface.
>> 
>> No, they don't. At the same time `TableCellEditor` interface can't be used to return a cell editor for `JComboBox` and for `JTree` components. These components use `ComboBoxEditor` and `TreeCellEditor` correspondingly.
>
>> After going on through the example, what I felt is "Adds to CellEditor the extensions necessary to configure an editor in a tree" is little generic description than the updated PR Definition.
> 
> The interface is generic, so the generic description fits well.
> 
> I still find the proposed version quite hard to parse. In my first comment, I suggested rephrasing the Javadoc to make it clearer and easier to understand.

> No, they don't. At the same time `TableCellEditor` interface can't be used to return a cell editor for `JComboBox` and for `JTree` components. These components use `ComboBoxEditor` and `TreeCellEditor` correspondingly.

Right the TableCellEditor should not be used as a JComboBox/JTree editor, it is only for JTable. But the objects implemented TableCellEditor interface can be used to modify the values stored as the JComboBox/JTree when the user edits the cell of the table. So the user selects the cell -> the TableCellEditor is activated for editing that cell -> if the data for the cell may be stored as a list then the JComboBox could be shown -> the user may change/edit the current value of the cell using JComboBox and its values? And the list of components in the spec is just an example of what components can be used by the TableCellEditor.

At least this is how I read it, might be wrong.

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

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



More information about the client-libs-dev mailing list