Examples of PrinterData


Examples of org.eclipse.swt.printing.PrinterData

      return;

    try {
      // Ask the user to specify the printer.
      PrintDialog dialog = new PrintDialog(shell, SWT.NONE);
      PrinterData printerData = dialog.open();
      if (printerData == null)
        return;

      Printer printer = new Printer(printerData);
      Point screenDPI = display.getDPI();
View Full Code Here

Examples of org.eclipse.swt.printing.PrinterData

    }

    if (name.equals(ControlExample.getResourceString("PrintDialog"))) {
      PrintDialog dialog = new PrintDialog(shell, style);
      dialog.setText(ControlExample.getResourceString("Title"));
      PrinterData result = dialog.open();
      textWidget.append(ControlExample.getResourceString("PrintDialog") + Text.DELIMITER);
      textWidget.append(ControlExample.getResourceString("Result", new String[] { "" + result }) + Text.DELIMITER
          + Text.DELIMITER);
      return;
    }
View Full Code Here

Examples of org.eclipse.swt.printing.PrinterData

* @param data the data that will be used when the dialog is opened or null to use default data
*
* @since 3.4
*/
public void setPrinterData(PrinterData data) {
  if (data == null) data = new PrinterData();
  this.printerData = data;
}
View Full Code Here

Examples of org.eclipse.swt.printing.PrinterData

*    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
*    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public PrinterData open() {
  PrinterData data = null;
  NSPrintPanel panel = NSPrintPanel.printPanel();
  NSPrintInfo printInfo = new NSPrintInfo(NSPrintInfo.sharedPrintInfo().copy());
  printInfo.setOrientation(printerData.orientation == PrinterData.LANDSCAPE ? OS.NSLandscapeOrientation : OS.NSPortraitOrientation);
  NSMutableDictionary dict = printInfo.dictionary()
  dict.setValue(NSNumber.numberWithBool(printerData.collate), OS.NSPrintMustCollate);
  dict.setValue(NSNumber.numberWithInt(printerData.copyCount), OS.NSPrintCopies);
  if (printerData.printToFile) {
    dict.setValue(OS.NSPrintSaveJob, OS.NSPrintJobDisposition);
  }
  if (printerData.fileName != null && printerData.fileName.length() > 0) {
    dict.setValue(NSString.stringWith(printerData.fileName), OS.NSPrintSavePath);
  }
  dict.setValue(NSNumber.numberWithBool(printerData.scope == PrinterData.ALL_PAGES), OS.NSPrintAllPages);
  if (printerData.scope == PrinterData.PAGE_RANGE) {
    dict.setValue(NSNumber.numberWithInt(printerData.startPage), OS.NSPrintFirstPage);
    dict.setValue(NSNumber.numberWithInt(printerData.endPage), OS.NSPrintLastPage);
  }
  panel.setOptions(OS.NSPrintPanelShowsPageSetupAccessory | panel.options());
  Shell parent = getParent();
  Display display = parent != null ? parent.getDisplay() : Display.getCurrent();
  int response;
  if ((getStyle () & SWT.SHEET) != 0) {
    initClasses();
    SWTPrintPanelDelegate delegate = (SWTPrintPanelDelegate)new SWTPrintPanelDelegate().alloc().init();
    long /*int*/ jniRef = OS.NewGlobalRef(this);
    if (jniRef == 0) SWT.error(SWT.ERROR_NO_HANDLES);
    OS.object_setInstanceVariable(delegate.id, SWT_OBJECT, jniRef);
    returnCode = -1;
    panel.beginSheetWithPrintInfo(printInfo, parent.view.window(), delegate, OS.sel_panelDidEnd_returnCode_contextInfo_, 0);
    while (returnCode == -1) {
      if (!display.readAndDispatch()) display.sleep();
    }
    if (delegate != null) delegate.release();
    if (jniRef != 0) OS.DeleteGlobalRef(jniRef);
    response = returnCode;
  } else {
    display.setData(SET_MODAL_DIALOG, this);
    response = (int)/*64*/panel.runModalWithPrintInfo(printInfo);
  }
  display.setData(SET_MODAL_DIALOG, null);
  if (response != OS.NSCancelButton) {
    NSPrinter printer = printInfo.printer();
    NSString str = printer.name();
    data = new PrinterData(Printer.DRIVER, str.getString());
    data.printToFile = printInfo.jobDisposition().isEqual(OS.NSPrintSaveJob);
    if (data.printToFile) {
      NSString filename = new NSString(dict.objectForKey(OS.NSPrintSavePath));
      data.fileName = filename.getString();
    }
View Full Code Here

Examples of org.eclipse.swt.printing.PrinterData

      return;
    }

    final PrintDialog dialog= new PrintDialog(shell, SWT.PRIMARY_MODAL);
    dialog.setPrinterData(fgPrinterData);
    final PrinterData data= dialog.open();

    if (data != null) {
      final Printer printer= new Printer(data);
      final Runnable styledTextPrinter= fTextWidget.print(printer, options);
View Full Code Here

Examples of org.eclipse.swt.printing.PrinterData

 
  int printMode = new PrintModeDialog(shell).open();
  if (printMode == -1)
    return;
  PrintDialog dialog = new PrintDialog(shell, SWT.NULL);
  PrinterData data = dialog.open();
  if (data != null) {
    PrintGraphicalViewerOperation op =
          new PrintGraphicalViewerOperation(new Printer(data), viewer);
    op.setPrintMode(printMode);
    op.run(selectedFile.getName());
View Full Code Here

Examples of org.eclipse.swt.printing.PrinterData

    public static void printDialog(Shell shell, Document doc, String url,
            NamespaceHandler nsh, String jobName) {
        PrintDialog dlg = new PrintDialog(shell);
        dlg.setText(jobName);
        PrinterData data = dlg.open();
        if (data != null) {
            print(data, doc, url, nsh, jobName);
        }
    }
View Full Code Here

Examples of org.eclipse.swt.printing.PrinterData

    public static void printDialog(Shell shell, String url,
            NamespaceHandler nsh, String jobName) {
        PrintDialog dlg = new PrintDialog(shell);
        dlg.setText(jobName);
        PrinterData data = dlg.open();
        if (data != null) {
            print(data, url, nsh, jobName);
        }
    }
View Full Code Here

Examples of org.eclipse.swt.printing.PrinterData

    {
        NeoGraphViewPart view = (NeoGraphViewPart) getWorkbenchPart();
        // let the user select the print mode
        PrintDialog dialog = new PrintDialog(
                view.getViewer().getControl().getShell(), SWT.NULL );
        PrinterData data = dialog.open();
        if ( data != null )
        {
            // TODO This is only a temporary implementation, until the Zest
            // Graph supports true
            // scalable printing...
View Full Code Here

Examples of org.eclipse.swt.printing.PrinterData

       * .swt.events.SelectionEvent)
       */
      @Override
      public void widgetSelected(SelectionEvent arg0) {
        PrintDialog dialog = new PrintDialog(shell);
        PrinterData data = dialog.open();
        if (data == null)
          return;
        Printer printer = new Printer(data);
        GC gc = new GC(printer);

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.