/** * Populates table with appropriate metrics * * @param testRun - testRun to display inside the table */ public void setTestRun(TestRun testRun) { //setup presentation TestRunNode node = new TestRunNode(testRun); this.model.setRoot(new DefaultMutableTreeNode(node)); final SimpleTreeStructure treeStructure = new SimpleTreeStructure.Impl(node); this.treeBuilder = new SimpleTreeBuilder(this.tree.getTree(), this.model, treeStructure, null); Disposer.register(this, this.treeBuilder); this.treeBuilder.expand(treeStructure.getRootElement(), () -> this.expandFailing(treeStructure, treeStructure.getRootElement())); this.treeBuilder.initRoot(); }
private void expandFailing(SimpleTreeStructure treeStructure, Object rootElement) { for (Object obj : treeStructure.getChildElements(rootElement)) { if (obj instanceof StatusProvider) { if (((StatusProvider) obj).getStatus() != TestStatus.PASSED) { this.treeBuilder.expand(obj, null); this.treeBuilder.queueUpdateFrom(obj, true, true); } this.expandFailing(treeStructure, obj); } } }
private void setupWorkItemQueries() { myTreeBuilder = new WorkItemQueriesTreeBuilder(myWorkItemQueriesTree, new SimpleTreeStructure.Impl(new NullNode())); Disposer.register(this, myTreeBuilder); }
public WorkItemQueriesTreeBuilder(@NotNull JTree tree, @NotNull SimpleTreeStructure treeStructure) { super(tree, new DefaultTreeModel(new DefaultMutableTreeNode(treeStructure.getRootElement())), treeStructure, null); }
public CruciblePanel(@NotNull final Project project) { super(false); myProject = project; final JBSplitter splitter = new JBSplitter(false, 0.2f); myReviewModel = new CrucibleReviewModel(project); myReviewTable = new JBTable(myReviewModel); myReviewTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myReviewTable.setStriped(true); myReviewTable.setExpandableItemsEnabled(false); final TableColumnModel columnModel = myReviewTable.getColumnModel(); columnModel.getColumn(1).setCellRenderer(new DescriptionCellRenderer()); setUpColumnWidths(myReviewTable); myReviewTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { final int viewRow = myReviewTable.getSelectedRow(); if (viewRow >= 0 && viewRow < myReviewTable.getRowCount()) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { final Review review = CrucibleManager.getInstance(myProject).getDetailsForReview((String)myReviewTable. getValueAt(viewRow, myReviewTable.getColumnModel().getColumnIndex(CrucibleBundle.message("crucible.id")))); if (review != null) { openDetailsToolWindow(review); myReviewTable.clearSelection(); } } }, ModalityState.stateForComponent(myReviewTable)); } } }}); final TableRowSorter<TableModel> rowSorter = new TableRowSorter<TableModel>(myReviewModel); rowSorter.setSortKeys(Collections.singletonList(new RowSorter.SortKey(4, SortOrder.ASCENDING))); rowSorter.sort(); myReviewTable.setRowSorter(rowSorter); final JScrollPane detailsScrollPane = ScrollPaneFactory.createScrollPane(myReviewTable); final SimpleTreeStructure reviewTreeStructure = createTreeStructure(); final DefaultTreeModel model = new CrucibleTreeModel(); final SimpleTree reviewTree = new SimpleTree(model); new AbstractTreeBuilder(reviewTree, model, reviewTreeStructure, null); reviewTree.invalidate(); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(reviewTree); splitter.setFirstComponent(scrollPane); splitter.setSecondComponent(detailsScrollPane); setContent(splitter); }
private SimpleTreeStructure createTreeStructure() { final CrucibleRootNode rootNode = new CrucibleRootNode(myReviewModel); return new CrucibleTreeStructure(rootNode); }
public JamAbstractTreeBuilder(final JTree tree, SimpleTreeStructure structure) { this(tree, new DefaultTreeModel(new DefaultMutableTreeNode()), structure); }
public JamAbstractTreeBuilder(final JTree tree, DefaultTreeModel treeModel, SimpleTreeStructure structure) { super(tree, treeModel, structure, null); setNodeDescriptorComparator(AlphaComparator.INSTANCE); }