mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[ui] add possibility to disable row hovering in tables for one row
Table api allows disabling hover for whole tables, and sometimes it's needed to disable hover for some rows (e.g. separators) GitOrigin-RevId: 05378dce11134fb7590583f106366a783dc74547
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0ee47cd0db
commit
a4e89fb0c3
@@ -738,7 +738,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
|
||||
}
|
||||
}
|
||||
else {
|
||||
Color hovered = isHoverPaintingDisabled(this) ? null : getHoveredRowBackground();
|
||||
Color hovered = isHoverPaintingDisabled(this) || isHoverPaintingDisabled(component) ? null : getHoveredRowBackground();
|
||||
if (hovered != null) {
|
||||
if (row == TableHoverListener.getHoveredRow(this)) {
|
||||
setRendererBackground(component, hovered);
|
||||
|
||||
@@ -162,6 +162,10 @@ public final class RenderingUtil {
|
||||
return Boolean.FALSE.equals(component.getClientProperty(PAINT_HOVERED_BACKGROUND));
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void setHoverPaintingDisabled(@NotNull JComponent component, boolean disabled) {
|
||||
component.putClientProperty(PAINT_HOVERED_BACKGROUND, !disabled);
|
||||
}
|
||||
public static @Nullable Color getHoverBackground(@NotNull JList<?> list) {
|
||||
if (isHoverPaintingDisabled(list)) return null;
|
||||
return CurrentTheme.List.Hover.background(isFocused(list));
|
||||
|
||||
Reference in New Issue
Block a user