Java Code Examples for com.intellij.ui.OnePixelSplitter#getFirstComponent()
The following examples show how to use
com.intellij.ui.OnePixelSplitter#getFirstComponent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnalyzeSizeToolWindowTest.java From size-analyzer with Apache License 2.0 | 6 votes |
@Test public void categoryNodesHaveCorrectExtraInformation() { JPanel toolPanel = toolWindow.getContent(); Component[] components = toolPanel.getComponents(); OnePixelSplitter splitter = (OnePixelSplitter) components[0]; JBScrollPane leftPane = (JBScrollPane) splitter.getFirstComponent(); JViewport leftView = leftPane.getViewport(); Tree suggestionTree = (Tree) leftView.getView(); TreePath webPPath = getTreePathWithString(suggestionTree, webPCategoryData.toString()); TreeCellRenderer treeCellRenderer = suggestionTree.getCellRenderer(); Component renderedNode = treeCellRenderer.getTreeCellRendererComponent( suggestionTree, webPPath.getLastPathComponent(), false, false, false, suggestionTree.getRowForPath(webPPath), false); assertThat(renderedNode.toString()).contains("2 recommendations"); assertThat(renderedNode.toString()).contains("29.30 KB"); }
Example 2
Source File: AnalyzeSizeToolWindowTest.java From size-analyzer with Apache License 2.0 | 6 votes |
@Test public void multipleSuggestionsCreateIssueTypeNode() { JPanel toolPanel = toolWindow.getContent(); Component[] components = toolPanel.getComponents(); OnePixelSplitter splitter = (OnePixelSplitter) components[0]; JBScrollPane leftPane = (JBScrollPane) splitter.getFirstComponent(); JViewport leftView = leftPane.getViewport(); Tree suggestionTree = (Tree) leftView.getView(); TreePath webPIssuePath = getTreePathWithString( suggestionTree, SuggestionDataFactory.issueTypeNodeNames.get(IssueType.WEBP)); DefaultMutableTreeNode webPIssueNode = (DefaultMutableTreeNode) webPIssuePath.getLastPathComponent(); assertThat(webPIssueNode.getChildCount()).isEqualTo(2); }
Example 3
Source File: AnalyzeSizeToolWindowTest.java From size-analyzer with Apache License 2.0 | 6 votes |
@Test public void autofixIsNotShownWhenNull() { JPanel toolPanel = toolWindow.getContent(); Component[] components = toolPanel.getComponents(); OnePixelSplitter splitter = (OnePixelSplitter) components[0]; JBScrollPane leftPane = (JBScrollPane) splitter.getFirstComponent(); JViewport leftView = leftPane.getViewport(); Tree suggestionTree = (Tree) leftView.getView(); JPanel rightPane = (JPanel) splitter.getSecondComponent(); TreePath streamingPath = getTreePathWithString(suggestionTree, streamingSuggestionData.toString()); suggestionTree.addSelectionPath(streamingPath); for (Component component : rightPane.getComponents()) { if (component instanceof JButton) { assertThat(component.isVisible()).isFalse(); } } }
Example 4
Source File: AnalyzeSizeToolWindowTest.java From size-analyzer with Apache License 2.0 | 5 votes |
@Test public void selectingCategoryNodeChangesCategoryPanel() { JPanel toolPanel = toolWindow.getContent(); Component[] components = toolPanel.getComponents(); OnePixelSplitter splitter = (OnePixelSplitter) components[0]; JBScrollPane leftPane = (JBScrollPane) splitter.getFirstComponent(); JViewport leftView = leftPane.getViewport(); Tree suggestionTree = (Tree) leftView.getView(); assertThat(suggestionTree.getSelectionCount()).isEqualTo(0); TreePath webPPath = getTreePathWithString(suggestionTree, webPCategoryData.toString()); suggestionTree.addSelectionPath(webPPath); JPanel rightPane = (JPanel) splitter.getSecondComponent(); assertThat(suggestionTree.getSelectionCount()).isEqualTo(1); for (Component component : rightPane.getComponents()) { if (component instanceof SimpleColoredComponent) { assertThat(component.toString()).contains(webPCategoryData.toString()); assertThat(component.toString()).contains("Estimated savings: 29.30 KB"); } else if (component instanceof JPanel) { Component[] suggestionPanelComponents = ((JPanel) component).getComponents(); assertThat(suggestionPanelComponents).hasLength(1); for (Component linkLabel : suggestionPanelComponents) { assertThat(((LinkLabel<?>) linkLabel).getText()).isEqualTo(SuggestionDataFactory.issueTypeNodeNames.get(IssueType.WEBP)); } } } }