1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.dialogs.changeset;
|
---|
3 |
|
---|
4 | import java.util.Comparator;
|
---|
5 |
|
---|
6 | import javax.swing.table.TableRowSorter;
|
---|
7 |
|
---|
8 | import org.openstreetmap.josm.data.osm.Changeset;
|
---|
9 | import org.openstreetmap.josm.data.osm.User;
|
---|
10 | import org.openstreetmap.josm.tools.AlphanumComparator;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * The row sorter for the changeset table
|
---|
14 | * @since 16826
|
---|
15 | */
|
---|
16 | class ChangesetCacheTableRowSorter extends TableRowSorter<ChangesetCacheManagerModel> {
|
---|
17 |
|
---|
18 | ChangesetCacheTableRowSorter(ChangesetCacheManagerModel model) {
|
---|
19 | super(model);
|
---|
20 |
|
---|
21 | // column 0 - Id
|
---|
22 | setComparator(0, Comparator.comparingInt(Changeset::getId));
|
---|
23 |
|
---|
24 | // column 1 - Upload comment
|
---|
25 | setComparator(1, Comparator.comparing(Changeset::getComment, AlphanumComparator.getInstance()));
|
---|
26 |
|
---|
27 | // column 2 - Open
|
---|
28 | setComparator(2, Comparator.comparing(Changeset::isOpen));
|
---|
29 |
|
---|
30 | // column 3 - User
|
---|
31 | setComparator(3, Comparator.comparing(Changeset::getUser, Comparator.comparing(User::getName)));
|
---|
32 |
|
---|
33 | // column 4 - Created at
|
---|
34 | setComparator(4, Comparator.comparing(Changeset::getCreatedAt));
|
---|
35 |
|
---|
36 | // column 5 - Closed at
|
---|
37 | setComparator(5, Comparator.comparing(Changeset::getClosedAt));
|
---|
38 |
|
---|
39 | // column 6 - Changes
|
---|
40 | setComparator(6, Comparator.comparingInt(Changeset::getChangesCount));
|
---|
41 |
|
---|
42 | // column 7 - Discussions
|
---|
43 | setComparator(7, Comparator.comparingInt(Changeset::getCommentsCount));
|
---|
44 | }
|
---|
45 | }
|
---|