fonts-fontawesome
fonts-fontawesome copied to clipboard
String binding exceptions
Hi There
When creating a FontAwesomeIconView using char constructor like below:
new FontAwesomeIconView(FontAwesomeIcon.ICON_EDIT.getUnicode())
I get the following exception:
A bound value cannot be set.
/C:/workspace/estimate/estimate/target/classes/atill/markdownfx/mdeditor-viewer.fxml
/C:/workspace/estimate/estimate/target/classes/projmon/gui/taskForm.fxml:102
at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:157)
at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:67)
at javafx.beans.property.StringProperty.setValue(StringProperty.java:84)
at javafx.scene.control.Labeled.setText(Labeled.java:135)
at com.cathive.fonts.fontawesome.FontAwesomeIconView.<init>(FontAwesomeIconView.java:55)
at atill.markdownfx.EditorViewerController.initialize(EditorViewerController.java:59)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2152)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
at javafx.fxml.FXMLLoader$IncludeElement.constructValue(FXMLLoader.java:937)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:567)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2314)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2131)
at projmon.FXControlLoader.loadControl(FXControlLoader.java:171)
at projmon.FXControlLoader.loadTaskForm(FXControlLoader.java:120)
at projmon.hierarchical.TaskHierarchy.loadContentControl(TaskHierarchy.java:125)
at projmon.control.ProjectScreenController$SelectedWorkContentListener.itemSelected(ProjectScreenController.java:108)
at projmon.control.ProjectScreenController$SelectedWorkContentListener.itemSelected(ProjectScreenController.java:1)
at projmon.control.WorkTreeController$3.itemSelected(WorkTreeController.java:141)
at projmon.control.WorkTreeController$3.itemSelected(WorkTreeController.java:1)
at projmon.hierarchical.HierarchyTreeCell$1.handle(HierarchyTreeCell.java:76)
at projmon.hierarchical.HierarchyTreeCell$1.handle(HierarchyTreeCell.java:1)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3113)
at javafx.scene.Scene$ClickGenerator.access$8600(Scene.java:3051)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3333)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3164)
at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3119)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1559)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2261)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:228)
at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
at com.sun.glass.ui.View.notifyMouse(View.java:922)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
at java.lang.Thread.run(Thread.java:722)
This is occurring under Java 7 and 8.
Using the following code works fine, under java 8 also.
FontAwesomeIconView iconView;
iconView = new FontAwesomeIconView();
iconView.setIcon(FontAwesomeIcon.ICON_EDIT);
A constructor with a FontAwesomeIcon
would be pretty useful :)
Hi Andy,
you are right. The constructor that accepts a String as argument is messed up and won't work, because the text-property of the FontAwesomeIconView is bound.
Want to provide a fix? ;-)
No problem.
I would like to remove the icon property since it can't represent more than one icon which the text property can. This feature is used in EstiMate. The #setIcon method should remain to support FXML but only set the text property to the unicode string of the icon.
I'm not sure if this PR fixes the issue. What happens if you call #setText after construction?
I think the way forward is to remove the binding.