Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8270373

TreeTableCell: inconsistent naming for tableRow and tableColumn property methods

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • jfx17
    • javafx
    • None
    • source, binary
    • low
    • Hide
      It's possible, although unlikely, that some application is expecting the "name" of the property returned by `tableColumnProperty()` or `tableRowProperty()` to incorrectly have the name `"treeTableColumn"` or `"treeTableRow"`.
      Show
      It's possible, although unlikely, that some application is expecting the "name" of the property returned by `tableColumnProperty()` or `tableRowProperty()` to incorrectly have the name `"treeTableColumn"` or `"treeTableRow"`.
    • Java API
    • JDK

      Summary

      Fix inconsistencies in the naming of methods and properties in TreeTableCell by deprecating getTreeTableRow, adding getTableRow, and renaming the (private) property object fields from treeTableRow and treeTableColumn to tableRow and tableColumn, including the name of the bean to match the public property names.

      Problem

      In the TreeTableCell class there is a mismatch between name of the following property method vs the getter:

          public final ReadOnlyObjectProperty<TreeTableRow<S>> tableRowProperty()
          public final TreeTableRow<S> getTreeTableRow()

      The get method has "Tree" in the name while the property method does not.

      By contrast, the corresponding methods for column are self-consistent, and are named without "Tree" in the name:

          public final ReadOnlyObjectProperty<TreeTableColumn<S,​T>> tableColumnProperty()
          public final TreeTableColumn<S,​T> getTableColumn()

      Additionally, the docs for each property is on a private property field that does have tree in the name, which results in no docs being generated for either the tableRow or tableColumn property.

      Finally, the update methods (effectively expert-mode setters) for the tableRow and columnRow properties also have "Tree" in their name, which is inconsistent.

      Solution

      The following changes are made to TreeTableCell:

      1. Deprecate the getTreeTableRow method.
      2. Add a getTableRow method.
      3. Rename the (private) property object fields from treeTableRow and treeTableColumn to tableRow and tableColumn, including the name of the bean, so that they match the public property method names. This will allow API docs to be generated.
      4. Deprecate the updateTreeTableColumn and updateTreeTableRow methods.
      5. Add updateTableColumn and updateTableRow methods.

      Specification

      javafx.scene.control.TreeTableCell:

           /**
            * The {@code TreeTableColumn} instance that backs this {@code TreeTableCell}.
            */
      -    private ReadOnlyObjectWrapper<TreeTableColumn<S,T>> treeTableColumn =
      -            new ReadOnlyObjectWrapper<TreeTableColumn<S,T>>(this, "treeTableColumn") {
      +    private ReadOnlyObjectWrapper<TreeTableColumn<S,T>> tableColumn =
      +            new ReadOnlyObjectWrapper<TreeTableColumn<S,T>>(this, "tableColumn") {
      ...
           /**
            * The {@code TreeTableRow} that this {@code TreeTableCell} currently finds itself placed within.
            */
      -    private ReadOnlyObjectWrapper<TreeTableRow<S>> treeTableRow =
      -            new ReadOnlyObjectWrapper<TreeTableRow<S>>(this, "treeTableRow");
      -    private void setTreeTableRow(TreeTableRow<S> value)
      +    private ReadOnlyObjectWrapper<TreeTableRow<S>> tableRow =
      +            new ReadOnlyObjectWrapper<TreeTableRow<S>>(this, "tableRow");
      +    private void setTableRow(TreeTableRow<S> value)
      ...
      -    public final TreeTableRow<S> getTreeTableRow()
      +    /**
      +     * Gets the value of the property {@code tableRow}.
      +     * @return the value of the property {@code tableRow}
      +     * @since 17
      +     */
      +    public final TreeTableRow<S> getTableRow()
      ...
      +    /**
      +     * @deprecated Use {@link getTableRow} instead.
      +     * @return the {@code TreeTableRow}
      +     */
      +    @Deprecated(since = "17")
      +    public final TreeTableRow<S> getTreeTableRow()
      ...
           /**
            * Updates the {@code TreeTableRow} associated with this {@code TreeTableCell}.
            * <p>
            * Note: This function is intended to be used by experts, primarily
            *       by those implementing new Skins. It is not common
            *       for developers or designers to access this function directly.
            * @param row the {@code TreeTableRow} associated with this {@code TreeTableCell}
      +     * @since 17
            */
      -    public final void updateTreeTableRow(TreeTableRow<S> treeTableRow) {
      +    public final void updateTableRow(TreeTableRow<S> row) {
      ...
           /**
            * Updates the {@code TreeTableColumn} associated with this {@code TreeTableCell}.
            * <p>
            * Note: This function is intended to be used by experts, primarily
            *       by those implementing new Skins. It is not common
            *       for developers or designers to access this function directly.
            * @param column the {@code TreeTableColumn} associated with this {@code TreeTableCell}
      +     * @since 17
            */
      -    public final void updateTreeTableColumn(TreeTableColumn<S,T> col) {
      +    public final void updateTableColumn(TreeTableColumn<S,T> column) {
      ...
      +    /**
      +     * @deprecated Use {@link updateTableRow} instead.
      +     * @param row the {@code TreeTableRow}
      +     */
      +    @Deprecated(since = "17")
      +    public final void updateTreeTableRow(TreeTableRow<S> row) {
      +        updateTableRow(row);
      +    }
      +
      +    /**
      +     * @deprecated Use {@link updateTableColumn} instead.
      +     * @param column the {@code TreeTableColumn}
      +     */
      +    @Deprecated(since = "17")
      +    public final void updateTreeTableColumn(TreeTableColumn<S,T> column) {
      +        updateTableColumn(column);
      +    }

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Ajit Ghaisas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: