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 241426

Summary: Creating an empty FXML file with an existing css add a spurious styleClass property
Product: javafx Reporter: jcambon
Component: ProjectAssignee: Roman Svitanic <rsvitanic>
Status: NEW ---    
Severity: normal CC: jcambon, svienot
Priority: P4    
Version: 8.0   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description jcambon 2014-02-05 09:46:44 UTC
Create a new "JavaFx>Empty FXML" file :
- no controller class
- use an existing style sheet

The generated fxml file is as follows:
...
<AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" styleClass="mainFxmlClass" xmlns:fx="http://javafx.com/fxml/1">
    <stylesheets>
        <URL value="@test.css"/>
    </stylesheets>
</AnchorPane>

As you can see, the AnchorPane setting includes the property styleClass="mainFxmlClass" that should not be there.
Comment 1 Lou Dasaro 2014-02-05 10:58:08 UTC
Changed Priority to P4, because "the issue has a clear and efficient workaround"

I think the command should be renamed from "New Empty FXML file" to "New FXML file". It seemed to me that including an empty styleClass (.mainFxmlClass) was an intentional part of the template, and I have been using it. The styleClass in the FXML file maps to the one generated in the .css file. 

Jerome, isn't this is a feature, or am I missing some potential downside of this feature/bug.
Comment 2 jcambon 2014-02-05 11:18:53 UTC
Indeed, if in the fxml creation wizard you are selecting the "Create New" stylesheet, a .css is created, with and empty mainFxmlClass. So it can make sense to add this rule on the root node.

But in this issue, we are using an *existing* stylesheet. In this case there is no reason to add such a css rule.