Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: 2571beb8 by Tony Chemit at 2020-07-27T18:11:02+02:00 Défauts d'affichage dans l'arbre (on peut désormais sélectionner un nœud à partir de la souris quelque soit la position du point) - See #1580 - - - - - 22ea111d by Tony Chemit at 2020-07-27T18:12:55+02:00 Défauts d'affichage dans l'arbre (suppression de la bordure en noire sur la ligne sélectionnée) - See #1580 - - - - - 2 changed files: - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/ObserveNavigationTreeShowPopupAction.java - client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/tree/navigation/NavigationTreeCellRenderer.java Changes: ===================================== client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/ObserveNavigationTreeShowPopupAction.java ===================================== @@ -112,41 +112,53 @@ public class ObserveNavigationTreeShowPopupAction { boolean rightClick = SwingUtilities.isRightMouseButton(e); - if (rightClick) { - - // get the coordinates of the mouse click - Point p = e.getPoint(); + // get the coordinates of the mouse click + Point p = e.getPoint(); - int closestRowForLocation = tree.getClosestRowForLocation(e.getX(), e.getY()); + int closestRowForLocation = tree.getClosestRowForLocation(e.getX(), e.getY()); - int rowToSelect = -1; + int rowToSelect = -1; - if (isRowSelected(closestRowForLocation)) { + if (isRowSelected(closestRowForLocation)) { - rowToSelect = closestRowForLocation; - } - - if (rowToSelect == -1) { - - // try to change selection + rowToSelect = closestRowForLocation; + } - TreePath pathForRow = tree.getPathForRow(closestRowForLocation); - tree.setSelectionPath(pathForRow); + if (rowToSelect == -1) { - if (isRowSelected(closestRowForLocation)) { + // try to change selection - rowToSelect = closestRowForLocation; - } + TreePath pathForRow = tree.getPathForRow(closestRowForLocation); + tree.setSelectionPath(pathForRow); + if (isRowSelected(closestRowForLocation)) { + rowToSelect = closestRowForLocation; } - if (rowToSelect != -1) { - - showPopup(rowToSelect, p); - + } else { + TreePath pathForRow = tree.getPathForRow(rowToSelect); + + Rectangle pathBounds = tree.getPathBounds(pathForRow); + if (e.getClickCount() == 2 && pathBounds != null && !pathBounds.contains(e.getPoint())) { + SwingUtilities.invokeLater(() -> { + if (tree.isExpanded(pathForRow)) { + tree.collapsePath(pathForRow); + } else { + tree.expandPath(pathForRow); + } + }); + e.consume(); + return; } } + if (rowToSelect != -1) { + return; + } + + if (rightClick) { + showPopup(rowToSelect, p); + } } private void openNodeMenu(KeyEvent e) { ===================================== client-datasource-editor-api/src/main/java/fr/ird/observe/client/datasource/editor/tree/navigation/NavigationTreeCellRenderer.java ===================================== @@ -49,6 +49,7 @@ public class NavigationTreeCellRenderer extends DefaultTreeRenderer { defaultVisuals.setForeground(value.getColor()); } super.configureVisuals(context); + rendererComponent.setBorder(null); } } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/9c6b4c4fc789d575df29629f8... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/9c6b4c4fc789d575df29629f8... You're receiving this email because of your account on gitlab.com.