Interface EnumSwitchField<F extends EnumSwitchField<F>>
- All Superinterfaces:
Comparable<F>,Component<F>,Copyable<F>,Field<F>,FormComponent<F>,Serializable
- All Known Implementing Classes:
DefaultEnumSwitchField
Defines a type of field use to display enumerated values in a boolean-like toggle switch
component. However, unlike boolean, there can be as many switch values as enumerated values.
Generally,
SelectField is preferred as it presents a dropdown, but there may be special
cases where a switch that shows all available values at once in a row is desired.
This component also automatically adds an empty value or "None" to display if the field is not required to allow nulling it out.
- Since:
- 2.x.x
- Author:
- Nathan Moore (nathandmoore)
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault FRemoves all the options from the select field.default FSets theEnumSwitchField.Attributes.DISPLAY_SINGLEattribute to true.default FdisplaySingle(boolean value) Sets theEnumSwitchField.Attributes.DISPLAY_SINGLEattribute.default FSets theEnumSwitchField.Attributes.DISPLAY_SINGLEattribute to false.default Foption(SelectOption... options) Provides options which can be selected by a select field.default FProvides an option which can be selected by a select field.default <O extends SelectOption>
Foptions(Collection<O> optionsToAdd) Provides options which can be selected by a select field using a collection ofSelectOptions.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.broadleafcommerce.metadata.dsl.core.Component
addAction, addAction, addComponent, addEndpoint, addEndpoint, apply, attribute, augmentationKey, classifier, clearConditionals, clearEndpoints, conditional, conditionals, description, description, findAction, findAction, findActions, findAttribute, findAttribute, findComponent, findComponent, findComponents, findEndpoint, findEndpoint, findEndpoint, findEndpoints, get, get, getAction, getAction, getActions, getActionsList, getAttribute, getAttribute, getAttributes, getAugmentationKey, getClassifier, getComponent, getComponent, getComponents, getComponentsList, getConditionals, getDescription, getEndpoint, getEndpoint, getEndpoints, getEndpointsList, getId, getLabel, getOrder, getScope, getType, hasAction, hasAttribute, hasComponent, hasEndpoint, id, isAugmentable, isTranslatable, label, label, notTranslatable, order, removeAction, removeAttribute, removeComponent, removeEndpoint, scope, self, setActions, setAttributes, setAugmentationKey, setClassifier, setComponents, setConditionals, setDescription, setEndpoints, setId, setLabel, setOrder, setScope, setTranslatable, setType, translatable, translatable, typeMethods inherited from interface com.broadleafcommerce.metadata.dsl.core.Field
clearReadOnlyConditionals, decorated, decorated, defaultValue, getDefaultValue, getName, getPlaceholder, getReadOnlyConditionals, getRequiredMessage, getValidationSchema, isReadOnly, isRequired, isShowInQueryBuilder, isTargetCollection, name, notReadOnly, notRequired, placeholder, placeholder, readOnly, readOnly, readOnlyConditional, readOnlyConditionals, required, required, required, required, requiredMessage, requiredMessage, setDefaultValue, setName, setPlaceholder, setReadOnly, setReadOnlyConditionals, setRequired, setRequiredMessage, setShowInQueryBuilder, setValidationSchema, targetIsCollection, targetIsNotCollection, validationMethod, validationSchema, validationSchemaMethods inherited from interface com.broadleafcommerce.metadata.dsl.core.FormComponent
getHelpText, getHint, getTooltip, helpText, helpText, helpText, hidden, hidden, hint, hint, isHidden, notHidden, setHelpText, setHidden, setHint, setTooltip, tooltip, tooltip
-
Method Details
-
displaySingle
Sets theEnumSwitchField.Attributes.DISPLAY_SINGLEattribute.- Parameters:
value- the value to set- Returns:
- this
-
displaySingle
Sets theEnumSwitchField.Attributes.DISPLAY_SINGLEattribute to true.- Returns:
- this
-
notDisplaySingle
Sets theEnumSwitchField.Attributes.DISPLAY_SINGLEattribute to false.- Returns:
- this
-
option
Provides an option which can be selected by a select field.- Parameters:
value- the value of the optionlabel- the label of the option- Returns:
- this
-
option
Provides options which can be selected by a select field.- Parameters:
options-SelectOptionsto be set as options- Returns:
- this
-
options
Provides options which can be selected by a select field using a collection ofSelectOptions.- Parameters:
optionsToAdd- A collection ofSelectOptions- Returns:
- this
-
clearOptions
Removes all the options from the select field.- Returns:
- this
-