当前位置: 首页>>代码示例>>Java>>正文


Java ColoredTableCellRenderer类代码示例

本文整理汇总了Java中com.intellij.ui.ColoredTableCellRenderer的典型用法代码示例。如果您正苦于以下问题:Java ColoredTableCellRenderer类的具体用法?Java ColoredTableCellRenderer怎么用?Java ColoredTableCellRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ColoredTableCellRenderer类属于com.intellij.ui包,在下文中一共展示了ColoredTableCellRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doCreateRenderer

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
@Override
public TableCellRenderer doCreateRenderer(ParameterTableModelItemBase<ParameterInfoImpl> item) {
  return new ColoredTableCellRenderer() {
    public void customizeCellRenderer(JTable table, Object value,
                                      boolean isSelected, boolean hasFocus, int row, int column) {
      if (value == null) return;
      if (isSelected || hasFocus) {
        acquireState(table, true, false, row, column);
        getCellState().updateRenderer(this);
        setPaintFocusBorder(false);
      }
      append((String)value, new SimpleTextAttributes(Font.PLAIN, null));
    }
  };


}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavaParameterTableModel.java

示例2: getTagAt

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
@Override
@Nullable
public Object getTagAt(@NotNull final MouseEvent e) {
  // TODO[yole]: don't update renderer on every event, like it's done in TreeLinkMouseListener
  Object tag;
  JTable table = (JTable)e.getSource();
  int row = table.rowAtPoint(e.getPoint());
  int column = table.columnAtPoint(e.getPoint());
  if (row == -1 || column == -1) return null;
  TableCellRenderer cellRenderer = table.getCellRenderer(row, column);
  if (cellRenderer instanceof DualView.TableCellRendererWrapper) {
    cellRenderer = ((DualView.TableCellRendererWrapper) cellRenderer).getRenderer();
  }
  if (cellRenderer instanceof TreeTableView.CellRendererWrapper) {
    cellRenderer = ((TreeTableView.CellRendererWrapper) cellRenderer).getBaseRenderer();
  }
  if (cellRenderer instanceof ColoredTableCellRenderer) {
    final ColoredTableCellRenderer renderer = (ColoredTableCellRenderer)cellRenderer;
    tag = forColoredRenderer(e, table, row, column, renderer);
  } else {
    tag = tryGetTag(e, table, row, column);
  }
  return tag;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:TableLinkMouseListener.java

示例3: PythonDocumentationPanel

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
public PythonDocumentationPanel() {
  super(ourModel, new ArrayList<PythonDocumentationMap.Entry>());
  setRenderer(1, new ColoredTableCellRenderer() {
    @Override
    protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
      String text = value == null ? "" : (String) value;
      int pos = 0;
      while(pos < text.length()) {
        int openBrace = text.indexOf('{', pos);
        if (openBrace == -1) openBrace = text.length();
        append(text.substring(pos, openBrace));
        int closeBrace = text.indexOf('}', openBrace);
        if (closeBrace == -1)
          closeBrace = text.length();
        else
          closeBrace++;
        append(text.substring(openBrace, closeBrace), new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, JBColor.BLUE.darker()));
        pos = closeBrace;
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PythonDocumentationConfigurable.java

示例4: getTagAt

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
@Nullable
protected Object getTagAt(final MouseEvent e) {
  // TODO[yole]: don't update renderer on every event, like it's done in TreeLinkMouseListener
  Object tag = null;
  JTable table = (JTable)e.getSource();
  int row = table.rowAtPoint(e.getPoint());
  int column = table.columnAtPoint(e.getPoint());
  if (row == -1 || column == -1) return null;
  TableCellRenderer cellRenderer = table.getCellRenderer(row, column);
  if (cellRenderer instanceof DualView.TableCellRendererWrapper) {
    cellRenderer = ((DualView.TableCellRendererWrapper) cellRenderer).getRenderer();
  }
  if (cellRenderer instanceof TreeTableView.CellRendererWrapper) {
    cellRenderer = ((TreeTableView.CellRendererWrapper) cellRenderer).getBaseRenderer();
  }
  if (cellRenderer instanceof ColoredTableCellRenderer) {
    final ColoredTableCellRenderer renderer = (ColoredTableCellRenderer)cellRenderer;
    tag = forColoredRenderer(e, table, row, column, renderer);
  } else {
    tag = tryGetTag(e, table, row, column);
  }
  return tag;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:TableLinkMouseListener.java

示例5: doCreateRenderer

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
@Override
public TableCellRenderer doCreateRenderer(CSharpParameterTableModelItem cSharpParameterTableModelItem)
{
	return new ColoredTableCellRenderer()
	{
		@Override
		public void customizeCellRenderer(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
		{
			if(value == null)
			{
				return;
			}
			if(isSelected || hasFocus)
			{
				acquireState(table, true, false, row, column);
				getCellState().updateRenderer(this);
				setPaintFocusBorder(false);
			}
			append((String) value, new SimpleTextAttributes(Font.PLAIN, null));
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:23,代码来源:CSharpParameterTableModel.java

示例6: getTagAt

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
@Nullable
public Object getTagAt(final MouseEvent e) {
  // TODO[yole]: don't update renderer on every event, like it's done in TreeLinkMouseListener
  Object tag = null;
  JTable table = (JTable)e.getSource();
  int row = table.rowAtPoint(e.getPoint());
  int column = table.columnAtPoint(e.getPoint());
  if (row == -1 || column == -1) return null;
  TableCellRenderer cellRenderer = table.getCellRenderer(row, column);
  if (cellRenderer instanceof DualView.TableCellRendererWrapper) {
    cellRenderer = ((DualView.TableCellRendererWrapper) cellRenderer).getRenderer();
  }
  if (cellRenderer instanceof TreeTableView.CellRendererWrapper) {
    cellRenderer = ((TreeTableView.CellRendererWrapper) cellRenderer).getBaseRenderer();
  }
  if (cellRenderer instanceof ColoredTableCellRenderer) {
    final ColoredTableCellRenderer renderer = (ColoredTableCellRenderer)cellRenderer;
    tag = forColoredRenderer(e, table, row, column, renderer);
  } else {
    tag = tryGetTag(e, table, row, column);
  }
  return tag;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:TableLinkMouseListener.java

示例7: appendTestStatusColorPresentation

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
public static void appendTestStatusColorPresentation(final SMTestProxy proxy,
                                                     final ColoredTableCellRenderer renderer) {
  final String title = getTestStatusPresentation(proxy);

  final TestStateInfo.Magnitude info = proxy.getMagnitudeInfo();
  switch (info) {
    case COMPLETE_INDEX:
    case PASSED_INDEX:
      renderer.append(title, PASSED_ATTRIBUTES);
      break;
    case RUNNING_INDEX:
      renderer.append(title, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
      break;
    case NOT_RUN_INDEX:
      renderer.append(title, SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
      break;
    case IGNORED_INDEX:
    case SKIPPED_INDEX:
      renderer.append(title, SimpleTextAttributes.EXCLUDED_ATTRIBUTES);
      break;
    case ERROR_INDEX:
    case FAILED_INDEX:
      renderer.append(title, DEFFECT_ATTRIBUTES);
      break;
    case TERMINATED_INDEX:
      renderer.append(title, TERMINATED_ATTRIBUTES);
      break;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:TestsPresentationUtil.java

示例8: handleDefaultValue

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
@Override
protected boolean handleDefaultValue(VirtualFile file, ColoredTableCellRenderer renderer) {
  final Language language = TemplateDataLanguagePatterns.getInstance().getTemplateDataLanguageByFileName(file);
  if (language != null) {
    renderer.append(visualize(language), SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES);
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TemplateDataLanguageConfigurable.java

示例9: forColoredRenderer

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
private Object forColoredRenderer(MouseEvent e, JTable table, int row, int column, ColoredTableCellRenderer renderer) {
  renderer.getTableCellRendererComponent(table, table.getValueAt(row, column), false, false, row, column);
  final Rectangle rc = table.getCellRect(row, column, false);
  int index = renderer.findFragmentAt(e.getPoint().x - rc.x);
  if (index >= 0) {
    return renderer.getFragmentTag(index);
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:TableLinkMouseListener.java

示例10: forColoredRenderer

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
private Object forColoredRenderer(MouseEvent e, JTable table, int row, int column, ColoredTableCellRenderer renderer) {
  renderer.getTableCellRendererComponent(table, table.getValueAt(row, column), false, false, row, column);
  final Rectangle rc = table.getCellRect(row, column, false);
  int index = renderer.findFragmentAt(e.getPoint().x - rc.x);
  if (index >= 0) {
    return renderer.getFragmentTagAt(index);
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:TableLinkMouseListener.java

示例11: appendSuiteStatusColorPresentation

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
public static void appendSuiteStatusColorPresentation(final SMTestProxy proxy,
                                                      final ColoredTableCellRenderer renderer) {
  int passedCount = 0;
  int errorsCount = 0;
  int failedCount = 0;
  int ignoredCount = 0;

  if (proxy.isLeaf()) {
    // If suite is empty show <no tests> label and exit from method
    renderer.append(RESULTS_NO_TESTS, proxy.wasLaunched() ? PASSED_ATTRIBUTES : DEFFECT_ATTRIBUTES);
    return;
  }

  final List<SMTestProxy> allTestCases = proxy.getAllTests();
  for (SMTestProxy testOrSuite : allTestCases) {
    // we should ignore test suites
    if (testOrSuite.isSuite()) {
      continue;
    }
    // if test check it state
    switch (testOrSuite.getMagnitudeInfo()) {
      case COMPLETE_INDEX:
      case PASSED_INDEX:
        passedCount++;
        break;
      case ERROR_INDEX:
        errorsCount++;
        break;
      case FAILED_INDEX:
        failedCount++;
        break;
      case IGNORED_INDEX:
      case SKIPPED_INDEX:
        ignoredCount++;
        break;
      case NOT_RUN_INDEX:
      case TERMINATED_INDEX:
      case RUNNING_INDEX:
        //Do nothing
        break;
    }
  }

  final String separator = " ";

  if (failedCount > 0) {
    renderer.append(SMTestsRunnerBundle.message(
        "sm.test.runner.ui.tabs.statistics.columns.results.count.msg.failed",
                                    failedCount) + separator,
                    DEFFECT_ATTRIBUTES);
  }

  if (errorsCount > 0) {
    renderer.append(SMTestsRunnerBundle.message(
        "sm.test.runner.ui.tabs.statistics.columns.results.count.msg.errors",
                                    errorsCount) + separator,
                    DEFFECT_ATTRIBUTES);
  }

  if (ignoredCount > 0) {
    renderer.append(SMTestsRunnerBundle.message(
        "sm.test.runner.ui.tabs.statistics.columns.results.count.msg.ignored",
                                    ignoredCount) + separator,
                    SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
  }

  if (passedCount > 0) {
    renderer.append(SMTestsRunnerBundle.message(
        "sm.test.runner.ui.tabs.statistics.columns.results.count.msg.passed",
                                    passedCount),
                    PASSED_ATTRIBUTES);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:74,代码来源:TestsPresentationUtil.java

示例12: DetectedPluginsPanel

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
public DetectedPluginsPanel() {
  super(PluginDownloader.class);
  final JTable entryTable = getEntryTable();
  myHeader = new PluginHeaderPanel(null);
  entryTable.setTableHeader(null);
  entryTable.setDefaultRenderer(PluginDownloader.class, new ColoredTableCellRenderer() {
    protected void customizeCellRenderer(final JTable table,
                                         final Object value,
                                         final boolean selected,
                                         final boolean hasFocus,
                                         final int row,
                                         final int column) {
      setBorder(null);
      final PluginDownloader downloader = (PluginDownloader)value;
      if (downloader != null) {
        final String pluginName = downloader.getPluginName();
        append(pluginName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
        final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(PluginId.getId(downloader.getPluginId()));
        if (ideaPluginDescriptor != null) {
          final String oldPluginName = ideaPluginDescriptor.getName();
          if (!Comparing.strEqual(pluginName, oldPluginName)) {
            append(" - " + oldPluginName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
          }
        }
        final String loadedVersion = downloader.getPluginVersion();
        if (loadedVersion != null || (ideaPluginDescriptor != null && ideaPluginDescriptor.getVersion() != null)) {
          final String installedVersion = ideaPluginDescriptor != null && ideaPluginDescriptor.getVersion() != null
                                          ? "v. " + ideaPluginDescriptor.getVersion() + (loadedVersion != null ? " -> " : "")
                                          : "";
          final String availableVersion = loadedVersion != null ? loadedVersion : "";
          append(" (" + installedVersion + availableVersion + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
        }
      }
    }
  });
  entryTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
      final int selectedRow = entryTable.getSelectedRow();
      if (selectedRow != -1) {
        final PluginDownloader selection = getValueAt(selectedRow);
        final IdeaPluginDescriptor descriptor = selection.getDescriptor();
        if (descriptor != null) {
          PluginManagerMain.pluginInfoUpdate(descriptor, null, myDescriptionPanel, myHeader);
        }
      }
    }
  });
  setCheckboxColumnName("");
  myDescriptionPanel.setPreferredSize(new Dimension(400, -1));
  myDescriptionPanel.setEditable(false);
  myDescriptionPanel.setContentType(UIUtil.HTML_MIME);
  myDescriptionPanel.addHyperlinkListener(new PluginManagerMain.MyHyperlinkListener());
  removeAll();

  final Splitter splitter = new Splitter(false);
  splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(entryTable));
  splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myDescriptionPanel));
  add(splitter, BorderLayout.CENTER);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:60,代码来源:DetectedPluginsPanel.java

示例13: forColoredRenderer

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
private static Object forColoredRenderer(MouseEvent e, JTable table, int row, int column, ColoredTableCellRenderer renderer) {
  renderer.getTableCellRendererComponent(table, table.getValueAt(row, column), false, false, row, column);
  final Rectangle rc = table.getCellRect(row, column, false);
  return renderer.getFragmentTagAt(e.getX() - rc.x);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:TableLinkMouseListener.java

示例14: handleDefaultValue

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
protected boolean handleDefaultValue(VirtualFile file, ColoredTableCellRenderer renderer) {
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:LanguagePerFileConfigurable.java

示例15: DetectedPluginsPanel

import com.intellij.ui.ColoredTableCellRenderer; //导入依赖的package包/类
protected DetectedPluginsPanel() {
  super(PluginDownloader.class);
  final JTable entryTable = getEntryTable();
  entryTable.setTableHeader(null);
  entryTable.setDefaultRenderer(PluginDownloader.class, new ColoredTableCellRenderer() {
    protected void customizeCellRenderer(final JTable table,
                                         final Object value,
                                         final boolean selected,
                                         final boolean hasFocus,
                                         final int row,
                                         final int column) {
      final PluginDownloader downloader = (PluginDownloader)value;
      if (downloader != null) {
        final String pluginName = downloader.getPluginName();
        append(pluginName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
        final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(PluginId.getId(downloader.getPluginId()));
        if (ideaPluginDescriptor != null) {
          final String oldPluginName = ideaPluginDescriptor.getName();
          if (!Comparing.strEqual(pluginName, oldPluginName)) {
            append(" - " + oldPluginName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
          }
        }
        final String loadedVersion = downloader.getPluginVersion();
        if (loadedVersion != null || (ideaPluginDescriptor != null && ideaPluginDescriptor.getVersion() != null)) {
          final String installedVersion = ideaPluginDescriptor != null && ideaPluginDescriptor.getVersion() != null
                                          ? "v. " + ideaPluginDescriptor.getVersion() + (loadedVersion != null ? " -> " : "")
                                          : "";
          final String availableVersion = loadedVersion != null ? loadedVersion : "";
          append(" (" + installedVersion + availableVersion + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
        }
      }
    }
  });
  entryTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
      final int selectedRow = entryTable.getSelectedRow();
      if (selectedRow != -1) {
        final PluginDownloader selection = getValueAt(selectedRow);
        final IdeaPluginDescriptor descriptor = selection.getDescriptor();
        if (descriptor != null) {
          PluginManagerMain.pluginInfoUpdate(descriptor, null, myDescriptionPanel);
        }
      }
    }
  });
  setCheckboxColumnName("");
  myDescriptionPanel.setPreferredSize(new Dimension(400, -1));
  myDescriptionPanel.setEditable(false);
  myDescriptionPanel.setContentType(UIUtil.HTML_MIME);
  myDescriptionPanel.addHyperlinkListener(new PluginManagerMain.MyHyperlinkListener());
  removeAll();

  final Splitter splitter = new Splitter(false);
  splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(entryTable));
  splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myDescriptionPanel));
  add(splitter, BorderLayout.CENTER);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:58,代码来源:DetectedPluginsPanel.java


注:本文中的com.intellij.ui.ColoredTableCellRenderer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。