Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8096842

Using fx:include crashes hierarchy/controller view in scenebuilder 2.0

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u40
    • 8
    • javafx
    • None
    • Version: 2.0-b20, Changeset: 5cac093e5c1f
      Date: 2014-03-21 09:30
      OS: Linux

      When including custom .fxml files with scenebuilder 2.0 the hierarchy/controller view stops working.
      The following error is logged:
      java.lang.ClassCastException: com.oracle.javafx.scenebuilder.kit.fxom.FXOMIntrinsic cannot be cast to com.oracle.javafx.scenebuilder.kit.fxom.FXOMInstance
      at com.oracle.javafx.scenebuilder.kit.metadata.util.DesignHierarchyMask.getColumnsSize(DesignHierarchyMask.java:767)
      at com.oracle.javafx.scenebuilder.kit.metadata.util.DesignHierarchyMask.getClassNameInfo(DesignHierarchyMask.java:234)
      at com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy.HierarchyItem.getClassNameInfo(HierarchyItem.java:264)
      at com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy.treeview.HierarchyTreeCell.updateLayout(HierarchyTreeCell.java:812)
      at com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy.treeview.HierarchyTreeCell.updateItem(HierarchyTreeCell.java:518)
      at com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy.treeview.HierarchyTreeCell.updateItem(HierarchyTreeCell.java:114)
      at javafx.scene.control.TreeCell.updateItem(TreeCell.java:509)
      at javafx.scene.control.TreeCell.indexChanged(TreeCell.java:474)
      at javafx.scene.control.IndexedCell.updateIndex(IndexedCell.java:115)
      at com.sun.javafx.scene.control.skin.VirtualFlow.setCellIndex(VirtualFlow.java:1792)
      at com.sun.javafx.scene.control.skin.VirtualFlow.addTrailingCells(VirtualFlow.java:1211)
      at com.sun.javafx.scene.control.skin.VirtualFlow.layoutChildren(VirtualFlow.java:1102)
      .....
      I will try to attach the logfile as well as an two example .fxml files.

      Child.fxml:
      <?xml version="1.0" encoding="UTF-8"?>

      <?import javafx.scene.control.*?>
      <?import java.lang.*?>
      <?import javafx.scene.layout.*?>

      <GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8">
        <columnConstraints>
          <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
          <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
        </columnConstraints>
        <rowConstraints>
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
        </rowConstraints>
         <children>
            <Label text="Label" GridPane.rowIndex="1" />
            <TextField GridPane.columnIndex="1" GridPane.rowIndex="1" />
         </children>
      </GridPane>

      Parent.fxml:
      <?xml version="1.0" encoding="UTF-8"?>

      <?import javafx.scene.control.*?>
      <?import java.lang.*?>
      <?import javafx.scene.layout.*?>

      <GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8">
        <columnConstraints>
          <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
          <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
        </columnConstraints>
        <rowConstraints>
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
        </rowConstraints>
         <children>
            <fx:include source="child.fxml" GridPane.columnIndex="1" GridPane.rowIndex="2" />
         </children>
      </GridPane>

      Opening the parent fails.
      This seems to happen when including a GridPane into another.
      When I wrap the included gridpane into a StackPane everything works fine.

        1. child.fxml
          0.9 kB
        2. parent.fxml
          0.9 kB

            slions Sandra Lions-piron
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: