public void startStreaming(FileDetailBean fileDetailBean) {
    this.fileDetailBean = fileDetailBean;
    pi.setValue(0f);
    pi.setVisible(true);
    textualProgress.setVisible(true);
    setFileName(fileDetailBean.getFileName());

    Button newCancelBtn = createNewCancelButton();
    cancelLayout.replaceComponent(cancelButton, newCancelBtn);
    cancelButton = newCancelBtn;
    cancelButton.addStyleName(CANCEL_BUTTON_STYLE_CLASS);
  }
 public void setProgress(long bytesReceived, long contentLength) {
   pi.setValue(new Float(bytesReceived / (float) contentLength));
   textualProgress.setValue(
       UploadUtil.getHumanReadableByteCount(bytesReceived, false)
           + " / "
           + UploadUtil.getHumanReadableByteCount(contentLength, false));
 }
Пример #3
0
 @Override
 public Layout runningLayout() {
   HorizontalLayout hl = new HorizontalLayout();
   hl.setMargin(true);
   ProgressBar pb = new ProgressBar();
   pb.setIndeterminate(true);
   Label running = new Label("Scan en Cours");
   hl.setSizeFull();
   hl.setSpacing(true);
   hl.addComponents(pb, running);
   hl.setSizeUndefined();
   VerticalLayout vl = new VerticalLayout();
   vl.setSizeFull();
   vl.addComponent(hl);
   vl.setComponentAlignment(hl, Alignment.MIDDLE_CENTER);
   return vl;
 }
  private void initForm() {
    layout = new VerticalLayout();
    addComponent(layout);

    layout.addComponent(fileName);

    pi.setVisible(false);
    pi.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(pi);

    textualProgress.setVisible(false);

    cancelLayout = new HorizontalLayout();
    cancelLayout.addStyleName(CANCEL_BUTTON_LAYOUT_STYLE_CLASS);
    cancelLayout.setWidth(100, Unit.PERCENTAGE);
    cancelLayout.addComponent(textualProgress);
    cancelButton = new Button();
    cancelLayout.addComponent(cancelButton);
    cancelLayout.setComponentAlignment(cancelButton, Alignment.TOP_RIGHT);
    layout.addComponent(cancelLayout);
  }
Пример #5
0
 public ProgressBarIndicator(int total, int remaining, Boolean displayPercentage) {
   this();
   float value = (total != 0) ? ((float) (total - remaining) / total) : 0;
   progressIndicator.setValue(value);
   if (displayPercentage) {
     if (total > 0) {
       this.progressStatusLabel.setValue(String.format("%.0f", value * 100) + "%");
     } else {
       this.progressStatusLabel = new Label("100%");
     }
   } else {
     this.progressStatusLabel.setValue(
         String.valueOf(total - remaining) + " / " + String.valueOf(total));
   }
 }