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

TextFieldTableColumn.updateItem() clears Graphic

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P4 P4
    • None
    • 8u20
    • javafx
    • JDK 8u20, Win 7 Pro SP1, 64 Bit

      Each time TextFieldTableColumn.updateItem() is invoked (e. g. as "super" call in decorating successor implementations) it clears the graphic node! This is very annoying, as e. g. designers like to use CSS to set an icon, or decorating successor implementations like to get the automatic convertion from TextFieldTableColumn but want to set pseudo states, which lead to CSS-set icons in turn.

      A simple workaround is to restore the graphic...

                              final Node graphic = this.getGraphic();
                              super.updateItem(value, empty);
                              this.setGraphic(graphic);

      (note: certainly only working if graphic is set programmatically -- NOT working with CSS-set graphic!)

      ...but this is really ugly. Simply spoken, the following code line in TextFieldTableColumn should get changed from clearing the graphic...

          /** {@inheritDoc} */
          @Override public void updateItem(T item, boolean empty) {
              super.updateItem(item, empty);
              CellUtils.updateItem(this, getConverter(), null, null, textField);
          }

      ...to restoring the graphic...

          /** {@inheritDoc} */
          @Override public void updateItem(T item, boolean empty) {
              super.updateItem(item, empty);
              CellUtils.updateItem(this, getConverter(), null, getGraphic(), textField);
          }

      It would be really nice if this would get fixed soon, as it is a totally bad thing that code tweaks in the controller are needed to make purely CSS-designed icons work with TextFieldTableField! :-)

            jgiles Jonathan Giles
            mkarg Markus Karg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: