private void populateContainer(
      HierarchicalContainer container, List<NodeDTO> nodes, NodeDTO parent) {

    for (NodeDTO node : nodes) {
      Item item = container.addItem(node);
      item.getItemProperty(TreePropertyID.NÁZEV).setValue(node.getName());
      container.setChildrenAllowed(node, true);
      if (parent != null) container.setParent(node, parent);

      List<NodeDTO> childrenNodes = nodeFacade.getNodesByParentNode(node);
      if (childrenNodes != null) populateContainer(container, childrenNodes, node);
    }
  }
  private HierarchicalContainer getCategoriesContainer() {

    // Create new container
    HierarchicalContainer container = new HierarchicalContainer();
    // Create containerproperty for name
    container.addContainerProperty(TreePropertyID.NÁZEV, String.class, null);
    // Create containerproperty for icon
    container.addContainerProperty(
        TreePropertyID.IKONA,
        ThemeResource.class,
        new ThemeResource("../runo/icons/16/folder.png"));

    List<NodeDTO> rootNodes = nodeFacade.getRootNodes();
    populateContainer(container, rootNodes, null);

    return container;
  }