示例#1
0
 /**
  * Update ProgressBar values.
  *
  * @param minValue the minimum value
  * @param maxValue the maximum value
  * @param selValue the value
  */
 void eswtSetProgressbarValues(int minValue, int maxValue, int selValue) {
   if (eswtProgressBar != null) {
     eswtProgressBar.setMinimum(minValue);
     eswtProgressBar.setMaximum(maxValue);
     eswtProgressBar.setSelection(selValue);
   }
 }
示例#2
0
 /**
  * Update ProgressBar widget.<br>
  * Try to reuse the old ProgressBar if possible, otherwise dispose it and create a new one.
  *
  * @param parent
  * @param indeterminate
  * @param visible
  */
 void eswtUpdateProgressbar(Composite parent, boolean indeterminate, boolean visible) {
   // Only dispose old ProgressBar if it has wrong style
   if (eswtProgressBar != null) {
     boolean isIndeterminate = (eswtProgressBar.getStyle() & SWT.INDETERMINATE) != 0;
     if (indeterminate != isIndeterminate) {
       eswtProgressBar.setLayoutData(null);
       eswtProgressBar.dispose();
       eswtProgressBar = null;
     }
   }
   // create new ProgressBar
   if (eswtProgressBar == null) {
     int newStyle = indeterminate ? SWT.INDETERMINATE : SWT.NONE;
     eswtProgressBar = new ProgressBar(parent, newStyle);
     eswtProgressBar.setLayoutData(eswtProgbarLD);
     // update ScrolledText's layoutdata
     FormData imageLD = (FormData) eswtImgLabel.getLayoutData();
     imageLD.bottom = new FormAttachment(eswtProgressBar);
   }
   // set Progressbar visibility
   if (eswtProgressBar != null) {
     eswtProgbarLD.top = (visible ? null : new FormAttachment(100));
     eswtProgressBar.setVisible(visible);
   }
 }
示例#3
0
 private void createLoadingBar() {
   new ProgressMonitorDialog(parent);
   Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
   shell.setText("Report Loading");
   shell.addDisposeListener(
       new org.eclipse.swt.events.DisposeListener() {
         @Override
         public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) {
           if (thread.isAlive()) {
             thread.interrupt();
             reportFinished = true;
           }
         }
       });
   Label label = new Label(shell, SWT.NONE);
   label.setSize(new Point(260, 20));
   label.setLocation(20, 30);
   label.setText("Please wait while the report loads.");
   label.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
   label.setAlignment(SWT.CENTER);
   Label timelabel = new Label(shell, SWT.NONE);
   timelabel.setSize(new Point(260, 20));
   timelabel.setLocation(20, 50);
   // timelabel.setText("(approx " + timeEst + ")");
   timelabel.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
   timelabel.setAlignment(SWT.CENTER);
   ProgressBar progressBar = new ProgressBar(shell, SWT.HORIZONTAL | SWT.INDETERMINATE);
   progressBar.setSize(new Point(200, 20));
   progressBar.setLocation(50, 80);
   Button button = new Button(shell, SWT.NONE);
   button.setSize(new Point(100, 30));
   button.setLocation(100, 120);
   button.setText("Cancel");
   button.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
   button.setAlignment(SWT.CENTER);
   button.addSelectionListener(
       new org.eclipse.swt.events.SelectionAdapter() {
         @Override
         public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
           if ((thread != null) && thread.isAlive()) {
             thread.interrupt();
             reportFinished = true;
           }
         }
       });
   shell.setSize(new Point(300, 200));
   LayoutUtils.centerGUI(shell);
   shell.open();
   while (!reportFinished) {
     if (!parent.getDisplay().readAndDispatch()) {
       parent.getDisplay().sleep();
     }
   }
   if (!shell.isDisposed()) {
     shell.close();
   }
 }
示例#4
0
  // 创建进度条
  private ProgressBar createProgressBar(Composite parent) {

    ProgressBar progressBar = new ProgressBar(parent, SWT.SMOOTH);

    progressBar.setMinimum(0); // 最小值

    progressBar.setMaximum(100); // 最大值

    return progressBar;
  }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ui.internal.progress.AnimationItem#animationDone()
  */
 @Override
 void animationDone() {
   super.animationDone();
   animationRunning = false;
   if (bar.isDisposed()) {
     return;
   }
   bar.setVisible(false);
   refresh();
 }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ui.internal.progress.AnimationItem#animationStart()
  */
 @Override
 void animationStart() {
   super.animationStart();
   animationRunning = true;
   if (bar.isDisposed()) {
     return;
   }
   bar.setVisible(true);
   refresh();
 }
