Skip to content

Commit 06509ba

Browse files
Add javadocs for layout module
DEVSIX-5535
1 parent 8a9f1b4 commit 06509ba

File tree

7 files changed

+139
-5
lines changed

7 files changed

+139
-5
lines changed

layout/src/main/java/com/itextpdf/layout/layout/LayoutContext.java

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,40 +55,78 @@ This file is part of the iText (R) project.
5555
public class LayoutContext {
5656

5757
/**
58-
* The {@link LayoutArea area} the content to be placed on.
58+
* The {@link LayoutArea} for the content to be placed on.
5959
*/
6060
protected LayoutArea area;
6161

62+
/**
63+
* The info about margins collapsing.
64+
*/
6265
protected MarginsCollapseInfo marginsCollapseInfo;
6366

67+
/**
68+
* The list of {@link Rectangle} objects.
69+
*/
6470
protected List<Rectangle> floatRendererAreas = new ArrayList<>();
6571

6672
/**
6773
* Indicates whether the height is clipped or not.
6874
*/
6975
protected boolean clippedHeight = false;
7076

77+
/**
78+
* Creates the layout context.
79+
*
80+
* @param area for the content to be placed on
81+
*/
7182
public LayoutContext(LayoutArea area) {
7283
this.area = area;
7384
}
7485

86+
/**
87+
* Creates the layout context.
88+
*
89+
* @param area for the content to be placed on
90+
* @param marginsCollapseInfo the info about margins collapsing
91+
*/
7592
public LayoutContext(LayoutArea area, MarginsCollapseInfo marginsCollapseInfo) {
7693
this.area = area;
7794
this.marginsCollapseInfo = marginsCollapseInfo;
7895
}
7996

97+
/**
98+
* Creates the layout context.
99+
*
100+
* @param area for the content to be placed on
101+
* @param marginsCollapseInfo the info about margins collapsing
102+
* @param floatedRendererAreas list of {@link Rectangle} objects
103+
*/
80104
public LayoutContext(LayoutArea area, MarginsCollapseInfo marginsCollapseInfo, List<Rectangle> floatedRendererAreas) {
81105
this(area, marginsCollapseInfo);
82106
if (floatedRendererAreas != null) {
83107
this.floatRendererAreas = floatedRendererAreas;
84108
}
85109
}
86110

111+
/**
112+
* Creates the layout context.
113+
*
114+
* @param area for the content to be placed on
115+
* @param clippedHeight indicates whether the height is clipped or not
116+
*/
87117
public LayoutContext(LayoutArea area, boolean clippedHeight) {
88118
this(area);
89119
this.clippedHeight = clippedHeight;
90120
}
91121

122+
/**
123+
* Creates the layout context.
124+
*
125+
* @param area for the content to be placed on
126+
* @param marginsCollapseInfo the info about margins collapsing
127+
* @param floatedRendererAreas list of {@link Rectangle} objects
128+
* @param clippedHeight indicates whether the height is clipped or not
129+
*/
92130
public LayoutContext(LayoutArea area, MarginsCollapseInfo marginsCollapseInfo, List<Rectangle> floatedRendererAreas, boolean clippedHeight) {
93131
this(area, marginsCollapseInfo);
94132
if (floatedRendererAreas != null) {
@@ -106,10 +144,20 @@ public LayoutArea getArea() {
106144
return area;
107145
}
108146

147+
/**
148+
* Gets info about margins collapsing.
149+
*
150+
* @return the info about margins collapsing
151+
*/
109152
public MarginsCollapseInfo getMarginsCollapseInfo() {
110153
return marginsCollapseInfo;
111154
}
112155

156+
/**
157+
* Gets list of {@link Rectangle} objects.
158+
*
159+
* @return list of {@link Rectangle} objects
160+
*/
113161
public List<Rectangle> getFloatRendererAreas() {
114162
return floatRendererAreas;
115163
}

layout/src/main/java/com/itextpdf/layout/layout/LayoutResult.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ public class LayoutResult {
8888
* This renderer will be used to draw the overflowed part of content.
8989
*/
9090
protected IRenderer overflowRenderer;
91+
/**
92+
* The {@link AreaBreak} that will be rendered by this object.
93+
*/
9194
protected AreaBreak areaBreak;
9295

9396
/**
@@ -189,10 +192,21 @@ public void setOverflowRenderer(IRenderer overflowRenderer) {
189192
this.overflowRenderer = overflowRenderer;
190193
}
191194

195+
/**
196+
* Gets areaBreak value.
197+
*
198+
* @return the areaBreak value
199+
*/
192200
public AreaBreak getAreaBreak() {
193201
return areaBreak;
194202
}
195203

204+
/**
205+
* Sets areaBreak value.
206+
*
207+
* @param areaBreak the areaBreak value
208+
* @return the areaBreak value
209+
*/
196210
public LayoutResult setAreaBreak(AreaBreak areaBreak) {
197211
this.areaBreak = areaBreak;
198212
return this;

layout/src/main/java/com/itextpdf/layout/layout/LineLayoutContext.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,23 @@ public class LineLayoutContext extends LayoutContext {
5353
private boolean floatOverflowedToNextPageWithNothing = false;
5454
private float textIndent;
5555

56+
/**
57+
* Creates the context for content of a line.
58+
*
59+
* @param area for the content to be placed on
60+
* @param marginsCollapseInfo the info about margins collapsing
61+
* @param floatedRendererAreas list of {@link Rectangle} objects
62+
* @param clippedHeight indicates whether the height is clipped or not
63+
*/
5664
public LineLayoutContext(LayoutArea area, MarginsCollapseInfo marginsCollapseInfo, List<Rectangle> floatedRendererAreas, boolean clippedHeight) {
5765
super(area, marginsCollapseInfo, floatedRendererAreas, clippedHeight);
5866
}
5967

68+
/**
69+
* Creates the context for content of a line.
70+
*
71+
* @param layoutContext the context for content layouting
72+
*/
6073
public LineLayoutContext(LayoutContext layoutContext) {
6174
super(layoutContext.area, layoutContext.marginsCollapseInfo, layoutContext.floatRendererAreas, layoutContext.clippedHeight);
6275
}

layout/src/main/java/com/itextpdf/layout/layout/LineLayoutResult.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,30 @@ public boolean isSplitForcedByNewline() {
9595
}
9696

9797
/**
98-
* Sets {@link #setSplitForcedByNewline}
98+
* Sets a flat that split was forced by new line symbol in rendered text.
9999
*
100100
* @param isSplitForcedByNewline indicates that split was forced by new line symbol in rendered text.
101101
* @return {@link com.itextpdf.layout.layout.LineLayoutResult this layout result} the setting was applied on.
102-
* @see #setSplitForcedByNewline
103102
*/
104103
public LineLayoutResult setSplitForcedByNewline(boolean isSplitForcedByNewline) {
105104
this.splitForcedByNewline = isSplitForcedByNewline;
106105
return this;
107106
}
108107

108+
/**
109+
* Gets the list of floats overflowed to next page.
110+
*
111+
* @return list of floats overflowed to next page
112+
*/
109113
public List<IRenderer> getFloatsOverflowedToNextPage() {
110114
return floatsOverflowedToNextPage;
111115
}
112116

117+
/**
118+
* Sets the list of floats overflowed to next page.
119+
*
120+
* @param floatsOverflowedToNextPage the floats overflowed to next page
121+
*/
113122
public void setFloatsOverflowedToNextPage(List<IRenderer> floatsOverflowedToNextPage) {
114123
this.floatsOverflowedToNextPage = floatsOverflowedToNextPage;
115124
}

layout/src/main/java/com/itextpdf/layout/layout/MinMaxWidthLayoutResult.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,53 @@ This file is part of the iText (R) project.
5151
*/
5252
public class MinMaxWidthLayoutResult extends LayoutResult {
5353

54+
/**
55+
* The {@link MinMaxWidth} value of min and max width.
56+
*/
5457
protected MinMaxWidth minMaxWidth;
5558

59+
/**
60+
* Creates min and max width.
61+
*
62+
* @param status the status which indicates the content
63+
* @param occupiedArea the area occupied by the content
64+
* @param splitRenderer the renderer to draw the splitted part of the content
65+
* @param overflowRenderer the renderer to draw the overflowed part of the content
66+
*/
5667
public MinMaxWidthLayoutResult(int status, LayoutArea occupiedArea, IRenderer splitRenderer, IRenderer overflowRenderer) {
5768
super(status, occupiedArea, splitRenderer, overflowRenderer);
5869
minMaxWidth = new MinMaxWidth();
5970
}
6071

72+
/**
73+
* Creates min and max width.
74+
*
75+
* @param status the status which indicates the content
76+
* @param occupiedArea the area occupied by the content
77+
* @param splitRenderer the renderer to draw the splitted part of the content
78+
* @param overflowRenderer the renderer to draw the overflowed part of the content
79+
* @param cause the first renderer to produce {@link LayoutResult#NOTHING}
80+
*/
6181
public MinMaxWidthLayoutResult(int status, LayoutArea occupiedArea, IRenderer splitRenderer, IRenderer overflowRenderer, IRenderer cause) {
6282
super(status, occupiedArea, splitRenderer, overflowRenderer, cause);
6383
minMaxWidth = new MinMaxWidth();
6484
}
6585

86+
/**
87+
* Gets min and max width.
88+
*
89+
* @return min and max width
90+
*/
6691
public MinMaxWidth getMinMaxWidth() {
6792
return minMaxWidth;
6893
}
6994

95+
/**
96+
* Sets min and max width.
97+
*
98+
* @param minMaxWidth min and max width
99+
* @return min and max width
100+
*/
70101
public MinMaxWidthLayoutResult setMinMaxWidth(MinMaxWidth minMaxWidth) {
71102
this.minMaxWidth = minMaxWidth;
72103
return this;

layout/src/main/java/com/itextpdf/layout/layout/PositionedLayoutContext.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,30 @@ This file is part of the iText (R) project.
4242
*/
4343
package com.itextpdf.layout.layout;
4444

45+
/**
46+
* Represents the result of positioning for layout context.
47+
*/
4548
public class PositionedLayoutContext extends LayoutContext {
4649

4750
private LayoutArea parentOccupiedArea;
4851

52+
/**
53+
* Creates position for layout context.
54+
*
55+
* @param area for the content to be placed on
56+
* @param parentOccupiedArea the parent content to be placed on
57+
*/
4958
public PositionedLayoutContext(LayoutArea area, LayoutArea parentOccupiedArea) {
5059
super(area);
5160
this.parentOccupiedArea = parentOccupiedArea;
5261
}
5362

63+
/**
64+
* Gets the value of the parent occupied area.
65+
*
66+
* @return the parent occupied area
67+
*/
5468
public LayoutArea getParentOccupiedArea() {
5569
return parentOccupiedArea;
5670
}
57-
5871
}

layout/src/main/java/com/itextpdf/layout/layout/RootLayoutArea.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,20 @@ This file is part of the iText (R) project.
4545

4646
import com.itextpdf.kernel.geom.Rectangle;
4747

48+
/**
49+
* Represents the root layout area.
50+
*/
4851
public class RootLayoutArea extends LayoutArea implements Cloneable {
4952
/**
5053
* Indicates whether the area already has some placed content or not.
5154
*/
5255
protected boolean emptyArea = true;
5356

5457
/**
55-
* {@inheritDoc}
58+
* Creates the root layout area.
59+
*
60+
* @param pageNumber the value number of page
61+
* @param bBox the bounding box
5662
*/
5763
public RootLayoutArea(int pageNumber, Rectangle bBox) {
5864
super(pageNumber, bBox);

0 commit comments

Comments
 (0)