com.intellij.ui.treeStructure.treetable.TreeTableCellRenderer Java Examples

The following examples show how to use com.intellij.ui.treeStructure.treetable.TreeTableCellRenderer. 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: QueryPlanPanel.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 6 votes vote down vote up
private void initTreeCellRenderer(ListTreeTableModelOnColumns model) {
    ((TreeTableCellRenderer) treeTable.getDefaultRenderer(TreeTableModel.class))
            .setCellRenderer(new TreeCellRenderer() {
                private final TreeCellRenderer myBaseRenderer = new HighlightableCellRenderer();

                @Override
                @SuppressWarnings("unchecked")
                public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
                                                              boolean expanded, boolean leaf, int row,
                                                              boolean hasFocus) {
                    Object transformedValue = Stream.of(model.getColumns())
                            .filter(col -> TreeTableModel.class == col.getColumnClass())
                            .findAny()
                            .map(col -> col.valueOf(value))
                            .orElseThrow(() ->
                                    new ShouldNeverHappenException("Sergey Ishchenko",
                                            "columns are statically defined, and each column set should contain "
                                                    + "operator column"));

                    JComponent result = (JComponent) myBaseRenderer.getTreeCellRendererComponent(tree,
                            transformedValue, selected, expanded, leaf, row, hasFocus);
                    result.setOpaque(!selected);
                    return result;
                }
            });
}
 
Example #2
Source File: CustomTreeTable.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
public TreeTableCellRenderer createTableRenderer(final TreeTableModel treeTableModel) {
    return new TreeTableCellRenderer(this, getTree()) {
        public Component getTableCellRendererComponent(final JTable table,
                                                       final Object value,
                                                       final boolean isSelected,
                                                       final boolean hasFocus,
                                                       final int row,
                                                       final int column) {
            return super.getTableCellRendererComponent(table, value, showSelection && isSelected, showCellFocus && hasFocus, row, column);
        }
    };
}
 
Example #3
Source File: AbstractFileTreeTable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public TreeTableCellRenderer createTableRenderer(TreeTableModel treeTableModel) {
  TreeTableCellRenderer tableRenderer = super.createTableRenderer(treeTableModel);
  UIUtil.setLineStyleAngled(tableRenderer);
  tableRenderer.setRootVisible(false);
  tableRenderer.setShowsRootHandles(true);

  return tableRenderer;
}