示例#7
0
 public synchronized void setProgressBarSelection(boolean last) {
   if (!dynamicTask && progressBar != null && !progressBar.isDisposed()) {
     progressBar
         .getDisplay()
         .asyncExec(
             new Runnable() {
               public void run() {
                 progressBar.setSelection(taskRunnedCount);
               }
             });
   }
 }
示例#8
0
 public void setProgressBarMaximun(final int count) {
   if (!dynamicTask && progressBar != null && !progressBar.isDisposed()) {
     progressBar
         .getDisplay()
         .asyncExec(
             new Runnable() {
               public void run() {
                 progressBar.setMaximum(count);
               }
             });
   }
 }
  public void open(int minValue, int maxValue) {
    childShell = new Shell(shell.getDisplay(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
    childShell.setText("Exporting to Excel.. please wait");

    progressBar = new ProgressBar(childShell, SWT.SMOOTH);
    progressBar.setMinimum(minValue);
    progressBar.setMaximum(maxValue);
    progressBar.setBounds(0, 0, 400, 25);
    progressBar.setFocus();

    childShell.pack();
    childShell.open();
  }
 /** Create contents of the shell. */
 protected void createContents() {
   setText("Working");
   setSize(300, 150);
   setCursor(waitingIndicator);
   setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
   ProgressBar progressBar = new ProgressBar(this, SWT.SMOOTH | SWT.INDETERMINATE);
   progressBar.setBounds(10, 71, 274, 25);
   progressBar.setEnabled(true);
   progressBar.setVisible(true);
   txtPleaseWaitUntil = new Text(this, SWT.WRAP | SWT.MULTI);
   txtPleaseWaitUntil.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
   txtPleaseWaitUntil.setText("Please wait until the application closes all open files.");
   txtPleaseWaitUntil.setBounds(12, 24, 272, 41);
 }
示例#11
0
  public void openLoadingShell() {
    this.message = "";
    this.isLoading = true;
    this.loadingShell = new Shell(this.display);
    this.loadingShell.setSize(50, 100);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    this.loadingShell.setLayout(gridLayout);
    ProgressBar pb = new ProgressBar(this.loadingShell, SWT.HORIZONTAL | SWT.INDETERMINATE);
    pb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label searching = new Label(this.loadingShell, SWT.NONE);
    searching.setText("Loading...");
    this.loadingShell.open();
  }
示例#12
0
  private void pintarTabla() {
    // Inicia un webdriver Oculto para buscar la url pasada desde el campo del objeto
    String cUrl = this.currentUrl;
    JavaWebDriver jwd = new JavaWebDriver(cUrl);
    jwd.init(0);
    // Devuelve resultados de la query
    ArrayList<Resultado> results = jwd.getResultados();

    // Pinta la tabla con los resultados de la query
    for (Resultado result : results) {
      TableItem item = new TableItem(tableReport, SWT.NONE);
      item.setText(new String[] {result.getNombre(), result.getUrl(), result.getTelefono()});
    }
    progressBar.setSelection(progressBar.getSelection() + 1);
  }
示例#13
0
  int eswtGetPreferredContentHeight() {
    int ret = getContentComp().computeSize(SWT.DEFAULT, SWT.DEFAULT).y;

    // Point imgSize = (eswtImgLabel != null
    // ? eswtImgLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT) : new Point(0, 0));
    // int ret = Math.max(
    // Math.min(
    // eswtScrolledText.computeSize(topShell.getClientArea().width - imgSize.x, SWT.DEFAULT).y,
    // topShell.getClientArea().height / 2),
    // imgSize.y);

    if (eswtProgressBar != null && eswtProgressBar.isVisible()) {
      ret += eswtProgressBar.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    }
    return ret;
  }
  /** Create contents of the dialog. */
  private void createContents() {
    shell = new Shell(getParent(), getStyle());
    shell.setSize(445, 135);
    shell.setText("\u8BF7\u7B49\u5F85");

    progressBar = new ProgressBar(shell, SWT.HORIZONTAL | SWT.SMOOTH | SWT.INDETERMINATE);
    progressBar.setBounds(40, 29, 364, 32);
  }
 /**
  * Set the progress bar ahead by a tick and update the text to the current time.
  *
  * @param currentTimeInSeconds the current number of seconds into the song
  */
 public void setCurrentTime(int currentTimeInSeconds) {
   if (this.currentTimeInSeconds != currentTimeInSeconds) {
     this.currentTimeInSeconds = currentTimeInSeconds;
     progressBar.setSelection(currentTimeInSeconds);
     currentTimeText.setText(formatTimeToString(currentTimeInSeconds));
     currentTimeText.pack();
   }
 }
示例#16
0
  @Test
  public void testRenderState() throws IOException {
    progressBar.setState(SWT.ERROR);
    lca.renderChanges(progressBar);

    Message message = Fixture.getProtocolMessage();
    assertEquals("error", message.findSetProperty(progressBar, "state").asString());
  }
 /**
  * Set the text at the right end of the progress bar and the maximum property on the progress bar.
  * This is the total length of the song.
  *
  * @param totalTimeInSeconds total length of the song in seconds
  */
 public void setTotalTime(int totalTimeInSeconds) {
   // Don't do any work if the total time hasn't changed.
   if (currentTotalTime != totalTimeInSeconds) {
     progressBar.setMaximum(totalTimeInSeconds);
     totalTimeText.setText(formatTimeToString(totalTimeInSeconds));
     totalTimeText.pack();
   }
 }
示例#18
0
  @Test
  public void testRenderSelection() throws IOException {
    progressBar.setSelection(10);
    lca.renderChanges(progressBar);

    Message message = Fixture.getProtocolMessage();
    assertEquals(10, message.findSetProperty(progressBar, "selection").asInt());
  }
示例#19
0
  @Test
  public void testRenderParent() throws IOException {
    lca.renderInitialization(progressBar);

    Message message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(progressBar);
    assertEquals(WidgetUtil.getId(progressBar.getParent()), operation.getParent());
  }
示例#20
0
  @Test
  public void testRenderChanges_rendersClientListener() throws IOException {
    progressBar.addListener(SWT.MouseEnter, new ClientListener(""));

    lca.renderChanges(progressBar);

    Message message = Fixture.getProtocolMessage();
    assertNotNull(message.findCallOperation(progressBar, "addListener"));
  }
示例#21
0
  /** Create contents of the window */
  protected void createContents() {
    setImage(
        SWTResourceManager.getImage(FileDownloadShell.class, "/org/wayne/feiq/ui/image/ico.png"));
    setSize(443, 141);
    setText("download file..");

    lblMsg = new Label(this, SWT.NONE);
    lblMsg.setText("Counting file size...");
    lblMsg.setBounds(10, 51, 350, 16);

    progressBar = new ProgressBar(this, SWT.SMOOTH);
    progressBar.setMaximum(100);
    progressBar.setBounds(10, 86, 417, 16);

    lblFile = new Label(this, SWT.NONE);
    lblFile.setBounds(10, 66, 350, 16);
    //
  }
示例#22
0
  public static Object create(ActionContext actionContext) {
    Thing self = (Thing) actionContext.get("self");

    int style = SWT.NONE;
    String selfStyle = self.getString("style");
    if ("HORIZONTAL".equals(selfStyle)) {
      style |= SWT.HORIZONTAL;
    } else if ("VERTICAL".equals(selfStyle)) {
      style |= SWT.VERTICAL;
    }

    if (self.getBoolean("SMOOTH")) style |= SWT.SMOOTH;
    if (self.getBoolean("BORDER")) style |= SWT.BORDER;
    if (self.getBoolean("INDETERMINATE")) style |= SWT.INDETERMINATE;

    Composite parent = (Composite) actionContext.get("parent");
    ProgressBar bar = new ProgressBar(parent, style);

    // 父类的初始化方法
    Bindings bindings = actionContext.push(null);
    bindings.put("control", bar);
    try {
      self.doAction("super.init", actionContext);
    } finally {
      actionContext.pop();
    }

    bar.setMaximum(self.getInt("maximum", 100));
    bar.setMinimum(self.getInt("minimum", 0));
    bar.setSelection(self.getInt("selection", 0));

    // 保存变量和创建子事物
    actionContext.getScope(0).put(self.getString("name"), bar);
    actionContext.peek().put("parent", bar);
    for (Thing child : self.getAllChilds()) {
      child.doAction("create", actionContext);
    }
    actionContext.peek().remove("parent");

    Designer.attach(bar, self.getMetadata().getPath(), actionContext);
    return bar;
  }
示例#23
0
  @Test
  public void testRenderStateUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(progressBar);

    progressBar.setState(SWT.ERROR);
    Fixture.preserveWidgets();
    lca.renderChanges(progressBar);

    Message message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(progressBar, "state"));
  }
