Package pt.tecnico.uilib.forms
Class Form
java.lang.Object
pt.tecnico.uilib.forms.Form
A Form has a set of input fields.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBooleanField
(String key, String label) void
addIntegerField
(String key, String label) void
addOptionField
(String key, String label, String... options) void
addRealField
(String key, String label) void
addStringField
(String key, String label) booleanField
(String key) void
clear()
Clear the form.static Boolean
Collection<Field<?>>
entries()
Field<?>
integerField
(String key) optionField
(String key) parse()
Request the parsing of all the form's fields, clearing previous field values.parse
(boolean clear) Request the parsing of all the form's fields.static Integer
requestInteger
(String prompt) static String
requestOption
(String prompt, String... options) static Double
requestReal
(String prompt) static String
requestString
(String prompt) stringField
(String key) title()
-
Constructor Details
-
Form
public Form()use default values: static UI and no title -
Form
- Parameters:
title
- the title
-
Form
- Parameters:
ui
- the dialog drivertitle
- the title
-
-
Method Details
-
title
- Returns:
- the title of the Form (can be null)
-
entries
- Returns:
- a copy of the Form's fields
-
field
- Parameters:
key
-- Returns:
- a copy of the Input requests of the Form
-
addBooleanField
- Parameters:
key
-label
-
-
addStringField
- Parameters:
key
-label
-
-
addRealField
- Parameters:
key
-label
-
-
addIntegerField
- Parameters:
key
-label
-
-
addOptionField
- Parameters:
key
-label
-options
-
-
booleanField
- Parameters:
key
-- Returns:
- field value
-
stringField
- Parameters:
key
-- Returns:
- field value
-
optionField
- Parameters:
key
-- Returns:
- field value
-
realField
- Parameters:
key
-- Returns:
- field value
-
integerField
- Parameters:
key
-- Returns:
- field value
-
parse
Request the parsing of all the form's fields, clearing previous field values.- Returns:
- the form
-
parse
Request the parsing of all the form's fields.- Parameters:
clear
- if true, field values are first cleared; otherwise, previous field values are used as default values.- Returns:
- the form
-
clear
public void clear()Clear the form. -
confirm
-
requestInteger
-
requestReal
-
requestString
-
requestOption
-