1+ package ru .nukkitx .forms .elements ;
2+
3+ import cn .nukkit .form .element .*;
4+ import cn .nukkit .form .window .FormWindowCustom ;
5+ import ru .nukkitx .forms .Form ;
6+
7+ import java .util .List ;
8+
9+ public class CustomForm extends Form {
10+
11+ public CustomForm () {
12+ form = new FormWindowCustom ("" );
13+ }
14+
15+ public CustomForm (String title ) {
16+ form = new FormWindowCustom (title );
17+ }
18+
19+ public CustomForm setTitle (String value ) {
20+ ((FormWindowCustom ) form ).setTitle (value );
21+ return this ;
22+ }
23+
24+ public CustomForm addLabel (String value ) {
25+ ((FormWindowCustom ) form ).addElement (new ElementLabel (value ));
26+ return this ;
27+ }
28+
29+ public CustomForm addInput () {
30+ ElementInput element = new ElementInput ("" );
31+ ((FormWindowCustom ) form ).addElement (element );
32+ return this ;
33+ }
34+
35+ public CustomForm addInput (String name ) {
36+ ElementInput element = new ElementInput (name );
37+ ((FormWindowCustom ) form ).addElement (element );
38+ return this ;
39+ }
40+
41+ public CustomForm addInput (String name , String placeholder ) {
42+ ElementInput element = new ElementInput (name , placeholder );
43+ ((FormWindowCustom ) form ).addElement (element );
44+ return this ;
45+ }
46+
47+ public CustomForm addInput (String name , String placeholder , String defaultText ) {
48+ ElementInput element = new ElementInput (name , placeholder , defaultText );
49+ ((FormWindowCustom ) form ).addElement (element );
50+ return this ;
51+ }
52+
53+ public CustomForm addToggle () {
54+ ElementToggle element = new ElementToggle ("" );
55+ ((FormWindowCustom ) form ).addElement (element );
56+ return this ;
57+ }
58+
59+ public CustomForm addToggle (String name ) {
60+ ElementToggle element = new ElementToggle (name );
61+ ((FormWindowCustom ) form ).addElement (element );
62+ return this ;
63+ }
64+
65+ public CustomForm addToggle (String name , boolean defaultValue ) {
66+ ElementToggle element = new ElementToggle (name , defaultValue );
67+ ((FormWindowCustom ) form ).addElement (element );
68+ return this ;
69+ }
70+
71+ public CustomForm addDropDown (String name , List <String > list ) {
72+ ElementDropdown element = new ElementDropdown (name , list );
73+ ((FormWindowCustom ) form ).addElement (element );
74+
75+ return this ;
76+ }
77+
78+ public CustomForm addDropDown (String name , List <String > list , int defaultValue ) {
79+ ElementDropdown element = new ElementDropdown (name , list , defaultValue );
80+ ((FormWindowCustom ) form ).addElement (element );
81+ return this ;
82+ }
83+
84+ public CustomForm addSlider (String name , int min , int max ) {
85+ ElementSlider element = new ElementSlider (name , min , max );
86+ ((FormWindowCustom ) form ).addElement (element );
87+
88+ return this ;
89+ }
90+
91+ public CustomForm addSlider (String name , int min , int max , int step ) {
92+ ElementSlider element = new ElementSlider (name , min , max , step , 3 );
93+ ((FormWindowCustom ) form ).addElement (element );
94+ return this ;
95+ }
96+
97+ public CustomForm addSlider (String name , int min , int max , int step , int defaultValue ) {
98+ ElementSlider element = new ElementSlider (name , min , max , step , defaultValue );
99+ ((FormWindowCustom ) form ).addElement (element );
100+ return this ;
101+ }
102+
103+ public CustomForm addStepSlider (String name , List <String > list ) {
104+ ElementStepSlider element = new ElementStepSlider (name , list );
105+ ((FormWindowCustom ) form ).addElement (element );
106+ return this ;
107+ }
108+
109+ public CustomForm addStepSlider (String name , List <String > list , int defaultStep ) {
110+ ElementStepSlider element = new ElementStepSlider (name , list , defaultStep );
111+ ((FormWindowCustom ) form ).addElement (element );
112+ return this ;
113+ }
114+ }
0 commit comments