Skip to content

Commit 2d92872

Browse files
Bring back the scrollbars (#5515)
* Bring back the scrollbars * Update CHANGELOG.md Co-Authored-By: Christoph <[email protected]>
1 parent b8d00f2 commit 2d92872

File tree

5 files changed

+14
-23
lines changed

5 files changed

+14
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
2828
- We fixed an exception which occurred when closing JabRef. [#5348](https://github.com/JabRef/jabref/issues/5348)
2929
- 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)
3030
- We fixed an error where the groups containing an entry loose their highlight color when scrolling. [#5022](https://github.com/JabRef/jabref/issues/5022)
31+
- We fixed an error where scrollbars were not shown. [#5374](https://github.com/JabRef/jabref/issues/5374)
3132
- We fixed an error where an exception was thrown when merging entries. [#5169](https://github.com/JabRef/jabref/issues/5169)
3233
- We fixed an error where certain metadata items were not serialized alphabetically.
3334
- 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)

src/main/java/org/jabref/gui/Base.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
-jr-sidepane-header-color: -jr-theme-text;
8888

8989
/* Specs for the scrollbars */
90-
-jr-scrollbar-thumb: -fx-outer-border;
91-
-jr-scrollbar-track: -fx-control-inner-background;
90+
-jr-scrollbar-thumb: derive(-fx-outer-border, -30%);
91+
-jr-scrollbar-track: derive(-fx-control-inner-background, -10%);
9292

9393
-jr-separator: derive(-fx-color, -5%);
9494

@@ -698,13 +698,13 @@
698698

699699
.scroll-bar {
700700
-fx-background-color: transparent;
701-
-fx-opacity: 0;
701+
-fx-opacity: 0.3;
702702
}
703703

704704
.scroll-bar:horizontal .track,
705705
.scroll-bar:vertical .track {
706706
-fx-background-color: -jr-scrollbar-track;
707-
-fx-opacity: 0.2;
707+
-fx-opacity: 0.6;
708708
-fx-background-radius: 0em;
709709
}
710710

@@ -718,7 +718,7 @@
718718

719719
.scroll-bar .thumb:hover,
720720
.scroll-bar .thumb:pressed {
721-
-fx-background-color: derive(-jr-scrollbar-thumb, -20%);
721+
-fx-background-color: derive(-jr-scrollbar-thumb, -30%);
722722
}
723723

724724
/* Hide increment and decrement buttons */
@@ -751,7 +751,7 @@
751751
-fx-padding: 0em 0.333em 0em 0.333em; /* 2 4 2 4 */
752752
}
753753

754-
/* Only show scrollbars for hovered elements */
754+
/* Restore full visibility of scrollbars for active elements */
755755
.list-view:hover .scroll-bar,
756756
.tree-view:hover .scroll-bar,
757757
.table-view:hover .scroll-bar,

src/main/java/org/jabref/gui/BasePanel.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import javafx.beans.binding.Bindings;
2121
import javafx.geometry.Orientation;
2222
import javafx.scene.Node;
23-
import javafx.scene.control.ScrollPane;
2423
import javafx.scene.control.SplitPane;
2524
import javafx.scene.layout.StackPane;
2625

@@ -745,10 +744,7 @@ public void setupMainPanel() {
745744

746745
createMainTable();
747746

748-
ScrollPane pane = mainTable.getPane();
749-
pane.setFitToHeight(true);
750-
pane.setFitToWidth(true);
751-
splitPane.getItems().add(pane);
747+
splitPane.getItems().add(mainTable);
752748

753749
// Set up name autocompleter for search:
754750
setupAutoCompletion();

src/main/java/org/jabref/gui/maintable/MainTable.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import javax.swing.undo.UndoManager;
1212

1313
import javafx.collections.ListChangeListener;
14-
import javafx.scene.control.ScrollPane;
1514
import javafx.scene.control.SelectionMode;
1615
import javafx.scene.control.TableRow;
1716
import javafx.scene.control.TableView;
@@ -56,7 +55,6 @@ public class MainTable extends TableView<BibEntryTableViewModel> {
5655

5756
private final BasePanel panel;
5857

59-
private final ScrollPane pane;
6058
private final BibDatabaseContext database;
6159
private final UndoManager undoManager;
6260

@@ -118,11 +116,7 @@ public MainTable(MainTableDataModel model, JabRefFrame frame,
118116

119117
this.panel = panel;
120118

121-
pane = new ScrollPane(this);
122-
pane.setFitToHeight(true);
123-
pane.setFitToWidth(true);
124-
125-
this.pane.getStylesheets().add(MainTable.class.getResource("MainTable.css").toExternalForm());
119+
this.getStylesheets().add(MainTable.class.getResource("MainTable.css").toExternalForm());
126120

127121
// Store visual state
128122
new PersistenceVisualStateTable(this, Globals.prefs);
@@ -335,10 +329,6 @@ public void addSelectionListener(ListChangeListener<? super BibEntryTableViewMod
335329
getSelectionModel().getSelectedItems().addListener(listener);
336330
}
337331

338-
public ScrollPane getPane() {
339-
return pane;
340-
}
341-
342332
public MainTableDataModel getTableModel() {
343333
return model;
344334
}

src/main/java/org/jabref/gui/maintable/SmartConstrainedResizePolicy.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ private Boolean initColumnSize(TableView<?> table) {
4242
for (TableColumnBase col : visibleLeafColumns) {
4343
double share = col.getPrefWidth() / totalPrefWidth;
4444
double newSize = tableWidth * share;
45+
46+
// Just to make sure that we are staying under the total table width (due to rounding errors)
47+
newSize -= 2;
48+
4549
resize(col, newSize - col.getWidth());
4650
}
4751
}
@@ -68,7 +72,7 @@ private Boolean constrainedResize(TableView.ResizeFeatures<?> prop) {
6872
List<? extends TableColumnBase<?, ?>> visibleLeafColumns = table.getVisibleLeafColumns();
6973
return constrainedResize(prop,
7074
false,
71-
getContentWidth(table),
75+
getContentWidth(table) - 2,
7276
visibleLeafColumns);
7377
}
7478

0 commit comments

Comments
 (0)