├── .gitignore ├── src └── main │ ├── java │ └── ru │ │ └── nukkitx │ │ ├── forms │ │ ├── FormResponse.java │ │ ├── elements │ │ │ ├── ImageType.java │ │ │ ├── ModalForm.java │ │ │ ├── SimpleForm.java │ │ │ └── CustomForm.java │ │ ├── CustomFormResponse.java │ │ ├── SimpleFormResponse.java │ │ ├── ModalFormResponse.java │ │ └── Form.java │ │ ├── FormAPI.java │ │ └── events │ │ └── EventListener.java │ └── resources │ └── plugin.yml ├── .github └── workflows │ └── maven.yml ├── LICENSE ├── pom.xml ├── README_EN.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea/ 2 | FormAPI.iml 3 | /target/ -------------------------------------------------------------------------------- /src/main/java/ru/nukkitx/forms/FormResponse.java: -------------------------------------------------------------------------------- 1 | package ru.nukkitx.forms; 2 | 3 | public interface FormResponse { 4 | 5 | } -------------------------------------------------------------------------------- /src/main/java/ru/nukkitx/forms/elements/ImageType.java: -------------------------------------------------------------------------------- 1 | package ru.nukkitx.forms.elements; 2 | 3 | public enum ImageType { 4 | PATH, URL 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: FormAPI 2 | main: ru.nukkitx.FormAPI 3 | api: "1.0.9" 4 | version: "${pom.version}" 5 | author: qPexLegendary 6 | load: STARTUP 7 | authors: 8 | - qPexLegendary 9 | - kkdevs 10 | - Hteppl -------------------------------------------------------------------------------- /src/main/java/ru/nukkitx/FormAPI.java: -------------------------------------------------------------------------------- 1 | package ru.nukkitx; 2 | 3 | import cn.nukkit.plugin.PluginBase; 4 | import ru.nukkitx.events.EventListener; 5 | 6 | public class FormAPI extends PluginBase { 7 | @Override 8 | public void onEnable() { 9 | this.getServer().getPluginManager().registerEvents(new EventListener(), this); 10 | } 11 | } -------------------------------------------------------------------------------- /src/main/java/ru/nukkitx/forms/CustomFormResponse.java: -------------------------------------------------------------------------------- 1 | package ru.nukkitx.forms; 2 | 3 | import cn.nukkit.Player; 4 | import cn.nukkit.form.window.FormWindowCustom; 5 | 6 | import java.util.List; 7 | 8 | public interface CustomFormResponse extends FormResponse { 9 | 10 | void handle(Player targetPlayer, FormWindowCustom targetForm, List data); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/ru/nukkitx/forms/SimpleFormResponse.java: -------------------------------------------------------------------------------- 1 | package ru.nukkitx.forms; 2 | 3 | import cn.nukkit.Player; 4 | import cn.nukkit.form.window.FormWindow; 5 | import cn.nukkit.form.window.FormWindowSimple; 6 | 7 | public interface SimpleFormResponse extends FormResponse { 8 | 9 | void handle(Player targetPlayer, FormWindowSimple targetForm, int data); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/ru/nukkitx/forms/ModalFormResponse.java: -------------------------------------------------------------------------------- 1 | package ru.nukkitx.forms; 2 | 3 | import cn.nukkit.Player; 4 | import cn.nukkit.form.window.FormWindow; 5 | import cn.nukkit.form.window.FormWindowModal; 6 | import cn.nukkit.form.window.FormWindowSimple; 7 | 8 | public interface ModalFormResponse extends FormResponse { 9 | 10 | void handle(Player targetPlayer, FormWindowModal targetForm, int data); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Java CI with Maven 5 | 6 | on: 7 | push: 8 | branches: [ FormAPI-2.0 ] 9 | pull_request: 10 | branches: [ FormAPI-2.0 ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Set up JDK 1.8 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: 1.8 23 | - name: Build with Maven 24 | run: mvn -B package --file pom.xml 25 | -------------------------------------------------------------------------------- /src/main/java/ru/nukkitx/forms/Form.java: -------------------------------------------------------------------------------- 1 | package ru.nukkitx.forms; 2 | 3 | import cn.nukkit.Player; 4 | import cn.nukkit.form.window.FormWindow; 5 | 6 | import java.util.HashMap; 7 | 8 | public abstract class Form { 9 | 10 | public static HashMap playersForm = new HashMap<>(); 11 | protected FormWindow form; 12 | 13 | public void send(Player player) { 14 | player.showFormWindow(form); 15 | } 16 | 17 | public static void sendForm(Player player, FormWindow form, ModalFormResponse response){ 18 | playersForm.put(player.getName(), response); 19 | player.showFormWindow(form); 20 | } 21 | 22 | public static void sendForm(Player player, FormWindow form, CustomFormResponse response){ 23 | playersForm.put(player.getName(), response); 24 | player.showFormWindow(form); 25 | } 26 | 27 | public static void sendForm(Player player, FormWindow form, SimpleFormResponse response){ 28 | playersForm.put(player.getName(), response); 29 | player.showFormWindow(form); 30 | } 31 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Terentev Andrey 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | ru.nukkitx 8 | FormAPI 9 | 2.2-SNAPSHOT 10 | 11 | 12 | 13 | 14 | ${basedir}/src/main/resources/ 15 | true 16 | 17 | 18 | 19 | 20 | org.apache.maven.plugins 21 | maven-compiler-plugin 22 | 23 | 8 24 | 8 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | nukkitx 33 | https://repo.nukkitx.com/main 34 | 35 | 36 | 37 | 38 | 39 | cn.nukkit 40 | nukkit 41 | 1.0-SNAPSHOT 42 | provided 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/main/java/ru/nukkitx/forms/elements/ModalForm.java: -------------------------------------------------------------------------------- 1 | package ru.nukkitx.forms.elements; 2 | 3 | import cn.nukkit.Player; 4 | import cn.nukkit.form.window.FormWindowModal; 5 | import ru.nukkitx.forms.Form; 6 | import ru.nukkitx.forms.ModalFormResponse; 7 | 8 | public class ModalForm extends Form { 9 | 10 | public ModalForm(FormWindowModal form){ 11 | this.form = form; 12 | } 13 | 14 | public ModalForm() { 15 | form = new FormWindowModal("", "", "", ""); 16 | } 17 | 18 | public ModalForm(String title) { 19 | form = new FormWindowModal(title, "", "", ""); 20 | } 21 | 22 | public ModalForm(String title, String content) { 23 | form = new FormWindowModal(title, content, "", ""); 24 | } 25 | 26 | public ModalForm(String title, String content, String trueButton) { 27 | form = new FormWindowModal(title, content, trueButton, ""); 28 | } 29 | 30 | public ModalForm(String title, String content, String trueButton, String falseButton) { 31 | form = new FormWindowModal(title, content, trueButton, falseButton); 32 | } 33 | 34 | public void send(Player player, ModalFormResponse response){ 35 | playersForm.put(player.getName(), response); 36 | player.showFormWindow(form); 37 | } 38 | 39 | public ModalForm setTitle(String value) { 40 | ((FormWindowModal) form).setTitle(value); 41 | 42 | return this; 43 | } 44 | 45 | public ModalForm setContent(String value) { 46 | ((FormWindowModal) form).setContent(value); 47 | return this; 48 | } 49 | 50 | public ModalForm setButton1(String value) { 51 | ((FormWindowModal) form).setButton1(value); 52 | return this; 53 | } 54 | 55 | public ModalForm setButton2(String value) { 56 | ((FormWindowModal) form).setButton2(value); 57 | return this; 58 | } 59 | } -------------------------------------------------------------------------------- /README_EN.md: -------------------------------------------------------------------------------- 1 | # FormAPI | NukkitX 2 | 3 | Simple library for creating forms (MCBE Nukkit) 4 | 5 |

6 | Examples: 7 |

8 | SimpleForm 9 | ----------------------------------- 10 |
11 | 12 | ```java 13 | SimpleForm form = new SimpleForm("Test simple form") 14 | .setContent("Sample text") 15 | .addButton("Just a button") 16 | .addButton("Button with diamond", ImageType.PATH, "textures/items/diamond"); 17 | 18 | form.send(player, (targetPlayer, targetForm, data) -> { 19 | if(data == -1) return; 20 | 21 | targetPlayer.sendMessage(data.toString()); 22 | }); 23 | ``` 24 | 25 | ![screenshot of sample](http://images.vfl.ru/ii/1576485918/351dffe3/28924854.png) 26 |

27 | CustomForm 28 | ----------------------------------- 29 |
30 | 31 | ```java 32 | CustomForm form = new CustomForm() 33 | .addLabel("Sample text") 34 | .addDropDown("Sample dropdown", Arrays.asList("Line 1", "Line 2", "Line 3")) 35 | .addInput("Text area") 36 | .addSlider("Slider", 1, 100) 37 | .addStepSlider("Step slider", Arrays.asList("Step 1", "Step 2", "Step 3")) 38 | .addToggle("Just a toggle", false); 39 | 40 | form.send(player, (targetPlayer, targetForm, data) -> { 41 | if(data == null) return; 42 | 43 | targetPlayer.sendMessage(data.toString()); 44 | }); 45 | ``` 46 | 47 | ![screenshot of sample](http://images.vfl.ru/ii/1576486356/8c9f89a6/28924955.png) 48 |

49 | ModalForm 50 | ----------------------------------- 51 |
52 | 53 | ```java 54 | ModalForm form = new ModalForm("It`s a title", "Sample text", "Positive button", "Negative button"); 55 | 56 | form.send(player, (targetPlayer, targetForm, data) -> { 57 | if(data == -1) return; 58 | 59 | targetPlayer.sendMessage(data.toString()); 60 | }); 61 | ``` 62 | 63 | ![screenshot of sample](http://images.vfl.ru/ii/1576486613/7c402664/28925022.png) 64 | ----------------------------------- 65 | Download: https://github.com/qPexLegendary/FormAPI/releases
66 | Example plugin: https://github.com/qPexLegendary/Example-for-FormAPI 67 | -------------------------------------------------------------------------------- /src/main/java/ru/nukkitx/forms/elements/SimpleForm.java: -------------------------------------------------------------------------------- 1 | package ru.nukkitx.forms.elements; 2 | 3 | import cn.nukkit.Player; 4 | import cn.nukkit.form.element.ElementButton; 5 | import cn.nukkit.form.element.ElementButtonImageData; 6 | import cn.nukkit.form.window.FormWindowSimple; 7 | import ru.nukkitx.forms.Form; 8 | import ru.nukkitx.forms.SimpleFormResponse; 9 | 10 | public class SimpleForm extends Form { 11 | 12 | public SimpleForm(FormWindowSimple form){ 13 | this.form = form; 14 | } 15 | 16 | public SimpleForm() { 17 | form = new FormWindowSimple("", ""); 18 | } 19 | 20 | public SimpleForm(String title) { 21 | form = new FormWindowSimple(title, ""); 22 | } 23 | 24 | public SimpleForm(String title, String content) { 25 | form = new FormWindowSimple(title, content); 26 | } 27 | 28 | public void send(Player player, SimpleFormResponse response) { 29 | playersForm.put(player.getName(), response); 30 | player.showFormWindow(form); 31 | } 32 | 33 | public SimpleForm setTitle(String value) { 34 | ((FormWindowSimple) form).setTitle(value); 35 | return this; 36 | } 37 | 38 | public SimpleForm setContent(String value) { 39 | ((FormWindowSimple) form).setContent(value); 40 | return this; 41 | } 42 | 43 | public SimpleForm addContent(String value){ 44 | ((FormWindowSimple) form).setContent(((FormWindowSimple) form).getContent() + value); 45 | return this; 46 | } 47 | 48 | public SimpleForm addContentLine(String value){ 49 | return addContent(value + "\n"); 50 | } 51 | 52 | public SimpleForm addContentOnNextLine(String value){ 53 | return addContent("\n" + value); 54 | } 55 | 56 | public SimpleForm addButton(String text) { 57 | ((FormWindowSimple) form).addButton(new ElementButton(text)); 58 | return this; 59 | } 60 | 61 | public SimpleForm addButton(String text, ImageType type, String ico) { 62 | ElementButton button = new ElementButton(text); 63 | button.addImage(new ElementButtonImageData((type == ImageType.PATH) ? "path" : "url", ico)); 64 | ((FormWindowSimple) form).addButton(button); 65 | return this; 66 | } 67 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FormAPI | NukkitX 2 | 3 | Простой API для создания форм (MCBE Nukkit) 4 | 5 |

6 | Примеры использования: 7 |

8 | SimpleForm 9 | ----------------------------------- 10 |
11 | 12 | ```java 13 | SimpleForm form = new SimpleForm("Тестовая форма") 14 | .setContent("Здесь должен быть какой-то текст, но почему-то его все-таки нет.") 15 | .addButton("Кнопочка") 16 | .addButton("Кнопоча с алмазиком", ImageType.PATH, "textures/items/diamond"); 17 | 18 | form.send(player, (targetPlayer, targetForm, data) -> { 19 | if(data == -1) return; //Если форма закрыта принудительно, то data будет иметь значение -1 20 | 21 | targetPlayer.sendMessage(data.toString()); 22 | }); 23 | ``` 24 | 25 | ![screenshot of sample](http://images.vfl.ru/ii/1576485918/351dffe3/28924854.png) 26 |

27 | CustomForm 28 | ----------------------------------- 29 |
30 | 31 | ```java 32 | CustomForm form = new CustomForm() 33 | .addLabel("Тут должен быть написан какой-то рандомный текст, но написано это.") 34 | .addDropDown("Выпадающий список", Arrays.asList("Вариант 1", "Вариант 2", "Вариант 3")) 35 | .addInput("Текстовое поле") 36 | .addSlider("Ползунок", 1, 100) 37 | .addStepSlider("Пошаговый ползунок", Arrays.asList("Вариант 1", "Вариант 2", "Вариант 3")) 38 | .addToggle("Переключатель", false); 39 | 40 | form.send(player, (targetPlayer, targetForm, data) -> { 41 | if(data == null) return; //Если форма закрыта принудительно, то data будет иметь значение null 42 | 43 | targetPlayer.sendMessage(data.toString()); 44 | }); 45 | ``` 46 | 47 | ![screenshot of sample](http://images.vfl.ru/ii/1576486356/8c9f89a6/28924955.png) 48 |

49 | ModalForm 50 | ----------------------------------- 51 |
52 | 53 | ```java 54 | ModalForm form = new ModalForm("Заголовок", "Текст", "Кнопка 1", "Кнопка 2"); 55 | 56 | form.send(player, (targetPlayer, targetForm, data) -> { 57 | if(data == -1) return; //Если форма закрыта принудительно, то data будет иметь значение -1 58 | 59 | targetPlayer.sendMessage(data.toString()); 60 | }); 61 | ``` 62 | 63 | ![screenshot of sample](http://images.vfl.ru/ii/1576486613/7c402664/28925022.png) 64 | ----------------------------------- 65 | Скачать: https://github.com/qPexLegendary/FormAPI/releases
66 | Пример плагина: https://github.com/qPexLegendary/Example-for-FormAPI 67 | -------------------------------------------------------------------------------- /src/main/java/ru/nukkitx/events/EventListener.java: -------------------------------------------------------------------------------- 1 | package ru.nukkitx.events; 2 | 3 | import cn.nukkit.Player; 4 | import cn.nukkit.event.EventHandler; 5 | import cn.nukkit.event.EventPriority; 6 | import cn.nukkit.event.Listener; 7 | import cn.nukkit.event.player.PlayerFormRespondedEvent; 8 | import cn.nukkit.event.player.PlayerQuitEvent; 9 | import cn.nukkit.form.response.FormResponse; 10 | import cn.nukkit.form.response.FormResponseCustom; 11 | import cn.nukkit.form.response.FormResponseModal; 12 | import cn.nukkit.form.response.FormResponseSimple; 13 | import cn.nukkit.form.window.FormWindow; 14 | import cn.nukkit.form.window.FormWindowCustom; 15 | import cn.nukkit.form.window.FormWindowModal; 16 | import cn.nukkit.form.window.FormWindowSimple; 17 | import ru.nukkitx.forms.CustomFormResponse; 18 | import ru.nukkitx.forms.Form; 19 | import ru.nukkitx.forms.ModalFormResponse; 20 | import ru.nukkitx.forms.SimpleFormResponse; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | public class EventListener implements Listener { 26 | 27 | @EventHandler(priority = EventPriority.HIGH) 28 | public void formResponded(PlayerFormRespondedEvent event) { 29 | Player player = event.getPlayer(); 30 | FormWindow window = event.getWindow(); 31 | FormResponse response = window.getResponse(); 32 | 33 | if (Form.playersForm.containsKey(player.getName())) { 34 | ru.nukkitx.forms.FormResponse temp = Form.playersForm.get(player.getName()); 35 | Form.playersForm.remove(player.getName()); 36 | 37 | Object data; 38 | 39 | if (response == null || event.wasClosed()) { 40 | if(temp instanceof CustomFormResponse){ 41 | ((CustomFormResponse) temp).handle(player, (FormWindowCustom) window, null); 42 | 43 | }else if(temp instanceof ModalFormResponse) { 44 | ((ModalFormResponse) temp).handle(player, (FormWindowModal) window, -1); 45 | 46 | }else if(temp instanceof SimpleFormResponse){ 47 | ((SimpleFormResponse) temp).handle(player, (FormWindowSimple) window, -1); 48 | } 49 | return; 50 | } 51 | 52 | if (window instanceof FormWindowSimple) { 53 | data = ((FormResponseSimple) response).getClickedButtonId(); 54 | ((SimpleFormResponse) temp).handle(player, (FormWindowSimple) window, (int) data); 55 | return; 56 | } 57 | 58 | if (window instanceof FormWindowCustom) { 59 | data = new ArrayList<>(((FormResponseCustom) response).getResponses().values()); 60 | ((CustomFormResponse) temp).handle(player, (FormWindowCustom) window, (List) data); 61 | return; 62 | } 63 | 64 | if (window instanceof FormWindowModal) { 65 | data = ((FormResponseModal) response).getClickedButtonId(); 66 | ((ModalFormResponse) temp).handle(player, (FormWindowModal) window, (int) data); 67 | } 68 | } 69 | } 70 | 71 | @EventHandler(priority = EventPriority.HIGH) 72 | public void playerQuit(PlayerQuitEvent event) { 73 | Player player = event.getPlayer(); 74 | 75 | Form.playersForm.remove(player.getName()); 76 | } 77 | } -------------------------------------------------------------------------------- /src/main/java/ru/nukkitx/forms/elements/CustomForm.java: -------------------------------------------------------------------------------- 1 | package ru.nukkitx.forms.elements; 2 | 3 | import cn.nukkit.Player; 4 | import cn.nukkit.form.element.*; 5 | import cn.nukkit.form.window.FormWindowCustom; 6 | import ru.nukkitx.forms.CustomFormResponse; 7 | import ru.nukkitx.forms.Form; 8 | 9 | import java.util.List; 10 | 11 | public class CustomForm extends Form { 12 | 13 | public CustomForm(FormWindowCustom form){ 14 | this.form = form; 15 | } 16 | 17 | public CustomForm() { 18 | form = new FormWindowCustom(""); 19 | } 20 | 21 | public CustomForm(String title) { 22 | form = new FormWindowCustom(title); 23 | } 24 | 25 | public void send(Player player, CustomFormResponse response){ 26 | playersForm.put(player.getName(), response); 27 | player.showFormWindow(form); 28 | } 29 | 30 | public CustomForm setTitle(String value) { 31 | ((FormWindowCustom) form).setTitle(value); 32 | return this; 33 | } 34 | 35 | public CustomForm addLabel(String value) { 36 | ((FormWindowCustom) form).addElement(new ElementLabel(value)); 37 | return this; 38 | } 39 | 40 | public CustomForm addInput() { 41 | ElementInput element = new ElementInput(""); 42 | ((FormWindowCustom) form).addElement(element); 43 | return this; 44 | } 45 | 46 | public CustomForm addInput(String name) { 47 | ElementInput element = new ElementInput(name); 48 | ((FormWindowCustom) form).addElement(element); 49 | return this; 50 | } 51 | 52 | public CustomForm addInput(String name, String placeholder) { 53 | ElementInput element = new ElementInput(name, placeholder); 54 | ((FormWindowCustom) form).addElement(element); 55 | return this; 56 | } 57 | 58 | public CustomForm addInput(String name, String placeholder, String defaultText) { 59 | ElementInput element = new ElementInput(name, placeholder, defaultText); 60 | ((FormWindowCustom) form).addElement(element); 61 | return this; 62 | } 63 | 64 | public CustomForm addToggle() { 65 | ElementToggle element = new ElementToggle(""); 66 | ((FormWindowCustom) form).addElement(element); 67 | return this; 68 | } 69 | 70 | public CustomForm addToggle(String name) { 71 | ElementToggle element = new ElementToggle(name); 72 | ((FormWindowCustom) form).addElement(element); 73 | return this; 74 | } 75 | 76 | public CustomForm addToggle(String name, boolean defaultValue) { 77 | ElementToggle element = new ElementToggle(name, defaultValue); 78 | ((FormWindowCustom) form).addElement(element); 79 | return this; 80 | } 81 | 82 | public CustomForm addDropDown(String name, List list) { 83 | ElementDropdown element = new ElementDropdown(name, list); 84 | ((FormWindowCustom) form).addElement(element); 85 | 86 | return this; 87 | } 88 | 89 | public CustomForm addDropDown(String name, List list, int defaultValue) { 90 | ElementDropdown element = new ElementDropdown(name, list, defaultValue); 91 | ((FormWindowCustom) form).addElement(element); 92 | return this; 93 | } 94 | 95 | public CustomForm addSlider(String name, int min, int max) { 96 | ElementSlider element = new ElementSlider(name, min, max); 97 | ((FormWindowCustom) form).addElement(element); 98 | 99 | return this; 100 | } 101 | 102 | public CustomForm addSlider(String name, int min, int max, int step) { 103 | ElementSlider element = new ElementSlider(name, min, max, step, 3); 104 | ((FormWindowCustom) form).addElement(element); 105 | return this; 106 | } 107 | 108 | public CustomForm addSlider(String name, int min, int max, int step, int defaultValue) { 109 | ElementSlider element = new ElementSlider(name, min, max, step, defaultValue); 110 | ((FormWindowCustom) form).addElement(element); 111 | return this; 112 | } 113 | 114 | public CustomForm addStepSlider(String name, List list) { 115 | ElementStepSlider element = new ElementStepSlider(name, list); 116 | ((FormWindowCustom) form).addElement(element); 117 | return this; 118 | } 119 | 120 | public CustomForm addStepSlider(String name, List list, int defaultStep) { 121 | ElementStepSlider element = new ElementStepSlider(name, list, defaultStep); 122 | ((FormWindowCustom) form).addElement(element); 123 | return this; 124 | } 125 | } --------------------------------------------------------------------------------