Noosrep
Noosrep

Reputation: 416

drag and drop progress Vaadin and Java

I have a Vaadin DragAndDropEvent from here but there's something weird about the progress indicator

@Override
public boolean listenProgress() {return true;}

@Override
public void onProgress(final StreamingProgressEvent event) {
  Notification.show("De upload is bezig", Notification.Type.WARNING_MESSAGE);
}

Could someone explain me where I need to put my Notification so that the notification is showed when the upload is in progress and not when it's done?

Upvotes: 1

Views: 161

Answers (1)

kukis
kukis

Reputation: 4634

TLDR: put UI.getCurrent().setPollInterval(10) before your progress = new ProgressIndicator(); line or enable Push Mode.

There are 2 solutions to this problem. You can either stick to ProgressIndicator which is used in your sample or use brand new ProgressBar together with Push Mode.

  1. Javadoc for ProgressIndicator states:

@Deprecated

Deprecated. as of 7.1, use ProgressBar combined with UI.setPushMode(PushMode) or UI.setPollInterval(int) instead.

your code does not work because your poll interval is higher (or disabled at all) than time needed for transfer the file.

  1. Second, similar approach is to use ProgressBar as suggested in JavaDoc. However, you still need to make sure that either PushMode or PollInterval is set.

Upvotes: 2

Related Questions