< prev index next >
src/java.desktop/unix/classes/sun/print/IPPPrintService.java
Print this page
@@ -23,10 +23,12 @@
* questions.
*/
package sun.print;
+import java.awt.GraphicsEnvironment;
+import java.awt.Toolkit;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import javax.print.DocFlavor;
import javax.print.DocPrintJob;
import javax.print.PrintService;
@@ -1069,10 +1071,15 @@
PrinterResolution[] supportedRes = getPrintResolutions();
if (supportedRes != null && (supportedRes.length > 0)) {
catList.add(PrinterResolution.class);
}
+ if (GraphicsEnvironment.isHeadless() == false) {
+ catList.add(DialogOwner.class);
+ catList.add(DialogTypeSelection.class);
+ }
+
supportedCats = new Class<?>[catList.size()];
catList.toArray(supportedCats);
Class<?>[] copyCats = new Class<?>[supportedCats.length];
System.arraycopy(supportedCats, 0, copyCats, 0, copyCats.length);
return copyCats;
@@ -1390,14 +1397,42 @@
return true;
}
}
}
return false;
- } if (attr.getCategory() == PrinterResolution.class) {
+ } else if (attr.getCategory() == PrinterResolution.class) {
if (attr instanceof PrinterResolution) {
return isSupportedResolution((PrinterResolution)attr);
}
+ } else if (attr.getCategory() == DialogOwner.class) {
+ DialogOwner owner = (DialogOwner)attr;
+ // ID not supported on any dialog type on Unix platforms.
+ if (DialogOwnerAccessor.getID(owner) != 0) {
+ return false;
+ }
+ // On Mac we have no control over the native dialog.
+ DialogTypeSelection dst = (attributes == null) ? null :
+ (DialogTypeSelection)attributes.get(DialogTypeSelection.class);
+ if (PrintServiceLookupProvider.isMac() &&
+ dst == DialogTypeSelection.NATIVE) {
+ return false;
+ }
+ // The other case is always a Swing dialog on all Unix platforms.
+ // So we only need to check that the toolkit supports
+ // always on top.
+ if (owner.getOwner() != null) {
+ return true;
+ } else {
+ return Toolkit.getDefaultToolkit().isAlwaysOnTopSupported();
+ }
+ } else if (attr.getCategory() == DialogTypeSelection.class) {
+ if (PrintServiceLookupProvider.isMac()) {
+ return true;
+ } else {
+ DialogTypeSelection dst = (DialogTypeSelection)attr;
+ return attr == DialogTypeSelection.COMMON;
+ }
}
return true;
}
< prev index next >