Class 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:
  • Constructor Details

    • CronExpressionField

      public CronExpressionField()
      Creates a new instance of CronExpressionField
    • CronExpressionField

      public CronExpressionField(String defaultExpression)
      Creates a new instance of CronExpressionField with a default expression.
      Parameters:
      defaultExpression - a String representing 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 - a boolean to 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 - a boolean to set the visibility of the button
    • setDefaultExpression

      public boolean setDefaultExpression(String cron)
      Allows the developer to set a default expression.
      Parameters:
      cron - a String representing the expression to be set as default
      Returns:
      a boolean indicating if the expression is valid or not
    • addCommonExpressions

      public boolean addCommonExpressions(String... crons)
      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 boolean indicating 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 - a boolean indicating 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 - a boolean indicating if the tooltip is displayed or not
    • generateModelValue

      protected String generateModelValue()
      Specified by:
      generateModelValue in class CustomField<String>
    • setPresentationValue

      protected void setPresentationValue(String newPresentationValue)
      Specified by:
      setPresentationValue in class CustomField<String>
    • setLocale

      public void setLocale(Locale locale)
      Sets the Locale for this component.
      Parameters:
      locale - the Locale to be used
    • setI18n

      public void setI18n(CronExpressionFieldI18n i18n)
      Sets the internationalization settings for the field.

      If i18n is null, default internationalization to english.

      Parameters:
      i18n - the CronExpressionFieldI18n to use, or null for default