Esempio n. 1
0
    void enqueue(Runnable r, boolean showdialog) {
      if (runlist == null) {
        runlist = new ArrayList<Runnable>();
      }
      runlist.add(r);
      if (showdialog && dialog == null) {
        dialog =
            new LongRunningTask() {
              public float getProgress() {
                return 1 - (float) state.getBytesRemaining() / state.getBytes();
              }

              public void run() {
                while (!isCancelled()) {
                  synchronized (this) {
                    try {
                      wait();
                    } catch (InterruptedException e) {
                    }
                  }
                }
              }
            };
        dialog.setCancellable(false);
        dialog.setModal(false);
        dialog.start(docpanel, UIManager.getString("PDFViewer.Loading"));
      }
    }
Esempio n. 2
0
 void close() {
   if (dialog != null) {
     dialog.cancel();
     synchronized (dialog) {
       dialog.notifyAll();
     }
   }
   if (runlist != null) {
     for (int i = 0; i < runlist.size(); i++) {
       runlist.get(i).run();
     }
   }
 }