Package org.jpedal.utils

Examples of org.jpedal.utils.SwingWorker


        /** if running terminate first */
    thumbnails.terminateDrawing();

    commonValues.setProcessing(true);

    SwingWorker worker = new SwingWorker() {
      public Object construct() {

        try {

          currentGUI.updateStatusMessage(Messages.getMessage("PdfViewerDecoding.page"));

          if (img != null)
            addImage(img);

          PdfPageData page_data = decode_pdf.getPdfPageData();
         
          if (img != null)
            page_data.setMediaBox(new float[]{0,0,img.getWidth(),img.getHeight()});

          page_data.checkSizeSet(1);
          currentGUI.resetRotationBox();

          /**
           * make sure screen fits display nicely
           */
          if ((resizePanel) && (thumbnails.isShownOnscreen()))
            currentGUI.zoom(false);

          if (Thread.interrupted())
            throw new InterruptedException();
         
          currentGUI.setPageNumber();
         
          currentGUI.setViewerTitle(null); // restore title
         
        } catch (Exception e) {
          currentGUI.setViewerTitle(null); //restore title
         
        }

        currentGUI.setStatusProgress(100);

        //reanable user changing scaling
        currentGUI.resetComboBoxes(true);
       
        //ensure drawn
        decode_pdf.repaint();

        openingTransferedFile=false;
       
        return null;
      }
    };

    worker.start();
  }
View Full Code Here


   
    File testDirExists=new File(output_dir);
    if(!testDirExists.exists())
      testDirExists.mkdirs();
   
    final SwingWorker worker = new SwingWorker() {
      public Object construct() {
        //do the save
       
        switch(type){
        case PdfDecoder.CLIPPEDIMAGES:
          decodeHires(startPage,endPage,format,output_dir);
          break;
        case PdfDecoder.RAWIMAGES:
          decodeImages(startPage,endPage,format,output_dir,false);
          break;
        case PdfDecoder.FINALIMAGES:
          decodeImages(startPage,endPage,format,output_dir,true);
          break;
        default:
          System.out.println("Unknown setting");
        break;
        }
       
        return null;
      }
    };
   
    worker.start();   
  }
View Full Code Here

   
    File testDirExists=new File(output_dir);
    if(!testDirExists.exists())
      testDirExists.mkdirs();
   
    final SwingWorker worker = new SwingWorker() {
      public Object construct() {
        //do the save
       
        switch(type){
        case Exporter.RECTANGLE:
          decodeTextRectangle(startPage,endPage,output_dir,useXMLExtraction);
          break;
        case Exporter.WORDLIST:
          decodeTextWordlist(startPage,endPage,output_dir,useXMLExtraction);
          break;
        case Exporter.TABLE:
          decodeTextTable(startPage,endPage,output_dir,useXMLExtraction);
         
          break;
        default:
          System.out.println("Unknown setting");
        break;
        }
       
        return null;
      }
    };
   
    worker.start()
   
  }
View Full Code Here

  public void setQualityBoxVisible(boolean visible){
  }

  private void setThumbnails() {
    SwingWorker worker = new SwingWorker() {
      public Object construct() {

        if(thumbnails.isShownOnscreen()) {
          setupThumbnailPanel();

          if(decode_pdf.getDisplayView()==Display.SINGLE_PAGE)
            thumbnails.generateOtherVisibleThumbnails(commonValues.getCurrentPage());
        }

        return null;
      }
    };
    worker.start();
  }
View Full Code Here

    clearHistory.setToolTipText("Clears the history of previous files");
    clearHistory.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        gui.clearRecentDocuments();

        SwingWorker searcher = new SwingWorker() {
          public Object construct() {
            for (int i = 0; i < 6; i++) {
              historyClearedLabel.setVisible(!historyClearedLabel.isVisible());
              try {
                Thread.sleep(300);
              } catch (InterruptedException e) {
              }
            }
            return null;
          }
        };

        searcher.start();
      }
    });
    JButton save = new JButton(Messages.getMessage("PdfPreferences.SaveAs"));
    save.setToolTipText("Save preferences in a new file");
    JButton reset = new JButton(Messages.getMessage("PdfPreferences.ResetToDefault"));
View Full Code Here

        //allow for re-entry
        if(drawing)
          this.terminateDrawing();
       
        //create the thread to just do the thumbnails
    worker = new SwingWorker() {

      public Object construct() {
       
        drawing=true;
       
View Full Code Here

      if (result == JOptionPane.NO_OPTION) {
        return false;
      }
    }
   
    final SwingWorker worker = new SwingWorker() {
      public Object construct() {
                for (Object allowedFile : allowedFiles) {
                    final String file = (String) allowedFile;

                    try {
                        currentCommands.openTransferedFile(file);
                    } catch (Exception e) {

                        int result;
                        if (allowedFiles.size() == 1) {
                            currentGUI.showMessageDialog(Messages.getMessage("PdfViewerOpenerror"), commonValues.getSelectedFile(), JOptionPane.ERROR_MESSAGE);
                            result = JOptionPane.NO_OPTION;
                        } else {
                            result = currentGUI.showConfirmDialog(Messages.getMessage("PdfViewerOpenerror") + ". Continue opening remaining files?", commonValues.getSelectedFile(),
                                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);

                        }

                        currentGUI.closeMultiViewerWindow(commonValues.getSelectedFile());

                        if (result == JOptionPane.NO_OPTION) {
                            return null;
                        }
                    }
                }
        return null;
      }
    };
    worker.start();
   
   
//        while (currentCommands.openingTransferedFiles()) {
//          Thread.sleep(250);
//        }
View Full Code Here

     
      searchCount.setText(Messages.getMessage("PdfViewerSearch.Scanning1"));
      searchCount.repaint();
    }

    searcher = new SwingWorker() {
      public Object construct() {

        isSearch=true;
        hasSearched=true;
       
View Full Code Here

TOP

Related Classes of org.jpedal.utils.SwingWorker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.