From 0205ad3d53811c5168f98f6cc38b0220d6a85d09 Mon Sep 17 00:00:00 2001 From: weisj Date: Mon, 6 Jul 2020 21:13:18 +0200 Subject: [PATCH] Add option to disable tree popups. --- .../weisj/darklaf/ui/tree/DarkTreeUI.java | 14 +++-- .../darklaf/properties/overwrites.properties | 1 + .../darklaf/properties/ui/tree.properties | 63 ++++++++++--------- 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java index bbbc4d95..15a0e2bb 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java @@ -179,8 +179,10 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener, C @Override protected void installListeners() { super.installListeners(); - popupListener = createPopupMouseListener(); - popupListener.install(); + if (UIManager.getBoolean("Tree.showFullRowInPopup")) { + popupListener = createPopupMouseListener(); + popupListener.install(); + } tree.addPropertyChangeListener(this); tree.addMouseListener(selectionListener); } @@ -377,8 +379,10 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener, C @Override protected void uninstallListeners() { super.uninstallListeners(); - popupListener.uninstall(); - popupListener = null; + if (popupListener != null) { + popupListener.uninstall(); + popupListener = null; + } tree.removeMouseListener(selectionListener); tree.removePropertyChangeListener(this); } @@ -550,7 +554,7 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener, C @Override public void update(final Graphics g, final JComponent c) { - popupListener.repaint(); + if (popupListener != null) popupListener.repaint(); super.update(g, c); } diff --git a/core/src/main/resources/com/github/weisj/darklaf/properties/overwrites.properties b/core/src/main/resources/com/github/weisj/darklaf/properties/overwrites.properties index 6e6a865d..e27c2568 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/properties/overwrites.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/properties/overwrites.properties @@ -30,4 +30,5 @@ Tree.renderBooleanAsCheckBox = treeBooleanRenderer TextComponent.roundedSelection = roundedSelection Button.convertIconOnlyToBorderless = borderlessIconButtons Tree.defaultLineStyle = treeLineStyle +Tree.showFullRowInPopup = treeRowPopup ToolTip.defaultStyle = tooltipStyle diff --git a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/tree.properties b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/tree.properties index 870ea80a..da223935 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/tree.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/tree.properties @@ -24,16 +24,16 @@ # # suppress inspection "UnusedProperty" for whole file # -TreeUI = com.github.weisj.darklaf.ui.tree.DarkTreeUI -Tree.editorBorder = com.github.weisj.darklaf.ui.tree.DarkTreeCellBorder -Tree.editorBorderColor = %widgetBorder -Tree.rendererFillBackground = false -Tree.selectionBorderColor = null -Tree.line = %borderFocus -Tree.hash = %borderFocus -Tree.lineFocusSelected = %borderFocus -Tree.lineSelected = %gridLine -Tree.lineUnselected = %gridLine +TreeUI = com.github.weisj.darklaf.ui.tree.DarkTreeUI +Tree.editorBorder = com.github.weisj.darklaf.ui.tree.DarkTreeCellBorder +Tree.editorBorderColor = %widgetBorder +Tree.rendererFillBackground = false +Tree.selectionBorderColor = null +Tree.line = %borderFocus +Tree.hash = %borderFocus +Tree.lineFocusSelected = %borderFocus +Tree.lineSelected = %gridLine +Tree.lineUnselected = %gridLine Tree.background = %Cell.background Tree.backgroundAlternative = %Cell.backgroundAlternative @@ -59,29 +59,30 @@ Tree.inactiveForegroundSelected = %Cell.inactiveForegroundSelected Tree.inactiveForegroundNoFocus = %Cell.inactiveForegroundNoFocus Tree.inactiveSelectedNoFocus = %Cell.inactiveSelectedNoFocus -Tree.textBackground = %textBackground -Tree.rowHeight = 22 -Tree.dropLineColor = %dropForeground +Tree.textBackground = %textBackground +Tree.rowHeight = 22 +Tree.dropLineColor = %dropForeground -Tree.alternateRowColor = false -Tree.renderBooleanAsCheckBox = true -Tree.booleanRenderType = checkBox -Tree.defaultLineStyle = line +Tree.alternateRowColor = false +Tree.renderBooleanAsCheckBox = true +Tree.booleanRenderType = checkBox +Tree.defaultLineStyle = line +Tree.showFullRowInPopup = true -Tree.editorBorderInsets = 2,5,2,5 +Tree.editorBorderInsets = 2,5,2,5 #Icons -Tree.collapsedIcon = navigation/arrowRight.svg[themed] -Tree.expandedIcon = navigation/arrowDown.svg[themed] -Tree.closedIcon = files/folder.svg[themed] -Tree.openIcon = files/folder.svg[themed] -Tree.leafIcon = files/general.svg[themed] -Tree.collapsed.selected.focused.icon = navigation/arrowRightSelected.svg[themed] -Tree.collapsed.selected.unfocused.icon = navigation/arrowRight.svg[themed] -Tree.collapsed.unselected.focused.icon = navigation/arrowRight.svg[themed] -Tree.collapsed.unselected.unfocused.icon = navigation/arrowRight.svg[themed] +Tree.collapsedIcon = navigation/arrowRight.svg[themed] +Tree.expandedIcon = navigation/arrowDown.svg[themed] +Tree.closedIcon = files/folder.svg[themed] +Tree.openIcon = files/folder.svg[themed] +Tree.leafIcon = files/general.svg[themed] +Tree.collapsed.selected.focused.icon = navigation/arrowRightSelected.svg[themed] +Tree.collapsed.selected.unfocused.icon = navigation/arrowRight.svg[themed] +Tree.collapsed.unselected.focused.icon = navigation/arrowRight.svg[themed] +Tree.collapsed.unselected.unfocused.icon = navigation/arrowRight.svg[themed] -Tree.expanded.selected.focused.icon = navigation/arrowDownSelected.svg[themed] -Tree.expanded.selected.unfocused.icon = navigation/arrowDown.svg[themed] -Tree.expanded.unselected.focused.icon = navigation/arrowDown.svg[themed] -Tree.expanded.unselected.unfocused.icon = navigation/arrowDown.svg[themed] +Tree.expanded.selected.focused.icon = navigation/arrowDownSelected.svg[themed] +Tree.expanded.selected.unfocused.icon = navigation/arrowDown.svg[themed] +Tree.expanded.unselected.focused.icon = navigation/arrowDown.svg[themed] +Tree.expanded.unselected.unfocused.icon = navigation/arrowDown.svg[themed]