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

TableSkinUtils should not contain actual code implementation

    Details

    • Type: CSR
    • Status: Draft
    • Priority: P3
    • Resolution: Unresolved
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      source, behavioral
    • Compatibility Risk:
      low
    • Interface Kind:
      Java API

      Description

      Summary

      Add a new protected method in TableColumnHeader allowing developers to override the algorithm used for resizing a column to fit its content.

      Problem

      The method resizeColumnToFitContent(TableViewSkinBase<?,?,?,?,?> tableSkin, TableColumnBase<?,?> tc, int maxRows) in javafx.scene.control.skin.TableSkinUtils cannot be accessed by a person overriding the TableView. Therefore, it is not possible for a developer to provide a custom implementation for a column being resized.

      Solution

      A solution is to remove the implementation from TableSkinUtils and move it somewhere, where it could be overridden. A 1st solution is to revert back to java 8 API and place this method in TableViewSkinBase but that would introduce an abstract method.

      A 2nd solution is to naturally place this method in the TableColumnHeader class since it's this specific class that will call this method.

      Specification

      The following API is added:

      javafx/scene/control/skin/TableColumnHeader.java :

      /**
       * Resizes the given column based on the pref width of all items contained in this column. This can be potentially
       * very expensive if the number of rows is large.
       *
       * @param tableSkin the {@code TableViewSkinBase} used to determine if we are dealing with a {@link TableView} or a
       *                  {@link TreeTableView}
       * @param tc        the column to resize
       * @param maxRows   the number of rows considered when resizing. If -1 is given, all rows are considered.
       * @since 12
       */
      protected void resizeColumnToFitContent(TableViewSkinBase<?,?,?,?,?> tableSkin, TableColumnBase<?,?> tc, int maxRows) {

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                shadzic Samir Hadzic
                Reporter:
                shadzic Samir Hadzic
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: