869 pageDialog.setBounds(x, y, dlgBounds.width, dlgBounds.height); 870 } 871 pageDialog.show(); 872 873 if (pageDialog.getStatus() == ServiceDialog.APPROVE) { 874 PrintRequestAttributeSet newas = 875 pageDialog.getAttributes(); 876 Class<?> amCategory = SunAlternateMedia.class; 877 878 if (attributes.containsKey(amCategory) && 879 !newas.containsKey(amCategory)) { 880 attributes.remove(amCategory); 881 } 882 attributes.addAll(newas); 883 return attributeToPageFormat(service, attributes); 884 } else { 885 return null; 886 } 887 } 888 889 protected PageFormat getPageFormatFromAttributes() { 890 if (attributes == null || attributes.isEmpty()) { 891 return null; 892 } 893 return attributeToPageFormat(getPrintService(), this.attributes); 894 } 895 896 897 /** 898 * Presents the user a dialog for changing properties of the 899 * print job interactively. 900 * The services browsable here are determined by the type of 901 * service currently installed. 902 * If the application installed a StreamPrintService on this 903 * PrinterJob, only the available StreamPrintService (factories) are 904 * browsable. 905 * 906 * @param attributes to store changed properties. 907 * @return false if the user cancels the dialog and true otherwise. 908 * @exception HeadlessException if GraphicsEnvironment.isHeadless() 909 * returns true. 910 * @see java.awt.GraphicsEnvironment#isHeadless 911 */ 912 public boolean printDialog(final PrintRequestAttributeSet attributes) 913 throws HeadlessException { 914 if (GraphicsEnvironment.isHeadless()) { 915 throw new HeadlessException(); 916 } | 869 pageDialog.setBounds(x, y, dlgBounds.width, dlgBounds.height); 870 } 871 pageDialog.show(); 872 873 if (pageDialog.getStatus() == ServiceDialog.APPROVE) { 874 PrintRequestAttributeSet newas = 875 pageDialog.getAttributes(); 876 Class<?> amCategory = SunAlternateMedia.class; 877 878 if (attributes.containsKey(amCategory) && 879 !newas.containsKey(amCategory)) { 880 attributes.remove(amCategory); 881 } 882 attributes.addAll(newas); 883 return attributeToPageFormat(service, attributes); 884 } else { 885 return null; 886 } 887 } 888 889 /** 890 * Presents the user a dialog for changing properties of the 891 * print job interactively. 892 * The services browsable here are determined by the type of 893 * service currently installed. 894 * If the application installed a StreamPrintService on this 895 * PrinterJob, only the available StreamPrintService (factories) are 896 * browsable. 897 * 898 * @param attributes to store changed properties. 899 * @return false if the user cancels the dialog and true otherwise. 900 * @exception HeadlessException if GraphicsEnvironment.isHeadless() 901 * returns true. 902 * @see java.awt.GraphicsEnvironment#isHeadless 903 */ 904 public boolean printDialog(final PrintRequestAttributeSet attributes) 905 throws HeadlessException { 906 if (GraphicsEnvironment.isHeadless()) { 907 throw new HeadlessException(); 908 } |