Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge identical group colors #6566

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where the blue and red text colors in the Merge entries dialog were not quite visible [#6334](https://github.com/JabRef/jabref/issues/6334)
- We fixed an issue where underscore character was removed from the file name in the Recent Libraries list in File menu [#6383](https://github.com/JabRef/jabref/issues/6383)
- We fixed an issue where few keyboard shortcuts regarding new entries were missing [#6403](https://github.com/JabRef/jabref/issues/6403)

- We fixed an issue where merge identical group colors and let UI only display identical color once [#6175](https://github.com/JabRef/jabref/issues/6175)
### Removed

- Ampersands are no longer escaped by default in the `bib` file. If you want to keep the current behaviour, you can use the new "Escape Ampersands" formatter as a save action. [#5869](https://github.com/JabRef/jabref/issues/5869)
Expand Down
23 changes: 14 additions & 9 deletions src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

import javax.swing.undo.UndoManager;
Expand Down Expand Up @@ -182,16 +184,19 @@ private Node createGroupColorRegion(BibEntryTableViewModel entry, List<AbstractG
container.setMinWidth(10);
container.setAlignment(Pos.CENTER_LEFT);
container.setPadding(new Insets(0, 2, 0, 2));

Set<Color> colorSet = new HashSet<>();
for (Color groupColor : groupColors) {
Rectangle groupRectangle = new Rectangle();
groupRectangle.getStyleClass().add("groupColumnBackground");
groupRectangle.setWidth(3);
groupRectangle.setHeight(18);
groupRectangle.setFill(groupColor);
groupRectangle.setStrokeWidth(1);

container.getChildren().add(groupRectangle);
if (!colorSet.contains(groupColor)) {
Rectangle groupRectangle = new Rectangle();
groupRectangle.getStyleClass().add("groupColumnBackground");
groupRectangle.setWidth(3);
groupRectangle.setHeight(18);
groupRectangle.setFill(groupColor);
groupRectangle.setStrokeWidth(1);

container.getChildren().add(groupRectangle);
colorSet.add(groupColor);
}
}

String matchedGroupsString = matchedGroups.stream()
Expand Down