| Other | 
|---|
| jfx21 b02Fixed | 
| Blocks :   | |
| Duplicate :   | |
| Duplicate :   | |
| Relates :   | |
| Relates :   | 
FULL PRODUCT VERSION :
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Ubuntu 14,
Windows 7 64,
MacOs 10.10.5
A DESCRIPTION OF THE PROBLEM :
If I create a TreeTableView with ColumnResizePolicy == CONSTRAINED_RESIZE_POLICY, then I add there some data and then clear the table, columns will not respect ResizePolicy anymore.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Add data to the table
2. Clear the table
3. Try to resize the table
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Columns respect CONSTRAINED_RESIZE_POLICY
ACTUAL -
They don't
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
/**
 * Created by kpasko on 19.08.15.
 */
public class Test2 extends Application {
	private TreeItem<Pojo> rootItem;
	@Override
	public void start(Stage primaryStage) {
        VBox root = new VBox();
		rootItem = new TreeItem<>();
		TreeTableView<Pojo> table = new TreeTableView<>();
		table.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY);
		table.setShowRoot(false);
		TreeTableColumn<Pojo, String> column = new TreeTableColumn<>("Column1");
		column.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getValue().getValue()));
		table.getColumns().add(column);
		table.setRoot(rootItem);
        HBox buttonsBox = new HBox();
        Button fillTable = new Button("fill table");
        fillTable.setOnAction(e -> fillTable());
        Button clearTable = new Button("clear table");
        clearTable.setOnAction(e -> rootItem.getChildren().clear());
        buttonsBox.getChildren().addAll(fillTable, clearTable);
        root.getChildren().addAll(buttonsBox, table);
		Scene scene = new Scene(root);
		primaryStage.setScene(scene);
		primaryStage.show();
	}
    private void fillTable() {
        rootItem.getChildren().add(new TreeItem<>(new Pojo("100")));
        rootItem.getChildren().add(new TreeItem<>(new Pojo("101")));
        rootItem.getChildren().add(new TreeItem<>(new Pojo("102")));
        rootItem.getChildren().add(new TreeItem<>(new Pojo("103")));
        rootItem.getChildren().add(new TreeItem<>(new Pojo("104")));
        rootItem.getChildren().add(new TreeItem<>(new Pojo("105")));
    }
	public static void main(String[] args) {
		launch(args);
	}
	private class Pojo {
		String value;
		public Pojo(String value) {
			this.value = value;
		}
		public String getValue() {
			return value;
		}
	}
}
---------- END SOURCE ----------
Edit:
Probably caused by an incomplete fix for RT-14855 / JDK-8113886
| 
 |