1 | /* | |
2 | * Copyright 2005 by Paulo Soares. | |
3 | * | |
4 | * The contents of this file are subject to the Mozilla Public License Version 1.1 | |
5 | * (the "License"); you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at http://www.mozilla.org/MPL/ | |
7 | * | |
8 | * Software distributed under the License is distributed on an "AS IS" basis, | |
9 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
10 | * for the specific language governing rights and limitations under the License. | |
11 | * | |
12 | * The Original Code is 'iText, a free JAVA-PDF library'. | |
13 | * | |
14 | * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by | |
15 | * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie. | |
16 | * All Rights Reserved. | |
17 | * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer | |
18 | * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved. | |
19 | * | |
20 | * Contributor(s): all the names of the contributors are added in the source code | |
21 | * where applicable. | |
22 | * | |
23 | * Alternatively, the contents of this file may be used under the terms of the | |
24 | * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the | |
25 | * provisions of LGPL are applicable instead of those above. If you wish to | |
26 | * allow use of your version of this file only under the terms of the LGPL | |
27 | * License and not to allow others to use your version of this file under | |
28 | * the MPL, indicate your decision by deleting the provisions above and | |
29 | * replace them with the notice and other provisions required by the LGPL. | |
30 | * If you do not delete the provisions above, a recipient may use your version | |
31 | * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE. | |
32 | * | |
33 | * This library is free software; you can redistribute it and/or modify it | |
34 | * under the terms of the MPL as stated above or under the terms of the GNU | |
35 | * Library General Public License as published by the Free Software Foundation; | |
36 | * either version 2 of the License, or any later version. | |
37 | * | |
38 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
39 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
40 | * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more | |
41 | * details. | |
42 | * | |
43 | * If you didn't download this code from the following link, you should check if | |
44 | * you aren't using an obsolete version: | |
45 | * http://www.lowagie.com/iText/ | |
46 | */ | |
47 | package com.lowagie.text.pdf; | |
48 | ||
49 | import java.io.IOException; | |
50 | import com.lowagie.text.error_messages.MessageLocalization; | |
51 | ||
52 | import com.lowagie.text.DocumentException; | |
53 | import com.lowagie.text.Image; | |
54 | import com.lowagie.text.Rectangle; | |
55 | /** | |
56 | * Creates a pushbutton field. It supports all the text and icon alignments. | |
57 | * The icon may be an image or a template. | |
58 | * <p> | |
59 | * Example usage: | |
60 | * <p> | |
61 | * <PRE> | |
62 | * Document document = new Document(PageSize.A4, 50, 50, 50, 50); | |
63 | * PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("output.pdf")); | |
64 | * document.open(); | |
65 | * PdfContentByte cb = writer.getDirectContent(); | |
66 | * Image img = Image.getInstance("image.png"); | |
67 | * PushbuttonField bt = new PushbuttonField(writer, new Rectangle(100, 100, 200, 200), "Button1"); | |
68 | * bt.setText("My Caption"); | |
69 | * bt.setFontSize(0); | |
70 | * bt.setImage(img); | |
71 | * bt.setLayout(PushbuttonField.LAYOUT_ICON_TOP_LABEL_BOTTOM); | |
72 | * bt.setBackgroundColor(Color.cyan); | |
73 | * bt.setBorderStyle(PdfBorderDictionary.STYLE_SOLID); | |
74 | * bt.setBorderColor(Color.red); | |
75 | * bt.setBorderWidth(3); | |
76 | * PdfFormField ff = bt.getField(); | |
77 | * PdfAction ac = PdfAction.createSubmitForm("http://www.submit-site.com", null, 0); | |
78 | * ff.setAction(ac); | |
79 | * writer.addAnnotation(ff); | |
80 | * document.close(); | |
81 | * </PRE> | |
82 | * @author Paulo Soares (psoares@consiste.pt) | |
83 | */ | |
84 | public class PushbuttonField extends BaseField { | |
85 | | |
86 | /** A layout option */ | |
87 | public static final int LAYOUT_LABEL_ONLY = 1; | |
88 | /** A layout option */ | |
89 | public static final int LAYOUT_ICON_ONLY = 2; | |
90 | /** A layout option */ | |
91 | public static final int LAYOUT_ICON_TOP_LABEL_BOTTOM = 3; | |
92 | /** A layout option */ | |
93 | public static final int LAYOUT_LABEL_TOP_ICON_BOTTOM = 4; | |
94 | /** A layout option */ | |
95 | public static final int LAYOUT_ICON_LEFT_LABEL_RIGHT = 5; | |
96 | /** A layout option */ | |
97 | public static final int LAYOUT_LABEL_LEFT_ICON_RIGHT = 6; | |
98 | /** A layout option */ | |
99 | public static final int LAYOUT_LABEL_OVER_ICON = 7; | |
100 | /** An icon scaling option */ | |
101 | public static final int SCALE_ICON_ALWAYS = 1; | |
102 | /** An icon scaling option */ | |
103 | public static final int SCALE_ICON_NEVER = 2; | |
104 | /** An icon scaling option */ | |
105 | public static final int SCALE_ICON_IS_TOO_BIG = 3; | |
106 | /** An icon scaling option */ | |
107 | public static final int SCALE_ICON_IS_TOO_SMALL = 4; | |
108 | ||
109 | /** | |
110 | * Holds value of property layout. | |
111 | */ | |
112 | private int layout = LAYOUT_LABEL_ONLY; | |
113 | | |
114 | /** | |
115 | * Holds value of property image. | |
116 | */ | |
117 | private Image image; | |
118 | | |
119 | /** | |
120 | * Holds value of property template. | |
121 | */ | |
122 | private PdfTemplate template; | |
123 | | |
124 | /** | |
125 | * Holds value of property scaleIcon. | |
126 | */ | |
127 | private int scaleIcon = SCALE_ICON_ALWAYS; | |
128 | | |
129 | /** | |
130 | * Holds value of property proportionalIcon. | |
131 | */ | |
132 | private boolean proportionalIcon = true; | |
133 | | |
134 | /** | |
135 | * Holds value of property iconVerticalAdjustment. | |
136 | */ | |
137 | private float iconVerticalAdjustment = 0.5f; | |
138 | | |
139 | /** | |
140 | * Holds value of property iconHorizontalAdjustment. | |
141 | */ | |
142 | private float iconHorizontalAdjustment = 0.5f; | |
143 | | |
144 | /** | |
145 | * Holds value of property iconFitToBounds. | |
146 | */ | |
147 | private boolean iconFitToBounds; | |
148 | | |
149 | private PdfTemplate tp; | |
150 | | |
151 | /** | |
152 | * Creates a new instance of PushbuttonField | |
153 | * @param writer the document <CODE>PdfWriter</CODE> | |
154 | * @param box the field location and dimensions | |
155 | * @param fieldName the field name. If <CODE>null</CODE> only the widget keys | |
156 | * will be included in the field allowing it to be used as a kid field. | |
157 | */ | |
158 | public PushbuttonField(PdfWriter writer, Rectangle box, String fieldName) { | |
159 | super(writer, box, fieldName); | |
160 | } | |
161 | | |
162 | /** | |
163 | * Getter for property layout. | |
164 | * @return Value of property layout. | |
165 | */ | |
166 | public int getLayout() { | |
167 | return this.layout; | |
168 | } | |
169 | | |
170 | /** | |
171 | * Sets the icon and label layout. Possible values are <CODE>LAYOUT_LABEL_ONLY</CODE>, | |
172 | * <CODE>LAYOUT_ICON_ONLY</CODE>, <CODE>LAYOUT_ICON_TOP_LABEL_BOTTOM</CODE>, | |
173 | * <CODE>LAYOUT_LABEL_TOP_ICON_BOTTOM</CODE>, <CODE>LAYOUT_ICON_LEFT_LABEL_RIGHT</CODE>, | |
174 | * <CODE>LAYOUT_LABEL_LEFT_ICON_RIGHT</CODE> and <CODE>LAYOUT_LABEL_OVER_ICON</CODE>. | |
175 | * The default is <CODE>LAYOUT_LABEL_ONLY</CODE>. | |
176 | * @param layout New value of property layout. | |
177 | */ | |
178 | public void setLayout(int layout) { | |
179 |
4
1. setLayout : changed conditional boundary → NO_COVERAGE 2. setLayout : changed conditional boundary → NO_COVERAGE 3. setLayout : negated conditional → NO_COVERAGE 4. setLayout : negated conditional → NO_COVERAGE |
if (layout < LAYOUT_LABEL_ONLY || layout > LAYOUT_LABEL_OVER_ICON) |
180 | throw new IllegalArgumentException(MessageLocalization.getComposedMessage("layout.out.of.bounds")); | |
181 | this.layout = layout; | |
182 | } | |
183 | | |
184 | /** | |
185 | * Getter for property image. | |
186 | * @return Value of property image. | |
187 | */ | |
188 | public Image getImage() { | |
189 | return this.image; | |
190 | } | |
191 | | |
192 | /** | |
193 | * Sets the icon as an image. | |
194 | * @param image the image | |
195 | */ | |
196 | public void setImage(Image image) { | |
197 | this.image = image; | |
198 | template = null; | |
199 | } | |
200 | | |
201 | /** | |
202 | * Getter for property template. | |
203 | * @return Value of property template. | |
204 | */ | |
205 | public PdfTemplate getTemplate() { | |
206 | return this.template; | |
207 | } | |
208 | | |
209 | /** | |
210 | * Sets the icon as a template. | |
211 | * @param template the template | |
212 | */ | |
213 | public void setTemplate(PdfTemplate template) { | |
214 | this.template = template; | |
215 | image = null; | |
216 | } | |
217 | | |
218 | /** | |
219 | * Getter for property scaleIcon. | |
220 | * @return Value of property scaleIcon. | |
221 | */ | |
222 | public int getScaleIcon() { | |
223 | return this.scaleIcon; | |
224 | } | |
225 | | |
226 | /** | |
227 | * Sets the way the icon will be scaled. Possible values are | |
228 | * <CODE>SCALE_ICON_ALWAYS</CODE>, <CODE>SCALE_ICON_NEVER</CODE>, | |
229 | * <CODE>SCALE_ICON_IS_TOO_BIG</CODE> and <CODE>SCALE_ICON_IS_TOO_SMALL</CODE>. | |
230 | * The default is <CODE>SCALE_ICON_ALWAYS</CODE>. | |
231 | * @param scaleIcon the way the icon will be scaled | |
232 | */ | |
233 | public void setScaleIcon(int scaleIcon) { | |
234 |
4
1. setScaleIcon : changed conditional boundary → NO_COVERAGE 2. setScaleIcon : changed conditional boundary → NO_COVERAGE 3. setScaleIcon : negated conditional → NO_COVERAGE 4. setScaleIcon : negated conditional → NO_COVERAGE |
if (scaleIcon < SCALE_ICON_ALWAYS || scaleIcon > SCALE_ICON_IS_TOO_SMALL) |
235 | scaleIcon = SCALE_ICON_ALWAYS; | |
236 | this.scaleIcon = scaleIcon; | |
237 | } | |
238 | | |
239 | /** | |
240 | * Getter for property proportionalIcon. | |
241 | * @return Value of property proportionalIcon. | |
242 | */ | |
243 | public boolean isProportionalIcon() { | |
244 | return this.proportionalIcon; | |
245 | } | |
246 | | |
247 | /** | |
248 | * Sets the way the icon is scaled. If <CODE>true</CODE> the icon is scaled proportionally, | |
249 | * if <CODE>false</CODE> the scaling is done anamorphicaly. | |
250 | * @param proportionalIcon the way the icon is scaled | |
251 | */ | |
252 | public void setProportionalIcon(boolean proportionalIcon) { | |
253 | this.proportionalIcon = proportionalIcon; | |
254 | } | |
255 | | |
256 | /** | |
257 | * Getter for property iconVerticalAdjustment. | |
258 | * @return Value of property iconVerticalAdjustment. | |
259 | */ | |
260 | public float getIconVerticalAdjustment() { | |
261 | return this.iconVerticalAdjustment; | |
262 | } | |
263 | | |
264 | /** | |
265 | * A number between 0 and 1 indicating the fraction of leftover space to allocate at the bottom of the icon. | |
266 | * A value of 0 positions the icon at the bottom of the annotation rectangle. | |
267 | * A value of 0.5 centers it within the rectangle. The default is 0.5. | |
268 | * @param iconVerticalAdjustment a number between 0 and 1 indicating the fraction of leftover space to allocate at the bottom of the icon | |
269 | */ | |
270 | public void setIconVerticalAdjustment(float iconVerticalAdjustment) { | |
271 |
2
1. setIconVerticalAdjustment : changed conditional boundary → NO_COVERAGE 2. setIconVerticalAdjustment : negated conditional → NO_COVERAGE |
if (iconVerticalAdjustment < 0) |
272 | iconVerticalAdjustment = 0; | |
273 |
2
1. setIconVerticalAdjustment : changed conditional boundary → NO_COVERAGE 2. setIconVerticalAdjustment : negated conditional → NO_COVERAGE |
else if (iconVerticalAdjustment > 1) |
274 | iconVerticalAdjustment = 1; | |
275 | this.iconVerticalAdjustment = iconVerticalAdjustment; | |
276 | } | |
277 | | |
278 | /** | |
279 | * Getter for property iconHorizontalAdjustment. | |
280 | * @return Value of property iconHorizontalAdjustment. | |
281 | */ | |
282 | public float getIconHorizontalAdjustment() { | |
283 | return this.iconHorizontalAdjustment; | |
284 | } | |
285 | | |
286 | /** | |
287 | * A number between 0 and 1 indicating the fraction of leftover space to allocate at the left of the icon. | |
288 | * A value of 0 positions the icon at the left of the annotation rectangle. | |
289 | * A value of 0.5 centers it within the rectangle. The default is 0.5. | |
290 | * @param iconHorizontalAdjustment a number between 0 and 1 indicating the fraction of leftover space to allocate at the left of the icon | |
291 | */ | |
292 | public void setIconHorizontalAdjustment(float iconHorizontalAdjustment) { | |
293 |
2
1. setIconHorizontalAdjustment : changed conditional boundary → NO_COVERAGE 2. setIconHorizontalAdjustment : negated conditional → NO_COVERAGE |
if (iconHorizontalAdjustment < 0) |
294 | iconHorizontalAdjustment = 0; | |
295 |
2
1. setIconHorizontalAdjustment : changed conditional boundary → NO_COVERAGE 2. setIconHorizontalAdjustment : negated conditional → NO_COVERAGE |
else if (iconHorizontalAdjustment > 1) |
296 | iconHorizontalAdjustment = 1; | |
297 | this.iconHorizontalAdjustment = iconHorizontalAdjustment; | |
298 | } | |
299 | | |
300 | private float calculateFontSize(float w, float h) throws IOException, DocumentException { | |
301 | BaseFont ufont = getRealFont(); | |
302 | float fsize = fontSize; | |
303 |
1
1. calculateFontSize : negated conditional → NO_COVERAGE |
if (fsize == 0) { |
304 | float bw = ufont.getWidthPoint(text, 1); | |
305 |
1
1. calculateFontSize : negated conditional → NO_COVERAGE |
if (bw == 0) |
306 | fsize = 12; | |
307 | else | |
308 |
1
1. calculateFontSize : Replaced float division with multiplication → NO_COVERAGE |
fsize = w / bw; |
309 |
2
1. calculateFontSize : Replaced float subtraction with addition → NO_COVERAGE 2. calculateFontSize : Replaced float division with multiplication → NO_COVERAGE |
float nfsize = h / (1 - ufont.getFontDescriptor(BaseFont.DESCENT, 1)); |
310 | fsize = Math.min(fsize, nfsize); | |
311 |
2
1. calculateFontSize : changed conditional boundary → NO_COVERAGE 2. calculateFontSize : negated conditional → NO_COVERAGE |
if (fsize < 4) |
312 | fsize = 4; | |
313 | } | |
314 |
1
1. calculateFontSize : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PushbuttonField::calculateFontSize → NO_COVERAGE |
return fsize; |
315 | } | |
316 | | |
317 | /** | |
318 | * Gets the button appearance. | |
319 | * @throws IOException on error | |
320 | * @throws DocumentException on error | |
321 | * @return the button appearance | |
322 | */ | |
323 | public PdfAppearance getAppearance() throws IOException, DocumentException { | |
324 | PdfAppearance app = getBorderAppearance(); | |
325 | Rectangle box = new Rectangle(app.getBoundingBox()); | |
326 |
6
1. getAppearance : negated conditional → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE 3. getAppearance : negated conditional → NO_COVERAGE 4. getAppearance : negated conditional → NO_COVERAGE 5. getAppearance : negated conditional → NO_COVERAGE 6. getAppearance : negated conditional → NO_COVERAGE |
if ((text == null || text.length() == 0) && (layout == LAYOUT_LABEL_ONLY || (image == null && template == null && iconReference == null))) { |
327 |
1
1. getAppearance : mutated return of Object value for com/lowagie/text/pdf/PushbuttonField::getAppearance to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return app; |
328 | } | |
329 |
4
1. getAppearance : negated conditional → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE 3. getAppearance : negated conditional → NO_COVERAGE 4. getAppearance : negated conditional → NO_COVERAGE |
if (layout == LAYOUT_ICON_ONLY && image == null && template == null && iconReference == null) |
330 |
1
1. getAppearance : mutated return of Object value for com/lowagie/text/pdf/PushbuttonField::getAppearance to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return app; |
331 | BaseFont ufont = getRealFont(); | |
332 |
2
1. getAppearance : negated conditional → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
boolean borderExtra = borderStyle == PdfBorderDictionary.STYLE_BEVELED || borderStyle == PdfBorderDictionary.STYLE_INSET; |
333 |
2
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
float h = box.getHeight() - borderWidth * 2; |
334 | float bw2 = borderWidth; | |
335 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
if (borderExtra) { |
336 |
2
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
h -= borderWidth * 2; |
337 |
1
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE |
bw2 *= 2; |
338 | } | |
339 |
2
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
float offsetX = (borderExtra ? 2 * borderWidth : borderWidth); |
340 | offsetX = Math.max(offsetX, 1); | |
341 | float offX = Math.min(bw2, offsetX); | |
342 | tp = null; | |
343 | float textX = Float.NaN; | |
344 | float textY = 0; | |
345 | float fsize = fontSize; | |
346 |
3
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 3. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
float wt = box.getWidth() - 2 * offX - 2; |
347 |
2
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
float ht = box.getHeight() - 2 * offX; |
348 |
2
1. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
float adj = (iconFitToBounds ? 0 : offX + 1); |
349 | int nlayout = layout; | |
350 |
3
1. getAppearance : negated conditional → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE 3. getAppearance : negated conditional → NO_COVERAGE |
if (image == null && template == null && iconReference == null) |
351 | nlayout = LAYOUT_LABEL_ONLY; | |
352 | Rectangle iconBox = null; | |
353 | while (true) { | |
354 | switch (nlayout) { | |
355 | case LAYOUT_LABEL_ONLY: | |
356 | case LAYOUT_LABEL_OVER_ICON: | |
357 |
7
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : changed conditional boundary → NO_COVERAGE 3. getAppearance : changed conditional boundary → NO_COVERAGE 4. getAppearance : negated conditional → NO_COVERAGE 5. getAppearance : negated conditional → NO_COVERAGE 6. getAppearance : negated conditional → NO_COVERAGE 7. getAppearance : negated conditional → NO_COVERAGE |
if (text != null && text.length() > 0 && wt > 0 && ht > 0) { |
358 | fsize = calculateFontSize(wt, ht); | |
359 |
2
1. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 2. getAppearance : Replaced float division with multiplication → NO_COVERAGE |
textX = (box.getWidth() - ufont.getWidthPoint(text, fsize)) / 2; |
360 |
2
1. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 2. getAppearance : Replaced float division with multiplication → NO_COVERAGE |
textY = (box.getHeight() - ufont.getFontDescriptor(BaseFont.ASCENT, fsize)) / 2; |
361 | } | |
362 | case LAYOUT_ICON_ONLY: | |
363 |
2
1. getAppearance : negated conditional → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
if (nlayout == LAYOUT_LABEL_OVER_ICON || nlayout == LAYOUT_ICON_ONLY) |
364 |
4
1. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 2. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 3. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 4. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
iconBox = new Rectangle(box.getLeft() + adj, box.getBottom() + adj, box.getRight() - adj, box.getTop() - adj); |
365 | break; | |
366 | case LAYOUT_ICON_TOP_LABEL_BOTTOM: | |
367 |
6
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : changed conditional boundary → NO_COVERAGE 3. getAppearance : negated conditional → NO_COVERAGE 4. getAppearance : negated conditional → NO_COVERAGE 5. getAppearance : negated conditional → NO_COVERAGE 6. getAppearance : negated conditional → NO_COVERAGE |
if (text == null || text.length() == 0 || wt <= 0 || ht <= 0) { |
368 | nlayout = LAYOUT_ICON_ONLY; | |
369 | continue; | |
370 | } | |
371 |
2
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
float nht = box.getHeight() * 0.35f - offX; |
372 |
2
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
if (nht > 0) |
373 | fsize = calculateFontSize(wt, nht); | |
374 | else | |
375 | fsize = 4; | |
376 |
2
1. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 2. getAppearance : Replaced float division with multiplication → NO_COVERAGE |
textX = (box.getWidth() - ufont.getWidthPoint(text, fsize)) / 2; |
377 |
1
1. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
textY = offX - ufont.getFontDescriptor(BaseFont.DESCENT, fsize); |
378 |
4
1. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 2. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 3. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 4. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
iconBox = new Rectangle(box.getLeft() + adj, textY + fsize, box.getRight() - adj, box.getTop() - adj); |
379 | break; | |
380 | case LAYOUT_LABEL_TOP_ICON_BOTTOM: | |
381 |
6
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : changed conditional boundary → NO_COVERAGE 3. getAppearance : negated conditional → NO_COVERAGE 4. getAppearance : negated conditional → NO_COVERAGE 5. getAppearance : negated conditional → NO_COVERAGE 6. getAppearance : negated conditional → NO_COVERAGE |
if (text == null || text.length() == 0 || wt <= 0 || ht <= 0) { |
382 | nlayout = LAYOUT_ICON_ONLY; | |
383 | continue; | |
384 | } | |
385 |
2
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
nht = box.getHeight() * 0.35f - offX; |
386 |
2
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
if (nht > 0) |
387 | fsize = calculateFontSize(wt, nht); | |
388 | else | |
389 | fsize = 4; | |
390 |
2
1. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 2. getAppearance : Replaced float division with multiplication → NO_COVERAGE |
textX = (box.getWidth() - ufont.getWidthPoint(text, fsize)) / 2; |
391 |
2
1. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
textY = box.getHeight() - offX - fsize; |
392 |
2
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
if (textY < offX) |
393 | textY = offX; | |
394 |
4
1. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 2. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 3. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 4. getAppearance : Replaced float addition with subtraction → NO_COVERAGE |
iconBox = new Rectangle(box.getLeft() + adj, box.getBottom() + adj, box.getRight() - adj, textY + ufont.getFontDescriptor(BaseFont.DESCENT, fsize)); |
395 | break; | |
396 | case LAYOUT_LABEL_LEFT_ICON_RIGHT: | |
397 |
6
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : changed conditional boundary → NO_COVERAGE 3. getAppearance : negated conditional → NO_COVERAGE 4. getAppearance : negated conditional → NO_COVERAGE 5. getAppearance : negated conditional → NO_COVERAGE 6. getAppearance : negated conditional → NO_COVERAGE |
if (text == null || text.length() == 0 || wt <= 0 || ht <= 0) { |
398 | nlayout = LAYOUT_ICON_ONLY; | |
399 | continue; | |
400 | } | |
401 |
2
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
float nw = box.getWidth() * 0.35f - offX; |
402 |
2
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
if (nw > 0) |
403 | fsize = calculateFontSize(wt, nw); | |
404 | else | |
405 | fsize = 4; | |
406 |
2
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
if (ufont.getWidthPoint(text, fsize) >= wt) { |
407 | nlayout = LAYOUT_LABEL_ONLY; | |
408 | fsize = fontSize; | |
409 | continue; | |
410 | } | |
411 |
1
1. getAppearance : Replaced float addition with subtraction → NO_COVERAGE |
textX = offX + 1; |
412 |
2
1. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 2. getAppearance : Replaced float division with multiplication → NO_COVERAGE |
textY = (box.getHeight() - ufont.getFontDescriptor(BaseFont.ASCENT, fsize)) / 2; |
413 |
4
1. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 2. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 3. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 4. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
iconBox = new Rectangle(textX + ufont.getWidthPoint(text, fsize), box.getBottom() + adj, box.getRight() - adj, box.getTop() - adj); |
414 | break; | |
415 | case LAYOUT_ICON_LEFT_LABEL_RIGHT: | |
416 |
6
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : changed conditional boundary → NO_COVERAGE 3. getAppearance : negated conditional → NO_COVERAGE 4. getAppearance : negated conditional → NO_COVERAGE 5. getAppearance : negated conditional → NO_COVERAGE 6. getAppearance : negated conditional → NO_COVERAGE |
if (text == null || text.length() == 0 || wt <= 0 || ht <= 0) { |
417 | nlayout = LAYOUT_ICON_ONLY; | |
418 | continue; | |
419 | } | |
420 |
2
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
nw = box.getWidth() * 0.35f - offX; |
421 |
2
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
if (nw > 0) |
422 | fsize = calculateFontSize(wt, nw); | |
423 | else | |
424 | fsize = 4; | |
425 |
2
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
if (ufont.getWidthPoint(text, fsize) >= wt) { |
426 | nlayout = LAYOUT_LABEL_ONLY; | |
427 | fsize = fontSize; | |
428 | continue; | |
429 | } | |
430 |
3
1. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 3. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
textX = box.getWidth() - ufont.getWidthPoint(text, fsize) - offX - 1; |
431 |
2
1. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 2. getAppearance : Replaced float division with multiplication → NO_COVERAGE |
textY = (box.getHeight() - ufont.getFontDescriptor(BaseFont.ASCENT, fsize)) / 2; |
432 |
4
1. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 2. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 3. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 4. getAppearance : Replaced float subtraction with addition → NO_COVERAGE |
iconBox = new Rectangle(box.getLeft() + adj, box.getBottom() + adj, textX - 1, box.getTop() - adj); |
433 | break; | |
434 | } | |
435 | break; | |
436 | } | |
437 |
3
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : Replaced float addition with subtraction → NO_COVERAGE 3. getAppearance : negated conditional → NO_COVERAGE |
if (textY < box.getBottom() + offX) |
438 |
1
1. getAppearance : Replaced float addition with subtraction → NO_COVERAGE |
textY = box.getBottom() + offX; |
439 |
5
1. getAppearance : changed conditional boundary → NO_COVERAGE 2. getAppearance : changed conditional boundary → NO_COVERAGE 3. getAppearance : negated conditional → NO_COVERAGE 4. getAppearance : negated conditional → NO_COVERAGE 5. getAppearance : negated conditional → NO_COVERAGE |
if (iconBox != null && (iconBox.getWidth() <= 0 || iconBox.getHeight() <= 0)) |
440 | iconBox = null; | |
441 | boolean haveIcon = false; | |
442 | float boundingBoxWidth = 0; | |
443 | float boundingBoxHeight = 0; | |
444 | PdfArray matrix = null; | |
445 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
if (iconBox != null) { |
446 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
if (image != null) { |
447 | tp = new PdfTemplate(writer); | |
448 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfTemplate::setBoundingBox → NO_COVERAGE |
tp.setBoundingBox(new Rectangle(image)); |
449 | writer.addDirectTemplateSimple(tp, PdfName.FRM); | |
450 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfTemplate::addImage → NO_COVERAGE |
tp.addImage(image, image.getWidth(), 0, 0, image.getHeight(), 0, 0); |
451 | haveIcon = true; | |
452 | boundingBoxWidth = tp.getBoundingBox().getWidth(); | |
453 | boundingBoxHeight = tp.getBoundingBox().getHeight(); | |
454 | } | |
455 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
else if (template != null) { |
456 | tp = new PdfTemplate(writer); | |
457 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfTemplate::setBoundingBox → NO_COVERAGE |
tp.setBoundingBox(new Rectangle(template.getWidth(), template.getHeight())); |
458 | writer.addDirectTemplateSimple(tp, PdfName.FRM); | |
459 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfTemplate::addTemplate → NO_COVERAGE |
tp.addTemplate(template, template.getBoundingBox().getLeft(), template.getBoundingBox().getBottom()); |
460 | haveIcon = true; | |
461 | boundingBoxWidth = tp.getBoundingBox().getWidth(); | |
462 | boundingBoxHeight = tp.getBoundingBox().getHeight(); | |
463 | } | |
464 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
else if (iconReference != null) { |
465 | PdfDictionary dic = (PdfDictionary)PdfReader.getPdfObject(iconReference); | |
466 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
if (dic != null) { |
467 | Rectangle r2 = PdfReader.getNormalizedRectangle(dic.getAsArray(PdfName.BBOX)); | |
468 | matrix = dic.getAsArray(PdfName.MATRIX); | |
469 | haveIcon = true; | |
470 | boundingBoxWidth = r2.getWidth(); | |
471 | boundingBoxHeight = r2.getHeight(); | |
472 | } | |
473 | } | |
474 | } | |
475 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
if (haveIcon) { |
476 |
1
1. getAppearance : Replaced float division with multiplication → NO_COVERAGE |
float icx = iconBox.getWidth() / boundingBoxWidth; |
477 |
1
1. getAppearance : Replaced float division with multiplication → NO_COVERAGE |
float icy = iconBox.getHeight() / boundingBoxHeight; |
478 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
if (proportionalIcon) { |
479 | switch (scaleIcon) { | |
480 | case SCALE_ICON_IS_TOO_BIG: | |
481 | icx = Math.min(icx, icy); | |
482 | icx = Math.min(icx, 1); | |
483 | break; | |
484 | case SCALE_ICON_IS_TOO_SMALL: | |
485 | icx = Math.min(icx, icy); | |
486 | icx = Math.max(icx, 1); | |
487 | break; | |
488 | case SCALE_ICON_NEVER: | |
489 | icx = 1; | |
490 | break; | |
491 | default: | |
492 | icx = Math.min(icx, icy); | |
493 | break; | |
494 | } | |
495 | icy = icx; | |
496 | } | |
497 | else { | |
498 | switch (scaleIcon) { | |
499 | case SCALE_ICON_IS_TOO_BIG: | |
500 | icx = Math.min(icx, 1); | |
501 | icy = Math.min(icy, 1); | |
502 | break; | |
503 | case SCALE_ICON_IS_TOO_SMALL: | |
504 | icx = Math.max(icx, 1); | |
505 | icy = Math.max(icy, 1); | |
506 | break; | |
507 | case SCALE_ICON_NEVER: | |
508 | icx = icy = 1; | |
509 | break; | |
510 | default: | |
511 | break; | |
512 | } | |
513 | } | |
514 |
4
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 3. getAppearance : Replaced float multiplication with division → NO_COVERAGE 4. getAppearance : Replaced float addition with subtraction → NO_COVERAGE |
float xpos = iconBox.getLeft() + (iconBox.getWidth() - (boundingBoxWidth * icx)) * iconHorizontalAdjustment; |
515 |
4
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 3. getAppearance : Replaced float multiplication with division → NO_COVERAGE 4. getAppearance : Replaced float addition with subtraction → NO_COVERAGE |
float ypos = iconBox.getBottom() + (iconBox.getHeight() - (boundingBoxHeight * icy)) * iconVerticalAdjustment; |
516 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::saveState → NO_COVERAGE |
app.saveState(); |
517 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::rectangle → NO_COVERAGE |
app.rectangle(iconBox.getLeft(), iconBox.getBottom(), iconBox.getWidth(), iconBox.getHeight()); |
518 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::clip → NO_COVERAGE |
app.clip(); |
519 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::newPath → NO_COVERAGE |
app.newPath(); |
520 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
if (tp != null) |
521 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::addTemplate → NO_COVERAGE |
app.addTemplate(tp, icx, 0, 0, icy, xpos, ypos); |
522 | else { | |
523 | float cox = 0; | |
524 | float coy = 0; | |
525 |
2
1. getAppearance : negated conditional → NO_COVERAGE 2. getAppearance : negated conditional → NO_COVERAGE |
if (matrix != null && matrix.size() == 6) { |
526 | PdfNumber nm = matrix.getAsNumber(4); | |
527 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
if (nm != null) |
528 | cox = nm.floatValue(); | |
529 | nm = matrix.getAsNumber(5); | |
530 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
if (nm != null) |
531 | coy = nm.floatValue(); | |
532 | } | |
533 |
5
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 3. getAppearance : Replaced float multiplication with division → NO_COVERAGE 4. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 5. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::addTemplateReference → NO_COVERAGE |
app.addTemplateReference(iconReference, PdfName.FRM, icx, 0, 0, icy, xpos - cox * icx, ypos - coy * icy); |
534 | } | |
535 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::restoreState → NO_COVERAGE |
app.restoreState(); |
536 | } | |
537 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
if (!Float.isNaN(textX)) { |
538 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::saveState → NO_COVERAGE |
app.saveState(); |
539 |
5
1. getAppearance : Replaced float multiplication with division → NO_COVERAGE 2. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 3. getAppearance : Replaced float multiplication with division → NO_COVERAGE 4. getAppearance : Replaced float subtraction with addition → NO_COVERAGE 5. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::rectangle → NO_COVERAGE |
app.rectangle(offX, offX, box.getWidth() - 2 * offX, box.getHeight() - 2 * offX); |
540 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::clip → NO_COVERAGE |
app.clip(); |
541 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::newPath → NO_COVERAGE |
app.newPath(); |
542 |
1
1. getAppearance : negated conditional → NO_COVERAGE |
if (textColor == null) |
543 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::resetGrayFill → NO_COVERAGE |
app.resetGrayFill(); |
544 | else | |
545 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::setColorFill → NO_COVERAGE |
app.setColorFill(textColor); |
546 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::beginText → NO_COVERAGE |
app.beginText(); |
547 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::setFontAndSize → NO_COVERAGE |
app.setFontAndSize(ufont, fsize); |
548 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::setTextMatrix → NO_COVERAGE |
app.setTextMatrix(textX, textY); |
549 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::showText → NO_COVERAGE |
app.showText(text); |
550 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::endText → NO_COVERAGE |
app.endText(); |
551 |
1
1. getAppearance : removed call to com/lowagie/text/pdf/PdfAppearance::restoreState → NO_COVERAGE |
app.restoreState(); |
552 | } | |
553 |
1
1. getAppearance : mutated return of Object value for com/lowagie/text/pdf/PushbuttonField::getAppearance to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return app; |
554 | } | |
555 | ||
556 | /** | |
557 | * Gets the pushbutton field. | |
558 | * @throws IOException on error | |
559 | * @throws DocumentException on error | |
560 | * @return the pushbutton field | |
561 | */ | |
562 | public PdfFormField getField() throws IOException, DocumentException { | |
563 | PdfFormField field = PdfFormField.createPushButton(writer); | |
564 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setWidget → NO_COVERAGE |
field.setWidget(box, PdfAnnotation.HIGHLIGHT_INVERT); |
565 |
1
1. getField : negated conditional → NO_COVERAGE |
if (fieldName != null) { |
566 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setFieldName → NO_COVERAGE |
field.setFieldName(fieldName); |
567 |
2
1. getField : Replaced bitwise AND with OR → NO_COVERAGE 2. getField : negated conditional → NO_COVERAGE |
if ((options & READ_ONLY) != 0) |
568 | field.setFieldFlags(PdfFormField.FF_READ_ONLY); | |
569 |
2
1. getField : Replaced bitwise AND with OR → NO_COVERAGE 2. getField : negated conditional → NO_COVERAGE |
if ((options & REQUIRED) != 0) |
570 | field.setFieldFlags(PdfFormField.FF_REQUIRED); | |
571 | } | |
572 |
1
1. getField : negated conditional → NO_COVERAGE |
if (text != null) |
573 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setMKNormalCaption → NO_COVERAGE |
field.setMKNormalCaption(text); |
574 |
1
1. getField : negated conditional → NO_COVERAGE |
if (rotation != 0) |
575 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setMKRotation → NO_COVERAGE |
field.setMKRotation(rotation); |
576 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setBorderStyle → NO_COVERAGE |
field.setBorderStyle(new PdfBorderDictionary(borderWidth, borderStyle, new PdfDashPattern(3))); |
577 | PdfAppearance tpa = getAppearance(); | |
578 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setAppearance → NO_COVERAGE |
field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tpa); |
579 | PdfAppearance da = (PdfAppearance)tpa.getDuplicate(); | |
580 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfAppearance::setFontAndSize → NO_COVERAGE |
da.setFontAndSize(getRealFont(), fontSize); |
581 |
1
1. getField : negated conditional → NO_COVERAGE |
if (textColor == null) |
582 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfAppearance::setGrayFill → NO_COVERAGE |
da.setGrayFill(0); |
583 | else | |
584 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfAppearance::setColorFill → NO_COVERAGE |
da.setColorFill(textColor); |
585 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setDefaultAppearanceString → NO_COVERAGE |
field.setDefaultAppearanceString(da); |
586 |
1
1. getField : negated conditional → NO_COVERAGE |
if (borderColor != null) |
587 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setMKBorderColor → NO_COVERAGE |
field.setMKBorderColor(borderColor); |
588 |
1
1. getField : negated conditional → NO_COVERAGE |
if (backgroundColor != null) |
589 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setMKBackgroundColor → NO_COVERAGE |
field.setMKBackgroundColor(backgroundColor); |
590 | switch (visibility) { | |
591 | case HIDDEN: | |
592 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setFlags → NO_COVERAGE |
field.setFlags(PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_HIDDEN); |
593 | break; | |
594 | case VISIBLE_BUT_DOES_NOT_PRINT: | |
595 | break; | |
596 | case HIDDEN_BUT_PRINTABLE: | |
597 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setFlags → NO_COVERAGE |
field.setFlags(PdfAnnotation.FLAGS_PRINT | PdfAnnotation.FLAGS_NOVIEW); |
598 | break; | |
599 | default: | |
600 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setFlags → NO_COVERAGE |
field.setFlags(PdfAnnotation.FLAGS_PRINT); |
601 | break; | |
602 | } | |
603 |
1
1. getField : negated conditional → NO_COVERAGE |
if (tp != null) |
604 |
1
1. getField : removed call to com/lowagie/text/pdf/PdfFormField::setMKNormalIcon → NO_COVERAGE |
field.setMKNormalIcon(tp); |
605 |
2
1. getField : Replaced integer subtraction with addition → NO_COVERAGE 2. getField : removed call to com/lowagie/text/pdf/PdfFormField::setMKTextPosition → NO_COVERAGE |
field.setMKTextPosition(layout - 1); |
606 | PdfName scale = PdfName.A; | |
607 |
1
1. getField : negated conditional → NO_COVERAGE |
if (scaleIcon == SCALE_ICON_IS_TOO_BIG) |
608 | scale = PdfName.B; | |
609 |
1
1. getField : negated conditional → NO_COVERAGE |
else if (scaleIcon == SCALE_ICON_IS_TOO_SMALL) |
610 | scale = PdfName.S; | |
611 |
1
1. getField : negated conditional → NO_COVERAGE |
else if (scaleIcon == SCALE_ICON_NEVER) |
612 | scale = PdfName.N; | |
613 |
2
1. getField : negated conditional → NO_COVERAGE 2. getField : removed call to com/lowagie/text/pdf/PdfFormField::setMKIconFit → NO_COVERAGE |
field.setMKIconFit(scale, proportionalIcon ? PdfName.P : PdfName.A, iconHorizontalAdjustment, |
614 | iconVerticalAdjustment, iconFitToBounds); | |
615 |
1
1. getField : mutated return of Object value for com/lowagie/text/pdf/PushbuttonField::getField to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return field; |
616 | } | |
617 | | |
618 | /** | |
619 | * Getter for property iconFitToBounds. | |
620 | * @return Value of property iconFitToBounds. | |
621 | */ | |
622 | public boolean isIconFitToBounds() { | |
623 | return this.iconFitToBounds; | |
624 | } | |
625 | | |
626 | /** | |
627 | * If <CODE>true</CODE> the icon will be scaled to fit fully within the bounds of the annotation, | |
628 | * if <CODE>false</CODE> the border width will be taken into account. The default | |
629 | * is <CODE>false</CODE>. | |
630 | * @param iconFitToBounds if <CODE>true</CODE> the icon will be scaled to fit fully within the bounds of the annotation, | |
631 | * if <CODE>false</CODE> the border width will be taken into account | |
632 | */ | |
633 | public void setIconFitToBounds(boolean iconFitToBounds) { | |
634 | this.iconFitToBounds = iconFitToBounds; | |
635 | } | |
636 | ||
637 | /** | |
638 | * Holds value of property iconReference. | |
639 | */ | |
640 | private PRIndirectReference iconReference; | |
641 | ||
642 | /** | |
643 | * Gets the reference to an existing icon. | |
644 | * @return the reference to an existing icon. | |
645 | */ | |
646 | public PRIndirectReference getIconReference() { | |
647 | return this.iconReference; | |
648 | } | |
649 | ||
650 | /** | |
651 | * Sets the reference to an existing icon. | |
652 | * @param iconReference the reference to an existing icon | |
653 | */ | |
654 | public void setIconReference(PRIndirectReference iconReference) { | |
655 | this.iconReference = iconReference; | |
656 | } | |
657 | | |
658 | } | |
Mutations | ||
179 |
1.1 2.2 3.3 4.4 |
|
234 |
1.1 2.2 3.3 4.4 |
|
271 |
1.1 2.2 |
|
273 |
1.1 2.2 |
|
293 |
1.1 2.2 |
|
295 |
1.1 2.2 |
|
303 |
1.1 |
|
305 |
1.1 |
|
308 |
1.1 |
|
309 |
1.1 2.2 |
|
311 |
1.1 2.2 |
|
314 |
1.1 |
|
326 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
327 |
1.1 |
|
329 |
1.1 2.2 3.3 4.4 |
|
330 |
1.1 |
|
332 |
1.1 2.2 |
|
333 |
1.1 2.2 |
|
335 |
1.1 |
|
336 |
1.1 2.2 |
|
337 |
1.1 |
|
339 |
1.1 2.2 |
|
346 |
1.1 2.2 3.3 |
|
347 |
1.1 2.2 |
|
348 |
1.1 2.2 |
|
350 |
1.1 2.2 3.3 |
|
357 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 |
|
359 |
1.1 2.2 |
|
360 |
1.1 2.2 |
|
363 |
1.1 2.2 |
|
364 |
1.1 2.2 3.3 4.4 |
|
367 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
371 |
1.1 2.2 |
|
372 |
1.1 2.2 |
|
376 |
1.1 2.2 |
|
377 |
1.1 |
|
378 |
1.1 2.2 3.3 4.4 |
|
381 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
385 |
1.1 2.2 |
|
386 |
1.1 2.2 |
|
390 |
1.1 2.2 |
|
391 |
1.1 2.2 |
|
392 |
1.1 2.2 |
|
394 |
1.1 2.2 3.3 4.4 |
|
397 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
401 |
1.1 2.2 |
|
402 |
1.1 2.2 |
|
406 |
1.1 2.2 |
|
411 |
1.1 |
|
412 |
1.1 2.2 |
|
413 |
1.1 2.2 3.3 4.4 |
|
416 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
420 |
1.1 2.2 |
|
421 |
1.1 2.2 |
|
425 |
1.1 2.2 |
|
430 |
1.1 2.2 3.3 |
|
431 |
1.1 2.2 |
|
432 |
1.1 2.2 3.3 4.4 |
|
437 |
1.1 2.2 3.3 |
|
438 |
1.1 |
|
439 |
1.1 2.2 3.3 4.4 5.5 |
|
445 |
1.1 |
|
446 |
1.1 |
|
448 |
1.1 |
|
450 |
1.1 |
|
455 |
1.1 |
|
457 |
1.1 |
|
459 |
1.1 |
|
464 |
1.1 |
|
466 |
1.1 |
|
475 |
1.1 |
|
476 |
1.1 |
|
477 |
1.1 |
|
478 |
1.1 |
|
514 |
1.1 2.2 3.3 4.4 |
|
515 |
1.1 2.2 3.3 4.4 |
|
516 |
1.1 |
|
517 |
1.1 |
|
518 |
1.1 |
|
519 |
1.1 |
|
520 |
1.1 |
|
521 |
1.1 |
|
525 |
1.1 2.2 |
|
527 |
1.1 |
|
530 |
1.1 |
|
533 |
1.1 2.2 3.3 4.4 5.5 |
|
535 |
1.1 |
|
537 |
1.1 |
|
538 |
1.1 |
|
539 |
1.1 2.2 3.3 4.4 5.5 |
|
540 |
1.1 |
|
541 |
1.1 |
|
542 |
1.1 |
|
543 |
1.1 |
|
545 |
1.1 |
|
546 |
1.1 |
|
547 |
1.1 |
|
548 |
1.1 |
|
549 |
1.1 |
|
550 |
1.1 |
|
551 |
1.1 |
|
553 |
1.1 |
|
564 |
1.1 |
|
565 |
1.1 |
|
566 |
1.1 |
|
567 |
1.1 2.2 |
|
569 |
1.1 2.2 |
|
572 |
1.1 |
|
573 |
1.1 |
|
574 |
1.1 |
|
575 |
1.1 |
|
576 |
1.1 |
|
578 |
1.1 |
|
580 |
1.1 |
|
581 |
1.1 |
|
582 |
1.1 |
|
584 |
1.1 |
|
585 |
1.1 |
|
586 |
1.1 |
|
587 |
1.1 |
|
588 |
1.1 |
|
589 |
1.1 |
|
592 |
1.1 |
|
597 |
1.1 |
|
600 |
1.1 |
|
603 |
1.1 |
|
604 |
1.1 |
|
605 |
1.1 2.2 |
|
607 |
1.1 |
|
609 |
1.1 |
|
611 |
1.1 |
|
613 |
1.1 2.2 |
|
615 |
1.1 |