Skip to content

Commit 124958e

Browse files
committed
Show more than one group color bar
Shows multiple colored bars if the entry belongs to more than one group (with color). Implements #4574.
1 parent d1307a8 commit 124958e

File tree

3 files changed

+75
-68
lines changed

3 files changed

+75
-68
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
1414
### Changed
1515

1616
- We added a short DOI field formatter which shortens DOI to more human readable form. [koppor#343](https://github.com/koppor/jabref/issues/343)
17+
- We improved the display of group memberships by adding multiple colored bars if the entry belongs to more than one group. [#4574](https://github.com/JabRef/jabref/issues/4574)
1718

1819
### Fixed
1920

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

+18-19
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import javafx.scene.control.Tooltip;
1818
import javafx.scene.input.MouseButton;
1919
import javafx.scene.input.MouseEvent;
20+
import javafx.scene.layout.HBox;
2021
import javafx.scene.layout.Pane;
21-
import javafx.scene.layout.StackPane;
2222
import javafx.scene.paint.Color;
2323
import javafx.scene.shape.Rectangle;
2424

@@ -129,27 +129,26 @@ public MainTableColumnFactory(BibDatabaseContext database, ColumnPreferences pre
129129
}
130130

131131
private Node createGroupColorRegion(BibEntryTableViewModel entry, List<AbstractGroup> matchedGroups) {
132-
Color groupColor = matchedGroups.stream()
133-
.flatMap(group -> OptionalUtil.toStream(group.getColor()))
134-
.findFirst()
135-
.orElse(Color.TRANSPARENT);
136-
137-
if (groupColor != Color.TRANSPARENT) {
138-
Rectangle border = new Rectangle();
139-
border.setWidth(5);
140-
border.setHeight(20);
141-
border.setFill(Color.DARKGRAY);
142-
143-
Rectangle groupRectangle = new Rectangle();
144-
groupRectangle.setWidth(3);
145-
groupRectangle.setHeight(18);
146-
groupRectangle.setFill(groupColor);
147-
148-
StackPane container = new StackPane();
132+
List<Color> groupColors = matchedGroups.stream()
133+
.flatMap(group -> OptionalUtil.toStream(group.getColor()))
134+
.collect(Collectors.toList());
135+
136+
if (!groupColors.isEmpty()) {
137+
HBox container = new HBox();
138+
container.setSpacing(2);
149139
container.setMinWidth(10);
150140
container.setAlignment(Pos.CENTER);
151141

152-
container.getChildren().addAll(border,groupRectangle);
142+
for (Color groupColor : groupColors) {
143+
Rectangle groupRectangle = new Rectangle();
144+
groupRectangle.setWidth(3);
145+
groupRectangle.setHeight(18);
146+
groupRectangle.setFill(groupColor);
147+
groupRectangle.setStroke(Color.DARKGRAY);
148+
groupRectangle.setStrokeWidth(1);
149+
150+
container.getChildren().add(groupRectangle);
151+
}
153152

154153
String matchedGroupsString = matchedGroups.stream()
155154
.map(AbstractGroup::getName)

src/test/resources/testbib/complex.bib

+56-49
Original file line numberDiff line numberDiff line change
@@ -21,78 +21,81 @@ @PhdThesis{deBraga2001
2121
@Article{1102917,
2222
author = {E. Bardram},
2323
title = {The trouble with login: on usability and computer security in ubiquitous computing},
24-
journal = {Personal Ubiquitous Comput.},
25-
year = {2005},
26-
volume = {9},
24+
doi = {http://dx.doi.org/10.1007/s00779-005-0347-6},
25+
issn = {1617-4909},
2726
number = {6},
2827
pages = {357--367},
29-
issn = {1617-4909},
30-
doi = {http://dx.doi.org/10.1007/s00779-005-0347-6},
28+
volume = {9},
3129
address = {London, UK},
3230
bdsk-url-1 = {http://dx.doi.org/10.1007/s00779-005-0347-6},
31+
groups = {TestOne, TestTwo},
32+
journal = {Personal Ubiquitous Comput.},
3333
priority = {prio1},
3434
publisher = {Springer-Verlag},
35+
year = {2005},
3536
}
3637

3738
@InProceedings{1137631,
38-
author = {Gustav Bostr\"{o}m and Jaana W\"{a}yrynen and Marine Bod\'{e}n and Konstantin Beznosov and Philippe Kruchten},
39-
title = {Extending XP practices to support security requirements engineering},
39+
author = {Gustav Bostr\"{o}m and Jaana W\"{a}yrynen and Marine Bod\'{e}n and Konstantin Beznosov and Philippe Kruchten, Churchill},
4040
booktitle = {SESS '06: Proceedings of the 2006 international workshop on Software engineering for secure systems},
41-
year = {2006},
42-
publisher = {ACM},
43-
location = {Shanghai, China},
41+
title = {Extending XP practices to support security requirements engineering},
42+
doi = {http://doi.acm.org/10.1145/1137627.1137631},
4443
isbn = {1-59593-411-1},
44+
location = {Shanghai, China},
4545
pages = {11--18},
46-
doi = {http://doi.acm.org/10.1145/1137627.1137631},
46+
publisher = {ACM},
4747
address = {New York, NY, USA},
4848
bdsk-url-1 = {http://doi.acm.org/10.1145/1137627.1137631},
4949
file = {:/Volumes/iDisk/Freie Universität Berlin/Semester 9/Softwareprozesse/p11-bostrom.pdf:PDF},
50-
groups = {StaticGroup},
50+
groups = {StaticGroup, TestOneSubOne, TestOneSubTwo, TestOne, TestTwo},
51+
year = {2006},
5152
}
5253

53-
@INPROCEEDINGS{1132768,
54-
author = {Christina Braz and Jean-Marc Robert},
55-
title = {Security and usability: the case of the user authentication methods},
56-
booktitle = {IHM '06: Proceedings of the 18th International Conferenceof the Association
57-
Francophone d'Interaction Homme-Machine},
58-
year = {2006},
59-
pages = {199--203},
60-
address = {New York, NY, USA},
61-
publisher = {ACM},
54+
@InProceedings{1132768,
55+
author = {Christina Braz and Jean-Marc Robert},
56+
booktitle = {IHM '06: Proceedings of the 18th International Conferenceof the Association Francophone d'Interaction Homme-Machine},
57+
title = {Security and usability: the case of the user authentication methods},
58+
doi = {http://doi.acm.org/10.1145/1132736.1132768},
59+
isbn = {1-59593-350-6},
60+
location = {Montreal, Canada},
61+
pages = {199--203},
62+
publisher = {ACM},
63+
address = {New York, NY, USA},
6264
bdsk-url-1 = {http://doi.acm.org/10.1145/1132736.1132768},
63-
doi = {http://doi.acm.org/10.1145/1132736.1132768},
64-
isbn = {1-59593-350-6},
65-
location = {Montreal, Canada}
65+
groups = {TestOneSubTwo, TestOneSubOne},
66+
year = {2006},
6667
}
6768

6869
@InProceedings{1137628,
6970
author = {Danilo Bruschi and Bart De Win and Mattia Monga},
70-
title = {Introduction to software engineering for secure systems: SESS06 -- secure by design},
7171
booktitle = {SESS '06: Proceedings of the 2006 international workshop on Software engineering for secure systems},
72-
year = {2006},
73-
publisher = {ACM},
74-
location = {Shanghai, China},
72+
title = {Introduction to software engineering for secure systems: SESS06 -- secure by design},
73+
doi = {http://doi.acm.org/10.1145/1137627.1137628},
7574
isbn = {1-59593-411-1},
75+
location = {Shanghai, China},
7676
pages = {1--2},
77-
doi = {http://doi.acm.org/10.1145/1137627.1137628},
77+
publisher = {ACM},
7878
address = {New York, NY, USA},
7979
bdsk-url-1 = {http://doi.acm.org/10.1145/1137627.1137628},
80+
groups = {TestTwo},
8081
readstatus = {read},
82+
year = {2006},
8183
}
8284

83-
@ARTICLE{1373163,
84-
author = {Elizabeth Churchill and Les Nelson and Diana K. Smetters},
85-
title = {Useful Computer Security},
86-
journal = {IEEE Internet Computing},
87-
year = {2008},
88-
volume = {12},
89-
pages = {10--12},
90-
number = {3},
91-
address = {Piscataway, NJ, USA},
85+
@Article{1373163,
86+
author = {Elizabeth Churchill and Les Nelson and Diana K. Smetters},
87+
title = {Useful Computer Security},
88+
doi = {http://dx.doi.org/10.1109/MIC.2008.67},
89+
issn = {1089-7801},
90+
number = {3},
91+
pages = {10--12},
92+
volume = {12},
93+
address = {Piscataway, NJ, USA},
9294
bdsk-url-1 = {http://dx.doi.org/10.1109/MIC.2008.67},
93-
doi = {http://dx.doi.org/10.1109/MIC.2008.67},
94-
issn = {1089-7801},
95-
publisher = {IEEE Educational Activities Department}
95+
groups = {TestOne},
96+
journal = {IEEE Internet Computing},
97+
publisher = {IEEE Educational Activities Department},
98+
year = {2008},
9699
}
97100

98101
@Article{820136,
@@ -136,17 +139,17 @@ @INPROCEEDINGS{1143122
136139

137140
@InProceedings{1233448,
138141
author = {Cheryl Hinds and Chinedu Ekwueme},
139-
title = {Increasing security and usability of computer systems with graphical passwords},
140142
booktitle = {ACM-SE 45: Proceedings of the 45th annual southeast regional conference},
141-
publisher = {ACM},
142-
location = {Winston-Salem, North Carolina},
143+
title = {Increasing security and usability of computer systems with graphical passwords},
144+
doi = {http://doi.acm.org/10.1145/1233341.1233448},
143145
isbn = {978-1-59593-629-5},
146+
location = {Winston-Salem, North Carolina},
144147
pages = {529--530},
145-
doi = {http://doi.acm.org/10.1145/1233341.1233448},
146-
abstract = {Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec id bibendum magna, ac tristique nulla. Aliquam ut vulputate velit, ac vulputate leo. Sed malesuada nisi eget lacus rhoncus, et feugiat libero suscipit. Sed vitae ultricies diam. Phasellus arcu tellus, scelerisque a lorem quis, molestie fermentum mi. Morbi nibh ante, sodales at nisl nec, tincidunt dapibus leo. Praesent auctor egestas commodo. Cras elit erat, accumsan a felis at, malesuada iaculis risus. Nunc in tincidunt metus. },
148+
publisher = {ACM},
149+
abstract = {Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec id bibendum magna, ac tristique nulla. Aliquam ut vulputate velit, ac vulputate leo. Sed malesuada nisi eget lacus rhoncus, et feugiat libero suscipit. Sed vitae ultricies diam. Phasellus arcu tellus, scelerisque a lorem quis, molestie fermentum mi. Morbi nibh ante, sodales at nisl nec, tincidunt dapibus leo. Praesent auctor egestas commodo. Cras elit erat, accumsan a felis at, malesuada iaculis risus. Nunc in tincidunt metus.},
147150
address = {New York, NY, USA},
148151
bdsk-url-1 = {http://doi.acm.org/10.1145/1233341.1233448},
149-
groups = {StaticGroup},
152+
groups = {StaticGroup, TestOneSubOne},
150153
year = {2007},
151154
}
152155

@@ -303,8 +306,12 @@ @Comment{jabref-meta:
303306
@Comment{jabref-meta: grouping:
304307
0 AllEntriesGroup:;
305308
1 StaticGroup:StaticGroup\;0\;1\;0x6d74baff\;\;A test static group\;;
306-
1 KeywordGroup:DynamicGroup\;0\;author\;Churchill\;0\;0\;1\;0x5eba7dff\;\;\;;
307-
1 AutomaticPersonsGroup:Automatic group (Authors)\;0\;author\;1\;\;\;Automatic group for all authors\;;
309+
1 KeywordGroup:DynamicGroup\;0\;author\;Churchill\;0\;0\;0\;0x5eba7dff\;\;\;;
310+
1 AutomaticPersonsGroup:Automatic group (Authors)\;0\;author\;0\;\;\;Automatic group for all authors\;;
311+
1 StaticGroup:TestOne\;0\;1\;0x311b92ff\;\;\;;
312+
2 StaticGroup:TestOneSubOne\;0\;1\;0xff7043ff\;\;\;;
313+
2 StaticGroup:TestOneSubTwo\;0\;1\;0x00bcd4ff\;\;\;;
314+
1 StaticGroup:TestTwo\;0\;0\;0x5d4037ff\;\;\;;
308315
}
309316
310317
@Comment{jabref-meta: keypattern_article:articleTest;}

0 commit comments

Comments
 (0)