Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 236559 - Using Netbeans "Make Controller" duplicates the fx:controller property, and makes the fxml file non-loadable anymore
Using Netbeans "Make Controller" duplicates the fx:controller property, and m...
Product: javafx
Classification: Unclassified
Component: Visual Tool Integration
PC Windows 7 x64
: P2 (vote)
: 7.4
Assigned To: Svata Dedic
: 236624 (view as bug list)
Depends on: 236509
  Show dependency treegraph
Reported: 2013-09-30 15:53 UTC by jcambon
Modified: 2013-11-23 07:23 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT

LoadingFailedError (40.66 KB, image/jpeg)
2013-10-01 22:59 UTC, Lou Dasaro

Note You need to log in before you can comment on or make changes to this bug.
Description jcambon 2013-09-30 15:53:12 UTC
If not yet done, install Scene Builder 1.1.
From NB 7.4RC1, create a new FXML Application project and specify to use a JDK7u40 platform, if it's not the default JavaFX platform already.

Open the FXML document from NB to invoke Scene Builder 1.1. In SB window, add a new Button, specify "button1" for the fx:id property, set the onAction to "HandleButton1Action", and save the FXML file.
Back in NB, go into edit mode for the FXMLDocument.fxml file, select "Source > Make Controller" from the NB main menu.

The fx:controller="javafxapplication3.FXMLDocumentController" property is then duplicated.

This prevent this fxml file to be loaded in SB.
Comment 1 Lou Dasaro 2013-09-30 17:14:55 UTC
If I'm understanding this correctly, when you create a JavaFX FXML project, an FXML file (FXMLDocument.fxml) is created along with a corresponding Controller file, and a reference to the Controller is stored in the FXML file, for example like 


Once you make ANY change to the FXML file using Scene Builder and save it, clicking "Make Controller" causes another reference to FXMLDocumentController.javafx:controller="javafxapplication19.FXMLDocumentController" to be inserted into the FXML file, rendering it incapable of being loaded in Scene Builder.

There are alternative scenarios that could cause this to happen as well. 

I believe this anomaly is due to the fact that the new Scene Builder updates the xmlns:fx namespace with version information (xmlns:fx=""), which is not properly recognized by NetBeans, and hence the existence of an existing controller is NOT detected and so NetBeans will insert as many duplicates as you like of references to FXMLDocumentController.javafx:controller="javafxapplication19.FXMLDocumentController"

AFAICT, If the namespace xmlns:fx="" had been properly recognized, this bug would not arise, because NetBeans would not make the duplicate controller. PLEASE see Bug 236509
Comment 2 jcambon 2013-10-01 07:36:57 UTC
Thanks for the quick update.
Yes, you understood the issue well.
Any chance we get this fixed soon ? I mean in the next 7.4 update ?
Comment 3 Lou Dasaro 2013-10-01 22:59:31 UTC
Created attachment 140708 [details]
Comment 4 Svata Dedic 2013-10-02 08:01:28 UTC
Confirmed, with patch to issue #236509 the Make controller does not duplicate the attribute; NB correctly finds the attribute and navigates to the existing controller class.
Comment 5 Lou Dasaro 2013-10-04 08:11:56 UTC
Is blocked until bug 236509 fix becomes a 7.4 patch.
Comment 6 Svata Dedic 2013-10-09 12:33:01 UTC
*** Bug 236624 has been marked as a duplicate of this bug. ***
Comment 7 Svata Dedic 2013-11-13 14:49:46 UTC
The underlying change transplanted to 74 (see issue #236509). Please verify
Comment 8 Lou Dasaro 2013-11-23 07:23:02 UTC
Verified Fixed in NetBeans 7.4-patch1

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo