Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Popup API; add caret/selection bounds properties #410

Merged
merged 4 commits into from
Jan 17, 2017
Merged

Deprecate Popup API; add caret/selection bounds properties #410

merged 4 commits into from
Jan 17, 2017

Conversation

JordanMartinez
Copy link
Contributor

I encountered an issue with calling getCaretBounds and getSelectionBounds near the same time when using EventStreams.

@JordanMartinez
Copy link
Contributor Author

Running my Popup Demo leads to this Exception:

Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException
	at org.reactfx.util.AccumulationFacility$IllegalAccumulation.reduce(AccumulationFacility.java:16)
	at org.reactfx.util.HashAccuMap.addAll(AccuMap.java:168)
	at org.reactfx.util.IteratorBasedAccuMap.addAll(AccuMap.java:127)
	at org.reactfx.util.NotificationAccumulatorBase.addAll(NotificationAccumulator.java:107)
	at org.reactfx.ObservableBase.enqueueNotifications(ObservableBase.java:62)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:56)
	at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)
	at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)
	at org.reactfx.EventStreams$1.lambda$observeInputs$0(EventStreams.java:67)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.OrElseConst.lambda$connect$0(OrElseConst.java:24)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.Val$2.lambda$connect$0(Val.java:691)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.OrElseConst.lambda$connect$0(OrElseConst.java:24)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.collection.ListReduction.lambda$connect$0(ListReduction.java:53)
	at org.reactfx.collection.LiveList.lambda$observeChanges$9(LiveList.java:268)
	at org.reactfx.util.ListNotifications.lambda$takeHead$0(NotificationAccumulator.java:317)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.collection.MemoizationListImpl$MemoizedView.publishNotifications(MemoizationList.java:58)
	at org.reactfx.collection.MemoizationListImpl$MemoizedView.access$300(MemoizationList.java:30)
	at org.reactfx.collection.MemoizationListImpl.force(MemoizationList.java:128)
	at org.fxmisc.flowless.SizeTracker.lambda$new$4(SizeTracker.java:60)
	at org.reactfx.value.Val$2.computeValue(Val.java:705)
	at org.reactfx.value.ValBase.getValue(ValBase.java:17)
	at org.reactfx.value.Val.lambda$combine$7(Val.java:584)
	at org.reactfx.value.Val$2.computeValue(Val.java:705)
	at org.reactfx.value.ValBase.getValue(ValBase.java:17)
	at javafx.beans.property.DoublePropertyBase$2.computeValue(DoublePropertyBase.java:191)
	at javafx.beans.binding.DoubleBinding.get(DoubleBinding.java:203)
	at javafx.beans.property.DoublePropertyBase.get(DoublePropertyBase.java:133)
	at javafx.beans.binding.DoubleExpression.getValue(DoubleExpression.java:70)
	at javafx.beans.binding.DoubleExpression.getValue(DoubleExpression.java:45)
	at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:356)
	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
	at javafx.beans.property.DoublePropertyBase.fireValueChangedEvent(DoublePropertyBase.java:106)
	at javafx.beans.property.DoublePropertyBase.markInvalid(DoublePropertyBase.java:113)
	at javafx.beans.property.DoublePropertyBase.access$000(DoublePropertyBase.java:52)
	at javafx.beans.property.DoublePropertyBase$Listener.invalidated(DoublePropertyBase.java:263)
	at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:137)
	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
	at javafx.beans.binding.DoubleBinding.invalidate(DoubleBinding.java:222)
	at com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:51)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.Val$2.lambda$connect$0(Val.java:691)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.Val$2.lambda$connect$0(Val.java:691)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.OrElseConst.lambda$connect$0(OrElseConst.java:24)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.collection.ListReduction.lambda$connect$0(ListReduction.java:53)
	at org.reactfx.collection.LiveList.lambda$observeChanges$9(LiveList.java:268)
	at org.reactfx.util.ListNotifications.lambda$takeHead$0(NotificationAccumulator.java:317)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.collection.ProperLiveList.fireModification(ProperLiveList.java:25)
	at org.reactfx.collection.ProperLiveList.fireRemoveRange(ProperLiveList.java:76)
	at org.reactfx.collection.MemoizationListImpl.forget(MemoizationList.java:188)
	at org.fxmisc.flowless.SizeTracker.forgetSizeOf(SizeTracker.java:167)
	at org.fxmisc.flowless.Navigator.layoutChildren(Navigator.java:61)
	at javafx.scene.Parent.layout(Parent.java:1087)
	at org.fxmisc.flowless.VirtualFlow.layoutChildren(VirtualFlow.java:165)
	at javafx.scene.Parent.layout(Parent.java:1087)
	at org.fxmisc.flowless.VirtualFlow.getCellIfVisible(VirtualFlow.java:128)
	at 

