Class CmsValidationScheduler

java.lang.Object
org.opencms.gwt.client.validation.CmsValidationScheduler

public class CmsValidationScheduler extends Object
This is a helper class for scheduling form validations.

Since validations can be asynchronous, it would be possible for a validation to start while another one is still waiting for a response from the server if it were ran directly. This might result in an inconsistent state of the form fields being validated. To prevent this, validation controllers use this class to schedule validations, and call this class again after they're finished to execute the next validation.

The result of this is that a validation will only start after all unfinished validations which have been scheduled before it have finished running.

Since:
8.0.0
  • Constructor Details

  • Method Details

    • get

      public static CmsValidationScheduler get()
      Returns the singleton instance of the validation scheduler.

      Returns:
      the validation scheduler
    • executeNext

      public void executeNext()
      This method should be called by the validation controller when it has finished running.

      It will execute the next validation if there is one.

    • schedule

      public void schedule(CmsValidationController action)
      This schedules a new validation to be run after all currently scheduled or running validations have finished.

      If there are no validations running, the validation will be started immediately.

      Parameters:
      action - the validation to be scheduled