RFR: 6465404: some problems in CellEditor related API docs [v5]
Alexey Ivanov
aivanov at openjdk.java.net
Wed Dec 15 16:49:01 UTC 2021
On Wed, 15 Dec 2021 01:36:38 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> @prrace Shall we update `TableCellEditor` Javadoc to _“Adds to CellEditor the extensions necessary to configure an editor in a table.”_ to make it similar to `TreeCellEditor`?
>
> Isn't this is another way around? The doc says that the object implementing this interface can be used "as an editor of values for components such as XXX", and it does not say that the XXX class should support the CellTableEditor?
> For example, the DefaultCellEditor class can be used as an editor for JComboBox/JCheckBox/JTextField.
Hm… It's not the other way around. `DefaultCellEditor` implements `TableCellEditor`; the interface defines the `getTableCellEditorComponent` method that returns the _real component_ which will be used as the value editor.
So yeah, you're absolutely right: the current statement in the doc seems wrong.
I'm for changing the Javadoc for `TableCellEditor` to be similar to `TreeCellEditor`: _“Adds to CellEditor the extensions necessary to configure an editor in a table.”_
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.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6608
More information about the client-libs-dev
mailing list