org.fxmisc.richtext.GenericStyledArea.getCaretBoundsOnScreen(GenericStyledArea.java:1419)

	at org.reactfx.value.Val$3.computeValue(Val.java:722)
	at org.reactfx.value.ValBase.getValue(ValBase.java:17)
	at org.reactfx.value.ChangeListenerWrapper.accept(Val.java:784)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.Val$3.lambda$connect$0(Val.java:717)
	at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)
	at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)
	at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)
	at org.reactfx.EventStreams$1.lambda$observeInputs$0(EventStreams.java:67)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.OrElseConst.lambda$connect$0(OrElseConst.java:24)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.Val$2.lambda$connect$0(Val.java:691)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.OrElseConst.lambda$connect$0(OrElseConst.java:24)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.collection.ListRangeReduction.lambda$connect$0(ListReduction.java:96)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.MappedVal.lambda$connect$0(MappedVal.java:28)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.Val$2.lambda$connect$0(Val.java:691)
	at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:765)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.value.Val$2.lambda$connect$0(Val.java:691)
	at org.reactfx.collection.InvalidationListenerWrapper.onChange(LiveList.java:413)
	at org.reactfx.collection.InvalidationListenerWrapper.onChange(LiveList.java:399)
	at org.reactfx.util.ListNotifications.lambda$takeHead$0(NotificationAccumulator.java:317)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.collection.ProperLiveList.fireModification(ProperLiveList.java:25)
	at org.reactfx.collection.ProperLiveList.fireElemInsertion(ProperLiveList.java:50)
	at org.reactfx.collection.MemoizationListImpl.get(MemoizationList.java:102)
	at org.fxmisc.flowless.CellListManager.getCell(CellListManager.java:64)
	at org.fxmisc.flowless.CellPositioner.getSizedCell(CellPositioner.java:129)
	at org.fxmisc.flowless.VirtualFlow.getCell(VirtualFlow.java:119)

	at org.fxmisc.richtext.GenericStyledArea.followCaret(GenericStyledArea.java:1114)
	at org.fxmisc.richtext.GenericStyledArea.layoutChildren(GenericStyledArea.java:1279)

	at javafx.scene.Parent.layout(Parent.java:1087)
	at javafx.scene.Parent.layout(Parent.java:1093)
	at javafx.scene.Parent.layout(Parent.java:1093)
	at javafx.scene.Scene.doLayoutPass(Scene.java:552)
	at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2397)
	at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354)
	at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:381)
	at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510)
	at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
	at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
	at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139)
	at java.lang.Thread.run(Thread.java:745)

@JordanMartinez
Copy link
Contributor Author

On a separate issue, do we need the following methods? Meaning, should these be removed from the code or just left there in case they are needed later?

  • ParagraphText#getCaretBounds
  • ParagraphBox#getCaretBounds
  • GenericStyledArea - getCaretBounds / (in this PR) getCaretBoundsInViewport

@JordanMartinez
Copy link
Contributor Author

Ok. I found out what was causing the issue and fixed it. This should be ready to merge now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant