Class CmsBurstEventManager

java.lang.Object
org.opencms.gwt.client.util.CmsBurstEventManager

public final class CmsBurstEventManager extends Object
Takes care of the burst of the same event, by skipping the first ones and executing only the last one.

Usage example:

   Window.addResizeHandler(new ResizeHandler() {
       public void onResize(ResizeEvent event) {
           CmsBurstEventManager.get().schedule("resize-window", new Command() {
               public void execute() {
                   // resize
               }
           }, 200);
       }
   });
 
Since:
8.0.0
See Also:
  • Method Details

    • get

      protected static CmsBurstEventManager get()
      Returns the singleton instance.

      Returns:
      the singleton instance
    • schedule

      public void schedule(String name, com.google.gwt.user.client.Command command, int delayMsec)
      Adds an 'burst' event to the manager.

      Parameters:
      name - the unique name, which identifies the event
      command - command to execute when the timer expires
      delayMsec - the timer delay (it's reseted if multiple events are added)
    • cancel

      public void cancel(String eventName)
      Removes the event from the manager.

      Parameters:
      eventName - the name of the event that we need to remove