Exemple #1
0
 public void applyHighlighters(@NotNull Component rendererComponent, int row, boolean selected) {
   boolean fgUpdated = false;
   for (VcsLogHighlighter highlighter : myHighlighters) {
     Color color =
         highlighter.getForeground(myDataPack.getGraphFacade().getCommitAtRow(row), selected);
     if (color != null) {
       rendererComponent.setForeground(color);
       fgUpdated = true;
     }
   }
   if (!fgUpdated) { // reset highlighting if no-one wants to change it
     rendererComponent.setForeground(UIUtil.getTableForeground(selected));
   }
 }
  public SimpleTextAttributes applyHighlighters(
      @NotNull Component rendererComponent,
      int row,
      int column,
      String text,
      boolean hasFocus,
      final boolean selected) {
    VcsLogHighlighter.VcsCommitStyle style = getStyle(row, column, text, hasFocus, selected);

    assert style.getBackground() != null
        && style.getForeground() != null
        && style.getTextStyle() != null;

    rendererComponent.setBackground(style.getBackground());
    rendererComponent.setForeground(style.getForeground());

    switch (style.getTextStyle()) {
      case BOLD:
        return SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
      case ITALIC:
        return SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES;
      default:
    }
    return SimpleTextAttributes.REGULAR_ATTRIBUTES;
  }
 private static Component setLabelColors(
     final Component label, final JTable table, final boolean isSelected, final int row) {
   if (label instanceof JComponent) {
     ((JComponent) label).setOpaque(true);
   }
   label.setForeground(isSelected ? table.getSelectionForeground() : table.getForeground());
   label.setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
   return label;
 }