Java Code Examples for com.intellij.util.ui.UIUtil#getTableBackground()

The following examples show how to use com.intellij.util.ui.UIUtil#getTableBackground() . 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: RecentChangesPopup.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void updateColors(boolean isSelected) {
  Color bg = isSelected ? UIUtil.getTableSelectionBackground() : UIUtil.getTableBackground();
  Color fg = isSelected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground();

  setColors(bg, fg, myPanel, myActionLabel, myDateLabel, mySpacePanel);
}
 
Example 2
Source File: VcsLogColorManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static Color getDefaultRootColor() {
  return UIUtil.getTableBackground();
}
 
Example 3
Source File: SchemesToImportPopup.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void updateColors(boolean isSelected) {
  Color bg = isSelected ? UIUtil.getTableSelectionBackground() : UIUtil.getTableBackground();
  Color fg = isSelected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground();

  setColors(bg, fg, myPanel, myNameLabel);
}
 
Example 4
Source File: PluginsTableRenderer.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  if (myPluginDescriptor == null) {
    return myPanel;
  }

  myName.setText(myPluginDescriptor.getName() + "  ");

  final Color fg = UIUtil.getTableForeground(isSelected);
  final Color bg = UIUtil.getTableBackground(isSelected);
  final Color grayedFg = isSelected ? fg : new JBColor(Gray._130, Gray._120);
  myName.setForeground(fg);
  myStatus.setForeground(grayedFg);
  myStatus.setIcon(AllIcons.Nodes.Plugin);
  String category = myPluginDescriptor.getCategory();
  myCategory.setForeground(grayedFg);
  if (category != null) {
    myCategory.setText(category.toUpperCase() + " ");
  }

  myPanel.setBackground(bg);
  myLastUpdated.setForeground(grayedFg);
  myLastUpdated.setText("");
  myDownloads.setForeground(grayedFg);
  myDownloads.setText("");

  final PluginNode pluginNode = myPluginDescriptor instanceof PluginNode ? (PluginNode)myPluginDescriptor : null;
  if (pluginNode != null) {
    String downloads = pluginNode.getDownloads();
    if (downloads == null) downloads = "";
    if (downloads.length() > 3) {
      downloads = new DecimalFormat("#,###").format(Integer.parseInt(downloads));
    }
    myDownloads.setText(downloads);

    myRating.setRate(pluginNode.getRating());
    myLastUpdated.setText(DateFormatUtil.formatBetweenDates(pluginNode.getDate(), System.currentTimeMillis()));
  }

  updatePresentation(isSelected, myPluginDescriptor, table.getModel());

  return myPanel;
}
 
Example 5
Source File: PluginManagerMain.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected void init() {
  GuiUtils.replaceJSplitPaneWithIDEASplitter(main);
  myDescriptionTextArea.setEditorKit(UIUtil.getHTMLEditorKit());
  myDescriptionTextArea.setEditable(false);
  myDescriptionTextArea.addHyperlinkListener(new MyHyperlinkListener());

  JScrollPane installedScrollPane = createTable();
  myPluginHeaderPanel = new PluginHeaderPanel(this, getPluginTable());
  myHeader.setBackground(UIUtil.getTextFieldBackground());
  myPluginHeaderPanel.getPanel().setBackground(UIUtil.getTextFieldBackground());
  myPluginHeaderPanel.getPanel().setOpaque(true);

  myHeader.add(myPluginHeaderPanel.getPanel(), BorderLayout.CENTER);
  installTableActions();

  myTablePanel.add(installedScrollPane, BorderLayout.CENTER);
  UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, myPanelDescription);
  myPanelDescription.setBorder(JBUI.Borders.empty(0, 7, 0, 0));

  final JPanel header = new JPanel(new BorderLayout()) {
    @Override
    protected void paintComponent(Graphics g) {
      super.paintComponent(g);
      final Color bg = UIUtil.getTableBackground(false);
      ((Graphics2D)g).setPaint(new GradientPaint(0, 0, ColorUtil.shift(bg, 1.4), 0, getHeight(), ColorUtil.shift(bg, 0.9)));
      g.fillRect(0, 0, getWidth(), getHeight());
    }
  };
  header.setBorder(new CustomLineBorder(JBUI.scale(1), JBUI.scale(1), 0, JBUI.scale(1)));
  final JLabel mySortLabel = new JLabel();
  mySortLabel.setForeground(UIUtil.getLabelDisabledForeground());
  mySortLabel.setBorder(JBUI.Borders.empty(1, 1, 1, 5));
  mySortLabel.setIcon(AllIcons.General.SplitDown);
  mySortLabel.setHorizontalTextPosition(SwingConstants.LEADING);
  header.add(mySortLabel, BorderLayout.EAST);
  myTablePanel.add(header, BorderLayout.NORTH);
  myToolbarPanel.setLayout(new BorderLayout());
  myActionToolbar = ActionManager.getInstance().createActionToolbar("PluginManager", getActionGroup(true), true);
  final JComponent component = myActionToolbar.getComponent();
  myToolbarPanel.add(component, BorderLayout.CENTER);
  myToolbarPanel.add(myFilter, BorderLayout.WEST);
  new ClickListener() {
    @Override
    public boolean onClick(@Nonnull MouseEvent event, int clickCount) {
      JBPopupFactory.getInstance().createActionGroupPopup("Sort by:", createSortersGroup(), DataManager.getInstance().getDataContext(myPluginTable),
                                                          JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true).showUnderneathOf(mySortLabel);
      return true;
    }
  }.installOn(mySortLabel);
  final TableModelListener modelListener = new TableModelListener() {
    @Override
    public void tableChanged(TableModelEvent e) {
      String text = "Sort by:";
      if (myPluginsModel.isSortByStatus()) {
        text += " status,";
      }
      if (myPluginsModel.isSortByRating()) {
        text += " rating,";
      }
      if (myPluginsModel.isSortByDownloads()) {
        text += " downloads,";
      }
      if (myPluginsModel.isSortByUpdated()) {
        text += " updated,";
      }
      text += " name";
      mySortLabel.setText(text);
    }
  };
  myPluginTable.getModel().addTableModelListener(modelListener);
  modelListener.tableChanged(null);

  Border border = new BorderUIResource.LineBorderUIResource(new JBColor(Gray._220, Gray._55), JBUI.scale(1));
  myInfoPanel.setBorder(border);
}