blob: 6f10824042fc6621be90d4949fc71f9969e4e1b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
## 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.
```java
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](https://user-images.githubusercontent.com/43245524/206871262-73e01588-9e7b-4667-8f5d-0d0bd4d48e43.png)
## 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
|