Skip to content

Commit 8a3980d

Browse files
deepika-uakurtakov
authored andcommitted
Javadoc basher changes for 4.39
Fixes eclipse-platform#3092
1 parent 979d417 commit 8a3980d

File tree

4 files changed

+100
-32
lines changed

4 files changed

+100
-32
lines changed

bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PDFDocument.java

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
* when those instances are no longer required.
3232
* </p>
3333
* <p>
34+
* <b>Note:</b> On Windows, this class uses the built-in "Microsoft Print to PDF"
35+
* printer which is available on Windows 10 and later.
36+
* </p>
37+
* <p>
3438
* The following example demonstrates how to use PDFDocument:
3539
* </p>
3640
* <pre>
@@ -76,6 +80,12 @@ static class PDFDocumentData extends DeviceData {
7680
/**
7781
* Constructs a new PDFDocument with the specified filename and page size.
7882
* <p>
83+
* The page size specifies the preferred dimensions in points (1/72 inch). On Windows,
84+
* the Microsoft Print to PDF driver only supports standard paper sizes, so the actual
85+
* page size may be larger than requested. Use {@link #getBounds()} to query the actual
86+
* page dimensions after construction.
87+
* </p>
88+
* <p>
7989
* You must dispose the PDFDocument when it is no longer required.
8090
* </p>
8191
*
@@ -87,35 +97,43 @@ static class PDFDocumentData extends DeviceData {
8797
* <li>ERROR_INVALID_ARGUMENT - if width or height is not positive</li>
8898
* </ul>
8999
* @exception SWTError <ul>
90-
* <li>ERROR_NO_HANDLES - if the PDF context could not be created</li>
100+
* <li>ERROR_NO_HANDLES - if the PDF printer is not available</li>
91101
* </ul>
92102
*
93103
* @see PageSize
94104
* @see #dispose()
105+
* @see #getBounds()
95106
*/
96107
public PDFDocument(String filename, PageSize pageSize) {
97108
super(checkData(filename, pageSize));
98109
}
99110

100111
/**
101-
* Constructs a new PDFDocument with the specified filename and page dimensions.
112+
* Constructs a new PDFDocument with the specified filename and preferred page dimensions.
113+
* <p>
114+
* The dimensions specify the preferred page size in points (1/72 inch). On Windows,
115+
* the Microsoft Print to PDF driver only supports standard paper sizes, so the actual
116+
* page size may be larger than requested. Use {@link #getBounds()} to query the actual
117+
* page dimensions after construction.
118+
* </p>
102119
* <p>
103120
* You must dispose the PDFDocument when it is no longer required.
104121
* </p>
105122
*
106123
* @param filename the path to the PDF file to create
107-
* @param widthInPoints the width of each page in points (1/72 inch)
108-
* @param heightInPoints the height of each page in points (1/72 inch)
124+
* @param widthInPoints the preferred width of each page in points (1/72 inch)
125+
* @param heightInPoints the preferred height of each page in points (1/72 inch)
109126
*
110127
* @exception IllegalArgumentException <ul>
111128
* <li>ERROR_NULL_ARGUMENT - if filename is null</li>
112129
* <li>ERROR_INVALID_ARGUMENT - if width or height is not positive</li>
113130
* </ul>
114131
* @exception SWTError <ul>
115-
* <li>ERROR_NO_HANDLES - if the PDF context could not be created</li>
132+
* <li>ERROR_NO_HANDLES - if the PDF printer is not available</li>
116133
* </ul>
117134
*
118135
* @see #dispose()
136+
* @see #getBounds()
119137
*/
120138
public PDFDocument(String filename, double widthInPoints, double heightInPoints) {
121139
this(filename, new PageSize(widthInPoints, heightInPoints));
@@ -237,9 +255,13 @@ public void newPage() {
237255
* This method should be called after completing the content of one page
238256
* and before starting to draw on the next page.
239257
* </p>
258+
* <p>
259+
* <b>Note:</b> On Windows, changing page dimensions after the document
260+
* has been started may not be fully supported by all printer drivers.
261+
* </p>
240262
*
241-
* @param widthInPoints the width of the new page in points (1/72 inch)
242-
* @param heightInPoints the height of the new page in points (1/72 inch)
263+
* @param widthInPoints the preferred width of the new page in points (1/72 inch)
264+
* @param heightInPoints the preferred height of the new page in points (1/72 inch)
243265
*
244266
* @exception IllegalArgumentException <ul>
245267
* <li>ERROR_INVALID_ARGUMENT - if width or height is not positive</li>
@@ -258,9 +280,13 @@ public void newPage(double widthInPoints, double heightInPoints) {
258280
}
259281

260282
/**
261-
* Returns the width of the current page in points.
283+
* Returns the actual width of the current page in points.
284+
* <p>
285+
* On Windows, this may be larger than the preferred width specified
286+
* in the constructor due to standard paper size constraints.
287+
* </p>
262288
*
263-
* @return the width in points (1/72 inch)
289+
* @return the actual width in points (1/72 inch)
264290
*
265291
* @exception SWTException <ul>
266292
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
@@ -272,9 +298,13 @@ public double getWidth() {
272298
}
273299

274300
/**
275-
* Returns the height of the current page in points.
301+
* Returns the actual height of the current page in points.
302+
* <p>
303+
* On Windows, this may be larger than the preferred height specified
304+
* in the constructor due to standard paper size constraints.
305+
* </p>
276306
*
277-
* @return the height in points (1/72 inch)
307+
* @return the actual height in points (1/72 inch)
278308
*
279309
* @exception SWTException <ul>
280310
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
@@ -287,8 +317,8 @@ public double getHeight() {
287317

288318
/**
289319
* Returns the DPI (dots per inch) of the PDF document.
290-
* PDF documents work in points where 1 point = 1/72 inch,
291-
* so the DPI is always 72.
320+
* Since the coordinate system is scaled to work in points (1/72 inch),
321+
* this always returns 72 DPI, consistent with GTK and Cocoa implementations.
292322
*
293323
* @return a point whose x coordinate is the horizontal DPI and whose y coordinate is the vertical DPI
294324
*
@@ -305,6 +335,10 @@ public Point getDPI() {
305335
/**
306336
* Returns a rectangle describing the receiver's size and location.
307337
* The rectangle dimensions are in points (1/72 inch).
338+
* <p>
339+
* On Windows, this returns the actual page size which may be larger
340+
* than the preferred size specified in the constructor.
341+
* </p>
308342
*
309343
* @return the bounding rectangle
310344
*

bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PDFDocument.java

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
* when those instances are no longer required.
3333
* </p>
3434
* <p>
35+
* <b>Note:</b> On Windows, this class uses the built-in "Microsoft Print to PDF"
36+
* printer which is available on Windows 10 and later.
37+
* </p>
38+
* <p>
3539
* The following example demonstrates how to use PDFDocument:
3640
* </p>
3741
* <pre>
@@ -76,6 +80,12 @@ static class PDFDocumentData extends DeviceData {
7680
/**
7781
* Constructs a new PDFDocument with the specified filename and page size.
7882
* <p>
83+
* The page size specifies the preferred dimensions in points (1/72 inch). On Windows,
84+
* the Microsoft Print to PDF driver only supports standard paper sizes, so the actual
85+
* page size may be larger than requested. Use {@link #getBounds()} to query the actual
86+
* page dimensions after construction.
87+
* </p>
88+
* <p>
7989
* You must dispose the PDFDocument when it is no longer required.
8090
* </p>
8191
*
@@ -87,35 +97,43 @@ static class PDFDocumentData extends DeviceData {
8797
* <li>ERROR_INVALID_ARGUMENT - if width or height is not positive</li>
8898
* </ul>
8999
* @exception SWTError <ul>
90-
* <li>ERROR_NO_HANDLES - if the PDF surface could not be created</li>
100+
* <li>ERROR_NO_HANDLES - if the PDF printer is not available</li>
91101
* </ul>
92102
*
93103
* @see PageSize
94104
* @see #dispose()
105+
* @see #getBounds()
95106
*/
96107
public PDFDocument(String filename, PageSize pageSize) {
97108
super(checkData(filename, pageSize));
98109
}
99110

100111
/**
101-
* Constructs a new PDFDocument with the specified filename and page dimensions.
112+
* Constructs a new PDFDocument with the specified filename and preferred page dimensions.
113+
* <p>
114+
* The dimensions specify the preferred page size in points (1/72 inch). On Windows,
115+
* the Microsoft Print to PDF driver only supports standard paper sizes, so the actual
116+
* page size may be larger than requested. Use {@link #getBounds()} to query the actual
117+
* page dimensions after construction.
118+
* </p>
102119
* <p>
103120
* You must dispose the PDFDocument when it is no longer required.
104121
* </p>
105122
*
106123
* @param filename the path to the PDF file to create
107-
* @param widthInPoints the width of each page in points (1/72 inch)
108-
* @param heightInPoints the height of each page in points (1/72 inch)
124+
* @param widthInPoints the preferred width of each page in points (1/72 inch)
125+
* @param heightInPoints the preferred height of each page in points (1/72 inch)
109126
*
110127
* @exception IllegalArgumentException <ul>
111128
* <li>ERROR_NULL_ARGUMENT - if filename is null</li>
112129
* <li>ERROR_INVALID_ARGUMENT - if width or height is not positive</li>
113130
* </ul>
114131
* @exception SWTError <ul>
115-
* <li>ERROR_NO_HANDLES - if the PDF surface could not be created</li>
132+
* <li>ERROR_NO_HANDLES - if the PDF printer is not available</li>
116133
* </ul>
117134
*
118135
* @see #dispose()
136+
* @see #getBounds()
119137
*/
120138
public PDFDocument(String filename, double widthInPoints, double heightInPoints) {
121139
this(filename, new PageSize(widthInPoints, heightInPoints));
@@ -190,9 +208,13 @@ public void newPage() {
190208
* This method should be called after completing the content of one page
191209
* and before starting to draw on the next page.
192210
* </p>
211+
* <p>
212+
* <b>Note:</b> On Windows, changing page dimensions after the document
213+
* has been started may not be fully supported by all printer drivers.
214+
* </p>
193215
*
194-
* @param widthInPoints the width of the new page in points (1/72 inch)
195-
* @param heightInPoints the height of the new page in points (1/72 inch)
216+
* @param widthInPoints the preferred width of the new page in points (1/72 inch)
217+
* @param heightInPoints the preferred height of the new page in points (1/72 inch)
196218
*
197219
* @exception IllegalArgumentException <ul>
198220
* <li>ERROR_INVALID_ARGUMENT - if width or height is not positive</li>
@@ -212,9 +234,13 @@ public void newPage(double widthInPoints, double heightInPoints) {
212234
}
213235

214236
/**
215-
* Returns the width of the current page in points.
237+
* Returns the actual width of the current page in points.
238+
* <p>
239+
* On Windows, this may be larger than the preferred width specified
240+
* in the constructor due to standard paper size constraints.
241+
* </p>
216242
*
217-
* @return the width in points (1/72 inch)
243+
* @return the actual width in points (1/72 inch)
218244
*
219245
* @exception SWTException <ul>
220246
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
@@ -226,9 +252,13 @@ public double getWidth() {
226252
}
227253

228254
/**
229-
* Returns the height of the current page in points.
255+
* Returns the actual height of the current page in points.
256+
* <p>
257+
* On Windows, this may be larger than the preferred height specified
258+
* in the constructor due to standard paper size constraints.
259+
* </p>
230260
*
231-
* @return the height in points (1/72 inch)
261+
* @return the actual height in points (1/72 inch)
232262
*
233263
* @exception SWTException <ul>
234264
* <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
@@ -241,8 +271,8 @@ public double getHeight() {
241271

242272
/**
243273
* Returns the DPI (dots per inch) of the PDF document.
244-
* PDF documents work in points where 1 point = 1/72 inch,
245-
* so the DPI is always 72.
274+
* Since the coordinate system is scaled to work in points (1/72 inch),
275+
* this always returns 72 DPI, consistent with GTK and Cocoa implementations.
246276
*
247277
* @return a point whose x coordinate is the horizontal DPI and whose y coordinate is the vertical DPI
248278
*
@@ -259,6 +289,10 @@ public Point getDPI() {
259289
/**
260290
* Returns a rectangle describing the receiver's size and location.
261291
* The rectangle dimensions are in points (1/72 inch).
292+
* <p>
293+
* On Windows, this returns the actual page size which may be larger
294+
* than the preferred size specified in the constructor.
295+
* </p>
262296
*
263297
* @return the bounding rectangle
264298
*

bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Device.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,11 @@ public int getDepth () {
390390
* multiple monitors. This method returns a value based on the
391391
* primary monitor DPI on startup (depending on the OS).</p>
392392
*
393-
* <p>Note: This method returns a DPI value under consideration of the
393+
* <p>Note: This method returns a DPI value under consideration of the
394394
* autoscale mode. If the autoscaled zoom is different to the native
395395
* zoom, the returned DPI will be calculated relative from the autoscaled
396-
* zoom to the DPI of the native zoom, e.g. in the Windows implementation
397-
* (with a base DPI of 96) this method will return 120 with autoscale mode
396+
* zoom to the DPI of the native zoom, e.g. in the Windows implementation
397+
* (with a base DPI of 96) this method will return 120 with autoscale mode
398398
* <i>integer</i> and 96 with autoscale mode <i>quarter</i>.</p>
399399
*
400400
* @return the horizontal and vertical DPI

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,11 @@ public int getDepth () {
454454
* multiple monitors. This method returns a value based on the
455455
* primary monitor DPI on startup (depending on the OS).</p>
456456
*
457-
* <p>Note: This method returns a DPI value under consideration of the
457+
* <p>Note: This method returns a DPI value under consideration of the
458458
* autoscale mode. If the autoscaled zoom is different to the native
459459
* zoom, the returned DPI will be calculated relative from the autoscaled
460-
* zoom to the DPI of the native zoom, e.g. in the Windows implementation
461-
* (with a base DPI of 96) this method will return 120 with autoscale mode
460+
* zoom to the DPI of the native zoom, e.g. in the Windows implementation
461+
* (with a base DPI of 96) this method will return 120 with autoscale mode
462462
* <i>integer</i> and 96 with autoscale mode <i>quarter</i>.</p>
463463
*
464464
* @return the horizontal and vertical DPI

0 commit comments

Comments
 (0)