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

Nested/TableColumnHeader: missing api to access tableSkin/tableHeaderRow

XMLWordPrintable

      Since fx9, access to tableSkin changed from protected to package-private. Also its accessibility in the headers' life-cycle changed from initially in super constructor (that is very early) to after setting its TableHeaderRow (<aside> wondering why you didn't keep it as a field in TableColumnHeader?</aside>)

      The tableSkin is needed in (not only) custom headers to configure themselves from skin/table properties. Core headers now configure themselves in

          void setTableHeaderRow(TableHeaderRow thr) {
              tableHeaderRow = thr;
              updateTableSkin();
          }

          private void updateTableSkin() {
              // when we get the table header row, we are also given the skin,
              // so this is the time to hook up listeners, etc.
              TableViewSkinBase<?,?,?,?,?> tableSkin = getTableSkin();
              if (tableSkin == null) return;
              // do config stuff related to skin/table
             ...
          }

          TableViewSkinBase<?,?,?,?,?> getTableSkin() {
              return tableHeaderRow == null ? null : tableHeaderRow.tableSkin;
          }

      For custom headers, there is no way to reliably hook into the config: even with deep reflection for accessing the package/private methods, the time as to when the skin is available is not clearly defined (for subs).

      The easiest solution (for me as application/framework developer) would be to move those methods into protected scope ...

            Unassigned Unassigned
            fastegal Jeanette Winzenburg
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: