Skip to content

Commit

Permalink
Fix container for group item count still visible if display count is …
Browse files Browse the repository at this point in the history
…off (#9980)

* Move adding of css-class 'hits' to only if pref settings say to display group count, to remove empty grey boxes if said setting is turned off

* Refactor for easier if-structure and clearer naming

* Modify changelog
  • Loading branch information
BeeJay28 authored Jun 7, 2023
1 parent e4e16d8 commit dc0d10c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue regarding recording redundant prefixes in search history. [#9685](https://github.com/JabRef/jabref/issues/9685)
- We fixed an issue where passing a URL containing a DOI led to a "No entry found" notification. [#9821](https://github.com/JabRef/jabref/issues/9821)
- We fixed some minor visual inconsistencies and issues in the preferences dialog. [#9866](https://github.com/JabRef/jabref/pull/9866)
- The order of save actions is now retained. [#9890](https://github.com/JabRef/jabref/pull/9890)
- We fixed an issue where the order of save actions was not retained in the bib file. [#9890](https://github.com/JabRef/jabref/pull/9890)
- We fixed an issue in the preferences 'External file types' tab ignoring a custom application path in the edit dialog. [#9895](https://github.com/JabRef/jabref/issues/9895)
- We fixed an issue in the preferences where custom columns could be added to the entry table with no qualifier. [#9913](https://github.com/JabRef/jabref/issues/9913)
Expand All @@ -100,7 +101,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixen an issue under Linux where under some systems the file instead of the folder was opened [#9607](https://github.com/JabRef/jabref/issues/9607)
- We fixed an issue where an Automatic Keyword Group could not be deleted in the UI. [#9778](https://github.com/JabRef/jabref/issues/9778)
- We fixed an issue where the citation key pattern `[edtrN_M]` returned the wrong editor. [#9946](https://github.com/JabRef/jabref/pull/9946)

- We fixed an issue where empty grey containers would remain in the groups panel, if displaying of group item count is turned off [#9972](https://github.com/JabRef/jabref/issues/9972)

### Removed

Expand Down
8 changes: 5 additions & 3 deletions src/main/java/org/jabref/gui/groups/GroupTreeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ private StackPane getArrowCell(GroupNodeViewModel viewModel) {

private StackPane createNumberCell(GroupNodeViewModel group) {
final StackPane node = new StackPane();
node.getStyleClass().setAll("hits");
if (!group.isRoot()) {
BindingsHelper.includePseudoClassWhen(node, PSEUDOCLASS_ANYSELECTED,
group.anySelectedEntriesMatchedProperty());
Expand All @@ -275,13 +274,16 @@ private StackPane createNumberCell(GroupNodeViewModel group) {
}
Text text = new Text();
EasyBind.subscribe(preferencesService.getGroupsPreferences().displayGroupCountProperty(),
newValue -> {
shouldDisplayGroupCount -> {
if (text.textProperty().isBound()) {
text.textProperty().unbind();
text.setText("");
}

if (newValue) {
node.getStyleClass().clear();

if (shouldDisplayGroupCount) {
node.getStyleClass().add("hits");
text.textProperty().bind(group.getHits().map(Number::intValue).map(this::getFormattedNumber));
}
});
Expand Down

0 comments on commit dc0d10c

Please sign in to comment.