code: private int buildGrid(SubMenuItem subMenu, int inset, int gridPosition) {
  
          // inset is the amount of offset to apply to the left, to make the tree look realistic
          // gridPosition is the row in the grid we populating.
  
          // while there are more menuitems in the current level
          for (MenuItem item : menuTree.getMenuItems(subMenu)) {
              if (item.hasChildren()) {
                  //
                  // for submenus, we make single label and call back on ourselves with the next level down
                  //
                  Label itemLbl = new Label("SubMenu " + item.getName());
                  itemLbl.setPadding(new Insets(12, 10, 12, inset));
                  itemLbl.setStyle("-fx-font-weight: bold; -fx-font-size: 120%;");
                  itemGrid.add(itemLbl, 0, gridPosition++, 2, 1);
                  gridPosition = buildGrid(MenuItemHelper.asSubMenu(item), inset + 10, gridPosition);
              } else {
                  //
                  // otherwise for child items we create the controls that display the value and allow
                  // editing.
                  //
                  Label itemLbl = new Label(item.getName());
                  itemLbl.setPadding(new Insets(3, 10, 3, inset));
                  itemGrid.add(itemLbl, 0, gridPosition);
  
                  itemGrid.add(createUiControlForItem(item), 1, gridPosition);
                  renderItemValue(item);
                  gridPosition++;
              }
          }
          return gridPosition;
      }
docs: Here we go through all the menu items and populate a GridPane with controls to display and edit each item.
  We start at ROOT and through every item in all submenus. This is a recursive function that is repeatedly
  called on sub menu's until we've finished all items.