Examples of PrintJob


Examples of java.awt.PrintJob

        file.add(new MenuItem("-"));
        file.add(tmp = new MenuItem("Print"));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (pluginLoader.getComponents().get("Terminal") != null) {
              PrintJob printJob =
                      appletFrame.getContentPane().getToolkit()
                      .getPrintJob((JFrame) appletFrame, "JTA Terminal", null);
              ((Component) pluginLoader.getComponents().get("Terminal"))
                      .print(printJob.getGraphics());
              printJob.end();
            }
          }
        });
        file.add(new MenuItem("-"));
        file.add(tmp = new MenuItem("Exit"));
View Full Code Here

Examples of java.awt.PrintJob

      if (setup.getComponents().get("Terminal") != null) {
        file.add(tmp = new JMenuItem("Print"));
        tmp.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_MASK));
        tmp.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
              PrintJob printJob =
                      frame.getToolkit().getPrintJob(frame, "JTA Terminal", null);
              // return if the user clicked cancel
              if (printJob == null) return;
              ((JComponent) setup.getComponents().get("Terminal"))
                      .print(printJob.getGraphics());
              printJob.end();
          }
        });
        file.addSeparator();
      }
      file.add(tmp = new JMenuItem("Exit"));
View Full Code Here

Examples of java.awt.PrintJob

    }

    @Override
    public void execute(final Workspace workspace, final View view, final Location at) {
        final Frame frame = new Frame();
        final PrintJob job = Toolkit.getDefaultToolkit().getPrintJob(frame, "Print object", null);

        if (job != null) {
            final Graphics pg = job.getGraphics();
            final Dimension pageSize = job.getPageDimension();

            if (pg != null) {
                pg.translate(LEFT, HEIGHT);
                pg.drawRect(0, 0, pageSize.width - LEFT - 1, pageSize.height - HEIGHT - 1);
                view.print(new PrintCanvas(pg, view));
                pg.dispose();
            }

            job.end();
        }
        frame.dispose();
    }
View Full Code Here

Examples of java.awt.PrintJob

    private static final Font TEXT_FONT = new Font("SansSerif", Font.PLAIN, 10);
    private static final Font TITLE_FONT = new Font("SansSerif", Font.BOLD, 12);

    public static void print(final String title, final String text) {
        final Frame parent = new Frame();
        final PrintJob job = Toolkit.getDefaultToolkit().getPrintJob(parent, "Print " + title, new Properties());

        if (job != null) {
            final Graphics graphic = job.getGraphics();
            // Dimension pageSize = job.getPageDimension();

            if (graphic != null) {
                graphic.translate(10, 10);
                final int x = 50;
                int y = 50;

                graphic.setFont(TITLE_FONT);

                final int height = graphic.getFontMetrics().getAscent();
                final int width = graphic.getFontMetrics().stringWidth(title);
                graphic.drawRect(x - 10, y - 10 - height, width + 20, height + 20);

                graphic.drawString(title, x, y);

                y += graphic.getFontMetrics().getHeight();
                y += 20;

                graphic.setFont(TEXT_FONT);
                final StringTokenizer tk = new StringTokenizer(text, "\n\r");
                while (tk.hasMoreTokens()) {
                    final String line = tk.nextToken();
                    graphic.drawString(line, x, y);
                    y += graphic.getFontMetrics().getHeight();
                }

                graphic.dispose();
            }

            job.end();
        }
        parent.dispose();
    }
View Full Code Here

