Browse Source

Add option to disable tree popups.

pull/198/head
weisj 4 years ago
parent
commit
0205ad3d53
  1. 14
      core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java
  2. 1
      core/src/main/resources/com/github/weisj/darklaf/properties/overwrites.properties
  3. 63
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/tree.properties

14
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 @Override
protected void installListeners() { protected void installListeners() {
super.installListeners(); super.installListeners();
popupListener = createPopupMouseListener(); if (UIManager.getBoolean("Tree.showFullRowInPopup")) {
popupListener.install(); popupListener = createPopupMouseListener();
popupListener.install();
}
tree.addPropertyChangeListener(this); tree.addPropertyChangeListener(this);
tree.addMouseListener(selectionListener); tree.addMouseListener(selectionListener);
} }
@ -377,8 +379,10 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener, C
@Override @Override
protected void uninstallListeners() { protected void uninstallListeners() {
super.uninstallListeners(); super.uninstallListeners();
popupListener.uninstall(); if (popupListener != null) {
popupListener = null; popupListener.uninstall();
popupListener = null;
}
tree.removeMouseListener(selectionListener); tree.removeMouseListener(selectionListener);
tree.removePropertyChangeListener(this); tree.removePropertyChangeListener(this);
} }
@ -550,7 +554,7 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener, C
@Override @Override
public void update(final Graphics g, final JComponent c) { public void update(final Graphics g, final JComponent c) {
popupListener.repaint(); if (popupListener != null) popupListener.repaint();
super.update(g, c); super.update(g, c);
} }

1
core/src/main/resources/com/github/weisj/darklaf/properties/overwrites.properties

@ -30,4 +30,5 @@ Tree.renderBooleanAsCheckBox = treeBooleanRenderer
TextComponent.roundedSelection = roundedSelection TextComponent.roundedSelection = roundedSelection
Button.convertIconOnlyToBorderless = borderlessIconButtons Button.convertIconOnlyToBorderless = borderlessIconButtons
Tree.defaultLineStyle = treeLineStyle Tree.defaultLineStyle = treeLineStyle
Tree.showFullRowInPopup = treeRowPopup
ToolTip.defaultStyle = tooltipStyle ToolTip.defaultStyle = tooltipStyle

63
core/src/main/resources/com/github/weisj/darklaf/properties/ui/tree.properties

@ -24,16 +24,16 @@
# #
# suppress inspection "UnusedProperty" for whole file # suppress inspection "UnusedProperty" for whole file
# #
TreeUI = com.github.weisj.darklaf.ui.tree.DarkTreeUI TreeUI = com.github.weisj.darklaf.ui.tree.DarkTreeUI
Tree.editorBorder = com.github.weisj.darklaf.ui.tree.DarkTreeCellBorder Tree.editorBorder = com.github.weisj.darklaf.ui.tree.DarkTreeCellBorder
Tree.editorBorderColor = %widgetBorder Tree.editorBorderColor = %widgetBorder
Tree.rendererFillBackground = false Tree.rendererFillBackground = false
Tree.selectionBorderColor = null Tree.selectionBorderColor = null
Tree.line = %borderFocus Tree.line = %borderFocus
Tree.hash = %borderFocus Tree.hash = %borderFocus
Tree.lineFocusSelected = %borderFocus Tree.lineFocusSelected = %borderFocus
Tree.lineSelected = %gridLine Tree.lineSelected = %gridLine
Tree.lineUnselected = %gridLine Tree.lineUnselected = %gridLine
Tree.background = %Cell.background Tree.background = %Cell.background
Tree.backgroundAlternative = %Cell.backgroundAlternative Tree.backgroundAlternative = %Cell.backgroundAlternative
@ -59,29 +59,30 @@ Tree.inactiveForegroundSelected = %Cell.inactiveForegroundSelected
Tree.inactiveForegroundNoFocus = %Cell.inactiveForegroundNoFocus Tree.inactiveForegroundNoFocus = %Cell.inactiveForegroundNoFocus
Tree.inactiveSelectedNoFocus = %Cell.inactiveSelectedNoFocus Tree.inactiveSelectedNoFocus = %Cell.inactiveSelectedNoFocus
Tree.textBackground = %textBackground Tree.textBackground = %textBackground
Tree.rowHeight = 22 Tree.rowHeight = 22
Tree.dropLineColor = %dropForeground Tree.dropLineColor = %dropForeground
Tree.alternateRowColor = false Tree.alternateRowColor = false
Tree.renderBooleanAsCheckBox = true Tree.renderBooleanAsCheckBox = true
Tree.booleanRenderType = checkBox Tree.booleanRenderType = checkBox
Tree.defaultLineStyle = line Tree.defaultLineStyle = line
Tree.showFullRowInPopup = true
Tree.editorBorderInsets = 2,5,2,5 Tree.editorBorderInsets = 2,5,2,5
#Icons #Icons
Tree.collapsedIcon = navigation/arrowRight.svg[themed] Tree.collapsedIcon = navigation/arrowRight.svg[themed]
Tree.expandedIcon = navigation/arrowDown.svg[themed] Tree.expandedIcon = navigation/arrowDown.svg[themed]
Tree.closedIcon = files/folder.svg[themed] Tree.closedIcon = files/folder.svg[themed]
Tree.openIcon = files/folder.svg[themed] Tree.openIcon = files/folder.svg[themed]
Tree.leafIcon = files/general.svg[themed] Tree.leafIcon = files/general.svg[themed]
Tree.collapsed.selected.focused.icon = navigation/arrowRightSelected.svg[themed] Tree.collapsed.selected.focused.icon = navigation/arrowRightSelected.svg[themed]
Tree.collapsed.selected.unfocused.icon = navigation/arrowRight.svg[themed] Tree.collapsed.selected.unfocused.icon = navigation/arrowRight.svg[themed]
Tree.collapsed.unselected.focused.icon = navigation/arrowRight.svg[themed] Tree.collapsed.unselected.focused.icon = navigation/arrowRight.svg[themed]
Tree.collapsed.unselected.unfocused.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.focused.icon = navigation/arrowDownSelected.svg[themed]
Tree.expanded.selected.unfocused.icon = navigation/arrowDown.svg[themed] Tree.expanded.selected.unfocused.icon = navigation/arrowDown.svg[themed]
Tree.expanded.unselected.focused.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.unselected.unfocused.icon = navigation/arrowDown.svg[themed]

Loading…
Cancel
Save