RFR: 8314070: javax.print: Support IPP output-bin attribute extension [v15]

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed May 29 07:17:18 UTC 2024


On Tue, 28 May 2024 16:47:21 GMT, Alexander Scherbatiy <alexsch at 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:
> 
>  - Move OutputBin import before PageRanges in RasterPrinterJob
>  - Add item listener to cbOutput only if the cbOutput is enabled
>  - Add messages if no print service is found or OutputBin category is not supported
>  - Move OutputBin import before PageRanges in CPrinterJob.java

src/java.desktop/share/classes/sun/print/PSPrinterJob.java line 1652:

> 1650:             }
> 1651:             if ((pFlags & OPTIONS) != 0) {
> 1652:                 for(String option: options.trim().split(" ")) {

code formatting..space between for and (

src/java.desktop/share/classes/sun/print/PSPrinterJob.java line 1677:

> 1675:             }
> 1676:             if ((pFlags & OPTIONS) != 0) {
> 1677:                 for(String option: options.trim().split(" ")) {

space is needed for coding style guideline between for and {

src/java.desktop/unix/classes/sun/print/CUPSPrinter.java line 42:

> 40: import javax.print.attribute.standard.MediaSize;
> 41: import javax.print.attribute.standard.MediaTray;
> 42: import javax.print.attribute.standard.OutputBin;

Import sorting improper...Should be after MediaPrintableArea and before PrinterResolution

test/jdk/javax/print/attribute/CheckSupportedOutputBinsTest.java line 34:

> 32: /*
> 33:  * @test
> 34:  * @bug JDK-8314070

should be just bugid

test/jdk/javax/print/attribute/OutputBinAttributePrintDialogTest.java line 60:

> 58: /*
> 59:  * @test
> 60:  * @bug JDK-8314070

only bugid is needed

test/jdk/javax/print/attribute/OutputBinAttributeTest.java line 58:

> 56: /*
> 57:  * @test
> 58:  * @bug JDK-8314070

same here only bugid needed

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1618300643
PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1618301861
PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1618305622
PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1618309492
PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1618320383
PR Review Comment: https://git.openjdk.org/jdk/pull/16166#discussion_r1618323832


More information about the client-libs-dev mailing list