Class FileDialogOption
A declarative control added to a native file dialog: a checkbox, a choice list or a text field.
This is the portable way to customize a dialog. Each desktop maps it to its
own widgets (an accessory view on macOS, IFileDialogCustomize on Windows,
gtk_file_chooser_add_choice on Linux, a Swing accessory in the simulator),
and the fallback chooser renders it with Codename One components. Mobile
pickers have a fixed UI and ignore options; check
FileDialogFeatures#OPTIONS before relying on them. The value the user
chose is read back from FileDialogResult#getOptionValue(String).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA checkbox.static final intA choice list.static final intA free text field. -
Method Summary
Modifier and TypeMethodDescriptionstatic FileDialogOptionCreates a checkbox option.static FileDialogOptionCreates a choice list option.defaultValue(String value) Changes the initial value; for a choice it must be one of the choices.String[]The entries of a choice option, empty for other types.The initial value.getId()The key the value is reported under.getLabel()The text shown for the control.intgetType()One of#TYPE_CHECKBOX,#TYPE_CHOICEor#TYPE_TEXT.static FileDialogOptionCreates a text field option.
-
Field Details
-
TYPE_CHECKBOX
public static final int TYPE_CHECKBOXA checkbox. Its value is"true"or"false".- See Also:
-
TYPE_CHOICE
public static final int TYPE_CHOICEA choice list. Its value is the selected choice.- See Also:
-
TYPE_TEXT
public static final int TYPE_TEXTA free text field.- See Also:
-
-
Method Details
-
checkbox
Creates a checkbox option.
Parameters
id: the key its value is reported underlabel: the checkbox textchecked: the initial state
Returns
the option
-
choice
Creates a choice list option. The first choice is selected initially.
Parameters
id: the key its value is reported underlabel: the label shown beside the listchoices: the entries
Returns
the option
-
text
Creates a text field option.
Parameters
id: the key its value is reported underlabel: the label shown beside the fieldvalue: the initial text
Returns
the option
-
defaultValue
Changes the initial value; for a choice it must be one of the choices.
Parameters
value: the initial value
Returns
this option
-
getId
The key the value is reported under.
Returns
the id
-
getType
public int getType()One of
#TYPE_CHECKBOX,#TYPE_CHOICEor#TYPE_TEXT.Returns
the type
-
getLabel
The text shown for the control.
Returns
the label
-
getChoices
The entries of a choice option, empty for other types.
Returns
a copy of the choices
-
getDefaultValue
The initial value.
Returns
the initial value
-