private ITreeNode createTreeNodes(MethodStats method) { final MyTreeNode node = new MyTreeNode(method); for (MethodStats entry : method.getCallees().values()) { node.addChild(createTreeNodes(entry)); } return node; }
private TreeTableView<ITreeNode> createTreeTableView(ProfileContainer container) { final List<Profile> profiles = container.getProfiles(); final MyTreeNode rootNode = new MyTreeNode(null); for (Profile p : profiles) { final MyTreeNode profileNode = new MyTreeNode(p); rootNode.addChild(profileNode); profileNode.addChild(createTreeNodes(p.getTopLevelMethod())); } final MyTreeModel model = new MyTreeModel(rootNode, new MethodStatsHelper(container)); final TreeItem<ITreeNode> root = model.toTreeItems(); root.setExpanded(true); final TreeTableView<ITreeNode> treeTableView = new TreeTableView<>(root); for (int i = 0; i < model.getColumnCount(); i++) { final int columnNo = i; final TreeTableColumn<ITreeNode, String> newColumn = new TreeTableColumn<>(model.getColumnName(i)); newColumn.setCellValueFactory( new Callback< TreeTableColumn.CellDataFeatures<ITreeNode, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ITreeNode, String> param) { return new ReadOnlyStringWrapper( model.getValue(param.getValue().getValue(), columnNo)); } }); treeTableView.getColumns().add(newColumn); } treeTableView.setShowRoot(false); return treeTableView; }