title: JavaFX: initialize() method not being called on custom component
body: <p>I am trying to create my own custom JavaFX component using FXML markup as well as a controller which extends HBox. For whatever reason, the initialize() method is simply not being called (I can see no debug output). This only occurs for my custom component, all my other controllers behave as expected and are always being initialized. I have no clue what is wrong - here is my code.</p>
  
  <p>NotificationItem.fxml (markup)</p>
  
  <pre><code>&lt;fx:root type="javafx.scene.layout.HBox" xmlns:fx="http://javafx.com/fxml" spacing="5"&gt;
    &lt;ImageView fx:id="image" preserveRatio="true" fitWidth="60" /&gt;
    &lt;VBox alignment="center"&gt;
      &lt;Text text="notification" /&gt;
      &lt;Label fx:id="title" /&gt;
      &lt;Label fx:id="content" /&gt;
      &lt;Label fx:id="timestamp" /&gt;
    &lt;/VBox&gt;
  &lt;/fx:root&gt;
  </code></pre>
  
  <p>NotificationItem.java (controller)</p>
  
  <pre><code>public class NotificationItem extends HBox {
      public static final String FXML_FILENAME = "NotificationItem.fxml";
  
      @FXML private ResourceBundle resources;  
      @FXML private ImageView image;
      @FXML private Label title;
      @FXML private Label content;
      @FXML private Label timestamp;
  
      private Notification notification; 
      private AbstractModel associatedModel;
  
      public NotificationItem(Notification notification) {
          this.notification = notification;
          this.associatedModel = notification.getAssociatedModel();
  
          FXMLHelper.loadFxml("/com/github/norbo11/topbuilders/fxml/" + FXML_FILENAME, this, this);
      }
  
      @FXML
      public void initialize() {      
          System.out.println(notification.getType());
  
          switch (notification.getType()) {
              case ASSIGNMENT_CLOSE_TO_END:
                  break;
              case EMPLOYEE_ASSIGNMENT_COMPLETE:
                  break;
              case NEW_ASSIGNMENT:
                  break;
              case NEW_MESSAGE:
                  Message message = (Message) associatedModel;
                  title.setText(resources.getString("home.notifications.new_message"));
                  content.setText(resources.getString("messages.sender") + ": " + message.getSender());
                  break;
              case NEW_QUOTE_REQUEST:
                  break;
          }
  
          timestamp.setText(Util.formatDate(notification.getDate()));
      }
  }
  </code></pre>
  
  <p>Procedure used to load my FXML (ignore the return value, that isn't used in this case)</p>
  
  <pre><code>public static LoadedFXML loadFxml(String filename, Object root, Object controller) {
          Log.info("Loading FXML: " + filename);
          Parent loadedRoot = null;
          AbstractController loadedController = null;
  
          try {
              FXMLLoader loader = new FXMLLoader(Main.getApp().getClass().getResource(filename));
              if (root != null) loader.setRoot(root);
              if (controller != null) loader.setController(controller);
  
              if (!filename.equals(LoginScene.getAbsoluteFxmlFilename())) {
                  Employee user = Employee.getCurrentEmployee();
  
                  //If the user is logged in
                  if (user != null) {
                      Locale locale = Employee.getCurrentEmployee().getSettings().getLocale();
                      loader.setResources(ResourceBundle.getBundle("lang.lang", locale, ClassLoader.getSystemClassLoader()));
                  }
              }
  
              if (root == null) loadedRoot = loader.load();
              if (controller == null) loadedController = loader.getController();
          } catch (IOException e) {
              e.printStackTrace();
          }
          return new LoadedFXML(loadedRoot, loadedController);
      }
  </code></pre>