Class CronEditorWebComponent

java.lang.Object
com.atlassian.jira.web.component.AbstractWebComponent
com.atlassian.jira.web.component.cron.CronEditorWebComponent

public class CronEditorWebComponent extends AbstractWebComponent
Used to display and process a cron-style HTML editor. This generates the inputs that can be placed into a form. You can get a handle on the form HTML by using the getHtml(CronEditorBean, String) method.

Once the form has been submitted you can attain a cron string by processing the input parameters with the getCronExpressionFromInput(CronEditorBean) method.

  • Constructor Details

  • Method Details

    • getHtml

      public String getHtml(CronEditorBean cronEditorBean, String paramPrefix)
      Will produce HTML inputs for selecting a time period that will be represented by a cron string. The incoming expression will populate the values of the form. This uses the default i18n bean to resolve i18n properties.
      Parameters:
      cronEditorBean - defines how the form inputs will be intialized.
      paramPrefix - prefix's the input names so that you can render multiple versions of this component on one page.
      Returns:
      HTML that represents the cron editor inputs.
    • getHtml

      public String getHtml(CronEditorBean cronEditorBean, String paramPrefix, @Nullable String errorMessage)
      Will produce HTML inputs for selecting a time period that will be represented by a cron string. The incoming expression will populate the values of the form. This uses the default i18n bean to resolve i18n properties.
      Parameters:
      cronEditorBean - defines how the form inputs will be intialized.
      paramPrefix - prefix's the input names so that you can render multiple versions of this component on one page.
      errorMessage - the error message that was associated with the last cron expression. Can be null to indicate that there was no error.
      Returns:
      HTML that represents the cron editor inputs.
    • getHtml

      public String getHtml(CronEditorBean cronEditorBean, I18nHelper i18n, String paramPrefix, @Nullable String errorMessage)
      Will produce HTML inputs for selecting a time period that will be represented by a cron string. The incoming expression will populate the values of the form.
      Parameters:
      cronEditorBean - defines how the form inputs will be intialized.
      i18n - used to resolve the i18n labeles.
      paramPrefix - prefixes the input names so that you can render multiple versions of this component on one page.
      errorMessage - the error message that was associated with the last cron expression. Can be null to indicate that there was no error.
      Returns:
      HTML that represents the cron editor inputs.
    • validateInput

      public ErrorCollection validateInput(CronEditorBean cronEditorBean, String fieldName)
    • getCronExpressionFromInput

      public String getCronExpressionFromInput(CronEditorBean cronEditorBean)
      This is a utility method that will process the parameters that the view put into the form and create a cron string from the inputs. This cron string must be validated, there is no guarantee that this output is a valid cron string.
      Parameters:
      cronEditorBean - holds the state of the submitted form
      Returns:
      a cron string that represents the user inputs in cron format.