From 88fd92ea3e39ededfdf69943dc078b97a3cc2a79 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 25 Oct 2019 20:53:11 +0200 Subject: [PATCH 1/2] Bring back the scrollbars --- CHANGELOG.md | 1 + src/main/java/org/jabref/gui/Base.css | 12 ++++++------ src/main/java/org/jabref/gui/BasePanel.java | 6 +----- .../java/org/jabref/gui/maintable/MainTable.java | 12 +----------- .../gui/maintable/SmartConstrainedResizePolicy.java | 6 +++++- 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed9808660c1..1c57dd9fcbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an exception which occurred when closing JabRef. [#5348](https://github.com/JabRef/jabref/issues/5348) - We fixed a few problems that prevented JabFox to communicate with JabRef. [#4737](https://github.com/JabRef/jabref/issues/4737) [#4303](https://github.com/JabRef/jabref/issues/4303) - We fixed an error where the groups containing an entry loose their highlight color when scrolling. [#5022](https://github.com/JabRef/jabref/issues/5022) +- We fixed an error where scrollbar were not shown. [#5374](https://github.com/JabRef/jabref/issues/5374) - We fixed an error where an exception was thrown when merging entries. [#5169](https://github.com/JabRef/jabref/issues/5169) - After assigning an entry to a group, the item count is now properly colored to reflect the new membership of the entry. [#3112](https://github.com/JabRef/jabref/issues/3112) - The group panel is now properly updated when switching between libraries (or when closing/opening one). [#3142](https://github.com/JabRef/jabref/issues/3142) diff --git a/src/main/java/org/jabref/gui/Base.css b/src/main/java/org/jabref/gui/Base.css index 42042f8d668..b7532c4c5eb 100644 --- a/src/main/java/org/jabref/gui/Base.css +++ b/src/main/java/org/jabref/gui/Base.css @@ -87,8 +87,8 @@ -jr-sidepane-header-color: -jr-theme-text; /* Specs for the scrollbars */ - -jr-scrollbar-thumb: -fx-outer-border; - -jr-scrollbar-track: -fx-control-inner-background; + -jr-scrollbar-thumb: derive(-fx-outer-border, -30%); + -jr-scrollbar-track: derive(-fx-control-inner-background, -10%); -jr-separator: derive(-fx-color, -5%); @@ -698,13 +698,13 @@ .scroll-bar { -fx-background-color: transparent; - -fx-opacity: 0; + -fx-opacity: 0.3; } .scroll-bar:horizontal .track, .scroll-bar:vertical .track { -fx-background-color: -jr-scrollbar-track; - -fx-opacity: 0.2; + -fx-opacity: 0.6; -fx-background-radius: 0em; } @@ -718,7 +718,7 @@ .scroll-bar .thumb:hover, .scroll-bar .thumb:pressed { - -fx-background-color: derive(-jr-scrollbar-thumb, -20%); + -fx-background-color: derive(-jr-scrollbar-thumb, -30%); } /* Hide increment and decrement buttons */ @@ -751,7 +751,7 @@ -fx-padding: 0em 0.333em 0em 0.333em; /* 2 4 2 4 */ } -/* Only show scrollbars for hovered elements */ +/* Restore full visibility of scrollbars for active elements */ .list-view:hover .scroll-bar, .tree-view:hover .scroll-bar, .table-view:hover .scroll-bar, diff --git a/src/main/java/org/jabref/gui/BasePanel.java b/src/main/java/org/jabref/gui/BasePanel.java index ecc1673e29b..909d8b38a29 100644 --- a/src/main/java/org/jabref/gui/BasePanel.java +++ b/src/main/java/org/jabref/gui/BasePanel.java @@ -20,7 +20,6 @@ import javafx.beans.binding.Bindings; import javafx.geometry.Orientation; import javafx.scene.Node; -import javafx.scene.control.ScrollPane; import javafx.scene.control.SplitPane; import javafx.scene.layout.StackPane; @@ -745,10 +744,7 @@ public void setupMainPanel() { createMainTable(); - ScrollPane pane = mainTable.getPane(); - pane.setFitToHeight(true); - pane.setFitToWidth(true); - splitPane.getItems().add(pane); + splitPane.getItems().add(mainTable); // Set up name autocompleter for search: setupAutoCompletion(); diff --git a/src/main/java/org/jabref/gui/maintable/MainTable.java b/src/main/java/org/jabref/gui/maintable/MainTable.java index dc9392ff1bd..297bf4505f9 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTable.java +++ b/src/main/java/org/jabref/gui/maintable/MainTable.java @@ -11,7 +11,6 @@ import javax.swing.undo.UndoManager; import javafx.collections.ListChangeListener; -import javafx.scene.control.ScrollPane; import javafx.scene.control.SelectionMode; import javafx.scene.control.TableRow; import javafx.scene.control.TableView; @@ -56,7 +55,6 @@ public class MainTable extends TableView { private final BasePanel panel; - private final ScrollPane pane; private final BibDatabaseContext database; private final UndoManager undoManager; @@ -118,11 +116,7 @@ public MainTable(MainTableDataModel model, JabRefFrame frame, this.panel = panel; - pane = new ScrollPane(this); - pane.setFitToHeight(true); - pane.setFitToWidth(true); - - this.pane.getStylesheets().add(MainTable.class.getResource("MainTable.css").toExternalForm()); + this.getStylesheets().add(MainTable.class.getResource("MainTable.css").toExternalForm()); // Store visual state new PersistenceVisualStateTable(this, Globals.prefs); @@ -335,10 +329,6 @@ public void addSelectionListener(ListChangeListener table) { for (TableColumnBase col : visibleLeafColumns) { double share = col.getPrefWidth() / totalPrefWidth; double newSize = tableWidth * share; + + // Just to make sure that we are staying under the total table width (due to rounding errors) + newSize -= 2; + resize(col, newSize - col.getWidth()); } } @@ -68,7 +72,7 @@ private Boolean constrainedResize(TableView.ResizeFeatures prop) { List> visibleLeafColumns = table.getVisibleLeafColumns(); return constrainedResize(prop, false, - getContentWidth(table), + getContentWidth(table) - 2, visibleLeafColumns); } From bbf60af5ea8c5830e2a45ad813055d245c26bc03 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 26 Oct 2019 10:38:27 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md Co-Authored-By: Christoph --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c57dd9fcbe..95d99a30140 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an exception which occurred when closing JabRef. [#5348](https://github.com/JabRef/jabref/issues/5348) - We fixed a few problems that prevented JabFox to communicate with JabRef. [#4737](https://github.com/JabRef/jabref/issues/4737) [#4303](https://github.com/JabRef/jabref/issues/4303) - We fixed an error where the groups containing an entry loose their highlight color when scrolling. [#5022](https://github.com/JabRef/jabref/issues/5022) -- We fixed an error where scrollbar were not shown. [#5374](https://github.com/JabRef/jabref/issues/5374) +- We fixed an error where scrollbars were not shown. [#5374](https://github.com/JabRef/jabref/issues/5374) - We fixed an error where an exception was thrown when merging entries. [#5169](https://github.com/JabRef/jabref/issues/5169) - After assigning an entry to a group, the item count is now properly colored to reflect the new membership of the entry. [#3112](https://github.com/JabRef/jabref/issues/3112) - The group panel is now properly updated when switching between libraries (or when closing/opening one). [#3142](https://github.com/JabRef/jabref/issues/3142)