Skip to content

Commit ac02bf7

Browse files
committed
Move inner classes from layout.Property to layout.property package
DEVSIX-585
1 parent 1533541 commit ac02bf7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+884
-783
lines changed

forms/src/main/java/com/itextpdf/forms/fields/PdfFormField.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ This file is part of the iText (R) project.
7979
import com.itextpdf.io.source.RandomAccessFileOrArray;
8080
import com.itextpdf.io.source.RandomAccessSourceFactory;
8181
import com.itextpdf.layout.Canvas;
82-
import com.itextpdf.layout.Property;
82+
import com.itextpdf.layout.property.Property;
8383
import com.itextpdf.layout.element.Paragraph;
84+
import com.itextpdf.layout.property.TextAlignment;
85+
import com.itextpdf.layout.property.VerticalAlignment;
8486

8587
import java.io.IOException;
8688
import java.util.ArrayList;
@@ -2183,15 +2185,15 @@ protected void drawTextAppearance(Rectangle rect, PdfFont font, int fontSize, St
21832185
justification = 0;
21842186
}
21852187
float x = 0;
2186-
Property.TextAlignment textAlignment = Property.TextAlignment.LEFT;
2188+
TextAlignment textAlignment = TextAlignment.LEFT;
21872189
if (justification == ALIGN_RIGHT) {
2188-
textAlignment = Property.TextAlignment.RIGHT;
2190+
textAlignment = TextAlignment.RIGHT;
21892191
x = rect.getWidth();
21902192
} else if (justification == ALIGN_CENTER) {
2191-
textAlignment = Property.TextAlignment.CENTER;
2193+
textAlignment = TextAlignment.CENTER;
21922194
x = rect.getWidth() / 2;
21932195
}
2194-
new Canvas(canvas, getDocument(), new Rectangle(0, -height, 0, 2 * height)).showTextAligned(paragraph, x, rect.getHeight() / 2, textAlignment, Property.VerticalAlignment.MIDDLE);
2196+
new Canvas(canvas, getDocument(), new Rectangle(0, -height, 0, 2 * height)).showTextAligned(paragraph, x, rect.getHeight() / 2, textAlignment, VerticalAlignment.MIDDLE);
21952197

21962198
canvas.
21972199
restoreState().
@@ -2517,8 +2519,8 @@ protected void drawButton(PdfCanvas canvas, float x, float y, float width, float
25172519
}
25182520

25192521
Paragraph paragraph = new Paragraph(text).setFont(font).setFontSize(fontSize).setMargin(0).setMultipliedLeading(1).
2520-
setVerticalAlignment(Property.VerticalAlignment.MIDDLE);
2521-
new Canvas(canvas, getDocument(), new Rectangle(0, -height, width, 2 * height)).showTextAligned(paragraph, width / 2, height / 2, Property.TextAlignment.CENTER, Property.VerticalAlignment.MIDDLE);
2522+
setVerticalAlignment(VerticalAlignment.MIDDLE);
2523+
new Canvas(canvas, getDocument(), new Rectangle(0, -height, width, 2 * height)).showTextAligned(paragraph, width / 2, height / 2, TextAlignment.CENTER, VerticalAlignment.MIDDLE);
25222524
}
25232525

25242526
/**

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ This file is part of the iText (R) project.
4747
import com.itextpdf.kernel.geom.Rectangle;
4848
import com.itextpdf.layout.layout.LayoutArea;
4949
import com.itextpdf.layout.layout.LayoutResult;
50+
import com.itextpdf.layout.property.AreaBreakType;
5051
import com.itextpdf.layout.renderer.DocumentRenderer;
5152

5253
/**
@@ -69,7 +70,7 @@ public ColumnDocumentRenderer(Document document, boolean immediateFlush, Rectang
6970

7071
@Override
7172
protected LayoutArea updateCurrentArea(LayoutResult overflowResult) {
72-
if (overflowResult != null && overflowResult.getAreaBreak() != null && overflowResult.getAreaBreak().getType() != Property.AreaBreakType.NEW_AREA) {
73+
if (overflowResult != null && overflowResult.getAreaBreak() != null && overflowResult.getAreaBreak().getType() != AreaBreakType.NEW_AREA) {
7374
nextAreaNumber = 0;
7475
}
7576
if (nextAreaNumber % columns.length == 0) {

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

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ This file is part of the iText (R) project.
5050
import com.itextpdf.layout.border.Border;
5151
import com.itextpdf.layout.hyphenation.HyphenationConfig;
5252
import com.itextpdf.layout.layout.LayoutPosition;
53+
import com.itextpdf.layout.property.Background;
54+
import com.itextpdf.layout.property.BaseDirection;
55+
import com.itextpdf.layout.property.FontKerning;
56+
import com.itextpdf.layout.property.HorizontalAlignment;
57+
import com.itextpdf.layout.property.Property;
58+
import com.itextpdf.layout.property.TextAlignment;
59+
import com.itextpdf.layout.property.Underline;
60+
import com.itextpdf.layout.property.UnitValue;
5361
import com.itextpdf.layout.splitting.ISplitCharacters;
5462

5563
import java.util.Arrays;
@@ -123,9 +131,9 @@ public <T> T getDefaultProperty(Property property) {
123131
* Gets the width property of the Element.
124132
*
125133
* @return the width of the element, with a value and a measurement unit.
126-
* @see Property.UnitValue
134+
* @see UnitValue
127135
*/
128-
public Property.UnitValue getWidth() {
136+
public UnitValue getWidth() {
129137
return getProperty(Property.WIDTH);
130138
}
131139

@@ -136,7 +144,7 @@ public Property.UnitValue getWidth() {
136144
* @return this Element.
137145
*/
138146
public Type setWidth(float width) {
139-
return setProperty(Property.WIDTH, Property.UnitValue.createPointValue(width));
147+
return setProperty(Property.WIDTH, UnitValue.createPointValue(width));
140148
}
141149

142150
/**
@@ -146,16 +154,16 @@ public Type setWidth(float width) {
146154
* @return this Element.
147155
*/
148156
public Type setWidthPercent(float widthPercent) {
149-
return setProperty(Property.WIDTH, Property.UnitValue.createPercentValue(widthPercent));
157+
return setProperty(Property.WIDTH, UnitValue.createPercentValue(widthPercent));
150158
}
151159

152160
/**
153-
* Sets the width property of the Element with a {@link com.itextpdf.layout.Property.UnitValue}.
161+
* Sets the width property of the Element with a {@link UnitValue}.
154162
*
155-
* @param width a {@link com.itextpdf.layout.Property.UnitValue} object
163+
* @param width a {@link UnitValue} object
156164
* @return this Element.
157165
*/
158-
public Type setWidth(Property.UnitValue width) {
166+
public Type setWidth(UnitValue width) {
159167
return setProperty(Property.WIDTH, width);
160168
}
161169

@@ -214,7 +222,7 @@ public Type setRelativePosition(float left, float top, float right, float bottom
214222
* @return this Element.
215223
*/
216224
public Type setFixedPosition(float x, float y, float width) {
217-
return setFixedPosition(x, y, Property.UnitValue.createPointValue(width));
225+
return setFixedPosition(x, y, UnitValue.createPointValue(width));
218226
}
219227

220228
/**
@@ -224,10 +232,10 @@ public Type setFixedPosition(float x, float y, float width) {
224232
*
225233
* @param x horizontal position on the page
226234
* @param y vertical position on the page
227-
* @param width a {@link com.itextpdf.layout.Property.UnitValue}
235+
* @param width a {@link UnitValue}
228236
* @return this Element.
229237
*/
230-
public Type setFixedPosition(float x, float y, Property.UnitValue width) {
238+
public Type setFixedPosition(float x, float y, UnitValue width) {
231239
return (Type) setProperty(Property.POSITION, LayoutPosition.FIXED).
232240
setProperty(Property.X, x).
233241
setProperty(Property.Y, y).
@@ -261,7 +269,7 @@ public Type setFixedPosition(int pageNumber, float x, float y, float width) {
261269
* @param width a floating point value measured in points.
262270
* @return this Element.
263271
*/
264-
public Type setFixedPosition(int pageNumber, float x, float y, Property.UnitValue width) {
272+
public Type setFixedPosition(int pageNumber, float x, float y, UnitValue width) {
265273
return (Type) setFixedPosition(x, y, width).
266274
setProperty(Property.PAGE_NUMBER, pageNumber);
267275
}
@@ -275,10 +283,10 @@ public Type setFixedPosition(int pageNumber, float x, float y, Property.UnitValu
275283
/**
276284
* Sets the horizontal alignment of this Element.
277285
*
278-
* @param horizontalAlignment an enum value of type {@link com.itextpdf.layout.Property.HorizontalAlignment}
286+
* @param horizontalAlignment an enum value of type {@link HorizontalAlignment}
279287
* @return this Element.
280288
*/
281-
public Type setHorizontalAlignment(Property.HorizontalAlignment horizontalAlignment) {
289+
public Type setHorizontalAlignment(HorizontalAlignment horizontalAlignment) {
282290
return setProperty(Property.HORIZONTAL_ALIGNMENT, horizontalAlignment);
283291
}
284292

@@ -315,10 +323,10 @@ public Type setFontSize(float fontSize) {
315323
/**
316324
* Sets the font size of this Element.
317325
*
318-
* @param alignment an enum value of type {@link com.itextpdf.layout.Property.TextAlignment}
326+
* @param alignment an enum value of type {@link TextAlignment}
319327
* @return this Element.
320328
*/
321-
public Type setTextAlignment(Property.TextAlignment alignment) {
329+
public Type setTextAlignment(TextAlignment alignment) {
322330
return setProperty(Property.TEXT_ALIGNMENT, alignment);
323331
}
324332

@@ -352,7 +360,7 @@ public Type setWordSpacing(float wordSpacing) {
352360
* @param fontKerning an enum value as a boolean wrapper specifying whether or not to apply kerning
353361
* @return this Element.
354362
*/
355-
public Type setFontKerning(Property.FontKerning fontKerning) {
363+
public Type setFontKerning(FontKerning fontKerning) {
356364
return setProperty(Property.FONT_KERNING, fontKerning);
357365
}
358366

@@ -378,7 +386,7 @@ public Type setBackgroundColor(Color backgroundColor) {
378386
* @return this Element.
379387
*/
380388
public Type setBackgroundColor(Color backgroundColor, float extraLeft, float extraTop, float extraRight, float extraBottom) {
381-
return setProperty(Property.BACKGROUND, new Property.Background(backgroundColor, extraLeft, extraTop, extraRight, extraBottom));
389+
return setProperty(Property.BACKGROUND, new Background(backgroundColor, extraLeft, extraTop, extraRight, extraBottom));
382390
}
383391

384392
/**
@@ -590,12 +598,12 @@ public Type setUnderline(float thickness, float yPosition) {
590598
* @return this element
591599
*/
592600
public Type setUnderline(Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle) {
593-
Property.Underline newUnderline = new Property.Underline(color, thickness, thicknessMul, yPosition, yPositionMul, lineCapStyle);
601+
Underline newUnderline = new Underline(color, thickness, thicknessMul, yPosition, yPositionMul, lineCapStyle);
594602
Object currentProperty = getProperty(Property.UNDERLINE);
595603
if (currentProperty instanceof List) {
596604
((List) currentProperty).add(newUnderline);
597-
} else if (currentProperty instanceof Property.Underline) {
598-
setProperty(Property.UNDERLINE, Arrays.asList((Property.Underline)currentProperty, newUnderline));
605+
} else if (currentProperty instanceof Underline) {
606+
setProperty(Property.UNDERLINE, Arrays.asList((Underline)currentProperty, newUnderline));
599607
} else {
600608
setProperty(Property.UNDERLINE, newUnderline);
601609
}
@@ -609,7 +617,7 @@ public Type setUnderline(Color color, float thickness, float thicknessMul, float
609617
* @param baseDirection base direction
610618
* @return this element
611619
*/
612-
public Type setBaseDirection(Property.BaseDirection baseDirection) {
620+
public Type setBaseDirection(BaseDirection baseDirection) {
613621
return setProperty(Property.BASE_DIRECTION, baseDirection);
614622
}
615623

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ This file is part of the iText (R) project.
4444
*/
4545
package com.itextpdf.layout;
4646

47+
import com.itextpdf.layout.property.Property;
48+
4749
/**
4850
* A generic Map-like interface that defines methods for storing and retrieving
4951
* objects by an enum key of the {@link Property} type.

0 commit comments

Comments
 (0)