use of javax.print.attribute.standard.MediaTray in project jdk8u_jdk by JetBrains.
the class WPrinterJob method setAttributes.
/**
* copy the attributes to the native print job
* Note that this method, and hence the re-initialisation
* of the GDI values is done on each entry to the print dialog since
* an app could redisplay the print dialog for the same job and
* 1) the application may have changed attribute settings
* 2) the application may have changed the printer.
* In the event that the user changes the printer using the
dialog, then it is up to GDI to report back all changed values.
*/
@Override
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
// initialize attribute values
initAttributeMembers();
super.setAttributes(attributes);
mAttCopies = getCopiesInt();
mDestination = destinationAttr;
if (attributes == null) {
// now always use attributes, so this shouldn't happen.
return;
}
Attribute[] attrs = attributes.toArray();
for (int i = 0; i < attrs.length; i++) {
Attribute attr = attrs[i];
try {
if (attr.getCategory() == Sides.class) {
setSidesAttrib(attr);
} else if (attr.getCategory() == Chromaticity.class) {
setColorAttrib(attr);
} else if (attr.getCategory() == PrinterResolution.class) {
setResolutionAttrib(attr);
} else if (attr.getCategory() == PrintQuality.class) {
setQualityAttrib(attr);
} else if (attr.getCategory() == SheetCollate.class) {
setCollateAttrib(attr);
} else if (attr.getCategory() == Media.class || attr.getCategory() == SunAlternateMedia.class) {
/* SunAlternateMedia is used if its a tray, and
* any Media that is specified is not a tray.
*/
if (attr.getCategory() == SunAlternateMedia.class) {
Media media = (Media) attributes.get(Media.class);
if (media == null || !(media instanceof MediaTray)) {
attr = ((SunAlternateMedia) attr).getMedia();
}
}
if (attr instanceof MediaSizeName) {
setWin32MediaAttrib(attr);
}
if (attr instanceof MediaTray) {
setMediaTrayAttrib(attr);
}
}
} catch (ClassCastException e) {
}
}
}
use of javax.print.attribute.standard.MediaTray in project jdk8u_jdk by JetBrains.
the class Win32MediaTray method getEnumValueTable.
protected EnumSyntax[] getEnumValueTable() {
ArrayList completeList = new ArrayList();
for (int i = 0; i < myEnumValueTable.length; i++) {
completeList.add(myEnumValueTable[i]);
}
completeList.addAll(winEnumTable);
MediaTray[] enumTable = new MediaTray[completeList.size()];
return (MediaTray[]) completeList.toArray(enumTable);
}
Aggregations