Java Code Examples for com.intellij.util.ui.UIUtil#getDecoratedRowColor()
The following examples show how to use
com.intellij.util.ui.UIUtil#getDecoratedRowColor() .
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: ManagePackagesDialog.java From consulo with Apache License 2.0 | 5 votes |
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (value instanceof RepoPackage) { RepoPackage repoPackage = (RepoPackage) value; String name = repoPackage.getName(); if (myCurrentlyInstalling.contains(name)) { final String colorCode = UIUtil.isUnderDarcula() ? "589df6" : "0000FF"; name = "<html><body>" + repoPackage.getName() + " <font color=\"#" + colorCode + "\">(installing)</font></body></html>"; } myNameLabel.setText(name); myRepositoryLabel.setText(repoPackage.getRepoUrl()); Component orig = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); final Color fg = orig.getForeground(); myNameLabel.setForeground(myInstalledPackages.contains(name) ? JBColor.BLUE : fg); } myRepositoryLabel.setForeground(JBColor.GRAY); final Color bg; if (isSelected) { bg = UIUtil.getListSelectionBackground(); } else { bg = index % 2 == 1 ? UIUtil.getListBackground() : UIUtil.getDecoratedRowColor(); } myPanel.setBackground(bg); myNameLabel.setBackground(bg); myRepositoryLabel.setBackground(bg); return myPanel; }
Example 2
Source File: InspectorTreeUI.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override protected void paintRow(final Graphics g, final Rectangle clipBounds, final Insets insets, final Rectangle bounds, final TreePath path, final int row, final boolean isExpanded, final boolean hasBeenExpanded, final boolean isLeaf) { final int containerWidth = tree.getParent() instanceof JViewport ? tree.getParent().getWidth() : tree.getWidth(); final int xOffset = tree.getParent() instanceof JViewport ? ((JViewport)tree.getParent()).getViewPosition().x : 0; if (path != null && myWideSelection) { boolean selected = tree.isPathSelected(path); Graphics2D rowGraphics = (Graphics2D)g.create(); rowGraphics.setClip(clipBounds); final Object sourceList = tree.getClientProperty(SOURCE_LIST_CLIENT_PROPERTY); Color background = tree.getBackground(); if ((row % 2) == 0 && Boolean.TRUE.equals(tree.getClientProperty(STRIPED_CLIENT_PROPERTY))) { background = UIUtil.getDecoratedRowColor(); } if (sourceList != null && (Boolean)sourceList) { if (selected) { if (tree.hasFocus()) { LIST_FOCUSED_SELECTION_BACKGROUND_PAINTER.paintBorder(tree, rowGraphics, xOffset, bounds.y, containerWidth, bounds.height); } else { LIST_SELECTION_BACKGROUND_PAINTER.paintBorder(tree, rowGraphics, xOffset, bounds.y, containerWidth, bounds.height); } } else if (myWideSelectionCondition.value(row)) { rowGraphics.setColor(background); rowGraphics.fillRect(xOffset, bounds.y, containerWidth, bounds.height); } } else { if (selected && (UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF())) { Color bg = getSelectionBackground(tree, true); if (myWideSelectionCondition.value(row)) { rowGraphics.setColor(bg); rowGraphics.fillRect(xOffset, bounds.y, containerWidth, bounds.height); } } } if (shouldPaintExpandControl(path, row, isExpanded, hasBeenExpanded, isLeaf)) { paintExpandControl(rowGraphics, bounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); } super.paintRow(rowGraphics, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); rowGraphics.dispose(); } else { super.paintRow(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); } }
Example 3
Source File: InspectorTreeUI.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override protected void paintRow(final Graphics g, final Rectangle clipBounds, final Insets insets, final Rectangle bounds, final TreePath path, final int row, final boolean isExpanded, final boolean hasBeenExpanded, final boolean isLeaf) { final int containerWidth = tree.getParent() instanceof JViewport ? tree.getParent().getWidth() : tree.getWidth(); final int xOffset = tree.getParent() instanceof JViewport ? ((JViewport)tree.getParent()).getViewPosition().x : 0; if (path != null && myWideSelection) { boolean selected = tree.isPathSelected(path); Graphics2D rowGraphics = (Graphics2D)g.create(); rowGraphics.setClip(clipBounds); final Object sourceList = tree.getClientProperty(SOURCE_LIST_CLIENT_PROPERTY); Color background = tree.getBackground(); if ((row % 2) == 0 && Boolean.TRUE.equals(tree.getClientProperty(STRIPED_CLIENT_PROPERTY))) { background = UIUtil.getDecoratedRowColor(); } if (sourceList != null && (Boolean)sourceList) { if (selected) { if (tree.hasFocus()) { LIST_FOCUSED_SELECTION_BACKGROUND_PAINTER.paintBorder(tree, rowGraphics, xOffset, bounds.y, containerWidth, bounds.height); } else { LIST_SELECTION_BACKGROUND_PAINTER.paintBorder(tree, rowGraphics, xOffset, bounds.y, containerWidth, bounds.height); } } else if (myWideSelectionCondition.value(row)) { rowGraphics.setColor(background); rowGraphics.fillRect(xOffset, bounds.y, containerWidth, bounds.height); } } else { if (selected && (UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF())) { Color bg = getSelectionBackground(tree, true); if (myWideSelectionCondition.value(row)) { rowGraphics.setColor(bg); rowGraphics.fillRect(xOffset, bounds.y, containerWidth, bounds.height); } } } if (shouldPaintExpandControl(path, row, isExpanded, hasBeenExpanded, isLeaf)) { paintExpandControl(rowGraphics, bounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); } super.paintRow(rowGraphics, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); rowGraphics.dispose(); } else { super.paintRow(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); } }
Example 4
Source File: WideSelectionTreeUI.java From consulo with Apache License 2.0 | 4 votes |
@Override protected void paintRow(final Graphics g, final Rectangle clipBounds, final Insets insets, final Rectangle bounds, final TreePath path, final int row, final boolean isExpanded, final boolean hasBeenExpanded, final boolean isLeaf) { final int containerWidth = tree.getParent() instanceof JViewport ? tree.getParent().getWidth() : tree.getWidth(); final int xOffset = tree.getParent() instanceof JViewport ? ((JViewport)tree.getParent()).getViewPosition().x : 0; if (path != null && myWideSelection) { boolean selected = tree.isPathSelected(path); Graphics2D rowGraphics = (Graphics2D)g.create(); rowGraphics.setClip(clipBounds); final Object sourceList = tree.getClientProperty(SOURCE_LIST_CLIENT_PROPERTY); Color background = tree.getBackground(); if ((row % 2) == 0 && Boolean.TRUE.equals(tree.getClientProperty(STRIPED_CLIENT_PROPERTY))) { background = UIUtil.getDecoratedRowColor(); } if (sourceList != null && (Boolean)sourceList) { if (selected) { if (tree.hasFocus()) { LIST_FOCUSED_SELECTION_BACKGROUND_PAINTER.paintBorder(tree, rowGraphics, xOffset, bounds.y, containerWidth, bounds.height); } else { LIST_SELECTION_BACKGROUND_PAINTER.paintBorder(tree, rowGraphics, xOffset, bounds.y, containerWidth, bounds.height); } } else if (myWideSelectionCondition.value(row)) { rowGraphics.setColor(background); rowGraphics.fillRect(xOffset, bounds.y, containerWidth, bounds.height); } } else { if (selected && (UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF())) { Color bg = getSelectionBackground(tree, true); if (myWideSelectionCondition.value(row)) { rowGraphics.setColor(bg); rowGraphics.fillRect(xOffset, bounds.y, containerWidth, bounds.height); } } } if (shouldPaintExpandControl(path, row, isExpanded, hasBeenExpanded, isLeaf)) { paintExpandControl(rowGraphics, bounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); } super.paintRow(rowGraphics, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); rowGraphics.dispose(); } else { super.paintRow(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); } }