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

Out of order error #53

Closed
ghost opened this issue May 8, 2014 · 4 comments
Closed

Out of order error #53

ghost opened this issue May 8, 2014 · 4 comments

Comments

@ghost
Copy link

ghost commented May 8, 2014

Hi Tomas, I was doing a style updated using the style map method below:

IndexRange range = port.richTextArea.getSelection();
if (range.getEnd() > range.getStart()) {
            StyleSpans<String> styles = port.richTextArea.getStyleSpans(range);
            StyleSpans<String> newStyles = styles.mapStyles(css -> getCleanedStyle(css + "-fx-fill: rgb(" + bufferStyle.valColor.get() + ");"));
            port.richTextArea.setStyleSpans(range.getStart(), newStyles);
            port.rebuildStyledTextElements();

        }

and get this error when I try to update a style parameter of a body of text that has multiple styles. For example, two words in black regular weight, I select one to make it bold. then select it again to make it red.

The get cleaned CSS styles gives correct styles, but to double check, I also used the basic CSS-> CSS+ newstyleupdate and still get the error

Is this something related to the RichTextFX?

Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: Value arrived out of order: 6
at org.reactfx.EventStreams$ExclusivePocket.push(EventStreams.java:624)
at org.reactfx.EventStreams$Pocket.lambda$fillFrom$23(EventStreams.java:614)
at org.reactfx.EventStreams$Pocket$$Lambda$27/816212225.accept(Unknown Source)
at org.reactfx.EventStreamBase.lambda$emit$0(EventStreamBase.java:10)
at org.reactfx.EventStreamBase$$Lambda$56/1874073084.accept(Unknown Source)
at org.reactfx.ListHelper$MultiElemHelper.forEach(ListHelper.java:118)
at org.reactfx.ListHelper.forEach(ListHelper.java:29)
at org.reactfx.EventStreamBase.emit(EventStreamBase.java:10)
at org.reactfx.EventStreams$8.lambda$subscribeToInputs$17(EventStreams.java:289)
at org.reactfx.EventStreams$8$$Lambda$28/1505547112.accept(Unknown Source)
at org.reactfx.EventStreamBase.lambda$emit$0(EventStreamBase.java:10)
at org.reactfx.EventStreamBase$$Lambda$56/1874073084.accept(Unknown Source)
at org.reactfx.ListHelper$SingleElemHelper.forEach(ListHelper.java:81)
at org.reactfx.ListHelper.forEach(ListHelper.java:29)
at org.reactfx.EventStreamBase.emit(EventStreamBase.java:10)
at org.reactfx.EventSource.push(EventSource.java:15)
at org.fxmisc.richtext.EditableStyledDocument.beginStyleChange(EditableStyledDocument.java:412)
at org.fxmisc.richtext.EditableStyledDocument.setStyleSpans(EditableStyledDocument.java:267)
at org.fxmisc.richtext.StyledTextArea.setStyleSpans(StyledTextArea.java:542)
at TextComponentElements.TextEditor.applyStylingToSelection(TextEditor.java:2083)
at TextComponentElements.TextEditor.applyStyle(TextEditor.java:2054)
at TextComponentElements.TextEditor.applyStyle(TextEditor.java:2043)
at GridMenuItems.GridMenuStyling.setActive(GridMenuStyling.java:245)
at GridMenuItems.GridMenuStyling.setSelected(GridMenuStyling.java:221)
at GridMenuItems.GridMenuStyling$3.changed(GridMenuStyling.java:175)
at GridMenuItems.GridMenuStyling$3.changed(GridMenuStyling.java:170)
at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:176)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.beans.property.ReadOnlyBooleanWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:178)
at javafx.beans.property.ReadOnlyBooleanWrapper$ReadOnlyPropertyImpl.access$100(ReadOnlyBooleanWrapper.java:148)
at javafx.beans.property.ReadOnlyBooleanWrapper.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:144)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:143)
at javafx.stage.Window.setShowing(Window.java:826)
at javafx.stage.Window.hide(Window.java:851)
at javafx.stage.PopupWindow.hide(PopupWindow.java:460)
at org.controlsfx.control.PopOver$4.invalidated(PopOver.java:191)
at javafx.beans.WeakInvalidationListener.invalidated(WeakInvalidationListener.java:83)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:339)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.scene.Node$LazyBoundsProperty.invalidate(Node.java:9009)
at javafx.scene.Node$MiscProperties.invalidateBoundsInLocal(Node.java:6268)
at javafx.scene.Node.invalidateBoundsInLocal(Node.java:3135)
at javafx.scene.Node.localBoundsChanged(Node.java:3773)
at javafx.scene.Node.impl_geomChanged(Node.java:3760)
at javafx.scene.Parent.childBoundsChanged(Parent.java:1742)
at javafx.scene.Node.notifyParentOfBoundsChange(Node.java:3830)
at javafx.scene.Node.transformedBoundsChanged(Node.java:3792)
at javafx.scene.Node.localBoundsChanged(Node.java:3774)
at javafx.scene.Node.impl_geomChanged(Node.java:3760)
at javafx.scene.Parent.childBoundsChanged(Parent.java:1742)
at javafx.scene.Node.notifyParentOfBoundsChange(Node.java:3830)
at javafx.scene.Node.transformedBoundsChanged(Node.java:3792)
at javafx.scene.Node.localBoundsChanged(Node.java:3774)
at javafx.scene.Node.impl_geomChanged(Node.java:3760)
at javafx.scene.Parent.childBoundsChanged(Parent.java:1742)
at javafx.scene.Node.notifyParentOfBoundsChange(Node.java:3830)
at javafx.scene.Node.transformedBoundsChanged(Node.java:3792)
at javafx.scene.Node.localBoundsChanged(Node.java:3774)
at javafx.scene.Node.impl_geomChanged(Node.java:3760)
at javafx.scene.Parent.childBoundsChanged(Parent.java:1742)
at javafx.scene.Node.notifyParentOfBoundsChange(Node.java:3830)
at javafx.scene.Node.transformedBoundsChanged(Node.java:3792)
at javafx.scene.Node.localBoundsChanged(Node.java:3774)
at javafx.scene.Node.impl_geomChanged(Node.java:3760)
at javafx.scene.text.Text.impl_geomChanged(Text.java:772)
at javafx.scene.text.Text.needsTextLayout(Text.java:202)
at javafx.scene.text.Text.needsFullTextLayout(Text.java:197)
at javafx.scene.text.Text.access$400(Text.java:96)
at javafx.scene.text.Text$7.invalidated(Text.java:507)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:111)
at javafx.beans.property.ObjectPropertyBase.access$000(ObjectPropertyBase.java:51)
at javafx.beans.property.ObjectPropertyBase$Listener.invalidated(ObjectPropertyBase.java:232)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:339)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:105)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:145)
at javafx.css.StyleableObjectProperty.set(StyleableObjectProperty.java:82)
at javafx.scene.control.Labeled$6.set(Labeled.java:358)
at javafx.scene.control.Labeled$6.set(Labeled.java:331)
at javafx.css.StyleableObjectProperty.applyStyle(StyleableObjectProperty.java:68)
at javafx.scene.control.Labeled$6.applyStyle(Labeled.java:345)
at javafx.scene.control.Labeled$6.applyStyle(Labeled.java:331)
at javafx.scene.CssStyleHelper.resetToInitialValues(CssStyleHelper.java:442)
at javafx.scene.CssStyleHelper.createStyleHelper(CssStyleHelper.java:222)
at javafx.scene.Node.impl_processCSS(Node.java:8877)
at javafx.scene.Parent.impl_processCSS(Parent.java:1250)
at javafx.scene.control.Control.impl_processCSS(Control.java:872)
at javafx.scene.Node.processCSS(Node.java:8732)
at javafx.scene.Node.processCSS(Node.java:8725)
at javafx.scene.Node.processCSS(Node.java:8725)
at javafx.scene.Node.processCSS(Node.java:8725)
at javafx.scene.Node.processCSS(Node.java:8725)
at javafx.scene.Node.processCSS(Node.java:8725)
at javafx.scene.Node.applyCss(Node.java:8825)
at javafx.scene.Node.impl_processCSS(Node.java:8746)
at com.sun.javafx.scene.control.skin.LabeledSkinBase.updateChildren(LabeledSkinBase.java:648)
at com.sun.javafx.scene.control.skin.LabeledSkinBase.handleControlPropertyChanged(LabeledSkinBase.java:184)
at com.sun.javafx.scene.control.skin.ListCellSkin.handleControlPropertyChanged(ListCellSkin.java:49)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$2.call(BehaviorSkinBase.java:189)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$2.call(BehaviorSkinBase.java:187)
at com.sun.javafx.scene.control.MultiplePropertyChangeListenerHandler$1.changed(MultiplePropertyChangeListenerHandler.java:55)
at javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:89)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:347)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:105)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:145)
at javafx.css.StyleableObjectProperty.set(StyleableObjectProperty.java:82)
at javafx.beans.property.ObjectProperty.setValue(ObjectProperty.java:69)
at javafx.scene.control.Labeled.setGraphic(Labeled.java:429)
at org.fxmisc.richtext.skin.ParagraphCell.updateItem(ParagraphCell.java:65)
at org.fxmisc.richtext.skin.ParagraphCell.updateItem(ParagraphCell.java:22)
at javafx.scene.control.ListCell.updateItem(ListCell.java:460)
at javafx.scene.control.ListCell.access$300(ListCell.java:74)
at javafx.scene.control.ListCell$4.onChanged(ListCell.java:155)
at javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:315)
at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:72)
at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
at javafx.collections.FXCollections$UnmodifiableObservableListImpl$1.onChanged(FXCollections.java:931)
at javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:158)
at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:72)
at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
at javafx.collections.ModifiableObservableListBase.set(ModifiableObservableListBase.java:163)
at org.fxmisc.richtext.EditableStyledDocument.setStyleSpans(EditableStyledDocument.java:276)
at org.fxmisc.richtext.StyledTextArea.setStyleSpans(StyledTextArea.java:542)
at TextComponentElements.TextEditor.applyStylingToSelection(TextEditor.java:2083)
at TextComponentElements.TextEditor.applyStyle(TextEditor.java:2054)
at TextComponentElements.TextEditor.applyStyle(TextEditor.java:2043)
at GridMenuItems.GridMenuStyling.setActive(GridMenuStyling.java:245)
at GridMenuItems.GridMenuStyling$5.handle(GridMenuStyling.java:271)
at GridMenuItems.GridMenuStyling$5.handle(GridMenuStyling.java:266)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:204)
at com.sun.javafx.event.EventQueue.fire(EventQueue.java:48)
at javafx.scene.Scene$MouseHandler.handleEnterExit(Scene.java:3662)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3728)
at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3471)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1695)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2486)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:314)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:345)
at com.sun.glass.ui.View.handleMouseEvent(View.java:526)
at com.sun.glass.ui.View.notifyMouse(View.java:898)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
at java.lang.Thread.run(Thread.java:744)
@TomasMikula
Copy link
Member

