Exemple #1
0
  /** If there's anything to print, initiate a print job */
  public synchronized void actionPerformed(ActionEvent ae) {
    if (isPrintUnderway) {
      out("ignoring [" + ae.getActionCommand() + "]; print already underway.");
      return;
    }
    LWMap map = VUE.getActiveMap();
    Rectangle2D bounds = map.getBounds();
    if (bounds.isEmpty()) {
      out("nothing to print in " + map);
      return;
    }
    boolean viewerPrint = false;
    if (ae.getActionCommand() != null && ae.getActionCommand().indexOf("Visible") >= 0)
      viewerPrint = true;

    // if any tool windows open in W2K/1.4.2 when start this thread,
    // the print dialog get's obscured!

    isPrintUnderway = true;
    setEnabled(false);
    try {
      new PrintJob(VUE.getActiveViewer(), viewerPrint).start();
      //             if (DEBUG.Enabled)
      //                 new PrintJob(VUE.getActiveViewer(), viewerPrint).start();
      //             else
      //                 new PrintJob(VUE.getActiveViewer(), viewerPrint).runPrint();
    } catch (Throwable t) {
      out("exception creating or running PrintJob: " + t);
      t.printStackTrace();
      isPrintUnderway = false;
      setEnabled(true);
    }
  }