Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4869502

Page Ranges 'To page' field is not populated when pageable is used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 5.0
    • 5.0
    • client-libs
    • 2d
    • tiger
    • generic
    • generic
    • Verified

      Implementing pageable interface and setting it to the PrinterJob is expected to set the page ranges value in the print dialog to the range returned by the pageable interface. If the implemented pageable interface returns a valid integer value for getNumberOfPages() this value has to be set as the max range in the print dialog. This seems to work fine in JDK1.3, 1.3.1, 1.4, 1.4.2 (b24) and 1.5.0-b04 on Windows. But right from JDK1.5.0-b05 the 'To page' value is set to 1 irrespective of what the pageable returns. In the PIT build (specified below) the 'To Page' field is empty and only 'From page' field is populated.

      Till JDK1.5.0-b04, when the prepopulated 'To Page' value is altered by the user a validation occurs and an error dialog is shown informing the user that the specified 'To Page' value is wrong. But in JDK1.5.0-b05 and later, the pageable interface methods are called as many no. of times as the value specified in the 'To Page' regardless of the value returned by getNumberOfPages(), provided if the getPageFormat() and getPrintable() methods does not return a null value. This happens even in the case of PIT build. I am marking this bug as a PIT failure since the behaviour seen in PIT build is different from JDK1.5.0-b05 where the 'TO' page value is not at all populated in the PIT build as opposed to being incorrectly populated in JDK1.5.0-b05.

      I expect the pageable methods to be called exactly as many no. of times as returned by getNumberOfPages() and this value must not be overridden by the value the user specifies in the PrintDialog. This is how it works till JDK1.5.0-b04.

      PIT build on which this was tested:
      java version "2d-jcg-win-01-23-May-03.tiger"
      Java(TM) 2 Runtime Environment, Standard Edition (build 2d-jcg-win-01-23-May-03.tiger)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b07, mixed mode)

      The above explained behaviour is seen only on Win32 platforms. On Solaris, the common dialog shown in JDK1.3, 1.4.2 are different from the one which is displayed in JDK1.5.0 and the common dialog which is shown in 1.4.2, 1.3 does not display the range values. On JDK1.5.0 b01 - b06, the page ranges values does not reflect the value returned by getNumberOfPages() and it is always defaulted to 1,1.

      I tested this Win NT, Win XP and Solaris 8.
      I am using a Xerox Docuprint N4025 printer.

      How to reproduce:
      I have attached a sample code. Execute the sample code. If you see the 'To Page' field empty in the print dialog then the bug is reproduced. It must be populated with '2', which is the value returned by getNumberOfPages() of the implemented pageable interface. Enter a value in the 'To Page' field and click OK (choose PrintToFile option also). You will see in the console that getPageFormat() and getPrintable() of the pageable interface being called that many no. of times.

      -------------------------------------------------------------------------------
      On Win32, when getNumOfPages() returns UNKNOWN_NUMBER_OF_PAGES the 'To Page' value is set to '9999' in the native print dialog. Noticed in all the builds prior to JDK1.5.0-b05.

      ###@###.### 2003-05-26
      -----------------------------------------------------------------------------
      This feature has broken in JDK1.5.0-b05 itself and hence removing the PIT tag.

      ###@###.### 2003-05-28
      -----------------------------------------------------------------------------

            jgodinez Jennifer Godinez (Inactive)
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: