Hi all, As I understood in the comments(JDK-8094829, JDK-8094078), treeVisible is buggy. Is it still buggy? If yes, is there intention to fix the treeVisible behavior? In case of fixing this it could be used to fix this issue. If I am not wrong, treeVisible is still used by Node, SwingNode and MediaView.
@Jonathan As you mentioned in JDK-8094829 "having a correctly working treeVisible property would be immensely useful." And I am completely agree and I would like to add that having in the public API would be even better :-). Thank you, Diego -----Original Message----- From: Jonathan Giles [mailto:jonathan.gi...@oracle.com] Sent: Sonntag, 28. Februar 2016 22:54 To: Cirujano Cuesta, Diego; openjfx-dev@openjdk.java.net Subject: Re: ProgressIndicator indeterminate transition bugs If you can, are you able to file bug reports for these? -- Jonathan On 29/02/16 10:49 AM, Cirujano Cuesta, Diego wrote: > Hi all, > > We found two important bugs in ProgressIndicator that are related with the > following tickets: > > https://bugs.openjdk.java.net/browse/JDK-8094829 > https://bugs.openjdk.java.net/browse/JDK-8094078 > > Now are quite critical because in a 4K monitor may cause OutOfMemoryException. > > Using the following example: > " > public class JFXMain extends Application{ > > @Override > public void start(Stage primaryStage) throws Exception { > HBox root = new HBox(); > ToggleButton toggleButton = new ToggleButton(); > ProgressIndicator progressIndicator = new > ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS); > StackPane stackPane = new StackPane(progressIndicator); > stackPane.visibleProperty().bind(toggleButton.selectedProperty()); > root.getChildren().addAll(toggleButton, stackPane); > primaryStage.setScene(new Scene(root)); > primaryStage.show(); > } > } > " > > ** First bug ** > > Starting the Progress Indicator with indeterminate progress will > trigger: rebuildTimeline by ProgressIndicatorSkin and in line 599 > start the animation even is not shown already: > indeterminateTransition.playFromStart(); > > ** Second bug ** > > With the last commits in ProgressIndicator, as commented in JDK-8094829, the > listeners do not care about the real visibility of the node(before it was > used impl_treeVisibleProperty()). The consequence is that the > ProgressIndicator in the example won´t be stopped. > > I can imagine that impl_treeVisibleProperty() should not be used and Jonathan > G. said: " but I can't reliably fix that without an API such as what I expect > the treeVisible API should do." But we did not find such alternative property. > > The solution we though is the usage of internal tree visible property like > this: > > 1. Modify method: > " > protected void updateAnimation(boolean isTreeVisible) { " > 2. Remove current calls to method in > " > @Override protected void handleControlPropertyChanged(String p) { > super.handleControlPropertyChanged(p); > > if ("INDETERMINATE".equals(p)) { > initialize(); > } else if ("PROGRESS".equals(p)) { > updateProgress(); > } > } > " > 3. Add listener at the end of the IndeterminateSpinner contructor the > visibility listener: > " > private IndeterminateSpinner(boolean spinEnabled, Paint > fillOverride) { > [...] > impl_treeVisibleProperty().addListener((obs, oldVal, newVal) ->{ > updateAnimation(newVal); > }); > } > " > > What do you think? > > Additional note: I would like to add one more thing. I think that could be > very good a property ReadOnlyBooleanProperty treeVisibleProperty() available > in all Nodes. > > Please let me know if we can do something else. > > Diego