-
Notifications
You must be signed in to change notification settings - Fork 273
Full sorting support for resource libraries #5886
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
Merged
cwisniew
merged 5 commits into
RPTools:develop
from
kwvanderlinde:feature/185-sorted-artpacks
Nov 25, 2025
Merged
Full sorting support for resource libraries #5886
cwisniew
merged 5 commits into
RPTools:develop
from
kwvanderlinde:feature/185-sorted-artpacks
Nov 25, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`LibraryUtils` handles the downloading and parsing of the library list, representing the results as a collection of `Library` records. When parsing the library list, it is much more strict about required formats, not permitted empty names, paths, or sizes, and not allowing paths that result in invalid URLs. `LibraryUtils` is also responsible for downloading and installing such a collectionm, though as a separate operation so that the caller can filter the results if desired. With the change in responsibilities, the test for `DownloadListWorker` in `AddResourceDialogTest` have been moved to the new `LibraryUtilsTest` and test `LibraryUtil#parseLibraryList(String)`. The other tests in `AddResourceDialogTest` tested that `LibraryRow` initialized itself properly, but that is no longer a real concern now that it just wraps a `Library` and `Library` is basic record. Error reporting works differently now. Previously, we would show error dialogs to the user any time anything went wrong, often regarding things that have nothing to with them or the current MT installation. E.g., we would show a popup if the server returned an invalid path for a library. What we do now is to collect all the failed installations - regardless of why they failed - and show the user one dialog to inform them which of their desired libraries could not be installed. As a result, some i18n keys have been removed.
The raw `JList` is now a `JList<LibraryRow>`, ensuring that it never contains a `String.` This completely avoids possibilities such as seen in RPTools#343. This is accomplished by moving the informational and error messages out of the `JList` and into a dedicated `JLabel`. This label is only displayed when there is a message to show the user and is completely hidden otherwise.
With the `JTable`, we now have separate columns for the library name and the size. The user can sort by either column by clicking on the column header. With this change, there is no more need for `LibraryRow` as we don't depend on the `#toString()` method of the rows as was needed with `JList`.
The library author is displayed in a new column of the RPTools table. This not only distinguishes it, but allows the user to sort by author in addition to library name or size if they so desire. For backwards compatibility, the author in the download library list is optional (though in practice it already exists in the listing). It's also just not a critical detail, so it's okay if it is missing. If there is no author, the dialog will display the name as "unknown" (`dialog.addresource.unknownAuthor`). With three equal-width columns, there is no longer enough room to display most library names. So we instead assign 60% of the table width to the library name, 25% to the author name, and 15% to the size. The user can resize these if needed, but in practice this appears to provide sufficient room. Once the user resizes any columns, the proportions they set will be preserve even if the table is subsequently resized.
fcc8fca to
36dec6d
Compare
cwisniew
approved these changes
Nov 25, 2025
cwisniew
approved these changes
Nov 25, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Identify the Bug or Feature request
Resolves #185
Description of the Change
At the UI-level, resource libraries in the RPTools tab of the Add Resource to Library dialog are now displayed in a
JTableinstead of aJList, with the library name and size shown in separate columns. This lets the user sort based on either field. We've also added the author to the UI, so the user can now sort based on that as well.Internally, I've pulled the library downloading and parsing logic out of
AddResourceDialogand into a separateLibraryUtilsclass, with theLibraryrecord representing the data parsed out of the downloaded library list. It works roughly as the oldDownloadListWorker, but:CompletionStagefor easier chaining compared toSwingWorkerlongsizes instead ofint. This is just future proofing as no packs are currently anywhere close to 2GB.I've also modified the error handling when installing libraries so that only a single error dialog is shown to the user rather than one per library per failure. The new dialog also tells the user which libraries failed to install, so there's a tiny bit of #5885 sneaking in here.
Final change is to rename the view files to match
AddResourceDialog, as previously they each snuck differentsss in their names, making the association less clear.Possible Drawbacks
Less calories burnt clicking through dialogs on shoddy network connections.
Documentation Notes
The RPTools library list can now be sorted based on library name, author, or size:

Release Notes
This change is