com.intellij.ui.ColoredTableCellRenderer Java Examples
The following examples show how to use
com.intellij.ui.ColoredTableCellRenderer.
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: VendorTypeColumn.java From intellij-latte with MIT License | 6 votes |
@Override public @Nullable TableCellRenderer getRenderer(T settings) { return new ColoredTableCellRenderer() { @Override protected void customizeCellRenderer(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (!(value instanceof LatteXmlFileData.VendorResult)) { return; } LatteXmlFileData.VendorResult vendor = (LatteXmlFileData.VendorResult) value; if (vendor.vendor == LatteConfiguration.Vendor.OTHER) { append(vendor.vendorName, new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, vendor.vendor.getColor())); } else { append(vendor.vendor.getName(), new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, vendor.vendor.getColor())); } } }; }
Example #2
Source File: PhpTypeColumn.java From intellij-latte with MIT License | 6 votes |
@Override public @Nullable TableCellRenderer getRenderer(T settings) { return new ColoredTableCellRenderer() { @Override protected void customizeCellRenderer(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value == null) { return; } LattePhpType type = LattePhpType.create((String) value); if (type.hasUndefinedClass(project)) { append((String) value, new SimpleTextAttributes(Font.PLAIN, JBColor.RED)); } else { append((String) value, new SimpleTextAttributes(Font.PLAIN, null)); } } }; }
Example #3
Source File: TableLinkMouseListener.java From consulo with Apache License 2.0 | 6 votes |
@javax.annotation.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; }
Example #4
Source File: CSharpParameterTableModel.java From consulo-csharp with Apache License 2.0 | 6 votes |
@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)); } }; }
Example #5
Source File: QuarkusExtensionsStep.java From intellij-quarkus with Eclipse Public License 2.0 | 6 votes |
private ExtensionsTable() { setShowGrid(false); setShowVerticalLines(false); this.setCellSelectionEnabled(false); this.setRowSelectionAllowed(true); this.setSelectionMode(0); this.setTableHeader(null); setModel(new Model(new ArrayList<>())); TableColumn selectedColumn = columnModel.getColumn(0); TableUtil.setupCheckboxColumn(this, 0); selectedColumn.setCellRenderer(new BooleanTableCellRenderer()); TableColumn extensionColumn = columnModel.getColumn(1); extensionColumn.setCellRenderer(new ColoredTableCellRenderer() { @Override protected void customizeCellRenderer(JTable table, @Nullable Object value, boolean b, boolean b1, int i, int i1) { QuarkusExtension extension = (QuarkusExtension) value; append(extension.getName(), new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, null)); append(" "); append(extension.asLabel(false), new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, null)); } }); }
Example #6
Source File: TemplateDataLanguageConfigurable.java From consulo with Apache License 2.0 | 5 votes |
@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; }
Example #7
Source File: TableLinkMouseListener.java From consulo with Apache License 2.0 | 5 votes |
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; }
Example #8
Source File: TestsPresentationUtil.java From consulo with Apache License 2.0 | 5 votes |
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; } }
Example #9
Source File: CSharpParameterTableModel.java From consulo-csharp with Apache License 2.0 | 5 votes |
@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()); } }; }
Example #10
Source File: RedisKeyValueDescriptor.java From nosql4idea with Apache License 2.0 | 4 votes |
@Override public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { if (!isNodeExpanded) { cellRenderer.append(getFormattedValue(), valueTextAttributes); } }
Example #11
Source File: LanguagePerFileConfigurable.java From consulo with Apache License 2.0 | 4 votes |
protected boolean handleDefaultValue(VirtualFile file, ColoredTableCellRenderer renderer) { return false; }
Example #12
Source File: TestsPresentationUtil.java From consulo with Apache License 2.0 | 4 votes |
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); } }
Example #13
Source File: CouchbaseResultDescriptor.java From nosql4idea with Apache License 2.0 | 4 votes |
public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { }
Example #14
Source File: CouchbaseKeyValueDescriptor.java From nosql4idea with Apache License 2.0 | 4 votes |
public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { if (!isNodeExpanded) { cellRenderer.append(getValueAndAbbreviateIfNecessary(), valueTextAttributes); } }
Example #15
Source File: CouchbaseValueDescriptor.java From nosql4idea with Apache License 2.0 | 4 votes |
public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { if (!isNodeExpanded) { cellRenderer.append(getFormattedValue(), valueTextAttributes); } }
Example #16
Source File: RedisValueDescriptor.java From nosql4idea with Apache License 2.0 | 4 votes |
@Override public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { if (!isNodeExpanded) { cellRenderer.append(getFormattedValue(), valueTextAttributes); } }
Example #17
Source File: MongoResultDescriptor.java From nosql4idea with Apache License 2.0 | 4 votes |
public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { }
Example #18
Source File: MongoValueDescriptor.java From nosql4idea with Apache License 2.0 | 4 votes |
public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { if (!isNodeExpanded) { cellRenderer.append(getFormattedValue(), valueTextAttributes); } }
Example #19
Source File: MongoKeyValueDescriptor.java From nosql4idea with Apache License 2.0 | 4 votes |
public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { if (!isNodeExpanded) { cellRenderer.append(getValueAndAbbreviateIfNecessary(), valueTextAttributes); } }
Example #20
Source File: PerGroupDependencyTableModel.java From intellij-spring-assistant with MIT License | 4 votes |
PerGroupDependencyTableModel(JBTable perGroupDependencyTable, @NotNull ProjectCreationRequest request, @NotNull DependencyGroup dependencyGroup, @NotNull Version bootVersion, @NotNull Map<DependencyGroup, List<Dependency>> filteredGroupAndDependencies) { this.perGroupDependencyTable = perGroupDependencyTable; this.request = request; this.dependencyGroup = dependencyGroup; this.bootVersion = bootVersion; this.filteredGroupAndDependencies = filteredGroupAndDependencies; reindex(); perGroupDependencyTable.setModel(this); resetTableLookAndFeelToSingleSelect(perGroupDependencyTable); TableColumnModel columnModel = perGroupDependencyTable.getColumnModel(); columnModel.setColumnMargin(0); TableColumn checkBoxColumn = columnModel.getColumn(CHECKBOX_COL_INDEX); TableUtil.setupCheckboxColumn(checkBoxColumn); checkBoxColumn.setCellRenderer(new BooleanTableCellRenderer()); TableColumn dependencyColumn = columnModel.getColumn(DEPENDENCY_NAME_COL_INDEX); dependencyColumn.setCellRenderer(new ColoredTableCellRenderer() { @Override protected void customizeCellRenderer(JTable table, @Nullable Object value, boolean selected, boolean hasFocus, int row, int column) { if (value != null) { Dependency dependency = Dependency.class.cast(value); boolean selectable = isCellEditable(row, CHECKBOX_COL_INDEX); if (selectable) { append(dependency.getName()); } else { append(dependency.getName(), GRAY_ATTRIBUTES); } } // Enable search highlighting. This in conjunction with TableSpeedSearch(below) enables type to search capability of intellij applySpeedSearchHighlighting(table, this, true, selected); } }); new TableSpeedSearch(perGroupDependencyTable, value -> { if (value instanceof Dependency) { return Dependency.class.cast(value).getName(); } return ""; }); // Add listeners // Allow user to select via keyboard perGroupDependencyTable.getActionMap().put("select_deselect_dependency", new AbstractAction() { public void actionPerformed(ActionEvent e) { toggleSelectionIfApplicable(perGroupDependencyTable.getSelectedRow()); } }); perGroupDependencyTable.getInputMap() .put(getKeyStroke(VK_SPACE, 0), "select_deselect_dependency"); // Allow user to toggle via double click perGroupDependencyTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent event) { if (event.getButton() == BUTTON1) { int columIndex = perGroupDependencyTable.columnAtPoint(event.getPoint()); if (columIndex == DEPENDENCY_NAME_COL_INDEX) { int rowIndex = perGroupDependencyTable.rowAtPoint(event.getPoint()); if (event.getClickCount() == 2) { toggleSelectionIfApplicable(rowIndex); } } } } }); perGroupDependencyTable.getSelectionModel().addListSelectionListener(e -> { if (!e.getValueIsAdjusting()) { int selectedRow = perGroupDependencyTable.getSelectedRow(); if (selectedRow != -1) { selectionListeners .forEach(listener -> listener.onDependencySelected(getDependencyAt(selectedRow))); } else { selectionListeners.forEach(listener -> listener.onDependencySelected(null)); } } }); }
Example #21
Source File: FragmentedKeyNodeDescriptor.java From nosql4idea with Apache License 2.0 | 2 votes |
@Override public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { }
Example #22
Source File: RedisResultDescriptor.java From nosql4idea with Apache License 2.0 | 2 votes |
@Override public void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded) { }
Example #23
Source File: NodeDescriptor.java From nosql4idea with Apache License 2.0 | votes |
void renderValue(ColoredTableCellRenderer cellRenderer, boolean isNodeExpanded);