@Override public TableCellRenderer doCreateRenderer(ParameterTableModelItemBase<ParameterInfoImpl> item) { return new ColoredTableCellRenderer() { public void customizeCellRenderer(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value == null) return; if (isSelected || hasFocus) { acquireState(table, true, false, row, column); getCellState().updateRenderer(this); setPaintFocusBorder(false); } append((String)value, new SimpleTextAttributes(Font.PLAIN, null)); } }; }
@Override @Nullable public Object getTagAt(@NotNull final MouseEvent e) { // TODO[yole]: don't update renderer on every event, like it's done in TreeLinkMouseListener Object tag; JTable table = (JTable)e.getSource(); int row = table.rowAtPoint(e.getPoint()); int column = table.columnAtPoint(e.getPoint()); if (row == -1 || column == -1) return null; TableCellRenderer cellRenderer = table.getCellRenderer(row, column); if (cellRenderer instanceof DualView.TableCellRendererWrapper) { cellRenderer = ((DualView.TableCellRendererWrapper) cellRenderer).getRenderer(); } if (cellRenderer instanceof TreeTableView.CellRendererWrapper) { cellRenderer = ((TreeTableView.CellRendererWrapper) cellRenderer).getBaseRenderer(); } if (cellRenderer instanceof ColoredTableCellRenderer) { final ColoredTableCellRenderer renderer = (ColoredTableCellRenderer)cellRenderer; tag = forColoredRenderer(e, table, row, column, renderer); } else { tag = tryGetTag(e, table, row, column); } return tag; }
public PythonDocumentationPanel() { super(ourModel, new ArrayList<PythonDocumentationMap.Entry>()); setRenderer(1, new ColoredTableCellRenderer() { @Override protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) { String text = value == null ? "" : (String) value; int pos = 0; while(pos < text.length()) { int openBrace = text.indexOf('{', pos); if (openBrace == -1) openBrace = text.length(); append(text.substring(pos, openBrace)); int closeBrace = text.indexOf('}', openBrace); if (closeBrace == -1) closeBrace = text.length(); else closeBrace++; append(text.substring(openBrace, closeBrace), new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, JBColor.BLUE.darker())); pos = closeBrace; } } }); }
@Nullable protected Object getTagAt(final MouseEvent e) { // TODO[yole]: don't update renderer on every event, like it's done in TreeLinkMouseListener Object tag = null; JTable table = (JTable)e.getSource(); int row = table.rowAtPoint(e.getPoint()); int column = table.columnAtPoint(e.getPoint()); if (row == -1 || column == -1) return null; TableCellRenderer cellRenderer = table.getCellRenderer(row, column); if (cellRenderer instanceof DualView.TableCellRendererWrapper) { cellRenderer = ((DualView.TableCellRendererWrapper) cellRenderer).getRenderer(); } if (cellRenderer instanceof TreeTableView.CellRendererWrapper) { cellRenderer = ((TreeTableView.CellRendererWrapper) cellRenderer).getBaseRenderer(); } if (cellRenderer instanceof ColoredTableCellRenderer) { final ColoredTableCellRenderer renderer = (ColoredTableCellRenderer)cellRenderer; tag = forColoredRenderer(e, table, row, column, renderer); } else { tag = tryGetTag(e, table, row, column); } return tag; }
@Override public TableCellRenderer doCreateRenderer(CSharpParameterTableModelItem cSharpParameterTableModelItem) { return new ColoredTableCellRenderer() { @Override public void customizeCellRenderer(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if(value == null) { return; } if(isSelected || hasFocus) { acquireState(table, true, false, row, column); getCellState().updateRenderer(this); setPaintFocusBorder(false); } append((String) value, new SimpleTextAttributes(Font.PLAIN, null)); } }; }
@Nullable public Object getTagAt(final MouseEvent e) { // TODO[yole]: don't update renderer on every event, like it's done in TreeLinkMouseListener Object tag = null; JTable table = (JTable)e.getSource(); int row = table.rowAtPoint(e.getPoint()); int column = table.columnAtPoint(e.getPoint()); if (row == -1 || column == -1) return null; TableCellRenderer cellRenderer = table.getCellRenderer(row, column); if (cellRenderer instanceof DualView.TableCellRendererWrapper) { cellRenderer = ((DualView.TableCellRendererWrapper) cellRenderer).getRenderer(); } if (cellRenderer instanceof TreeTableView.CellRendererWrapper) { cellRenderer = ((TreeTableView.CellRendererWrapper) cellRenderer).getBaseRenderer(); } if (cellRenderer instanceof ColoredTableCellRenderer) { final ColoredTableCellRenderer renderer = (ColoredTableCellRenderer)cellRenderer; tag = forColoredRenderer(e, table, row, column, renderer); } else { tag = tryGetTag(e, table, row, column); } return tag; }
public static void appendTestStatusColorPresentation(final SMTestProxy proxy, final ColoredTableCellRenderer renderer) { final String title = getTestStatusPresentation(proxy); final TestStateInfo.Magnitude info = proxy.getMagnitudeInfo(); switch (info) { case COMPLETE_INDEX: case PASSED_INDEX: renderer.append(title, PASSED_ATTRIBUTES); break; case RUNNING_INDEX: renderer.append(title, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); break; case NOT_RUN_INDEX: renderer.append(title, SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES); break; case IGNORED_INDEX: case SKIPPED_INDEX: renderer.append(title, SimpleTextAttributes.EXCLUDED_ATTRIBUTES); break; case ERROR_INDEX: case FAILED_INDEX: renderer.append(title, DEFFECT_ATTRIBUTES); break; case TERMINATED_INDEX: renderer.append(title, TERMINATED_ATTRIBUTES); break; } }
@Override protected boolean handleDefaultValue(VirtualFile file, ColoredTableCellRenderer renderer) { final Language language = TemplateDataLanguagePatterns.getInstance().getTemplateDataLanguageByFileName(file); if (language != null) { renderer.append(visualize(language), SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES); return true; } return false; }
private Object forColoredRenderer(MouseEvent e, JTable table, int row, int column, ColoredTableCellRenderer renderer) { renderer.getTableCellRendererComponent(table, table.getValueAt(row, column), false, false, row, column); final Rectangle rc = table.getCellRect(row, column, false); int index = renderer.findFragmentAt(e.getPoint().x - rc.x); if (index >= 0) { return renderer.getFragmentTag(index); } return null; }
@Override protected TableCellRenderer doCreateRenderer(CSharpParameterTableModelItem tableModelItem) { return new ColoredTableCellRenderer() { @Override protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) { append(value == null ? "" : value.toString()); } }; }
private Object forColoredRenderer(MouseEvent e, JTable table, int row, int column, ColoredTableCellRenderer renderer) { renderer.getTableCellRendererComponent(table, table.getValueAt(row, column), false, false, row, column); final Rectangle rc = table.getCellRect(row, column, false); int index = renderer.findFragmentAt(e.getPoint().x - rc.x); if (index >= 0) { return renderer.getFragmentTagAt(index); } return null; }
public static void appendSuiteStatusColorPresentation(final SMTestProxy proxy, final ColoredTableCellRenderer renderer) { int passedCount = 0; int errorsCount = 0; int failedCount = 0; int ignoredCount = 0; if (proxy.isLeaf()) { // If suite is empty show <no tests> label and exit from method renderer.append(RESULTS_NO_TESTS, proxy.wasLaunched() ? PASSED_ATTRIBUTES : DEFFECT_ATTRIBUTES); return; } final List<SMTestProxy> allTestCases = proxy.getAllTests(); for (SMTestProxy testOrSuite : allTestCases) { // we should ignore test suites if (testOrSuite.isSuite()) { continue; } // if test check it state switch (testOrSuite.getMagnitudeInfo()) { case COMPLETE_INDEX: case PASSED_INDEX: passedCount++; break; case ERROR_INDEX: errorsCount++; break; case FAILED_INDEX: failedCount++; break; case IGNORED_INDEX: case SKIPPED_INDEX: ignoredCount++; break; case NOT_RUN_INDEX: case TERMINATED_INDEX: case RUNNING_INDEX: //Do nothing break; } } final String separator = " "; if (failedCount > 0) { renderer.append(SMTestsRunnerBundle.message( "sm.test.runner.ui.tabs.statistics.columns.results.count.msg.failed", failedCount) + separator, DEFFECT_ATTRIBUTES); } if (errorsCount > 0) { renderer.append(SMTestsRunnerBundle.message( "sm.test.runner.ui.tabs.statistics.columns.results.count.msg.errors", errorsCount) + separator, DEFFECT_ATTRIBUTES); } if (ignoredCount > 0) { renderer.append(SMTestsRunnerBundle.message( "sm.test.runner.ui.tabs.statistics.columns.results.count.msg.ignored", ignoredCount) + separator, SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES); } if (passedCount > 0) { renderer.append(SMTestsRunnerBundle.message( "sm.test.runner.ui.tabs.statistics.columns.results.count.msg.passed", passedCount), PASSED_ATTRIBUTES); } }
public DetectedPluginsPanel() { super(PluginDownloader.class); final JTable entryTable = getEntryTable(); myHeader = new PluginHeaderPanel(null); entryTable.setTableHeader(null); entryTable.setDefaultRenderer(PluginDownloader.class, new ColoredTableCellRenderer() { protected void customizeCellRenderer(final JTable table, final Object value, final boolean selected, final boolean hasFocus, final int row, final int column) { setBorder(null); final PluginDownloader downloader = (PluginDownloader)value; if (downloader != null) { final String pluginName = downloader.getPluginName(); append(pluginName, SimpleTextAttributes.REGULAR_ATTRIBUTES); final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(PluginId.getId(downloader.getPluginId())); if (ideaPluginDescriptor != null) { final String oldPluginName = ideaPluginDescriptor.getName(); if (!Comparing.strEqual(pluginName, oldPluginName)) { append(" - " + oldPluginName, SimpleTextAttributes.REGULAR_ATTRIBUTES); } } final String loadedVersion = downloader.getPluginVersion(); if (loadedVersion != null || (ideaPluginDescriptor != null && ideaPluginDescriptor.getVersion() != null)) { final String installedVersion = ideaPluginDescriptor != null && ideaPluginDescriptor.getVersion() != null ? "v. " + ideaPluginDescriptor.getVersion() + (loadedVersion != null ? " -> " : "") : ""; final String availableVersion = loadedVersion != null ? loadedVersion : ""; append(" (" + installedVersion + availableVersion + ")", SimpleTextAttributes.GRAY_ATTRIBUTES); } } } }); entryTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { final int selectedRow = entryTable.getSelectedRow(); if (selectedRow != -1) { final PluginDownloader selection = getValueAt(selectedRow); final IdeaPluginDescriptor descriptor = selection.getDescriptor(); if (descriptor != null) { PluginManagerMain.pluginInfoUpdate(descriptor, null, myDescriptionPanel, myHeader); } } } }); setCheckboxColumnName(""); myDescriptionPanel.setPreferredSize(new Dimension(400, -1)); myDescriptionPanel.setEditable(false); myDescriptionPanel.setContentType(UIUtil.HTML_MIME); myDescriptionPanel.addHyperlinkListener(new PluginManagerMain.MyHyperlinkListener()); removeAll(); final Splitter splitter = new Splitter(false); splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(entryTable)); splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myDescriptionPanel)); add(splitter, BorderLayout.CENTER); }
private static Object forColoredRenderer(MouseEvent e, JTable table, int row, int column, ColoredTableCellRenderer renderer) { renderer.getTableCellRendererComponent(table, table.getValueAt(row, column), false, false, row, column); final Rectangle rc = table.getCellRect(row, column, false); return renderer.getFragmentTagAt(e.getX() - rc.x); }
protected boolean handleDefaultValue(VirtualFile file, ColoredTableCellRenderer renderer) { return false; }
protected DetectedPluginsPanel() { super(PluginDownloader.class); final JTable entryTable = getEntryTable(); entryTable.setTableHeader(null); entryTable.setDefaultRenderer(PluginDownloader.class, new ColoredTableCellRenderer() { protected void customizeCellRenderer(final JTable table, final Object value, final boolean selected, final boolean hasFocus, final int row, final int column) { final PluginDownloader downloader = (PluginDownloader)value; if (downloader != null) { final String pluginName = downloader.getPluginName(); append(pluginName, SimpleTextAttributes.REGULAR_ATTRIBUTES); final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(PluginId.getId(downloader.getPluginId())); if (ideaPluginDescriptor != null) { final String oldPluginName = ideaPluginDescriptor.getName(); if (!Comparing.strEqual(pluginName, oldPluginName)) { append(" - " + oldPluginName, SimpleTextAttributes.REGULAR_ATTRIBUTES); } } final String loadedVersion = downloader.getPluginVersion(); if (loadedVersion != null || (ideaPluginDescriptor != null && ideaPluginDescriptor.getVersion() != null)) { final String installedVersion = ideaPluginDescriptor != null && ideaPluginDescriptor.getVersion() != null ? "v. " + ideaPluginDescriptor.getVersion() + (loadedVersion != null ? " -> " : "") : ""; final String availableVersion = loadedVersion != null ? loadedVersion : ""; append(" (" + installedVersion + availableVersion + ")", SimpleTextAttributes.GRAY_ATTRIBUTES); } } } }); entryTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { final int selectedRow = entryTable.getSelectedRow(); if (selectedRow != -1) { final PluginDownloader selection = getValueAt(selectedRow); final IdeaPluginDescriptor descriptor = selection.getDescriptor(); if (descriptor != null) { PluginManagerMain.pluginInfoUpdate(descriptor, null, myDescriptionPanel); } } } }); setCheckboxColumnName(""); myDescriptionPanel.setPreferredSize(new Dimension(400, -1)); myDescriptionPanel.setEditable(false); myDescriptionPanel.setContentType(UIUtil.HTML_MIME); myDescriptionPanel.addHyperlinkListener(new PluginManagerMain.MyHyperlinkListener()); removeAll(); final Splitter splitter = new Splitter(false); splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(entryTable)); splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myDescriptionPanel)); add(splitter, BorderLayout.CENTER); }
public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { if (!isNodeExpanded) { cellRenderer.append(getValueAndAbbreviateIfNecessary(), valueTextAttributes); } }
public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { if (!isNodeExpanded) { cellRenderer.append(getFormattedValue(), valueTextAttributes); } }
public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { }
@Override public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { if (!isNodeExpanded) { cellRenderer.append(getFormattedValue(), valueTextAttributes); } }
@Override public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { }
void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded);