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

TableColumnHeader: initial auto-size broken with multiple sort

    XMLWordPrintable

Details

    Description

      Run the example below, shift-sort every column: header texts will be truncated. Auto-size later by double-clicking into resize region sizes okay. Might be related to JDK-8186188. Seems to be difficult to determine the size requirements when the (layout/skin?) state is not yet fully initialized ..

      The example:

      import java.util.Locale;
      import de.swingempire.fx.util.FXUtils;
      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;

      /**
       * TableColumn: auto-size broken with multi-sort
       *
       */
      public class TableColumnSortSizeBug extends Application {

          private Parent getContent() {
              TableView<Locale> table = new TableView<>(FXCollections.observableArrayList(
                      Locale.getAvailableLocales()));
              TableColumn<Locale, String> countryCode = new TableColumn<>("CountryCode");
              countryCode.setCellValueFactory(new PropertyValueFactory<>("country"));
              TableColumn<Locale, String> language = new TableColumn<>("Language");
              language.setCellValueFactory(new PropertyValueFactory<>("language"));
              TableColumn<Locale, String> variant = new TableColumn<>("Variant");
              variant.setCellValueFactory(new PropertyValueFactory<>("variant"));
              table.getColumns().addAll(countryCode, language, variant);
              BorderPane pane = new BorderPane(table);
              return pane;
          }

          @Override
          public void start(Stage primaryStage) throws Exception {
              primaryStage.setScene(new Scene(getContent(), 800, 400));
              primaryStage.show();
          }
          
          public static void main(String[] args) {
              launch(args);
          }

      }


      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: