Is there a specific document naming convention I should follow when creating FXML files or XML files in general? I've been following some tutorials that Oracle has provided and come to the conclusion that FXML files should start with the prefix
fxml
and end with the suffix
view
So an example FXML document would look like
fxml_tableview.fxml
Tutorial source: http://docs.oracle.com/javafx/2/fxml_get_started/jfxpub-fxml_get_started.htm Specific page: http://docs.oracle.com/javafx/2/fxml_get_started/fxml_tutorial_intermediate.htm
The CERN paper on JavaFX includes a section on naming conventions.
Both, the FXML file and its controller should have names allowing an easy identification that they belong to the same view, without looking at their content. In fact, JavaFX introduced a naming convention for nested controllers. For instance, if an included view ID is
dialog
, then the corresponding controller can be referenced asdialogController
. This convention could be extended to other entities associated with a single view such as model, service, CSS or resource bundle properties file. In addition, all files related to a single view could be placed in a dedicated Java package, named after the view. In such case the content of every package would be similar:• [view_name].fxml
• [view_name]Controller.java
• [view_name]Model.java
• [view_name]Service.java
• [view_name].css
• [view_name].properties
Note that only the FXML, controller and in most cases also model files are be present, while CSS, resource bundle and any additional files are optional. Such convention is very easy to remember. With a glimpse of an eye one can recognize all the elements and have a good idea what is inside.
Source: Best Practices For Efficient Development Of JavaFX Applications