示例#24
0
  @Test
  public void testRenderMaxmumUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(progressBar);

    progressBar.setMaximum(10);
    Fixture.preserveWidgets();
    lca.renderChanges(progressBar);

    Message message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(progressBar, "maximum"));
  }
  /** Create contents of the window. */
  protected void createContents() {
    shlSkriptLoading = new Shell();
    shlSkriptLoading.setSize(450, 91);
    shlSkriptLoading.setText("Skript Editor is Loading");
    shlSkriptLoading.setLayout(new GridLayout(1, false));

    txtLoading = new Label(shlSkriptLoading, SWT.NONE);
    txtLoading.setText("Loading");
    txtLoading.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    progressBar = new ProgressBar(shlSkriptLoading, SWT.NONE);
    progressBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
  }
  public PasswordCheckingDialog() {
    display = new Display();
    shlObaLogin = new Shell(display);
    shlObaLogin.setText("OBA Login");
    shlObaLogin.setSize(300, 150);

    bar = new ProgressBar(shlObaLogin, SWT.SMOOTH | SWT.INDETERMINATE);
    bar.setBounds(10, 51, 262, 32);

    Label lblLoginUsingSaved = new Label(shlObaLogin, SWT.NONE);
    lblLoginUsingSaved.setAlignment(SWT.CENTER);
    lblLoginUsingSaved.setBounds(10, 10, 262, 20);
    lblLoginUsingSaved.setText("Login using saved password...");
  }