Hi Maher,

the cause of the problem is that a call to setStyleSpans indirectly results in another call to setStyleSpans before the first one is finished. The order is roughly this:

  • you call setStyleSpans
  • that causes changes in the scene graph
  • which triggers reapplying CSS to the changed paragraph
  • which somehow causes your PopOver window to hide (not sure why)
  • which you probably listen to and call another setStyleSpans from the listener.

I will fix the problem with recursive calls to setStyleSpans (so that they are not a problem any more), but you may still want to break the loop above (try addressing one of the last two points). Also, I will not get to it until next week.

@ghost
Copy link
Author

ghost commented May 8, 2014

Thanks! Nice analysis. I'll dig into it to try to fix the problem on my
end. The reason I hide pop over is that in case user had the in text pop
over showing, I want to his it my clicking away from the text. So in this
case clicking the apply style button will hide it. I also get a scene graph
tool kit error sometimes but things work. And it does not complain about a
specific line so was not sure what it is. Thanks for the analysis. I will
focus on it.
Next week is great :D
Thanks again
On May 8, 2014 4:06 AM, "TomasMikula" notifications@github.com wrote:

Hi Maher,

the cause of the problem is that a call to setStyleSpans indirectly
results in another call to setStyleSpans before the first one is
finished. The order is roughly this:

  • you call setStyleSpans
  • that causes changes in the scene graph
  • which triggers reapplying CSS to the changed paragraph
  • which somehow causes your PopOver window to hide (not sure why)
  • which you probably listen to and call another setStyleSpans from the
    listener.

I will fix the problem with recursive calls to setStyleSpans (so that
they are not a problem any more), but you may still want to break the loop
above (try addressing one of the last two points). Also, I will not get to
it until next week.


Reply to this email directly or view it on GitHubhttps://github.com//issues/53#issuecomment-42537663
.

@TomasMikula
Copy link
Member

Hi Maher,

please, try the new build to see if the "out of order" error disappeared.

@ghost
Copy link
Author

ghost commented May 13, 2014

Hi, yes! fixed. No issues.
Best,
Maher

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

No branches or pull requests

1 participant