Skip to content

Commit daf7778

Browse files
committed
Document model: borders
1 parent 57a55ac commit daf7778

File tree

5 files changed

+76
-5
lines changed

5 files changed

+76
-5
lines changed

model/src/main/java/com/itextpdf/model/border/DashedBorder.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,29 @@
33
import com.itextpdf.core.pdf.canvas.PdfCanvas;
44
import com.itextpdf.core.color.Color;
55

6+
/**
7+
* Draws a border with dashes around the element it's been set to.
8+
*/
69
public class DashedBorder extends Border {
710

811
private static final float dashModifier = 5f;
912
private static final float gapModifier = 3.5f;
1013

14+
/**
15+
* Creates a DashedBorder with the specified width and sets the color to black.
16+
*
17+
* @param width width of the border
18+
*/
1119
public DashedBorder(float width) {
1220
super(width);
1321
}
14-
22+
23+
/**
24+
* Creates a DashedBorder with the specified width and the specified color.
25+
*
26+
* @param color color of the border
27+
* @param width width of the border
28+
*/
1529
public DashedBorder(Color color, float width) {
1630
super(color, width);
1731
}

model/src/main/java/com/itextpdf/model/border/DottedBorder.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,28 @@
33
import com.itextpdf.core.pdf.canvas.PdfCanvas;
44
import com.itextpdf.core.color.Color;
55

6+
/**
7+
* Draws a dotted border around the element it has been set to. Do note that this border draw square dots,
8+
* if you want to draw round dots, see {@link com.itextpdf.model.border.RoundDotsBorder}.
9+
*/
610
public class DottedBorder extends Border {
11+
712
private static final float gapModifier = 1.5f;
813

14+
/**
15+
* Creates a DotterBorder instance with the specified width. The color is set to the default: black.
16+
* @param width width of the border
17+
*/
918
public DottedBorder(float width) {
1019
super(width);
1120
}
1221

22+
/**
23+
* Creates a DottedBorder instance with the specified width and color.
24+
*
25+
* @param color color of the border
26+
* @param width width of the border
27+
*/
1328
public DottedBorder(Color color, float width) {
1429
super(color, width);
1530
}

model/src/main/java/com/itextpdf/model/border/DoubleBorder.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,30 @@
33
import com.itextpdf.core.pdf.canvas.PdfCanvas;
44
import com.itextpdf.core.color.Color;
55

6+
/**
7+
* Creates a double border around the element it's set to. The space between the two border lines has
8+
* the same width as the two borders. If a background has been set on the element the color will show in
9+
* between the two borders.
10+
*/
611
public class DoubleBorder extends Border{
712

13+
/**
14+
* Creates a DoubleBorder with the specified width for both the two borders as the space in between them.
15+
* The color is set to the default: black.
16+
*
17+
* @param width width of the borders and the space between them
18+
*/
819
public DoubleBorder(float width) {
920
super(width);
1021
}
1122

23+
/**
24+
* Creates a DoubleBorder with the specified width for both the two borders as the space in between them and
25+
* the specified color for the two borders. The space in between the two borders is either colorless or will
26+
* be filled with the background color of the element, if a color has been set.
27+
*
28+
* @param width width of the borders and the space between them
29+
*/
1230
public DoubleBorder(Color color, float width) {
1331
super(color, width);
1432
}
@@ -106,16 +124,12 @@ public void draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float
106124

107125
@Override
108126
public void drawCellBorder(PdfCanvas canvas, float x1, float y1, float x2, float y2) {
109-
// float x3 = 0, y3 = 0;
110-
// float x4 = 0, y4 = 0;
111127
float thirdOfWidth = width / 3;
112128

113129
Border.Side borderSide = getBorderSide(x1, y1, x2, y2);
114130

115131
switch (borderSide) {
116132
case TOP:
117-
//x1 += thirdOfWidth;
118-
//x2 += 2*thirdOfWidth;
119133
y1 -= thirdOfWidth;
120134
y2 = y1;
121135
break;

model/src/main/java/com/itextpdf/model/border/RoundDotsBorder.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,27 @@
44
import com.itextpdf.core.pdf.canvas.PdfCanvasConstants;
55
import com.itextpdf.core.color.Color;
66

7+
/**
8+
* Draws a border with rounded dots aroudn the element it's been set to. For square dots see {@link com.itextpdf.model.border.DottedBorder}.
9+
*/
710
public class RoundDotsBorder extends Border {
811
private static final float gapModifier = 2.5f;
912

13+
/**
14+
* Creates a RoundDotsBorder with the specified witµdth and sets the color to black.
15+
*
16+
* @param width width of the border
17+
*/
1018
public RoundDotsBorder(float width) {
1119
super(width);
1220
}
1321

22+
/**
23+
* Creates a RoundDotsBorder with the specified witµdth and the specified color.
24+
*
25+
* @param color color of the border
26+
* @param width width of the border
27+
*/
1428
public RoundDotsBorder(Color color, float width) {
1529
super(color, width);
1630
}

model/src/main/java/com/itextpdf/model/border/SolidBorder.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,26 @@
33
import com.itextpdf.core.pdf.canvas.PdfCanvas;
44
import com.itextpdf.core.color.Color;
55

6+
/**
7+
* Draws a solid border around the element it's set to.
8+
*/
69
public class SolidBorder extends Border {
710

11+
/**
12+
* Creates a SolidBorder with the specified width and sets the color to black.
13+
*
14+
* @param width width of the border
15+
*/
816
public SolidBorder(float width) {
917
super(width);
1018
}
1119

20+
/**
21+
* Creates a SolidBorder with the specified width and the specified color.
22+
*
23+
* @param color color of the border
24+
* @param width width of the border
25+
*/
1226
public SolidBorder(Color color, float width) {
1327
super(color, width);
1428
}

0 commit comments

Comments
 (0)