github isXander/YetAnotherConfigLib 2.1.0
v2.1.0

3 years ago

Lists

Implements mutable list options where you can create, remove and shift entries in a list.

API

Lists hack option groups with their own implementation for this, so each individual list takes form as a whole option group.

ListOption.createBuilder(String.class)
    .name(Text.of("List Option"))
    .binding(/* gets and sets a List, requires list field to be not final, does not manipulate the list */)
    .controller(StringController::new) // usual controllers, passed to every entry
    .initial("") // when adding a new entry to the list, this is the initial value it has
    .build()

Implementation details

When implementing this, it was vital to me that all controllers work with lists, not ones specifically designed
for list entries. This was achieved quite easily by having each entry being its own option with an empty name and tooltip with its own controller, that pairs with its list "parent" to actually modify the option.

Option groups were taken advantage of and hacked into its own option, only minor changes had to be made to get this
to work with value application.

Applicable controllers have been modified to expand their inputs to near full width when no name is present.

Screenshots

screenshot

String improvements

  • Allow StringControllerElement to have unlimited text length
  • When pressing Delete in a text field whilst text is highlighted,
    it will act like Backspace like it should.

Other changes

  • Slightly compacted elements

Don't miss a new YetAnotherConfigLib release

NewReleases is sending notifications on new releases.