JDK-8201285 : DateCell text color are not updated correctly when DateCell with disable = true is reused
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 10,openjfx11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: x86_64
  • Submitted: 2018-04-05
  • Updated: 2018-07-24
  • Resolved: 2018-05-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
openjfx11Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode

ADDITIONAL OS VERSION INFORMATION :
maOS High Sierra 10.13.4

A DESCRIPTION OF THE PROBLEM :
DateCell text color are not updated correctly when DateCell with disable = true is reused.

This problem has occurred in JDK 10.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Start the test application
2) Display the calendar popup
3) Last month click
4) Next month click
5) Next month click

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The text color of DateCell is displayed correctly
ACTUAL -
Some DateCell text colors are grayed out

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.time.LocalDate;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.DateCell;
import javafx.scene.control.DatePicker;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class DateCellDisableTest extends Application{
	
	@Override
	public void start(Stage primaryStage) throws Exception {

		DatePicker datePicker = new DatePicker();
		
		datePicker.setDayCellFactory((cell)->{
			return new DateCell() {
				@Override
				public void updateItem(final LocalDate item, final boolean empty) {
					super.updateItem(item, empty);
					
					if (item.isBefore(LocalDate.now())) {
						this.setDisable(true);
					}
				}
			};
		});
		
		
		BorderPane root = new BorderPane(datePicker);
		
		Scene scene = new Scene(root, 400, 400);
		primaryStage.setScene(scene);
		primaryStage.show();
	}
	
	public static void main(String[] args) {
		Application.launch(args);
	}

}

---------- END SOURCE ----------


Comments
Once you verify that this patch also fixes JDK-8201310, you can close that as a duplicate of this bug.
29-05-2018

+1
29-05-2018

+1
29-05-2018

Review request: Patch to revert JDK-8177636 which caused regression. http://cr.openjdk.java.net/~pkbalakr/fx/8201285/webrev00/
25-05-2018

We have another issue JDK-8201310 which is regression caused due to JDK-8177636. I think we should revert JDK-8177636 patch.
24-05-2018

Regression caused due to JDK-8177636
24-04-2018

Issue reproducible with JDK-10+15 on Windows 7. (Not reproducible with JDK-10+14)
11-04-2018

jdk10 regresison
10-04-2018

Issue is reproducible in Windows 10 also. Its a regression introduced in JDK 10+b15. Windows 10 JDK results: ------------------------------ 8u172-b11 : Pass 9.0.4+11 : Pass 10+14 : Pass 10+15 : Fail <-- regression introduced here 10+46 : Fail 11-ea+6 : Fail ------------------------------
09-04-2018