Skip to content

Commit c861837

Browse files
committed
Remove deprecated code
DEVSIX-3495
1 parent 90f78d8 commit c861837

19 files changed

+308
-508
lines changed

src/main/java/com/itextpdf/html2pdf/LogMessageConstant.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,8 @@ public final class LogMessageConstant {
6565
public static final String ERROR_WHILE_LAYOUT_OF_FORM_FIELD = "Cannot layout form field field. It won't be displayed";
6666
/** The Constant ERROR_WHILE_LAYOUT_OF_FORM_FIELD_WITH_TYPE. */
6767
public static final String ERROR_WHILE_LAYOUT_OF_FORM_FIELD_WITH_TYPE = "Error during layout of form filed with type {0}.";
68-
/** The Constant HEIGHT_VALUE_IN_PERCENT_NOT_SUPPORTED. */
69-
@Deprecated
70-
public static final String HEIGHT_VALUE_IN_PERCENT_NOT_SUPPORTED = "Height value in percent not supported";
7168
/** The Constant INPUT_FIELD_DOES_NOT_FIT. */
7269
public static final String INPUT_FIELD_DOES_NOT_FIT = "Input field doesn't fit in outer object. It will be clipped";
73-
/** The Constant INPUT_SUPPORTS_ONLY_POINT_WIDTH. */
74-
@Deprecated
75-
public static final String INPUT_SUPPORTS_ONLY_POINT_WIDTH = "Input field supports only point width";
7670
/** The Constant INPUT_TYPE_IS_INVALID. */
7771
public static final String INPUT_TYPE_IS_INVALID = "Input type {0} is invalid. The default text type will be used instead.";
7872
/** The Constant INPUT_TYPE_IS_NOT_SUPPORTED. */
@@ -103,22 +97,14 @@ public final class LogMessageConstant {
10397
public static final String PDF_DOCUMENT_NOT_PRESENT = "PdfDocument is not present";
10498
/** The Constant QUOTES_PROPERTY_INVALID. */
10599
public static final String QUOTES_PROPERTY_INVALID = "Quote property \"{0}\" is invalid. It should contain even number of <string> values.";
106-
@Deprecated
107-
public static final String RULE_IS_NOT_SUPPORTED = "The rule @{0} is unsupported. All selectors in this rule will be ignored.";
108100
/** The Constant TEXT_DECORATION_BLINK_NOT_SUPPORTED. */
109101
public static final String TEXT_DECORATION_BLINK_NOT_SUPPORTED = "text-decoration: blink not supported";
110-
/** The Constant TEXT_WAS_NOT_PROCESSED. */
111-
@Deprecated
112-
public static final String TEXT_WAS_NOT_PROCESSED = "Text was not processed: {0}";
113102
/** The Constant UNABLE_TO_PROCESS_EXTERNAL_CSS_FILE. */
114103
public static final String UNABLE_TO_PROCESS_EXTERNAL_CSS_FILE = "Unable to process external css file";
115104
/** The Constant UNABLE_TO_PROCESS_IMAGE_AS_SVG */
116105
public static final String UNABLE_TO_PROCESS_IMAGE_AS_SVG = "Unable to process image found at {0} as an SVG";
117106
/** The Constant UNABLE_TO_RESOLVE_COUNTER. */
118107
public static final String UNABLE_TO_RESOLVE_COUNTER = "Unable to resolve counter \"{0}\"";
119-
/** The Constant UNABLE_TO_RESOLVE_FONT. */
120-
@Deprecated
121-
public static final String UNABLE_TO_RESOLVE_FONT = "Unable to resolve font: {0}. The default one will be used instead";
122108
/** The Constant UNABLE_TO_RETRIEVE_FONT. */
123109
public static final String UNABLE_TO_RETRIEVE_FONT = "Unable to retrieve font:\n {0}";
124110
/** The Constant UNABLE_TO_RETRIEVE_IMAGE_WITH_GIVEN_BASE_URI. */

src/main/java/com/itextpdf/html2pdf/attach/impl/layout/PageMarginBoxDummyElement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ This file is part of the iText (R) project.
5252
import java.util.Map;
5353

5454
/**
55-
* @deprecated Remove this class in 7.2 and use {@link PageMarginBoxContextNode} instead
56-
* (by making it implement {@link IElementNode}).
55+
* @deprecated To be removed in next major pdfHTML version once {@link PageMarginBoxContextNode} implements
56+
* {@link IElementNode} so that it can be used directly instead of creating dummy node.
5757
*/
5858
@Deprecated
5959
class PageMarginBoxDummyElement implements IElementNode, ICustomElementNode {
Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/*
22
This file is part of the iText (R) project.
33
Copyright (c) 1998-2020 iText Group NV
4-
Authors: Bruno Lowagie, Paulo Soares, et al.
5-
4+
Authors: iText Software.
5+
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU Affero General Public License version 3
88
as published by the Free Software Foundation with the addition of the
99
following permission added to Section 15 as permitted in Section 7(a):
1010
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
1111
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
1212
OF THIRD PARTY RIGHTS
13-
13+
1414
This program is distributed in the hope that it will be useful, but
1515
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1616
or FITNESS FOR A PARTICULAR PURPOSE.
@@ -20,52 +20,77 @@ This file is part of the iText (R) project.
2020
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2121
Boston, MA, 02110-1301 USA, or download the license from the following URL:
2222
http://itextpdf.com/terms-of-use/
23-
23+
2424
The interactive user interfaces in modified source and object code versions
2525
of this program must display Appropriate Legal Notices, as required under
2626
Section 5 of the GNU Affero General Public License.
27-
27+
2828
In accordance with Section 7(b) of the GNU Affero General Public License,
2929
a covered work must retain the producer line in every PDF that is created
3030
or manipulated using iText.
31-
31+
3232
You can be released from the requirements of the license by purchasing
3333
a commercial license. Buying such a license is mandatory as soon as you
3434
develop commercial activities involving the iText software without
3535
disclosing the source code of your own applications.
3636
These activities include: offering paid services to customers as an ASP,
3737
serving PDFs on the fly in a web application, shipping iText with a closed
3838
source product.
39-
39+
4040
For more information, please contact iText Software Corp. at this
4141
4242
*/
4343
package com.itextpdf.html2pdf.attach.impl.layout.form.element;
4444

4545
import com.itextpdf.html2pdf.attach.impl.layout.form.renderer.ButtonRenderer;
46+
import com.itextpdf.layout.element.BlockElement;
47+
import com.itextpdf.layout.element.IBlockElement;
48+
import com.itextpdf.layout.element.Image;
49+
import com.itextpdf.layout.property.Property;
4650
import com.itextpdf.layout.renderer.IRenderer;
4751

4852
/**
49-
* Extension of the {@link FormField} class representing a input with type button or submit in html
50-
* @deprecated will be renamed to {@code InputButton} in next major release
53+
* Extension of the {@link FormField} class representing a button in html
5154
*/
52-
@Deprecated
5355
public class Button extends FormField<Button> {
5456

55-
/**
56-
* Creates a new {@link Button} instance.
57-
*
58-
* @param id the id
59-
*/
6057
public Button(String id) {
6158
super(id);
6259
}
6360

64-
/* (non-Javadoc)
65-
* @see com.itextpdf.layout.element.AbstractElement#makeNewRenderer()
66-
*/
6761
@Override
6862
protected IRenderer makeNewRenderer() {
6963
return new ButtonRenderer(this);
7064
}
65+
66+
67+
/**
68+
* Adds any block element to the div's contents.
69+
*
70+
* @param element a {@link BlockElement}
71+
* @return this Element
72+
*/
73+
public Button add(IBlockElement element) {
74+
childElements.add(element);
75+
return this;
76+
}
77+
78+
/**
79+
* Adds an image to the div's contents.
80+
*
81+
* @param element an {@link Image}
82+
* @return this Element
83+
*/
84+
public Button add(Image element) {
85+
childElements.add(element);
86+
return this;
87+
}
88+
89+
@Override
90+
public <T1> T1 getDefaultProperty(int property) {
91+
if (property == Property.KEEP_TOGETHER) {
92+
return (T1) (Object) true;
93+
}
94+
return super.<T1>getDefaultProperty(property);
95+
}
7196
}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/*
22
This file is part of the iText (R) project.
33
Copyright (c) 1998-2020 iText Group NV
4-
Authors: iText Software.
5-
4+
Authors: Bruno Lowagie, Paulo Soares, et al.
5+
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU Affero General Public License version 3
88
as published by the Free Software Foundation with the addition of the
99
following permission added to Section 15 as permitted in Section 7(a):
1010
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
1111
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
1212
OF THIRD PARTY RIGHTS
13-
13+
1414
This program is distributed in the hope that it will be useful, but
1515
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1616
or FITNESS FOR A PARTICULAR PURPOSE.
@@ -20,79 +20,50 @@ This file is part of the iText (R) project.
2020
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2121
Boston, MA, 02110-1301 USA, or download the license from the following URL:
2222
http://itextpdf.com/terms-of-use/
23-
23+
2424
The interactive user interfaces in modified source and object code versions
2525
of this program must display Appropriate Legal Notices, as required under
2626
Section 5 of the GNU Affero General Public License.
27-
27+
2828
In accordance with Section 7(b) of the GNU Affero General Public License,
2929
a covered work must retain the producer line in every PDF that is created
3030
or manipulated using iText.
31-
31+
3232
You can be released from the requirements of the license by purchasing
3333
a commercial license. Buying such a license is mandatory as soon as you
3434
develop commercial activities involving the iText software without
3535
disclosing the source code of your own applications.
3636
These activities include: offering paid services to customers as an ASP,
3737
serving PDFs on the fly in a web application, shipping iText with a closed
3838
source product.
39-
39+
4040
For more information, please contact iText Software Corp. at this
4141
4242
*/
4343
package com.itextpdf.html2pdf.attach.impl.layout.form.element;
4444

45-
import com.itextpdf.html2pdf.attach.impl.layout.form.renderer.ButtonContainerRenderer;
46-
import com.itextpdf.layout.element.BlockElement;
47-
import com.itextpdf.layout.element.IBlockElement;
48-
import com.itextpdf.layout.element.Image;
49-
import com.itextpdf.layout.property.Property;
45+
import com.itextpdf.html2pdf.attach.impl.layout.form.renderer.InputButtonRenderer;
5046
import com.itextpdf.layout.renderer.IRenderer;
5147

5248
/**
53-
* Extension of the {@link FormField} class representing a button in html
54-
* @deprecated Will be renamed to {@code Button} in next major release
49+
* Extension of the {@link FormField} class representing a input with type button or submit in html
5550
*/
56-
@Deprecated
57-
public class ButtonContainer extends FormField<ButtonContainer> {
58-
59-
public ButtonContainer(String id) {
60-
super(id);
61-
}
62-
63-
@Override
64-
protected IRenderer makeNewRenderer() {
65-
return new ButtonContainerRenderer(this);
66-
}
67-
51+
public class InputButton extends FormField<InputButton> {
6852

6953
/**
70-
* Adds any block element to the div's contents.
54+
* Creates a new {@link InputButton} instance.
7155
*
72-
* @param element a {@link BlockElement}
73-
* @return this Element
56+
* @param id the id
7457
*/
75-
public ButtonContainer add(IBlockElement element) {
76-
childElements.add(element);
77-
return this;
58+
public InputButton(String id) {
59+
super(id);
7860
}
7961

80-
/**
81-
* Adds an image to the div's contents.
82-
*
83-
* @param element an {@link Image}
84-
* @return this Element
62+
/* (non-Javadoc)
63+
* @see com.itextpdf.layout.element.AbstractElement#makeNewRenderer()
8564
*/
86-
public ButtonContainer add(Image element) {
87-
childElements.add(element);
88-
return this;
89-
}
90-
9165
@Override
92-
public <T1> T1 getDefaultProperty(int property) {
93-
if (property == Property.KEEP_TOGETHER) {
94-
return (T1) (Object) true;
95-
}
96-
return super.<T1>getDefaultProperty(property);
66+
protected IRenderer makeNewRenderer() {
67+
return new InputButtonRenderer(this);
9768
}
9869
}

src/main/java/com/itextpdf/html2pdf/attach/impl/layout/form/renderer/AbstractFormFieldRenderer.java

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ This file is part of the iText (R) project.
5858
import com.itextpdf.layout.property.FloatPropertyValue;
5959
import com.itextpdf.layout.property.OverflowPropertyValue;
6060
import com.itextpdf.layout.property.Property;
61-
import com.itextpdf.layout.property.UnitValue;
6261
import com.itextpdf.layout.renderer.BlockRenderer;
6362
import com.itextpdf.layout.renderer.DrawContext;
6463
import com.itextpdf.layout.renderer.IRenderer;
@@ -195,16 +194,9 @@ public MinMaxWidth getMinMaxWidth() {
195194

196195
/**
197196
* Adjusts the field layout.
198-
*
199-
* @deprecated Will be removed in 3.0.0, override {@link #adjustFieldLayout(LayoutContext)} instead.
197+
* @param layoutContext layout context
200198
*/
201-
@Deprecated
202-
protected abstract void adjustFieldLayout();
203-
204-
//NOTE: should be abstract in 3.0.0
205-
protected void adjustFieldLayout(LayoutContext layoutContext) {
206-
adjustFieldLayout();
207-
}
199+
protected abstract void adjustFieldLayout(LayoutContext layoutContext);
208200

209201
/**
210202
* Creates the flat renderer instance.
@@ -243,17 +235,6 @@ protected boolean isRendererFit(float availableWidth, float availableHeight) {
243235
return availableHeight >= occupiedArea.getBBox().getHeight() && availableWidth >= occupiedArea.getBBox().getWidth();
244236
}
245237

246-
/**
247-
* Gets the content width.
248-
*
249-
* @return the content width
250-
* @deprecated will be removed in 3.0.0. Use {@link #retrieveWidth(float)}} instead.
251-
*/
252-
@Deprecated
253-
protected Float getContentWidth() {
254-
return super.retrieveWidth(0);
255-
}
256-
257238
/**
258239
* Gets the accessibility language.
259240
*
@@ -263,16 +244,6 @@ protected String getLang() {
263244
return this.<String>getProperty(Html2PdfProperty.FORM_ACCESSIBILITY_LANGUAGE);
264245
}
265246

266-
//NOTE: should be removed in 3.0.0
267-
@Override
268-
protected Float retrieveWidth(float parentBoxWidth) {
269-
UnitValue width = super.<UnitValue>getProperty(Property.WIDTH);
270-
if (width != null && width.isPointValue()) {
271-
return getContentWidth();
272-
}
273-
return super.retrieveWidth(parentBoxWidth);
274-
}
275-
276247
protected boolean isLayoutBasedOnFlatRenderer() {
277248
return true;
278249
}

src/main/java/com/itextpdf/html2pdf/attach/impl/layout/form/renderer/AbstractOneLineTextFieldRenderer.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@ This file is part of the iText (R) project.
5555
*/
5656
public abstract class AbstractOneLineTextFieldRenderer extends AbstractTextFieldRenderer {
5757

58-
/**
59-
* The position of the base line of the text.
60-
* @deprecated use {@link #getLastYLineRecursively()} instead. Will be removed in 3.0.0
61-
*/
62-
@Deprecated
63-
protected float baseline;
64-
6558
/**
6659
* Creates a new {@link AbstractOneLineTextFieldRenderer} instance.
6760
*
@@ -74,7 +67,6 @@ public abstract class AbstractOneLineTextFieldRenderer extends AbstractTextField
7467
@Override
7568
public void move(float dxRight, float dyUp) {
7669
super.move(dxRight, dyUp);
77-
baseline += dyUp;
7870
}
7971

8072
/**
@@ -86,7 +78,6 @@ public void move(float dxRight, float dyUp) {
8678
void cropContentLines(List<LineRenderer> lines, Rectangle bBox) {
8779
adjustNumberOfContentLines(lines, bBox, 1);
8880
updateParagraphHeight();
89-
this.baseline = lines.get(0).getYLine();
9081
}
9182

9283
/**

0 commit comments

Comments
 (0)