Java 类com.intellij.ui.GroupedElementsRenderer 实例源码

项目:intellij-ce-playground    文件:ArrangementColorsProviderImpl.java   
public ArrangementColorsProviderImpl(@Nullable ArrangementColorsAware colorsAware) {
  myColorsAware = colorsAware;

  // Default settings.
  myDefaultNormalAttributes.setForegroundColor(UIUtil.getTreeTextForeground());
  myDefaultNormalAttributes.setBackgroundColor(UIUtil.getPanelBackground());
  myDefaultSelectedAttributes.setForegroundColor(UIUtil.getTreeSelectionForeground());
  myDefaultSelectedAttributes.setBackgroundColor(UIUtil.getTreeSelectionBackground());
  myDefaultNormalBorderColor = UIUtil.getBorderColor();
  Color selectionBorderColor = UIUtil.getTreeSelectionBorderColor();
  if (selectionBorderColor == null) {
    selectionBorderColor = GroupedElementsRenderer.SELECTED_FRAME_FOREGROUND;
  }
  myDefaultSelectedBorderColor = selectionBorderColor;
}
项目:tools-idea    文件:ArrangementColorsProviderImpl.java   
public ArrangementColorsProviderImpl(@Nullable ArrangementColorsAware colorsAware) {
  myColorsAware = colorsAware;

  // Default settings.
  myDefaultNormalAttributes.setForegroundColor(UIUtil.getTreeTextForeground());
  myDefaultNormalAttributes.setBackgroundColor(UIUtil.getPanelBackground());
  myDefaultSelectedAttributes.setForegroundColor(UIUtil.getTreeSelectionForeground());
  myDefaultSelectedAttributes.setBackgroundColor(UIUtil.getTreeSelectionBackground());
  myDefaultNormalBorderColor = UIUtil.getBorderColor();
  Color selectionBorderColor = UIUtil.getTreeSelectionBorderColor();
  if (selectionBorderColor == null) {
    selectionBorderColor = GroupedElementsRenderer.SELECTED_FRAME_FOREGROUND;
  }
  myDefaultSelectedBorderColor = selectionBorderColor;
}
项目:consulo    文件:ArrangementColorsProviderImpl.java   
public ArrangementColorsProviderImpl(@Nullable ArrangementColorsAware colorsAware) {
  myColorsAware = colorsAware;

  // Default settings.
  myDefaultNormalAttributes.setForegroundColor(UIUtil.getTreeTextForeground());
  myDefaultNormalAttributes.setBackgroundColor(UIUtil.getPanelBackground());
  myDefaultSelectedAttributes.setForegroundColor(UIUtil.getTreeSelectionForeground());
  myDefaultSelectedAttributes.setBackgroundColor(UIUtil.getTreeSelectionBackground());
  myDefaultNormalBorderColor = UIUtil.getBorderColor();
  Color selectionBorderColor = UIUtil.getTreeSelectionBorderColor();
  if (selectionBorderColor == null) {
    selectionBorderColor = GroupedElementsRenderer.SELECTED_FRAME_FOREGROUND;
  }
  myDefaultSelectedBorderColor = selectionBorderColor;
}
项目:tools-idea    文件:ColoredCommanderRenderer.java   
@Override
protected void customizeCellRenderer(final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) {
  // Fix GTK background
  if (UIUtil.isUnderGTKLookAndFeel()){
    final Color background = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
    UIUtil.changeBackGround(this, background);
  }
  Color color = UIUtil.getListForeground();
  SimpleTextAttributes attributes = null;
  String locationString = null;

  setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); // for separator, see below

  if (value instanceof NodeDescriptor) {
    final NodeDescriptor descriptor = (NodeDescriptor)value;
    setIcon(descriptor.getIcon());
    final Color elementColor = descriptor.getColor();

    if (elementColor != null) {
      color = elementColor;
    }

    if (descriptor instanceof AbstractTreeNode) {
      final AbstractTreeNode treeNode = (AbstractTreeNode)descriptor;
      final TextAttributesKey attributesKey = treeNode.getAttributesKey();

      if (attributesKey != null) {
        final TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attributesKey);

        if (textAttributes != null) attributes =  SimpleTextAttributes.fromTextAttributes(textAttributes);
      }
      locationString = treeNode.getLocationString();

      final PresentationData presentation = treeNode.getPresentation();
      if (presentation.hasSeparatorAbove() && !selected) {
        setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, GroupedElementsRenderer.POPUP_SEPARATOR_FOREGROUND),
                                                     BorderFactory.createEmptyBorder(0, 0, 1, 0)));
      }
    }
  }

  if(attributes == null) attributes = new SimpleTextAttributes(Font.PLAIN, color);
  final String text = value.toString();

  if (myCommanderPanel.isEnableSearchHighlighting()) {
    JList list1 = myCommanderPanel.getList();
    if (list1 != null) {
      SpeedSearchUtil.appendFragmentsForSpeedSearch(list1, text, attributes, selected, this);
    }
  }
  else {
    append(text != null ? text : "", attributes);
  }

  if (locationString != null && locationString.length() > 0) {
    append(" (" + locationString + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
}
项目:consulo    文件:ColoredCommanderRenderer.java   
@Override
protected void customizeCellRenderer(final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) {
  // Fix GTK background
  if (UIUtil.isUnderGTKLookAndFeel()){
    final Color background = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
    UIUtil.changeBackGround(this, background);
  }
  Color color = UIUtil.getListForeground();
  SimpleTextAttributes attributes = null;
  String locationString = null;

  setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); // for separator, see below

  if (value instanceof NodeDescriptor) {
    final NodeDescriptor descriptor = (NodeDescriptor)value;
    setIcon(descriptor.getIcon());
    final Color elementColor = descriptor.getColor();

    if (elementColor != null) {
      color = elementColor;
    }

    if (descriptor instanceof AbstractTreeNode) {
      final AbstractTreeNode treeNode = (AbstractTreeNode)descriptor;
      final TextAttributesKey attributesKey = treeNode.getAttributesKey();

      if (attributesKey != null) {
        final TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attributesKey);

        if (textAttributes != null) attributes =  SimpleTextAttributes.fromTextAttributes(textAttributes);
      }
      locationString = treeNode.getLocationString();

      final PresentationData presentation = treeNode.getPresentation();
      if (presentation.hasSeparatorAbove() && !selected) {
        setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, GroupedElementsRenderer.POPUP_SEPARATOR_FOREGROUND),
                                                     BorderFactory.createEmptyBorder(0, 0, 1, 0)));
      }
    }
  }

  if(attributes == null) attributes = new SimpleTextAttributes(Font.PLAIN, color);
  final String text = value.toString();

  if (myCommanderPanel.isEnableSearchHighlighting()) {
    JList list1 = myCommanderPanel.getList();
    if (list1 != null) {
      SpeedSearchUtil.appendFragmentsForSpeedSearch(list1, text, attributes, selected, this);
    }
  }
  else {
    append(text != null ? text : "", attributes);
  }

  if (locationString != null && locationString.length() > 0) {
    append(" (" + locationString + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
}