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

Fix inconsistent sort order in map download list. #12533

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ public MapDownloadSwingTable(final Collection<MapDownloadItem> maps) {
table =
JTableBuilder.<MapDownloadItem>builder()
.columnNames(columnNames)
.rowData(
maps.stream()
.sorted(Comparator.comparing(MapDownloadItem::getMapName))
.collect(Collectors.toList()))
.rowData(maps)
.rowMapper(mapDownloadListing -> rowMapper(mapDownloadListing, tagNames))
.build();
table.getRowSorter().toggleSortOrder(0);
table.addKeyListener(new JTableTypeAheadListener(table, 0));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.google.common.base.Preconditions.checkArgument;

import com.google.common.base.Preconditions;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
Expand Down Expand Up @@ -34,7 +35,7 @@
public class JTableBuilder<T> {

private Function<T, List<String>> rowMapper;
private List<T> rowData;
private Collection<T> rowData;
private List<List<String>> tableData;
private List<String> columnNames;

Expand Down Expand Up @@ -128,7 +129,7 @@ public JTableBuilder<T> tableData(final List<List<String>> tableData) {
return this;
}

public JTableBuilder<T> rowData(final List<T> rowData) {
public JTableBuilder<T> rowData(final Collection<T> rowData) {
this.rowData = rowData;
return this;
}
Expand Down