alt: mod list now sorted by filename ignoring case
This commit is contained in:
@@ -104,7 +104,7 @@ public final class ModListPage extends ListPageBase<ModListPageSkin.ModInfoObjec
|
|||||||
if (exception == null)
|
if (exception == null)
|
||||||
getProperties().put(ModListPage.class, FXUtils.onWeakChangeAndOperate(tab.selectedProperty(), newValue -> {
|
getProperties().put(ModListPage.class, FXUtils.onWeakChangeAndOperate(tab.selectedProperty(), newValue -> {
|
||||||
if (newValue)
|
if (newValue)
|
||||||
itemsProperty().setAll(list.stream().map(ModListPageSkin.ModInfoObject::new).collect(Collectors.toList()));
|
itemsProperty().setAll(list.stream().map(ModListPageSkin.ModInfoObject::new).sorted().collect(Collectors.toList()));
|
||||||
}));
|
}));
|
||||||
else
|
else
|
||||||
getProperties().remove(ModListPage.class);
|
getProperties().remove(ModListPage.class);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import org.jackhuang.hmcl.ui.SVG;
|
|||||||
import org.jackhuang.hmcl.ui.construct.FloatListCell;
|
import org.jackhuang.hmcl.ui.construct.FloatListCell;
|
||||||
import org.jackhuang.hmcl.ui.construct.SpinnerPane;
|
import org.jackhuang.hmcl.ui.construct.SpinnerPane;
|
||||||
import org.jackhuang.hmcl.ui.construct.TwoLineListItem;
|
import org.jackhuang.hmcl.ui.construct.TwoLineListItem;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import static org.jackhuang.hmcl.ui.ToolbarListPageSkin.createToolbarButton;
|
import static org.jackhuang.hmcl.ui.ToolbarListPageSkin.createToolbarButton;
|
||||||
import static org.jackhuang.hmcl.util.StringUtils.isNotBlank;
|
import static org.jackhuang.hmcl.util.StringUtils.isNotBlank;
|
||||||
@@ -131,7 +132,7 @@ class ModListPageSkin extends SkinBase<ModListPage> {
|
|||||||
getChildren().setAll(pane);
|
getChildren().setAll(pane);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ModInfoObject extends RecursiveTreeObject<ModInfoObject> {
|
static class ModInfoObject extends RecursiveTreeObject<ModInfoObject> implements Comparable<ModInfoObject> {
|
||||||
private final BooleanProperty active;
|
private final BooleanProperty active;
|
||||||
private final ModInfo modInfo;
|
private final ModInfo modInfo;
|
||||||
private final String message;
|
private final String message;
|
||||||
@@ -160,5 +161,10 @@ class ModListPageSkin extends SkinBase<ModListPage> {
|
|||||||
ModInfo getModInfo() {
|
ModInfo getModInfo() {
|
||||||
return modInfo;
|
return modInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(@NotNull ModListPageSkin.ModInfoObject o) {
|
||||||
|
return modInfo.getFileName().toLowerCase().compareTo(o.modInfo.getFileName().toLowerCase());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user