Small improvements to ListOption #89
Merged
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.
This PR adds two small patches to
ListOption<T>.Patch 1: Allow to specify size limits for option lists.
This allows to set a "minimum" and a "maximum" length for the option list, beyond which it may not grow/shrink using the GUI. To facilitate that, the "add entry" and "remove entry" buttons are disabled whenever an operation would break these size constraints.
Patch 2: Allow "reversed" lists that add new options at their end.
ListOptions until now always grew at the top. I had the situation in my mod HaloHUD where I needed a list of entries to grow the opposite way. The workaround is quite ugly: https://github.com/Crendgrim/yaclx/blob/988aa3a7d7efbee935bb412c19681743abfa5a32/common/src/main/java/mod/crend/yaclx/auto/internal/BindingHelper.java#L98
This patch cleans that up by providing an option to the builder to manipulate this behaviour as the mod developer wishes.