This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 242114 - "Make Controller" removes @FXML annotation from fx:included fields
Summary: "Make Controller" removes @FXML annotation from fx:included fields
Status: RESOLVED FIXED
Alias: None
Product: javafx
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: PC All
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-19 18:52 UTC by swpalmer
Modified: 2015-06-28 05:57 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description swpalmer 2014-02-19 18:52:49 UTC
Product Version: NetBeans IDE Dev (Build 201402190001)
Java: 1.8.0; Java HotSpot(TM) 64-Bit Server VM 25.0-b69
Runtime: Java(TM) SE Runtime Environment 1.8.0-b129
System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb)

Make Controller action on an fxml file that includes another fxml file will remove the @FXML annotation from the existing field in the controller for both the Node and the controller class.

E.g. Given and FXML file containing:

<fx:include fx:id="myPanel" source="some_other.fxml" />

and a controller for that fxml file containing:

@FXML
private Parent myPanel;
@FXML
private AnotherController myPanelController;


After invoking "Make Controller" the controller code looks like:

private Parent myPanel;
private AnotherController myPanelController;
Comment 1 Lou Dasaro 2014-03-11 18:44:29 UTC
See also Bug 241839 which is a DIFFERENT, yet related, anomaly.
Comment 2 Svata Dedic 2014-11-28 09:44:25 UTC
Yes, fx:include is not supported in the @FXML binding analysis, AFAIK.
Comment 3 Svata Dedic 2014-11-28 18:42:52 UTC
Fixed in jet-main#32249f0a276f
Comment 4 Lou Dasaro 2014-11-28 20:50:13 UTC
Hi Svata, 

Regarding Comment #2, if that is the case, what is the Fix to be tested in Comment #3?

Best regards,
Comment 5 Svata Dedic 2014-11-28 21:36:55 UTC
I included the fx:include in fx:id simple indexing pass. It will be noted, so potentially @FXML bound variable will not be discarded (as the .fxml reference to the field is now recognized). However the scanner does not traverse the includes (for performance reasons and simplicity), so generator is not able to generate such a @FXML variable for you.

Possible future enhancements include:
* determine the type of the fx:included object, generate bound field
* process the closure of fx:includes, generate complete model
(feel free to file such enhancements, if you find them useful).
Comment 6 pablopina 2015-06-28 01:22:09 UTC
What version has this been fixed on? It is still happening for me in 8.0.2
Comment 7 Lou Dasaro 2015-06-28 05:57:55 UTC
Sorry for the inconvenience. 8.0.2 was released on 28 November 2014. So the patch didn't make the cut in time for 8.0.2, but has been fixed in Development (see Svata's comment above) and should be in NetBeans IDE 8.1.

If this is problematic for you, you *might* consider trying a development release from http://bits.netbeans.org/download/trunk/nightly/latest/