示例#27
0
  public Upload(Composite parent, int style, int... uploadStyles) {
    super(parent, style);
    setLayout(FormLayoutFactory.defaults().create());

    fileUpload = new FileUpload(this, SWT.NONE);
    fileUpload.setLayoutData(FormDataFactory.filled().create());
    fileUpload.setText(i18n.get("select"));
    fileUpload.setData(RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE);
    setData(RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE);

    fileUpload.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent ev) {
            UIUtils.activateCallback("upload");
            fileUpload.submit(UploadService.registerHandler(Upload.this));
          }
        });

    if (ArrayUtils.contains(uploadStyles, SHOW_UPLOAD_BUTTON)) {
      log.info("SHOW_UPLOAD_BUTTON is not supported yet.");
    }

    if (ArrayUtils.contains(uploadStyles, SHOW_PROGRESS)) {
      fileUpload.setLayoutData(FormDataFactory.filled().noRight().create());

      progress = new ProgressBar(this, SWT.HORIZONTAL);
      progress.setLayoutData(FormDataFactory.filled().left(fileUpload).create());
      progress.setMaximum(Integer.MAX_VALUE);

      progressLabel = new Label(this, SWT.NONE);
      progressLabel.setLayoutData(FormDataFactory.filled().top(0, 5).left(fileUpload, 20).create());
      progressLabel.setText(i18n.get("progressLabel"));
      log.warn("not yet ported: progressLabel.setForeground( new Color( 0x60, 0x60, 0x60 ) ) ");
      progressLabel.moveAbove(progress);
    }
  }
  public TrackProgressBar(Composite parent, int flags) {
    super(parent, flags);
    currentTotalTime = 0;

    setLayout(new GridLayout(3, false));

    currentTimeText = new Label(this, SWT.NONE);
    currentTimeText.setText("---:---");

    progressBar = new ProgressBar(this, SWT.SMOOTH);
    progressBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    totalTimeText = new Label(this, SWT.NONE);
    totalTimeText.setText("---:---");
  }
 /** Open the window. */
 public void open() {
   Display display = Display.getDefault();
   createContents();
   shlSkriptLoading.open();
   shlSkriptLoading.layout();
   while (!shlSkriptLoading.isDisposed()) {
     txtLoading.setText(text);
     progressBar.setSelection((int) (((percent + section) / sections) * 100));
     if (!display.readAndDispatch()) {
       display.sleep();
     }
     if (done) {
       display.close();
     }
   }
 }
  public boolean checkPassword(String[] savedUserInfos) {
    // center the dialog screen to the monitor
    Rectangle bounds = display.getBounds();
    Rectangle rect = shlObaLogin.getBounds();
    int x = bounds.x + (bounds.width - rect.width) / 2;
    int y = bounds.y + (bounds.height - rect.height) / 2;
    shlObaLogin.setLocation(x, y);
    shlObaLogin.open();
    for (int i = 0; i < 100; i++) {
      try {
        Thread.sleep(10);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      bar.setSelection(i);
    }

    controller = OBAController.getInstance();
    boolean result = controller.loginWithSavePasswd(savedUserInfos);
    display.dispose();
    return result;
  }