Package sun.print

Examples of sun.print.ServiceDialog


 
  Rectangle gcBounds = (gc == null) ?  GraphicsEnvironment.
      getLocalGraphicsEnvironment().getDefaultScreenDevice().
      getDefaultConfiguration().getBounds() : gc.getBounds();

  ServiceDialog dialog;
  if (owner instanceof Frame) {
      dialog = new ServiceDialog(gc,
               x + gcBounds.x,
               y + gcBounds.y,
               services, defaultIndex,
               flavor, attributes,
               (Frame)owner);
  } else {
      dialog = new ServiceDialog(gc,
               x + gcBounds.x,
               y + gcBounds.y,
               services, defaultIndex,
               flavor, attributes,
               (Dialog)owner);
  }
  Rectangle dlgBounds = dialog.getBounds();

  // get union of all GC bounds
  GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  GraphicsDevice[] gs = ge.getScreenDevices();
  for (int j=0; j<gs.length; j++) {
            gcBounds =
                gcBounds.union(gs[j].getDefaultConfiguration().getBounds());
  }

  // if portion of dialog is not within the gc boundary
  if (!gcBounds.contains(dlgBounds)) {
      // put in the center relative to parent frame/dialog
      dialog.setLocationRelativeTo(owner);
  }
        dialog.show();

        if (dialog.getStatus() == ServiceDialog.APPROVE) {
            PrintRequestAttributeSet newas = dialog.getAttributes();
            Class dstCategory = Destination.class;
            Class amCategory = SunAlternateMedia.class;
            Class fdCategory = Fidelity.class;

            if (attributes.containsKey(dstCategory) &&
                !newas.containsKey(dstCategory))
            {
                attributes.remove(dstCategory);
            }

            if (attributes.containsKey(amCategory) &&
                !newas.containsKey(amCategory))
            {
                attributes.remove(amCategory);
            }

            attributes.addAll(newas);

            Fidelity fd = (Fidelity)attributes.get(fdCategory);
            if (fd != null) {
                if (fd == Fidelity.FIDELITY_TRUE) {
                    removeUnsupportedAttributes(dialog.getPrintService(),
                                                flavor, attributes);
                }
            }
        }

  return dialog.getPrintService();
    }
View Full Code Here


        Rectangle gcBounds = (gc == null) ?  GraphicsEnvironment.
            getLocalGraphicsEnvironment().getDefaultScreenDevice().
            getDefaultConfiguration().getBounds() : gc.getBounds();

        ServiceDialog dialog;
        if (owner instanceof Frame) {
            dialog = new ServiceDialog(gc,
                                       x + gcBounds.x,
                                       y + gcBounds.y,
                                       services, defaultIndex,
                                       flavor, attributes,
                                       (Frame)owner);
        } else {
            dialog = new ServiceDialog(gc,
                                       x + gcBounds.x,
                                       y + gcBounds.y,
                                       services, defaultIndex,
                                       flavor, attributes,
                                       (Dialog)owner);
        }
        Rectangle dlgBounds = dialog.getBounds();

        // get union of all GC bounds
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] gs = ge.getScreenDevices();
        for (int j=0; j<gs.length; j++) {
            gcBounds =
                gcBounds.union(gs[j].getDefaultConfiguration().getBounds());
        }

        // if portion of dialog is not within the gc boundary
        if (!gcBounds.contains(dlgBounds)) {
            // put in the center relative to parent frame/dialog
            dialog.setLocationRelativeTo(owner);
        }
        dialog.show();

        if (dialog.getStatus() == ServiceDialog.APPROVE) {
            PrintRequestAttributeSet newas = dialog.getAttributes();
            Class dstCategory = Destination.class;
            Class amCategory = SunAlternateMedia.class;
            Class fdCategory = Fidelity.class;

            if (attributes.containsKey(dstCategory) &&
                !newas.containsKey(dstCategory))
            {
                attributes.remove(dstCategory);
            }

            if (attributes.containsKey(amCategory) &&
                !newas.containsKey(amCategory))
            {
                attributes.remove(amCategory);
            }

            attributes.addAll(newas);

            Fidelity fd = (Fidelity)attributes.get(fdCategory);
            if (fd != null) {
                if (fd == Fidelity.FIDELITY_TRUE) {
                    removeUnsupportedAttributes(dialog.getPrintService(),
                                                flavor, attributes);
                }
            }
        }

        return dialog.getPrintService();
    }
View Full Code Here

        if (service == null) {
            return null;
        }

        ServiceDialog pageDialog = new ServiceDialog(gc, x, y, service,
                                       DocFlavor.SERVICE_FORMATTED.PAGEABLE,
                                       attributes, (Frame)null);
        pageDialog.show();

        if (pageDialog.getStatus() == ServiceDialog.APPROVE) {
            PrintRequestAttributeSet newas =
                pageDialog.getAttributes();
            Class amCategory = SunAlternateMedia.class;

            if (attributes.containsKey(amCategory) &&
                !newas.containsKey(amCategory)) {
                attributes.remove(amCategory);
View Full Code Here

                if (!(window instanceof Dialog) &&
                    !(window instanceof Frame)) {
                    window = new Frame();
                    isNewFrame = true;
                }
                ServiceDialog pageDialog;
                if (window instanceof Frame) {
                    pageDialog = new ServiceDialog(gc, x, y, service,
                                        DocFlavor.SERVICE_FORMATTED.PAGEABLE,
                                        attributes, (Frame)window);
                } else {
                    pageDialog = new ServiceDialog(gc, x, y, service,
                                        DocFlavor.SERVICE_FORMATTED.PAGEABLE,
                                        attributes, (Dialog)window);
                }
                pageDialog.show();
                if (isNewFrame) {
                    window.dispose();
                }

                if (pageDialog.getStatus() == ServiceDialog.APPROVE) {
                    PrintRequestAttributeSet newas =
                        pageDialog.getAttributes();
                    Class amCategory = SunAlternateMedia.class;

                    if (attributes.containsKey(amCategory) &&
                        newas.containsKey(amCategory)) {
                        attributes.remove(amCategory);
View Full Code Here

TOP

Related Classes of sun.print.ServiceDialog

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.