blob: b300a6a5475f61503d47925bee428fe073b5cf7a (
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
41
42
43
44
45
46
47
48
49
|
package dev.isxander.yacl3.impl.controller;
import dev.isxander.yacl3.api.Controller;
import dev.isxander.yacl3.api.Option;
import dev.isxander.yacl3.api.controller.DropdownStringControllerBuilder;
import dev.isxander.yacl3.gui.controllers.dropdown.DropdownStringController;
import java.util.Arrays;
import java.util.List;
public class DropdownStringControllerBuilderImpl extends StringControllerBuilderImpl implements DropdownStringControllerBuilder {
private List<String> values;
private boolean allowEmptyValue = false;
private boolean allowAnyValue = false;
public DropdownStringControllerBuilderImpl(Option<String> option) {
super(option);
}
@Override
public DropdownStringControllerBuilder values(List<String> values) {
this.values = values;
return this;
}
@Override
public DropdownStringControllerBuilderImpl values(String... values) {
this.values = Arrays.asList(values);
return this;
}
@Override
public DropdownStringControllerBuilderImpl allowEmptyValue(boolean allowEmptyValue) {
this.allowEmptyValue = allowEmptyValue;
return this;
}
@Override
public DropdownStringControllerBuilderImpl allowAnyValue(boolean allowAnyValue) {
this.allowAnyValue = allowAnyValue;
return this;
}
@Override
public Controller<String> build() {
return new DropdownStringController(option, values, allowEmptyValue, allowAnyValue);
}
}
|