Module com.gluonhq.charm.glisten
Class DefaultOptionEditorFactory<T>
- java.lang.Object
-
- com.gluonhq.impl.charm.glisten.control.skin.settings.DefaultOptionEditorFactory<T>
-
- Type Parameters:
T
- The type of the property of the Option value
- All Implemented Interfaces:
Callback<Option<T>,OptionEditor<T>>
public class DefaultOptionEditorFactory<T> extends Object implements Callback<Option<T>,OptionEditor<T>>
A default implementation of theCallback
type required by theSettingsPane
option editor factory
. By default this is the implementation used by SettingsPane, but developers may choose to provide their own, or more likely, extend this implementation and override thecall(com.gluonhq.charm.glisten.control.settings.Option)
method to add in support for additional editor types.- See Also:
SettingsPane
-
-
Constructor Summary
Constructors Constructor Description DefaultOptionEditorFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OptionEditor<T>
call(Option<T> option)
Thecall
method is called when required.static OptionEditor<Color>
createColorEditor(Option option)
Creates anOptionEditor
based on aColorPicker
to edit anOption
where the type of its value is aColor
static <T> OptionEditor<T>
createComboBoxEditor(Option<T> option, Collection<T> items)
Creates anOptionEditor
based on aComboBox
to edit anOption
where the type of its value is aCollection
of items of type Tstatic OptionEditor<LocalDate>
createDateEditor(Option option)
Creates anOptionEditor
based on aDatePicker
to edit anOption
where the type of its value is aLocalDate
static OptionEditor<Number>
createNumberEditor(Option<Number> option)
Creates anOptionEditor
based on aTextField
to edit anOption
where the type of its value is aNumber
static OptionEditor<Boolean>
createSwitchEditor(Option option)
Creates anOptionEditor
based on aToggleButton
to edit anOption
where the type of its value is aBoolean
static OptionEditor<String>
createTextEditor(Option option)
Creates anOptionEditor
based on aTextField
to edit anOption
where the type of its value is aString
-
-
-
Method Detail
-
call
public OptionEditor<T> call(Option<T> option)
Thecall
method is called when required. For a givenOption
, it will return anOptionEditor
based on the type of class of itsOption.valueProperty()
or null if this value is null or not available editor was found- Specified by:
call
in interfaceCallback<Option<T>,OptionEditor<T>>
- Parameters:
option
- is the providedOption
of type T- Returns:
- An
OptionEditor
of type T or null
-
createTextEditor
public static final OptionEditor<String> createTextEditor(Option option)
Creates anOptionEditor
based on aTextField
to edit anOption
where the type of its value is aString
- Parameters:
option
-- Returns:
-
createNumberEditor
public static final OptionEditor<Number> createNumberEditor(Option<Number> option)
Creates anOptionEditor
based on aTextField
to edit anOption
where the type of its value is aNumber
- Parameters:
option
-- Returns:
-
createSwitchEditor
public static final OptionEditor<Boolean> createSwitchEditor(Option option)
Creates anOptionEditor
based on aToggleButton
to edit anOption
where the type of its value is aBoolean
- Parameters:
option
-- Returns:
-
createComboBoxEditor
public static final <T> OptionEditor<T> createComboBoxEditor(Option<T> option, Collection<T> items)
Creates anOptionEditor
based on aComboBox
to edit anOption
where the type of its value is aCollection
of items of type T- Parameters:
option
-- Returns:
-
createColorEditor
public static final OptionEditor<Color> createColorEditor(Option option)
Creates anOptionEditor
based on aColorPicker
to edit anOption
where the type of its value is aColor
- Parameters:
option
-- Returns:
-
createDateEditor
public static final OptionEditor<LocalDate> createDateEditor(Option option)
Creates anOptionEditor
based on aDatePicker
to edit anOption
where the type of its value is aLocalDate
- Parameters:
option
-- Returns:
-
-