void cancelAllEntities() {
    for (Object entity : myModalEntities) {
      // DialogWrapperDialog is not accessible here
      if (entity instanceof Dialog) {
        ((Dialog)entity).setVisible(false);
        if (entity instanceof Disposable) {
          Disposer.dispose((Disposable)entity);
        }
      }
      else if (entity instanceof ProgressIndicator) {
        ((ProgressIndicator)entity).cancel();
      }
      else if (entity instanceof JobProvider) {
        ((JobProvider)entity).getJob().cancel(new CancellationException("force leave modal"));
      }
    }
  }
void cancelAllEntities()