Examples of java.awt.PrintJob

    } else if (cmd.equals("close")) {
      frame.setVisible(false);

    } else if (cmd.equals("print")) {  // TBD
      PrintJob pjob = getToolkit().getPrintJob(frame, "Defect Log", null);
      if (pjob != null) {
        Graphics pg = pjob.getGraphics();
        if (pg != null) {
          table.printAll(pg);
          pg.dispose();
        }
        pjob.end();
      }

    } else if (cmd.equals("dts")) {
      if (Settings.isReadOnly()) return;
      if (buildingDtsSelector) return;
View Full Code Here

Examples of java.awt.PrintJob

    private static final Font TEXT_FONT = new Font("SansSerif", Font.PLAIN, 10);
    private static final Font TITLE_FONT = new Font("SansSerif", Font.BOLD, 12);

    public static void print(final String title, final String text) {
        final Frame parent = new Frame();
        final PrintJob job = Toolkit.getDefaultToolkit().getPrintJob(parent, "Print " + title, new Properties());

        if (job != null) {
            final Graphics graphic = job.getGraphics();
            // Dimension pageSize = job.getPageDimension();

            if (graphic != null) {
                graphic.translate(10, 10);
                final int x = 50;
                int y = 50;

                graphic.setFont(TITLE_FONT);

                final int height = graphic.getFontMetrics().getAscent();
                final int width = graphic.getFontMetrics().stringWidth(title);
                graphic.drawRect(x - 10, y - 10 - height, width + 20, height + 20);

                graphic.drawString(title, x, y);

                y += graphic.getFontMetrics().getHeight();
                y += 20;

                graphic.setFont(TEXT_FONT);
                final StringTokenizer tk = new StringTokenizer(text, "\n\r");
                while (tk.hasMoreTokens()) {
                    final String line = tk.nextToken();
                    graphic.drawString(line, x, y);
                    y += graphic.getFontMetrics().getHeight();
                }

                graphic.dispose();
            }

            job.end();
        }
        parent.dispose();
    }
View Full Code Here

Examples of net.sf.paperclips.PrintJob

    footer.setFontData(fontTiny);
    page.setFooter(footer);
   
    this.customize(page);
 
    PrintJob job = new PrintJob(i18n.tr("Hibiscus {0}",HBCI.LONGDATEFORMAT.format(new Date())),page);
   
    // Wenn man den Default-Rand laesst, ist er rechts groesser als links - das ist nicht abheft-freundlich ;)
    // Ich denke, die meisten User brauchen das nicht aendern. Falls doch, kann es der
    // User ja ueber die Properties-Datei anpassen
    Margins margins = job.getMargins();
    margins.left  = settings.getInt("margin.left",100);
    margins.right = settings.getInt("margin.right",50);
   
    return job;
  }
View Full Code Here

Examples of org.mapfish.print.servlet.job.PrintJob

        if (requestHeaders.length() > 0) {
            specJson.getInternalObj().getJSONObject(JSON_ATTRIBUTES).put(JSON_REQUEST_HEADERS, requestHeaders);
        }
        String ref = UUID.randomUUID().toString() + "@" + this.servletInfo.getServletId();

        PrintJob job = this.context.getBean(PrintJob.class);

        job.setReferenceId(ref);
        job.setRequestData(specJson);
        job.setSecurityContext(SecurityContextHolder.getContext());

        // check that we have authorization and configure the job so it can only be access by users with sufficient authorization
        final String templateName = specJson.getString(Constants.JSON_LAYOUT_KEY);
        final MapPrinter mapPrinter = this.mapPrinterFactory.create(appId);
        final Template template = mapPrinter.getConfiguration().getTemplate(templateName);
        job.configureAccess(template);

        try {
            this.jobManager.submit(job);
        } catch (RuntimeException exc) {
            LOGGER.error("Error when creating job", exc);
View Full Code Here

Examples of org.simoes.lpd.common.PrintJob

   
    /** remove print job from queue.
     * @return PrintJob from the queue or null if it was not found
     */
    public PrintJob remove(long id) throws ObjectNotFoundException {
    PrintJob rval = null;
    try {
        rval = (PrintJob)queue.remove(id);
    } catch (ObjectNotFoundException objectNotFoundException) {
        log.info("print job for id[" + id + "] was not found in the queue[" + queue.getName() + "]");
        throw objectNotFoundException;
View Full Code Here

Examples of org.simoes.lpd.common.PrintJob

    final String METHOD_NAME = "getNextPrintJob(): ";
    QueuedPrintJob rval = null;
    try {
      QueuedObject queuedObject = (QueuedObject)queue.getNext();
      long queueId = queuedObject.getId();
      PrintJob printJob = (PrintJob)queuedObject.getObject();
      // create a clone of the PrintJob for our return value
      rval = new QueuedPrintJob(queueId, (PrintJob)printJob.clone());
    } catch (ObjectNotFoundException e) {
      log.info(METHOD_NAME + e.getMessage());
      throw e;
    }
    return rval;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.