Class CronExpressionField
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<CustomField<T>,T>
com.vaadin.flow.component.customfield.CustomField<String>
com.flowingcode.vaadin.addons.cronexpressionfield.CronExpressionField
- All Implemented Interfaces:
AttachNotifier,BlurNotifier<CustomField<String>>,DetachNotifier,Focusable<CustomField<String>>,FocusNotifier<CustomField<String>>,HasElement,HasEnabled,HasHelper,HasLabel,HasSize,HasStyle,HasTheme,HasValidation,HasValue<AbstractField.ComponentValueChangeEvent<CustomField<String>,,String>, String> HasValueAndElement<AbstractField.ComponentValueChangeEvent<CustomField<String>,,String>, String> HasTooltip,HasValidationProperties,InputField<AbstractField.ComponentValueChangeEvent<CustomField<String>,,String>, String> Serializable
@CssImport("./styles/cron-expression-field-styles.css")
public class CronExpressionField
extends CustomField<String>
UI component for building cron expressions.
- Author:
- Sofia Nuñez / Flowing Code
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
AbstractField.ComponentValueChangeEvent<C extends Component,V extends Object> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
BlurNotifier.BlurEvent<C extends Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
FocusNotifier.FocusEvent<C extends Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
HasValue.ValueChangeEvent<V extends Object>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>> -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance ofCronExpressionFieldCronExpressionField(String defaultExpression) Creates a new instance ofCronExpressionFieldwith a default expression. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddCommonExpressions(String... crons) Sets a list of cron expressions to be displayed if setCommonExpressionsVisible is enabled.protected StringvoidsetCommonExpressionsVisible(boolean commonExpressionsVisible) Sets visible a ComboBox with common expressions.voidsetCronInputEnabled(boolean isEnabled) Enables or disables user input for the cron expression text field.booleansetDefaultExpression(String cron) Allows the developer to set a default expression.voidsetHelpEnabled(boolean helpEnabled) Sets whether the UI components get a tooltip with helper text for the user.voidSets the internationalization settings for the field.voidSets theLocalefor this component.voidsetNextDatesButtonVisible(boolean nextDatesVisible) Displays a button that generates a grid with the next dates scheduled by the generated cron expression.protected voidsetPresentationValue(String newPresentationValue) Methods inherited from class com.vaadin.flow.component.customfield.CustomField
add, addThemeVariants, getLabel, onAttach, remove, removeThemeVariants, setLabel, updateValueMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, setValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
-
Constructor Details
-
CronExpressionField
public CronExpressionField()Creates a new instance ofCronExpressionField -
CronExpressionField
Creates a new instance ofCronExpressionFieldwith a default expression.- Parameters:
defaultExpression- aStringrepresenting the default cron expression to be set
-
-
Method Details
-
setCronInputEnabled
public void setCronInputEnabled(boolean isEnabled) Enables or disables user input for the cron expression text field.- Parameters:
isEnabled- abooleanto set the editing mode of the cron expression TextField
-
setNextDatesButtonVisible
public void setNextDatesButtonVisible(boolean nextDatesVisible) Displays a button that generates a grid with the next dates scheduled by the generated cron expression.- Parameters:
nextDatesVisible- abooleanto set the visibility of the button
-
setDefaultExpression
Allows the developer to set a default expression.- Parameters:
cron- aStringrepresenting the expression to be set as default- Returns:
- a
booleanindicating if the expression is valid or not
-
addCommonExpressions
Sets a list of cron expressions to be displayed if setCommonExpressionsVisible is enabled.The method validates the cron expressions to be added.
- Parameters:
crons- one or more strings of cron expressions to be validated- Returns:
- a
booleanindicating if all the cron expressions pass the validation
-
setCommonExpressionsVisible
public void setCommonExpressionsVisible(boolean commonExpressionsVisible) Sets visible a ComboBox with common expressions.When set, a combobox with previously set cron expressions is displayed inside the advanced mode layout allowing the user to choose from one of them.
- Parameters:
commonExpressionsVisible- abooleanindicating if the ComboBox is displayed or not
-
setHelpEnabled
public void setHelpEnabled(boolean helpEnabled) Sets whether the UI components get a tooltip with helper text for the user.- Parameters:
helpEnabled- abooleanindicating if the tooltip is displayed or not
-
generateModelValue
- Specified by:
generateModelValuein classCustomField<String>
-
setPresentationValue
- Specified by:
setPresentationValuein classCustomField<String>
-
setLocale
Sets theLocalefor this component.- Parameters:
locale- theLocaleto be used
-
setI18n
Sets the internationalization settings for the field.If
i18nisnull, default internationalization to english.- Parameters:
i18n- theCronExpressionFieldI18nto use, ornullfor default
-