API break in 2.1 JavaFXBuilderFactory

Tom Schindl tom.schindl at bestsolution.at
Tue Jan 3 06:58:03 PST 2012


Hi Greg,

Great thanks!

Tom

Am 03.01.12 15:55, schrieb Greg Brown:
> Ah, I see. Thanks for clarifying. 
> 
> In 2.0.x, the default JavaFXBuilderFactory constructor called JavaFXBuilderFactory(true). This was an unfortunate oversight, since the alwaysUseBuilders flag was meant for internal testing use only and should not have been set by the default constructor. However, it sounds like removing the boolean constructor completely will probably cause some confusion. I'll put it back and mark it as deprecated.
> 
> Thanks,
> G
> 
> On Jan 3, 2012, at 9:46 AM, Tom Schindl wrote:
> 
>> I'm seeing this exception on 2.0.2 with the default constructor - on 2.1
>> all is fine!
>>
>> My problem is that to support my tooling on OS-X (2.1) and Windows
>> (2.0.2 & 2.1) I now have to use reflection to use the none default
>> constructor making my code look ugly but well if it has to be like this
>> ... .
>>
>> Tom
>>
>>
>> Am 03.01.12 15:39, schrieb Greg Brown:
>>> Not sure why you are seeing that exception. I don't have a problem loading that markup using the default constructor. The default constructor just invokes JavaFXBuilderFactory(ClassLoader, boolean) and passes false as the second argument.
>>>
>>> FWIW, these FXMLLoader constructors now create a default JavaFXBuilderFactory by default, so you may not actually need to create your own instance:
>>>
>>> FXMLLoader()
>>> FXMLLoader(URL)
>>> FXMLLoader(URL, ResourceBundle)
>>>
>>> G
>>>
>>> On Dec 31, 2011, at 8:37 AM, Tom Schindl wrote:
>>>
>>>> Hi,
>>>>
>>>> It looks like the JavaFXBuilderFactory lost the
>>>> JavaFXBuilderFactory(boolean) constructor.
>>>>
>>>> I've been this constructor like this "new JavaFXBuilderFactory(false)"
>>>> because with the default one (new JavaFXBuilderFactory()) an FXML-File
>>>> like this:
>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <!-- 
>>>>> 	Do not edit this file it is generated by e(fx)clipse from /at/bestsolution/efxclipse/testcases/fxgraph/BindingTest.fxgraph
>>>>> -->
>>>>>
>>>>> <?import java.lang.*?>
>>>>> <?import javafx.scene.control.Label?>
>>>>> <?import javafx.scene.control.TextField?>
>>>>> <?import javafx.scene.layout.HBox?>
>>>>>
>>>>> <HBox xmlns:fx="http://javafx.com/fxml">
>>>>> 	
>>>>> 	<children>
>>>>> 		<Label> 
>>>>> 			<text>Binding</text>
>>>>> 		</Label>
>>>>> 		<TextField fx:id="field1"/> 
>>>>> 		<TextField text="${field1.text}"/> 
>>>>> 	</children>
>>>>>
>>>>> </HBox>
>>>>
>>>> Fails with an exception like this.
>>>>
>>>>> WARNUNG: Method text failed
>>>>> java.lang.NullPointerException
>>>>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>> 	at java.lang.reflect.Method.invoke(Method.java:597)
>>>>> 	at javafx.fxml.JavaFXBuilder$ObjectBuilder.put(JavaFXBuilderFactory.java:237)
>>>>> 	at javafx.fxml.JavaFXBuilder$ObjectBuilder.put(JavaFXBuilderFactory.java:138)
>>>>> 	at javafx.fxml.FXMLLoader$ExpressionTargetMapping.changed(FXMLLoader.java:1127)
>>>>> 	at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:181)
>>>>> 	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
>>>>> 	at javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(ReadOnlyObjectPropertyBase.java:43)
>>>>> 	at com.sun.javafx.fxml.expression.ExpressionBinding$ValueProperty.fireValueChangedEvent(ExpressionBinding.java:87)
>>>>> 	at com.sun.javafx.fxml.expression.ExpressionBinding$KeyPathMonitor$2.onChanged(ExpressionBinding.java:154)
>>>>> 	at com.sun.javafx.fxml.BeanAdapter$PropertyInvalidationListener.invalidated(BeanAdapter.java:170)
>>>>> 	at com.sun.javafx.binding.ExpressionHelper$MultipleInvalidation.fireValueChangedEvent(ExpressionHelper.java:301)
>>>>> 	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
>>>>> 	at javafx.scene.control.TextInputControl$TextProperty.fireValueChangedEvent(TextInputControl.java:991)
>>>>> 	at javafx.scene.control.TextInputControl$TextProperty.markInvalid(TextInputControl.java:995)
>>>>> 	at javafx.scene.control.TextInputControl$TextProperty.invalidate(TextInputControl.java:935)
>>>>> 	at javafx.scene.control.TextInputControl$TextProperty.access$100(TextInputControl.java:907)
>>>>> 	at javafx.scene.control.TextInputControl$1.invalidated(TextInputControl.java:109)
>>>>> 	at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:140)
>>>>> 	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
>>>>> 	at javafx.scene.control.TextField$TextFieldContent.insert(TextField.java:70)
>>>>> 	at javafx.scene.control.TextInputControl.replaceText(TextInputControl.java:338)
>>>>> 	at com.sun.javafx.scene.control.skin.TextFieldSkin.replaceText(TextFieldSkin.java:407)
>>>>> 	at com.sun.javafx.scene.control.behavior.TextFieldBehavior.replaceText(TextFieldBehavior.java:134)
>>>>> 	at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.defaultKeyTyped(TextInputControlBehavior.java:185)
>>>>> 	at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.callAction(TextInputControlBehavior.java:114)
>>>>> 	at com.sun.javafx.scene.control.behavior.BehaviorBase.callActionForEvent(BehaviorBase.java:165)
>>>>> 	at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.callActionForEvent(TextInputControlBehavior.java:107)
>>>>> 	at com.sun.javafx.scene.control.behavior.BehaviorBase$1.handle(BehaviorBase.java:127)
>>>>> 	at com.sun.javafx.scene.control.behavior.BehaviorBase$1.handle(BehaviorBase.java:125)
>>>>> 	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:56)
>>>>> 	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:162)
>>>>> 	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:115)
>>>>> 	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.EventUtil.fireEventImpl(EventUtil.java:47)
>>>>> 	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
>>>>> 	at javafx.event.Event.fireEvent(Event.java:171)
>>>>> 	at javafx.scene.Scene$KeyHandler.process(Scene.java:2938)
>>>>> 	at javafx.scene.Scene$KeyHandler.access$1700(Scene.java:2868)
>>>>> 	at javafx.scene.Scene.impl_processKeyEvent(Scene.java:1431)
>>>>> 	at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:1862)
>>>>> 	at com.sun.javafx.tk.quantum.EmbeddedScene$3.run(EmbeddedScene.java:366)
>>>>> 	at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:119)
>>>>> 	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
>>>>> 	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2545)
>>>>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
>>>>> 	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:977)
>>>>> 	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>>>>> 	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:893)
>>>>> 	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:91)
>>>>> 	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:565)
>>>>> 	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>>>>> 	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:520)
>>>>> 	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
>>>>> 	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
>>>>> 	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>>>>> 	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>>>>> 	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>>>>> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:352)
>>>>> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>>>>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>> 	at java.lang.reflect.Method.invoke(Method.java:597)
>>>>> 	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:624)
>>>>> 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579)
>>>>> 	at org.eclipse.equinox.launcher.Main.run(Main.java:1433)
>>>>> 	at org.eclipse.equinox.launcher.Main.main(Main.java:1409)
>>>>
>>>> Why has the constructor been removed? Should binding work also if one
>>>> uses the default constructor?
>>>>
>>>> Tom
>>>>
>>>> -- 
>>>> B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
>>>> ------------------------------------------------------------------------
>>>> tom schindl                 geschäftsführer/CEO
>>>> ------------------------------------------------------------------------
>>>> eduard-bodem-gasse 5-7/1   A-6020 innsbruck     fax      ++43 512 935833
>>>> http://www.BestSolution.at                      phone    ++43 512 935834
>>>
>>
>>
>> -- 
>> B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
>> ------------------------------------------------------------------------
>> tom schindl                 geschäftsführer/CEO
>> ------------------------------------------------------------------------
>> eduard-bodem-gasse 5-7/1   A-6020 innsbruck     fax      ++43 512 935833
>> http://www.BestSolution.at                      phone    ++43 512 935834
> 


-- 
B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl                 geschäftsführer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5-7/1   A-6020 innsbruck     fax      ++43 512 935833
http://www.BestSolution.at                      phone    ++43 512 935834


More information about the openjfx-dev mailing list