Class CmsAsyncJoinHandler

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

public class CmsAsyncJoinHandler extends Object
Helper class used to perform an action when multiple asynchronous tasks have finished.

To use this, first, for every action, add a token which uniquely identifies the action. Remove the corresponding token when the action is finished. When all tokens are removed, the final action will be executed.

  • Field Details

  • Constructor Details

    • CmsAsyncJoinHandler

      public CmsAsyncJoinHandler(Runnable joinAction)
      Creates a new instance.

      Parameters:
      joinAction - the final action to execute
  • Method Details

    • addTokens

      public void addTokens(Object... tokens)
      Adds tokens.

      Parameters:
      tokens - the tokens to add
    • removeToken

      public void removeToken(Object token)
      Removes a token.

      When all tokens have been removed, the final action is executed.

      Parameters:
      token - the token to remove