use of com.intellij.ui.ColoredTreeCellRenderer in project android by JetBrains.
the class NlComponentTree method createCellRenderer.
private void createCellRenderer() {
ColoredTreeCellRenderer renderer = new ColoredTreeCellRenderer() {
@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
if (value instanceof NlComponent) {
StructureTreeDecorator.decorate(this, (NlComponent) value);
}
}
};
renderer.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
setCellRenderer(renderer);
}
use of com.intellij.ui.ColoredTreeCellRenderer in project android by JetBrains.
the class AppTrace method generateBottomUpTree.
private JComponent generateBottomUpTree(HNode<MethodUsage> graph) {
AppStatTreeNode top = new AppStatTreeNode();
convertGraphToTree(graph, top);
JTree tree = new JTree(top);
JComponent bottomUpColumnTree = new ColumnTreeBuilder(tree).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Method").setRenderer(new ColoredTreeCellRenderer() {
@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
AppStatTreeNode node = (AppStatTreeNode) value;
append(generateNameForColumn(node.getMethodNamespace(), node.getMethodName(), getSeparator()));
}
})).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Exclusive stats").setRenderer(new ColoredTreeCellRenderer() {
@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
AppStatTreeNode node = (AppStatTreeNode) value;
append(String.format("%2.1f%%", node.getPercentageExclusive() * 100));
}
})).build();
return bottomUpColumnTree;
}
use of com.intellij.ui.ColoredTreeCellRenderer in project android by JetBrains.
the class VariantCheckboxTreeCellRenderer method appendModule.
protected void appendModule(@NotNull Module module, @Nullable String variant) {
ColoredTreeCellRenderer textRenderer = getTextRenderer();
textRenderer.append(module.getName());
textRenderer.setIcon(GradleUtil.getModuleIcon(module));
if (isNotEmpty(variant)) {
textRenderer.append(" ", REGULAR_ATTRIBUTES);
textRenderer.append("(" + variant + ")", GRAY_ATTRIBUTES);
}
}
use of com.intellij.ui.ColoredTreeCellRenderer in project android by JetBrains.
the class LicenseAgreementStep method createCellRenderer.
private ColoredTreeCellRenderer createCellRenderer() {
return new ColoredTreeCellRenderer() {
@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
if (row == 0) {
append("Licenses", SimpleTextAttributes.REGULAR_ATTRIBUTES);
return;
}
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
if (!leaf) {
License license = (License) node.getUserObject();
appendLicenseText(license, license.getId());
} else {
Change change = (Change) node.getUserObject();
if (change == null) {
return;
}
appendLicenseText(change.license, change.toString());
setIcon(AllIcons.Actions.Download);
}
}
private void appendLicenseText(@Nullable License license, String text) {
boolean notAccepted = license != null && !myAcceptances.get(license.getId());
if (notAccepted) {
append("*", SimpleTextAttributes.ERROR_ATTRIBUTES);
append(text, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
} else {
append(text, SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
};
}
use of com.intellij.ui.ColoredTreeCellRenderer in project android by JetBrains.
the class AppTrace method generateTopdownTree.
// Convert a HNode tree into an AppStat tree (better suited for rendition in a ColumnTree).
private JComponent generateTopdownTree(HNode<MethodUsage> graph) {
AppStatTreeNode top = new AppStatTreeNode();
// Intentionally discard first child
graph = graph.getFirstChild();
convertGraphToTree(graph, top);
JTree tree = new JTree(top);
JComponent topdownColumnTree = new ColumnTreeBuilder(tree).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Method").setRenderer(new ColoredTreeCellRenderer() {
@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
AppStatTreeNode node = (AppStatTreeNode) value;
append(generateNameForColumn(node.getMethodNamespace(), node.getMethodName(), getSeparator()));
}
})).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Inclusive stats").setRenderer(new ColoredTreeCellRenderer() {
@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
AppStatTreeNode node = (AppStatTreeNode) value;
append(String.format("%2.1f%%", node.getPercentageInclusive() * 100));
}
})).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Exclusive stats").setRenderer(new ColoredTreeCellRenderer() {
@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
AppStatTreeNode node = (AppStatTreeNode) value;
append(String.format("%2.1f%%", node.getPercentageExclusive() * 100));
}
})).build();
return topdownColumnTree;
}
Aggregations