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

The following examples show how to use com.intellij.ui.treeStructure.treetable.TreeTableModel. 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: DualView.java    From consulo with Apache License 2.0 6 votes vote down vote up
private ColumnInfo[] createTreeColumns(DualViewColumnInfo[] columns) {
  Collection<ColumnInfo> result = new ArrayList<ColumnInfo>();

  final ColumnInfo firstColumn = columns[0];
  ColumnInfo firstTreeColumn = new ColumnInfo(firstColumn.getName()) {
    public Object valueOf(Object object) {
      return firstColumn.valueOf(object);
    }

    public Class getColumnClass() {
      return TreeTableModel.class;
    }

    public boolean isCellEditable(Object o) {
      return true;
    }
  };
  result.add(firstTreeColumn);
  for (int i = 1; i < columns.length; i++) {
    DualViewColumnInfo column = columns[i];
    if (column.shouldBeShownIsTheTree()) result.add(column);
  }

  return result.toArray(new ColumnInfo[result.size()]);
}
 
Example #3
Source File: ExtractMethodTreeTableModel.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
@Override
public Class getColumnClass(int column) {
    if (column == 0) {
        return TreeTableModel.class;
    } else if (column == 1) {
        return ExtractMethodCandidateGroup.class;
    }
    return String.class;
}
 
Example #4
Source File: GodClassPreviewResultDialog.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
@Override
public Class getColumnClass(int column) {
    if (column == 0) {
        return TreeTableModel.class;
    }
    return String.class;
}
 
Example #5
Source File: AbstractTreeTableModel.java    From IntelliJDeodorant with MIT License 5 votes vote down vote up
@Override
public Class getColumnClass(int column) {
    if (column == 0) {
        return TreeTableModel.class;
    }
    return String.class;
}
 
Example #6
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 #7
Source File: ActionsTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
public Class getColumnClass(int column) {
  if (column == 0) {
    return TreeTableModel.class;
  }
  else {
    return Object.class;
  }
}
 
Example #8
Source File: NotificationsConfigurablePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Class getColumnClass(int column) {
  if (NotificationsTreeTable.DISPLAY_TYPE_COLUMN == column) {
    return NotificationDisplayType.class;
  }
  if (NotificationsTreeTable.LOG_COLUMN == column) {
    return Boolean.class;
  }
  if (NotificationsTreeTable.READ_ALOUD_COLUMN == column) {
    return Boolean.class;
  }

  return TreeTableModel.class;
}
 
Example #9
Source File: InspectionsConfigTreeTable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Class getColumnClass(final int column) {
  switch (column) {
    case TREE_COLUMN:
      return TreeTableModel.class;
    case SEVERITIES_COLUMN:
      return Icon.class;
    case IS_ENABLED_COLUMN:
      return Boolean.class;
  }
  throw new IllegalArgumentException();
}
 
Example #10
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;
}
 
Example #11
Source File: AbstractFileTreeTable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Class getColumnClass(final int column) {
  switch (column) {
    case 0:
      return TreeTableModel.class;
    case 1:
      return myValueClass;
    default:
      throw new RuntimeException("invalid column " + column);
  }
}
 
Example #12
Source File: ColumnDefinitions.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 4 votes vote down vote up
@Override
public Class<?> getColumnClass() {
    return TreeTableModel.class;
}
 
Example #13
Source File: JsonTreeTableView.java    From nosql4idea with Apache License 2.0 4 votes vote down vote up
@Override
public Class getColumnClass() {
    return TreeTableModel.class;
}
 
Example #14
Source File: OptionTableWithPreviewPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Class getColumnClass() {
  return TreeTableModel.class;
}