public TreeItem<Box> createNode(final Box b) {
        return new TreeItem<Box>(b) {

            private boolean isLeaf;

            private boolean isFirstTimeChildren = true;
            private boolean isFirstTimeLeaf = true;

            @Override
            public ObservableList<TreeItem<Box>> getChildren() {
                if (isFirstTimeChildren) {
                    isFirstTimeChildren = false;
                    buildChildren(super.getChildren());
                }
                return super.getChildren();
            }


            @Override
            public boolean isLeaf() {
                if (isFirstTimeLeaf) {
                    isFirstTimeLeaf = false;

                    isLeaf = !(getValue() instanceof Container);
                }

                return isLeaf;
            }

            private void buildChildren(final ObservableList<TreeItem<Box>> children) {
                Box b = this.getValue();
                if (b != null && b instanceof Container) {
                    final Iterator<Box> boxes = ((Container) b).getBoxes().iterator();
                    int i = 100;
                    while (boxes.hasNext() && i-- > 0) {
                        // show 100 now and the rest later
                        children.add(createNode(boxes.next()));
                    }
                    new Thread() {
                        @Override
                        public void run() {
                            while (boxes.hasNext()) {
                                int i = 100;
                                List<TreeItem<Box>> treeItemList = new LinkedList<TreeItem<Box>>();
                                while (boxes.hasNext() && i-- > 0) {
                                    // show 100 now and the rest later
                                    treeItemList.add(createNode(boxes.next()));
                                }
                                final TreeItem<Box> treeItems[] = treeItemList.toArray(new TreeItem[treeItemList.size()]);
                                Platform.runLater(new Runnable() {
                                    public void run() {
                                        children.addAll(treeItems);
                                    }
                                });
                            }
                        }
                    }.start();

                }
            }
        };
    }