@@ -58,52 +58,62 @@ public abstract class Border {
58
58
public static final Border NO_BORDER = null ;
59
59
/**
60
60
* The solid border.
61
+ *
61
62
* @see SolidBorder
62
63
*/
63
64
public static final int SOLID = 0 ;
64
65
/**
65
66
* The dashed border.
67
+ *
66
68
* @see DashedBorder
67
69
*/
68
70
public static final int DASHED = 1 ;
69
71
/**
70
72
* The dotted border.
73
+ *
71
74
* @see DottedBorder
72
75
*/
73
76
public static final int DOTTED = 2 ;
74
77
/**
75
78
* The double border.
79
+ *
76
80
* @see DoubleBorder
77
81
*/
78
82
public static final int DOUBLE = 3 ;
79
83
/**
80
84
* The round-dots border.
85
+ *
81
86
* @see RoundDotsBorder
82
87
*/
83
88
public static final int ROUND_DOTS = 4 ;
84
89
/**
85
90
* The 3D groove border.
91
+ *
86
92
* @see GrooveBorder
87
93
*/
88
94
public static final int _3D_GROOVE = 5 ;
89
95
/**
90
96
* The 3D inset border.
97
+ *
91
98
* @see InsetBorder
92
99
*/
93
100
public static final int _3D_INSET = 6 ;
94
101
/**
95
102
* The 3D outset border.
103
+ *
96
104
* @see OutsetBorder
97
105
*/
98
106
public static final int _3D_OUTSET = 7 ;
99
107
/**
100
108
* The 3D ridge border.
109
+ *
101
110
* @see RidgeBorder
102
111
*/
103
112
public static final int _3D_RIDGE = 8 ;
104
113
105
114
/**
106
115
* The color of the border.
116
+ *
107
117
* @see Color
108
118
* @deprecated use {@link Border#transparentColor} instead
109
119
*/
@@ -112,6 +122,7 @@ public abstract class Border {
112
122
113
123
/**
114
124
* The color of the border.
125
+ *
115
126
* @see TransparentColor
116
127
*/
117
128
protected TransparentColor transparentColor ;
@@ -156,16 +167,16 @@ protected Border(Color color, float width) {
156
167
/**
157
168
* Creates a {@link Border border} with given width, {@link Color color} and opacity.
158
169
*
159
- * @param color the color which the border should have
160
- * @param width the width which the border should have
170
+ * @param color the color which the border should have
171
+ * @param width the width which the border should have
161
172
* @param opacity the opacity which border should have; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
162
173
*/
163
174
protected Border (Color color , float width , float opacity ) {
164
175
this .color = color ;
165
176
this .transparentColor = new TransparentColor (color , opacity );
166
177
this .width = width ;
167
178
}
168
-
179
+
169
180
/**
170
181
* <p>
171
182
* All borders are supposed to be drawn in such way, that inner content of the element is on the right from the
@@ -182,14 +193,14 @@ protected Border(Color color, float width, float opacity) {
182
193
* <code>borderWidthAfter</code> - width of the left border. Those width are used to handle areas
183
194
* of border joins.
184
195
* </p>
185
- * @param canvas PdfCanvas to be written to
186
- * @param x1 x coordinate of the beginning point of the element side, that should be bordered
187
- * @param y1 y coordinate of the beginning point of the element side, that should be bordered
188
- * @param x2 x coordinate of the ending point of the element side, that should be bordered
189
- * @param y2 y coordinate of the ending point of the element side, that should be bordered
190
- * @param borderWidthBefore defines width of the border that is before the current one
191
- * @param borderWidthAfter defines width of the border that is after the current one
192
196
*
197
+ * @param canvas PdfCanvas to be written to
198
+ * @param x1 x coordinate of the beginning point of the element side, that should be bordered
199
+ * @param y1 y coordinate of the beginning point of the element side, that should be bordered
200
+ * @param x2 x coordinate of the ending point of the element side, that should be bordered
201
+ * @param y2 y coordinate of the ending point of the element side, that should be bordered
202
+ * @param borderWidthBefore defines width of the border that is before the current one
203
+ * @param borderWidthAfter defines width of the border that is after the current one
193
204
* @deprecated Will be removed in 7.1.0. use {@link Border#draw(PdfCanvas, float, float, float, float, Side, float, float)} instead
194
205
*/
195
206
@ Deprecated
@@ -211,29 +222,93 @@ protected Border(Color color, float width, float opacity) {
211
222
* <code>borderWidthAfter</code> - width of the left border. Those width are used to handle areas
212
223
* of border joins.
213
224
* </p>
214
- * @param canvas PdfCanvas to be written to
215
- * @param x1 x coordinate of the beginning point of the element side, that should be bordered
216
- * @param y1 y coordinate of the beginning point of the element side, that should be bordered
217
- * @param x2 x coordinate of the ending point of the element side, that should be bordered
218
- * @param y2 y coordinate of the ending point of the element side, that should be bordered
219
- * @param side the {@link Border.Side}, that represents element side, that should be bordered
225
+ *
226
+ * @param canvas PdfCanvas to be written to
227
+ * @param x1 x coordinate of the beginning point of the element side, that should be bordered
228
+ * @param y1 y coordinate of the beginning point of the element side, that should be bordered
229
+ * @param x2 x coordinate of the ending point of the element side, that should be bordered
230
+ * @param y2 y coordinate of the ending point of the element side, that should be bordered
231
+ * @param side the {@link Border.Side}, that represents element side, that should be bordered
220
232
* @param borderWidthBefore defines width of the border that is before the current one
221
- * @param borderWidthAfter defines width of the border that is after the current one
233
+ * @param borderWidthAfter defines width of the border that is after the current one
222
234
*/
223
235
public void draw (PdfCanvas canvas , float x1 , float y1 , float x2 , float y2 , Side side , float borderWidthBefore , float borderWidthAfter ) {
224
236
tmpSide = side ;
225
237
draw (canvas , x1 , y1 , x2 , y2 , borderWidthBefore , borderWidthAfter );
226
238
tmpSide = Side .NONE ;
227
239
}
228
240
241
+ /**
242
+ * <p>
243
+ * All borders are supposed to be drawn in such way, that inner content of the element is on the right from the
244
+ * drawing direction. Borders are drawn in this order: top, right, bottom, left.
245
+ * </p>
246
+ * <p>
247
+ * Given points specify the line which lies on the border of the content area,
248
+ * therefore the border itself should be drawn to the left from the drawing direction.
249
+ * </p>
250
+ * <p>
251
+ * <code>borderWidthBefore</code> and <code>borderWidthAfter</code> parameters are used to
252
+ * define the widths of the borders that are before and after the current border, e.g. for
253
+ * the bottom border, <code>borderWidthBefore</code> specifies width of the right border and
254
+ * <code>borderWidthAfter</code> - width of the left border. Those width are used to handle areas
255
+ * of border joins.
256
+ * </p>
257
+ *
258
+ * @param canvas PdfCanvas to be written to
259
+ * @param x1 x coordinate of the beginning point of the element side, that should be bordered
260
+ * @param y1 y coordinate of the beginning point of the element side, that should be bordered
261
+ * @param x2 x coordinate of the ending point of the element side, that should be bordered
262
+ * @param y2 y coordinate of the ending point of the element side, that should be bordered
263
+ * @param borderRadius border radius
264
+ * @param side the {@link Border.Side}, that represents element side, that should be bordered
265
+ * @param borderWidthBefore defines width of the border that is before the current one
266
+ * @param borderWidthAfter defines width of the border that is after the current one
267
+ */
268
+ public void draw (PdfCanvas canvas , float x1 , float y1 , float x2 , float y2 , float borderRadius , Side side , float borderWidthBefore , float borderWidthAfter ) {
269
+ tmpSide = side ;
270
+ draw (canvas , x1 , y1 , x2 , y2 , borderRadius , borderWidthBefore , borderWidthAfter );
271
+ tmpSide = Side .NONE ;
272
+ }
273
+
274
+ /**
275
+ * <p>
276
+ * All borders are supposed to be drawn in such way, that inner content of the element is on the right from the
277
+ * drawing direction. Borders are drawn in this order: top, right, bottom, left.
278
+ * </p>
279
+ * <p>
280
+ * Given points specify the line which lies on the border of the content area,
281
+ * therefore the border itself should be drawn to the left from the drawing direction.
282
+ * </p>
283
+ * <p>
284
+ * <code>borderWidthBefore</code> and <code>borderWidthAfter</code> parameters are used to
285
+ * define the widths of the borders that are before and after the current border, e.g. for
286
+ * the bottom border, <code>borderWidthBefore</code> specifies width of the right border and
287
+ * <code>borderWidthAfter</code> - width of the left border. Those width are used to handle areas
288
+ * of border joins.
289
+ * </p>
290
+ *
291
+ * @param canvas PdfCanvas to be written to
292
+ * @param x1 x coordinate of the beginning point of the element side, that should be bordered
293
+ * @param y1 y coordinate of the beginning point of the element side, that should be bordered
294
+ * @param x2 x coordinate of the ending point of the element side, that should be bordered
295
+ * @param y2 y coordinate of the ending point of the element side, that should be bordered
296
+ * @param borderRadius border radius
297
+ * @param borderWidthBefore defines width of the border that is before the current one
298
+ * @param borderWidthAfter defines width of the border that is after the current one
299
+ * @deprecated Will be removed in 7.1.0. use {@link Border#draw(PdfCanvas, float, float, float, float, float, Side, float, float)} instead
300
+ */
301
+ @ Deprecated
302
+ public abstract void draw (PdfCanvas canvas , float x1 , float y1 , float x2 , float y2 , float borderRadius , float borderWidthBefore , float borderWidthAfter );
303
+
229
304
/**
230
305
* Draws the border of a cell.
231
306
*
232
307
* @param canvas PdfCanvas to be written to
233
- * @param x1 x coordinate of the beginning point of the element side, that should be bordered
234
- * @param y1 y coordinate of the beginning point of the element side, that should be bordered
235
- * @param x2 x coordinate of the ending point of the element side, that should be bordered
236
- * @param y2 y coordinate of the ending point of the element side, that should be bordered
308
+ * @param x1 x coordinate of the beginning point of the element side, that should be bordered
309
+ * @param y1 y coordinate of the beginning point of the element side, that should be bordered
310
+ * @param x2 x coordinate of the ending point of the element side, that should be bordered
311
+ * @param y2 y coordinate of the ending point of the element side, that should be bordered
237
312
*/
238
313
public abstract void drawCellBorder (PdfCanvas canvas , float x1 , float y1 , float x2 , float y2 );
239
314
@@ -253,7 +328,7 @@ public Color getColor() {
253
328
254
329
/**
255
330
* Gets the opacity of the {@link Border border}
256
- *
331
+ *
257
332
* @return the border opacity; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
258
333
*/
259
334
public float getOpacity () {
@@ -345,13 +420,13 @@ protected Side getBorderSide(float x1, float y1, float x2, float y2) {
345
420
346
421
boolean isTop = false ;
347
422
boolean isBottom = false ;
348
- if (Math .abs (x2 - x1 ) > 0.0005f ) {
423
+ if (Math .abs (x2 - x1 ) > 0.0005f ) {
349
424
isTop = x2 - x1 > 0 ;
350
425
isBottom = x2 - x1 < 0 ;
351
426
}
352
427
353
428
if (isTop ) {
354
- return Side .TOP ;
429
+ return isLeft ? Side . LEFT : Side .TOP ;
355
430
} else if (isRight ) {
356
431
return Side .RIGHT ;
357
432
} else if (isBottom ) {
@@ -368,5 +443,7 @@ protected Side getBorderSide(float x1, float y1, float x2, float y2) {
368
443
* The rectangle sides are expected to be parallel to corresponding page sides
369
444
* Otherwise the result is Side.NONE
370
445
*/
371
- public enum Side {NONE , TOP , RIGHT , BOTTOM , LEFT }
446
+ public enum Side {
447
+ NONE , TOP , RIGHT , BOTTOM , LEFT
448
+ }
372
449
}
0 commit comments