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

TableView: incorrect resize on double-click into parent of nested columns

XMLWordPrintable

      The very first (in the table's lifetime) double-click into the resize region of the parent of nested columns shrinks it such that it no longer spans the child columns. In that state, no resize cursor appears on the parent. It switches back to spanning only when any of its children is resized. After that, double-clicks have no effect.

      Not entirely certain about expected behaviour: either do nothing always, or to recursively auto-size all its children.

      An example to play with:

      /*
       * Created on 11.08.2017
       *
       */
      import java.util.Locale;

      import javafx.application.Application;
      import javafx.collections.FXCollections;
      import javafx.scene.Parent;
      import javafx.scene.Scene;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.control.cell.PropertyValueFactory;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;

      /**
       * Bug: First double-click into resize-region of parent column shrinks
       * the header
       */
      public class DoubleClickNestedColumnBug extends Application {

          private Parent getContent() {
              TableView<Locale> table = new TableView<>(FXCollections.observableArrayList(
                      Locale.getAvailableLocales()));
              TableColumn<Locale, String> country = new TableColumn<>("Country");
              TableColumn<Locale, String> countryCode = new TableColumn<>("Code");
              countryCode.setCellValueFactory(new PropertyValueFactory<>("country"));
              TableColumn<Locale, String> countryDisplay = new TableColumn<>("Name");
              countryDisplay.setCellValueFactory(new PropertyValueFactory<>("displayCountry"));
              country.getColumns().addAll(countryCode, countryDisplay);
              table.getColumns().addAll(country);
              BorderPane pane = new BorderPane(table);
              return pane;
          }

          @Override
          public void start(Stage primaryStage) throws Exception {
              primaryStage.setScene(new Scene(getContent(), 800, 400));
      // primaryStage.setTitle(FXUtils.version());
              primaryStage.show();

          }
          
          public static void main(String[] args) {
              launch(args);
          }

      }

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

              Created:
              Updated: