On Mon, 27 May 2024 17:02:35 GMT, Alexander Scherbatiy <alex...@openjdk.org> wrote:
>> The fix adds new public `OutputBin` print attribute class which allow to set >> a printer output bin in a `PrinterJob` class. The corresponding internal >> `CustomOutputBin` class is added as well. >> >> - Constants used in `OutputBin` class are based on [Internet Printing >> Protocol (IPP): “output-bin” attribute >> extension](https://ftp.pwg.org/pub/pwg/candidates/cs-ippoutputbin10-20010207-5100.2.pdf) >> document. >> - `CUPSPrinter.getOutputBins(String printer)` method uses PPD >> `ppdFindOption(..., "OutputBin")` function to get supported output bins for >> the given printer on native level. >> - The fix propagates the `OutputBin` attribute from the printer job >> attributes to `NSPrintInfo` print settings with `OutputBin` key on macOS. >> >> The fix was tested on `Kyocera ECOSYS M8130cidn` printer where >> `ppdFindOption(..., "OutputBin")` call returns 4 output bins (text, choice): >> - Printer settings, None >> - Inner tray, INNERTRAY >> - Separator tray, SEPARATORTRAY >> - Finisher (face-down), Main >> >> if `Printer settings`, `Inner tray`, or `Finisher (face-down)` >> CustomOutputBins is set to `PrinterJob.print(...)` attributes a test page is >> printed to the Main tray of the `Kyocera ECOSYS M8130cidn` printer. If >> `Separator tray` is used a page is printed to the Separator tray. This is >> consistent with the printer behavior when a native print dialog is used from >> a native Preview app to print a document on macOS. > > Alexander Scherbatiy has updated the pull request incrementally with four > additional commits since the last revision: > > - Fix types in tests > - Fix typos in tests > - Check if OutputBin category supported in tests > - Add automated CheckSupportedOutputBinsTest test src/java.desktop/share/classes/sun/print/RasterPrinterJob.java line 93: > 91: import javax.print.attribute.standard.SheetCollate; > 92: import javax.print.attribute.standard.Sides; > 93: import javax.print.attribute.standard.OutputBin; Sort the import..OutputBin should be placed before PageRanges src/java.desktop/share/classes/sun/print/RasterPrinterJob.java line 1283: > 1281: if (!isSupportedValue(outputBinAttr, attributes)) { > 1282: outputBinAttr = null; > 1283: } Should we set it to null if user-set output-bin attribute is not among supported values or should we set it to default as is done for printer-resolution and others src/java.desktop/share/classes/sun/print/ServiceDialog.java line 2927: > 2925: lblOutput.setEnabled(outputEnabled); > 2926: > 2927: cbOutput.addItemListener(this); If Attribute category is unsupported, the panel will be disabled, in that case, is there any need to add itemlistener? I guess we can make it conditional to category being supported ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1616918563 PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1616933045 PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1616942526