1 | /* | |
2 | * $Id: PdfPTable.java 4065 2009-09-16 23:09:11Z psoares33 $ | |
3 | * | |
4 | * Copyright 2001, 2002 Paulo Soares | |
5 | * | |
6 | * The contents of this file are subject to the Mozilla Public License Version 1.1 | |
7 | * (the "License"); you may not use this file except in compliance with the License. | |
8 | * You may obtain a copy of the License at http://www.mozilla.org/MPL/ | |
9 | * | |
10 | * Software distributed under the License is distributed on an "AS IS" basis, | |
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
12 | * for the specific language governing rights and limitations under the License. | |
13 | * | |
14 | * The Original Code is 'iText, a free JAVA-PDF library'. | |
15 | * | |
16 | * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by | |
17 | * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie. | |
18 | * All Rights Reserved. | |
19 | * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer | |
20 | * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved. | |
21 | * | |
22 | * Contributor(s): all the names of the contributors are added in the source code | |
23 | * where applicable. | |
24 | * | |
25 | * Alternatively, the contents of this file may be used under the terms of the | |
26 | * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the | |
27 | * provisions of LGPL are applicable instead of those above. If you wish to | |
28 | * allow use of your version of this file only under the terms of the LGPL | |
29 | * License and not to allow others to use your version of this file under | |
30 | * the MPL, indicate your decision by deleting the provisions above and | |
31 | * replace them with the notice and other provisions required by the LGPL. | |
32 | * If you do not delete the provisions above, a recipient may use your version | |
33 | * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE. | |
34 | * | |
35 | * This library is free software; you can redistribute it and/or modify it | |
36 | * under the terms of the MPL as stated above or under the terms of the GNU | |
37 | * Library General Public License as published by the Free Software Foundation; | |
38 | * either version 2 of the License, or any later version. | |
39 | * | |
40 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
41 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
42 | * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more | |
43 | * details. | |
44 | * | |
45 | * If you didn't download this code from the following link, you should check if | |
46 | * you aren't using an obsolete version: | |
47 | * http://www.lowagie.com/iText/ | |
48 | */ | |
49 | ||
50 | package com.lowagie.text.pdf; | |
51 | ||
52 | import java.util.ArrayList; | |
53 | import com.lowagie.text.error_messages.MessageLocalization; | |
54 | ||
55 | import com.lowagie.text.DocumentException; | |
56 | import com.lowagie.text.Element; | |
57 | import com.lowagie.text.ElementListener; | |
58 | import com.lowagie.text.Image; | |
59 | import com.lowagie.text.LargeElement; | |
60 | import com.lowagie.text.Phrase; | |
61 | import com.lowagie.text.Rectangle; | |
62 | import com.lowagie.text.pdf.events.PdfPTableEventForwarder; | |
63 | ||
64 | /** | |
65 | * This is a table that can be put at an absolute position but can also | |
66 | * be added to the document as the class <CODE>Table</CODE>. | |
67 | * In the last case when crossing pages the table always break at full rows; if a | |
68 | * row is bigger than the page it is dropped silently to avoid infinite loops. | |
69 | * <P> | |
70 | * A PdfPTableEvent can be associated to the table to do custom drawing | |
71 | * when the table is rendered. | |
72 | * @author Paulo Soares (psoares@consiste.pt) | |
73 | */ | |
74 | ||
75 | public class PdfPTable implements LargeElement{ | |
76 | | |
77 | /** | |
78 | * The index of the original <CODE>PdfcontentByte</CODE>. | |
79 | */ | |
80 | public static final int BASECANVAS = 0; | |
81 | | |
82 | /** | |
83 | * The index of the duplicate <CODE>PdfContentByte</CODE> where the background will be drawn. | |
84 | */ | |
85 | public static final int BACKGROUNDCANVAS = 1; | |
86 | | |
87 | /** | |
88 | * The index of the duplicate <CODE>PdfContentByte</CODE> where the border lines will be drawn. | |
89 | */ | |
90 | public static final int LINECANVAS = 2; | |
91 | | |
92 | /** | |
93 | * The index of the duplicate <CODE>PdfContentByte</CODE> where the text will be drawn. | |
94 | */ | |
95 | public static final int TEXTCANVAS = 3; | |
96 | | |
97 | protected ArrayList rows = new ArrayList(); | |
98 | protected float totalHeight = 0; | |
99 | protected PdfPCell[] currentRow; | |
100 | protected int currentRowIdx = 0; | |
101 | protected PdfPCell defaultCell = new PdfPCell((Phrase)null); | |
102 | protected float totalWidth = 0; | |
103 | protected float[] relativeWidths; | |
104 | protected float[] absoluteWidths; | |
105 | protected PdfPTableEvent tableEvent; | |
106 | | |
107 | /** | |
108 | * Holds value of property headerRows. | |
109 | */ | |
110 | protected int headerRows; | |
111 | | |
112 | /** | |
113 | * Holds value of property widthPercentage. | |
114 | */ | |
115 | protected float widthPercentage = 80; | |
116 | | |
117 | /** | |
118 | * Holds value of property horizontalAlignment. | |
119 | */ | |
120 | private int horizontalAlignment = Element.ALIGN_CENTER; | |
121 | | |
122 | /** | |
123 | * Holds value of property skipFirstHeader. | |
124 | */ | |
125 | private boolean skipFirstHeader = false; | |
126 | /** | |
127 | * Holds value of property skipLastFooter. | |
128 | * @since 2.1.6 | |
129 | */ | |
130 | private boolean skipLastFooter = false; | |
131 | ||
132 | protected boolean isColspan = false; | |
133 | | |
134 | protected int runDirection = PdfWriter.RUN_DIRECTION_DEFAULT; | |
135 | ||
136 | /** | |
137 | * Holds value of property lockedWidth. | |
138 | */ | |
139 | private boolean lockedWidth = false; | |
140 | | |
141 | /** | |
142 | * Holds value of property splitRows. | |
143 | */ | |
144 | private boolean splitRows = true; | |
145 | | |
146 | /** | |
147 | * The spacing before the table. | |
148 | */ | |
149 | protected float spacingBefore; | |
150 | | |
151 | /** | |
152 | * The spacing after the table. | |
153 | */ | |
154 | protected float spacingAfter; | |
155 | | |
156 | /** | |
157 | * Holds value of property extendLastRow. | |
158 | */ | |
159 | private boolean[] extendLastRow = { false, false }; | |
160 | | |
161 | /** | |
162 | * Holds value of property headersInEvent. | |
163 | */ | |
164 | private boolean headersInEvent; | |
165 | | |
166 | /** | |
167 | * Holds value of property splitLate. | |
168 | */ | |
169 | private boolean splitLate = true; | |
170 | | |
171 | /** | |
172 | * Defines if the table should be kept | |
173 | * on one page if possible | |
174 | */ | |
175 | private boolean keepTogether; | |
176 | | |
177 | /** | |
178 | * Indicates if the PdfPTable is complete once added to the document. | |
179 | * | |
180 | * @since iText 2.0.8 | |
181 | */ | |
182 | protected boolean complete = true; | |
183 | | |
184 | /** | |
185 | * Holds value of property footerRows. | |
186 | */ | |
187 | private int footerRows; | |
188 | | |
189 | /** | |
190 | * Keeps track of the completeness of the current row. | |
191 | * @since 2.1.6 | |
192 | */ | |
193 | protected boolean rowCompleted = true; | |
194 | | |
195 | protected PdfPTable() { | |
196 | } | |
197 | | |
198 | /** | |
199 | * Constructs a <CODE>PdfPTable</CODE> with the relative column widths. | |
200 | * | |
201 | * @param relativeWidths the relative column widths | |
202 | */ | |
203 | public PdfPTable(float[] relativeWidths) { | |
204 |
1
1. |
if (relativeWidths == null) |
205 | throw new NullPointerException(MessageLocalization.getComposedMessage("the.widths.array.in.pdfptable.constructor.can.not.be.null")); | |
206 |
1
1. |
if (relativeWidths.length == 0) |
207 | throw new IllegalArgumentException(MessageLocalization.getComposedMessage("the.widths.array.in.pdfptable.constructor.can.not.have.zero.length")); | |
208 | this.relativeWidths = new float[relativeWidths.length]; | |
209 |
1
1. |
System.arraycopy(relativeWidths, 0, this.relativeWidths, 0, relativeWidths.length); |
210 | absoluteWidths = new float[relativeWidths.length]; | |
211 |
1
1. |
calculateWidths(); |
212 | currentRow = new PdfPCell[absoluteWidths.length]; | |
213 | keepTogether = false; | |
214 | } | |
215 | | |
216 | /** | |
217 | * Constructs a <CODE>PdfPTable</CODE> with <CODE>numColumns</CODE> columns. | |
218 | * | |
219 | * @param numColumns the number of columns | |
220 | */ | |
221 | public PdfPTable(int numColumns) { | |
222 |
2
1. 2. |
if (numColumns <= 0) |
223 | throw new IllegalArgumentException(MessageLocalization.getComposedMessage("the.number.of.columns.in.pdfptable.constructor.must.be.greater.than.zero")); | |
224 | relativeWidths = new float[numColumns]; | |
225 |
3
1. 2. 3. |
for (int k = 0; k < numColumns; ++k) |
226 | relativeWidths[k] = 1; | |
227 | absoluteWidths = new float[relativeWidths.length]; | |
228 |
1
1. |
calculateWidths(); |
229 | currentRow = new PdfPCell[absoluteWidths.length]; | |
230 | keepTogether = false; | |
231 | } | |
232 | | |
233 | /** | |
234 | * Constructs a copy of a <CODE>PdfPTable</CODE>. | |
235 | * | |
236 | * @param table the <CODE>PdfPTable</CODE> to be copied | |
237 | */ | |
238 | public PdfPTable(PdfPTable table) { | |
239 |
1
1. |
copyFormat(table); |
240 |
2
1. 2. |
for (int k = 0; k < currentRow.length; ++k) { |
241 |
1
1. |
if (table.currentRow[k] == null) |
242 | break; | |
243 | currentRow[k] = new PdfPCell(table.currentRow[k]); | |
244 | } | |
245 |
2
1. 2. |
for (int k = 0; k < table.rows.size(); ++k) { |
246 | PdfPRow row = (PdfPRow)(table.rows.get(k)); | |
247 |
1
1. |
if (row != null) |
248 | row = new PdfPRow(row); | |
249 | rows.add(row); | |
250 | } | |
251 | } | |
252 | | |
253 | /** | |
254 | * Makes a shallow copy of a table (format without content). | |
255 | * | |
256 | * @param table | |
257 | * @return a shallow copy of the table | |
258 | */ | |
259 | public static PdfPTable shallowCopy(PdfPTable table) { | |
260 | PdfPTable nt = new PdfPTable(); | |
261 |
1
1. shallowCopy : removed call to com/lowagie/text/pdf/PdfPTable::copyFormat → NO_COVERAGE |
nt.copyFormat(table); |
262 |
1
1. shallowCopy : mutated return of Object value for com/lowagie/text/pdf/PdfPTable::shallowCopy to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return nt; |
263 | } | |
264 | ||
265 | /** | |
266 | * Copies the format of the sourceTable without copying the content. | |
267 | * | |
268 | * @param sourceTable | |
269 | * @since 2.1.6 private is now protected | |
270 | */ | |
271 | protected void copyFormat(PdfPTable sourceTable) { | |
272 | relativeWidths = new float[sourceTable.getNumberOfColumns()]; | |
273 | absoluteWidths = new float[sourceTable.getNumberOfColumns()]; | |
274 |
1
1. copyFormat : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(sourceTable.relativeWidths, 0, relativeWidths, 0, getNumberOfColumns()); |
275 |
1
1. copyFormat : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(sourceTable.absoluteWidths, 0, absoluteWidths, 0, getNumberOfColumns()); |
276 | totalWidth = sourceTable.totalWidth; | |
277 | totalHeight = sourceTable.totalHeight; | |
278 | currentRowIdx = 0; | |
279 | tableEvent = sourceTable.tableEvent; | |
280 | runDirection = sourceTable.runDirection; | |
281 | defaultCell = new PdfPCell(sourceTable.defaultCell); | |
282 | currentRow = new PdfPCell[sourceTable.currentRow.length]; | |
283 | isColspan = sourceTable.isColspan; | |
284 | splitRows = sourceTable.splitRows; | |
285 | spacingAfter = sourceTable.spacingAfter; | |
286 | spacingBefore = sourceTable.spacingBefore; | |
287 | headerRows = sourceTable.headerRows; | |
288 | footerRows = sourceTable.footerRows; | |
289 | lockedWidth = sourceTable.lockedWidth; | |
290 | extendLastRow = sourceTable.extendLastRow; | |
291 | headersInEvent = sourceTable.headersInEvent; | |
292 | widthPercentage = sourceTable.widthPercentage; | |
293 | splitLate = sourceTable.splitLate; | |
294 | skipFirstHeader = sourceTable.skipFirstHeader; | |
295 | skipLastFooter = sourceTable.skipLastFooter; | |
296 | horizontalAlignment = sourceTable.horizontalAlignment; | |
297 | keepTogether = sourceTable.keepTogether; | |
298 | complete = sourceTable.complete; | |
299 | } | |
300 | ||
301 | /** | |
302 | * Sets the relative widths of the table. | |
303 | * | |
304 | * @param relativeWidths the relative widths of the table. | |
305 | * @throws DocumentException if the number of widths is different than the number | |
306 | * of columns | |
307 | */ | |
308 | public void setWidths(float[] relativeWidths) throws DocumentException { | |
309 |
1
1. setWidths : negated conditional → NO_COVERAGE |
if (relativeWidths.length != getNumberOfColumns()) |
310 | throw new DocumentException(MessageLocalization.getComposedMessage("wrong.number.of.columns")); | |
311 | this.relativeWidths = new float[relativeWidths.length]; | |
312 |
1
1. setWidths : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(relativeWidths, 0, this.relativeWidths, 0, relativeWidths.length); |
313 | absoluteWidths = new float[relativeWidths.length]; | |
314 | totalHeight = 0; | |
315 |
1
1. setWidths : removed call to com/lowagie/text/pdf/PdfPTable::calculateWidths → NO_COVERAGE |
calculateWidths(); |
316 | calculateHeights(true); | |
317 | } | |
318 | ||
319 | /** | |
320 | * Sets the relative widths of the table. | |
321 | * | |
322 | * @param relativeWidths the relative widths of the table. | |
323 | * @throws DocumentException if the number of widths is different than the number | |
324 | * of columns | |
325 | */ | |
326 | public void setWidths(int[] relativeWidths) throws DocumentException { | |
327 | float[] tb = new float[relativeWidths.length]; | |
328 |
2
1. setWidths : changed conditional boundary → NO_COVERAGE 2. setWidths : negated conditional → NO_COVERAGE |
for (int k = 0; k < relativeWidths.length; ++k) |
329 | tb[k] = relativeWidths[k]; | |
330 |
1
1. setWidths : removed call to com/lowagie/text/pdf/PdfPTable::setWidths → NO_COVERAGE |
setWidths(tb); |
331 | } | |
332 | ||
333 | /** | |
334 | * @since 2.1.6 private is now protected | |
335 | */ | |
336 | protected void calculateWidths() { | |
337 |
2
1. calculateWidths : changed conditional boundary → NO_COVERAGE 2. calculateWidths : negated conditional → NO_COVERAGE |
if (totalWidth <= 0) |
338 | return; | |
339 | float total = 0; | |
340 | int numCols = getNumberOfColumns(); | |
341 |
3
1. calculateWidths : changed conditional boundary → NO_COVERAGE 2. calculateWidths : Changed increment from 1 to -1 → NO_COVERAGE 3. calculateWidths : negated conditional → NO_COVERAGE |
for (int k = 0; k < numCols; ++k) |
342 |
1
1. calculateWidths : Replaced float addition with subtraction → NO_COVERAGE |
total += relativeWidths[k]; |
343 |
3
1. calculateWidths : changed conditional boundary → NO_COVERAGE 2. calculateWidths : Changed increment from 1 to -1 → NO_COVERAGE 3. calculateWidths : negated conditional → NO_COVERAGE |
for (int k = 0; k < numCols; ++k) |
344 |
2
1. calculateWidths : Replaced float multiplication with division → NO_COVERAGE 2. calculateWidths : Replaced float division with multiplication → NO_COVERAGE |
absoluteWidths[k] = totalWidth * relativeWidths[k] / total; |
345 | } | |
346 | | |
347 | /** | |
348 | * Sets the full width of the table. | |
349 | * | |
350 | * @param totalWidth the full width of the table. | |
351 | */ | |
352 | public void setTotalWidth(float totalWidth) { | |
353 |
1
1. setTotalWidth : negated conditional → NO_COVERAGE |
if (this.totalWidth == totalWidth) |
354 | return; | |
355 | this.totalWidth = totalWidth; | |
356 | totalHeight = 0; | |
357 |
1
1. setTotalWidth : removed call to com/lowagie/text/pdf/PdfPTable::calculateWidths → NO_COVERAGE |
calculateWidths(); |
358 | calculateHeights(true); | |
359 | } | |
360 | ||
361 | /** | |
362 | * Sets the full width of the table from the absolute column width. | |
363 | * | |
364 | * @param columnWidth the absolute width of each column | |
365 | * @throws DocumentException if the number of widths is different than the number | |
366 | * of columns | |
367 | */ | |
368 | public void setTotalWidth(float[] columnWidth) throws DocumentException { | |
369 |
1
1. setTotalWidth : negated conditional → NO_COVERAGE |
if (columnWidth.length != getNumberOfColumns()) |
370 | throw new DocumentException(MessageLocalization.getComposedMessage("wrong.number.of.columns")); | |
371 | totalWidth = 0; | |
372 |
1
1. setTotalWidth : Replaced float addition with subtraction → NO_COVERAGE |
for (float v : columnWidth) totalWidth += v; |
373 |
1
1. setTotalWidth : removed call to com/lowagie/text/pdf/PdfPTable::setWidths → NO_COVERAGE |
setWidths(columnWidth); |
374 | } | |
375 | ||
376 | /** | |
377 | * Sets the percentage width of the table from the absolute column width. | |
378 | * | |
379 | * @param columnWidth the absolute width of each column | |
380 | * @param pageSize the page size | |
381 | * @throws DocumentException | |
382 | */ | |
383 | public void setWidthPercentage(float[] columnWidth, Rectangle pageSize) throws DocumentException { | |
384 |
1
1. setWidthPercentage : negated conditional → NO_COVERAGE |
if (columnWidth.length != getNumberOfColumns()) |
385 | throw new IllegalArgumentException(MessageLocalization.getComposedMessage("wrong.number.of.columns")); | |
386 | float totalWidth = 0; | |
387 |
1
1. setWidthPercentage : Replaced float addition with subtraction → NO_COVERAGE |
for (float v : columnWidth) totalWidth += v; |
388 |
3
1. setWidthPercentage : Replaced float subtraction with addition → NO_COVERAGE 2. setWidthPercentage : Replaced float division with multiplication → NO_COVERAGE 3. setWidthPercentage : Replaced float multiplication with division → NO_COVERAGE |
widthPercentage = totalWidth / (pageSize.getRight() - pageSize.getLeft()) * 100f; |
389 |
1
1. setWidthPercentage : removed call to com/lowagie/text/pdf/PdfPTable::setWidths → NO_COVERAGE |
setWidths(columnWidth); |
390 | } | |
391 | ||
392 | /** | |
393 | * Gets the full width of the table. | |
394 | * | |
395 | * @return the full width of the table | |
396 | */ | |
397 | public float getTotalWidth() { | |
398 | return totalWidth; | |
399 | } | |
400 | | |
401 | /** | |
402 | * Calculates the heights of the table. | |
403 | * | |
404 | * @param firsttime if true, the heights of the rows will be recalculated. | |
405 | * This takes time; normally the heights of the rows are already calcultated, | |
406 | * so in most cases, it's save to use false as parameter. | |
407 | * @return the total height of the table. Note that it will be 0 if you didn't | |
408 | * specify the width of the table with setTotalWidth(). | |
409 | * @since 2.1.5 added a parameter and a return type to an existing method, | |
410 | * and made it public | |
411 | */ | |
412 | public float calculateHeights(boolean firsttime) { | |
413 |
2
1. calculateHeights : changed conditional boundary → NO_COVERAGE 2. calculateHeights : negated conditional → NO_COVERAGE |
if (totalWidth <= 0) |
414 |
1
1. calculateHeights : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::calculateHeights → NO_COVERAGE |
return 0; |
415 | totalHeight = 0; | |
416 |
2
1. calculateHeights : changed conditional boundary → NO_COVERAGE 2. calculateHeights : negated conditional → NO_COVERAGE |
for (int k = 0; k < rows.size(); ++k) { |
417 |
1
1. calculateHeights : Replaced float addition with subtraction → NO_COVERAGE |
totalHeight += getRowHeight(k, firsttime); |
418 | } | |
419 |
1
1. calculateHeights : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::calculateHeights → NO_COVERAGE |
return totalHeight; |
420 | } | |
421 | | |
422 | /** | |
423 | * Calculates the heights of the table. | |
424 | */ | |
425 | public void calculateHeightsFast() { | |
426 | calculateHeights(false); | |
427 | } | |
428 | | |
429 | /** | |
430 | * Gets the default <CODE>PdfPCell</CODE> that will be used as | |
431 | * reference for all the <CODE>addCell</CODE> methods except | |
432 | * <CODE>addCell(PdfPCell)</CODE>. | |
433 | * | |
434 | * @return default <CODE>PdfPCell</CODE> | |
435 | */ | |
436 | public PdfPCell getDefaultCell() { | |
437 | return defaultCell; | |
438 | } | |
439 | | |
440 | /** | |
441 | * Adds a cell element. | |
442 | * | |
443 | * @param cell the cell element | |
444 | */ | |
445 | public void addCell(PdfPCell cell) { | |
446 | rowCompleted = false; | |
447 | PdfPCell ncell = new PdfPCell(cell); | |
448 | | |
449 | int colspan = ncell.getColspan(); | |
450 | colspan = Math.max(colspan, 1); | |
451 |
1
1. addCell : Replaced integer subtraction with addition → NO_COVERAGE |
colspan = Math.min(colspan, currentRow.length - currentRowIdx); |
452 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPCell::setColspan → NO_COVERAGE |
ncell.setColspan(colspan); |
453 | ||
454 |
1
1. addCell : negated conditional → NO_COVERAGE |
if (colspan != 1) |
455 | isColspan = true; | |
456 | int rdir = ncell.getRunDirection(); | |
457 |
1
1. addCell : negated conditional → NO_COVERAGE |
if (rdir == PdfWriter.RUN_DIRECTION_DEFAULT) |
458 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPCell::setRunDirection → NO_COVERAGE |
ncell.setRunDirection(runDirection); |
459 | | |
460 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPTable::skipColsWithRowspanAbove → NO_COVERAGE |
skipColsWithRowspanAbove(); |
461 | | |
462 | boolean cellAdded = false; | |
463 |
2
1. addCell : changed conditional boundary → NO_COVERAGE 2. addCell : negated conditional → NO_COVERAGE |
if (currentRowIdx < currentRow.length) { |
464 | currentRow[currentRowIdx] = ncell; | |
465 |
1
1. addCell : Replaced integer addition with subtraction → NO_COVERAGE |
currentRowIdx += colspan; |
466 | cellAdded = true; | |
467 | } | |
468 | ||
469 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPTable::skipColsWithRowspanAbove → NO_COVERAGE |
skipColsWithRowspanAbove(); |
470 | | |
471 |
2
1. addCell : changed conditional boundary → NO_COVERAGE 2. addCell : negated conditional → NO_COVERAGE |
while (currentRowIdx >= currentRow.length) { |
472 | int numCols = getNumberOfColumns(); | |
473 |
1
1. addCell : negated conditional → NO_COVERAGE |
if (runDirection == PdfWriter.RUN_DIRECTION_RTL) { |
474 | PdfPCell[] rtlRow = new PdfPCell[numCols]; | |
475 | int rev = currentRow.length; | |
476 |
3
1. addCell : changed conditional boundary → NO_COVERAGE 2. addCell : Changed increment from 1 to -1 → NO_COVERAGE 3. addCell : negated conditional → NO_COVERAGE |
for (int k = 0; k < currentRow.length; ++k) { |
477 | PdfPCell rcell = currentRow[k]; | |
478 | int cspan = rcell.getColspan(); | |
479 |
1
1. addCell : Replaced integer subtraction with addition → NO_COVERAGE |
rev -= cspan; |
480 | rtlRow[rev] = rcell; | |
481 |
2
1. addCell : Replaced integer subtraction with addition → NO_COVERAGE 2. addCell : Replaced integer addition with subtraction → NO_COVERAGE |
k += cspan - 1; |
482 | } | |
483 | currentRow = rtlRow; | |
484 | } | |
485 | PdfPRow row = new PdfPRow(currentRow); | |
486 |
2
1. addCell : changed conditional boundary → NO_COVERAGE 2. addCell : negated conditional → NO_COVERAGE |
if (totalWidth > 0) { |
487 | row.setWidths(absoluteWidths); | |
488 |
1
1. addCell : Replaced float addition with subtraction → NO_COVERAGE |
totalHeight += row.getMaxHeights(); |
489 | } | |
490 | rows.add(row); | |
491 | currentRow = new PdfPCell[numCols]; | |
492 | currentRowIdx = 0; | |
493 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPTable::skipColsWithRowspanAbove → NO_COVERAGE |
skipColsWithRowspanAbove(); |
494 | rowCompleted = true; | |
495 | } | |
496 | | |
497 |
1
1. addCell : negated conditional → NO_COVERAGE |
if (!cellAdded) { |
498 | currentRow[currentRowIdx] = ncell; | |
499 |
1
1. addCell : Replaced integer addition with subtraction → NO_COVERAGE |
currentRowIdx += colspan; |
500 | } | |
501 | } | |
502 | | |
503 | /** | |
504 | * When updating the row index, cells with rowspan should be taken into account. | |
505 | * This is what happens in this method. | |
506 | * @since 2.1.6 | |
507 | */ | |
508 | private void skipColsWithRowspanAbove() { | |
509 | int direction = 1; | |
510 |
1
1. skipColsWithRowspanAbove : negated conditional → NO_COVERAGE |
if (runDirection == PdfWriter.RUN_DIRECTION_RTL) |
511 | direction = -1; | |
512 |
1
1. skipColsWithRowspanAbove : negated conditional → NO_COVERAGE |
while (rowSpanAbove(rows.size(), currentRowIdx)) |
513 |
1
1. skipColsWithRowspanAbove : Replaced integer addition with subtraction → NO_COVERAGE |
currentRowIdx += direction; |
514 | } | |
515 | | |
516 | PdfPCell obtainCell(final int row, final int col) { | |
517 | PdfPCell[] cells = ((PdfPRow)rows.get(row)).getCells(); | |
518 |
2
1. obtainCell : changed conditional boundary → NO_COVERAGE 2. obtainCell : negated conditional → NO_COVERAGE |
for (int i = 0; i < cells.length; i++) { |
519 |
1
1. obtainCell : negated conditional → NO_COVERAGE |
if (cells[i] != null) { |
520 |
5
1. obtainCell : changed conditional boundary → NO_COVERAGE 2. obtainCell : changed conditional boundary → NO_COVERAGE 3. obtainCell : Replaced integer addition with subtraction → NO_COVERAGE 4. obtainCell : negated conditional → NO_COVERAGE 5. obtainCell : negated conditional → NO_COVERAGE |
if (col >= i && col < (i + cells[i].getColspan())) { |
521 |
1
1. obtainCell : mutated return of Object value for com/lowagie/text/pdf/PdfPTable::obtainCell to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return cells[i]; |
522 | } | |
523 | } | |
524 | } | |
525 |
1
1. obtainCell : mutated return of Object value for com/lowagie/text/pdf/PdfPTable::obtainCell to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
526 | } | |
527 | /** | |
528 | * Checks if there are rows above belonging to a rowspan. | |
529 | * @param currRow the current row to check | |
530 | * @param currCol the current column to check | |
531 | * @return true if there's a cell above that belongs to a rowspan | |
532 | * @since 2.1.6 | |
533 | */ | |
534 | boolean rowSpanAbove(int currRow, int currCol) { | |
535 | | |
536 |
6
1. rowSpanAbove : changed conditional boundary → NO_COVERAGE 2. rowSpanAbove : changed conditional boundary → NO_COVERAGE 3. rowSpanAbove : changed conditional boundary → NO_COVERAGE 4. rowSpanAbove : negated conditional → NO_COVERAGE 5. rowSpanAbove : negated conditional → NO_COVERAGE 6. rowSpanAbove : negated conditional → NO_COVERAGE |
if ((currCol >= getNumberOfColumns()) |
537 | || (currCol < 0) | |
538 | || (currRow < 1)) | |
539 |
1
1. rowSpanAbove : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
540 | | |
541 |
1
1. rowSpanAbove : Replaced integer subtraction with addition → NO_COVERAGE |
int row = currRow - 1; |
542 | PdfPRow aboveRow = (PdfPRow)rows.get(row); | |
543 |
1
1. rowSpanAbove : negated conditional → NO_COVERAGE |
if (aboveRow == null) |
544 |
1
1. rowSpanAbove : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
545 | PdfPCell aboveCell = obtainCell(row,currCol); | |
546 |
3
1. rowSpanAbove : changed conditional boundary → NO_COVERAGE 2. rowSpanAbove : negated conditional → NO_COVERAGE 3. rowSpanAbove : negated conditional → NO_COVERAGE |
while ((aboveCell == null) && (row > 0)) { |
547 |
1
1. rowSpanAbove : Changed increment from -1 to 1 → NO_COVERAGE |
aboveRow = (PdfPRow)rows.get(--row); |
548 |
1
1. rowSpanAbove : negated conditional → NO_COVERAGE |
if (aboveRow == null) |
549 |
1
1. rowSpanAbove : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
550 | aboveCell = obtainCell(row,currCol); | |
551 | } | |
552 | | |
553 |
1
1. rowSpanAbove : Replaced integer subtraction with addition → NO_COVERAGE |
int distance = currRow - row; |
554 | ||
555 |
1
1. rowSpanAbove : negated conditional → NO_COVERAGE |
if (aboveCell == null) { |
556 |
1
1. rowSpanAbove : Replaced integer subtraction with addition → NO_COVERAGE |
int col = currCol - 1; |
557 | aboveCell = obtainCell(row,col); | |
558 |
3
1. rowSpanAbove : changed conditional boundary → NO_COVERAGE 2. rowSpanAbove : negated conditional → NO_COVERAGE 3. rowSpanAbove : negated conditional → NO_COVERAGE |
while ((aboveCell == null) && (row > 0)) |
559 |
1
1. rowSpanAbove : Changed increment from -1 to 1 → NO_COVERAGE |
aboveCell = obtainCell(row,--col); |
560 |
4
1. rowSpanAbove : changed conditional boundary → NO_COVERAGE 2. rowSpanAbove : negated conditional → NO_COVERAGE 3. rowSpanAbove : negated conditional → NO_COVERAGE 4. rowSpanAbove : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return aboveCell != null && aboveCell.getRowspan() > distance; |
561 | } | |
562 | | |
563 |
3
1. rowSpanAbove : changed conditional boundary → NO_COVERAGE 2. rowSpanAbove : negated conditional → NO_COVERAGE 3. rowSpanAbove : negated conditional → NO_COVERAGE |
if ((aboveCell.getRowspan() == 1) && (distance > 1)) { |
564 |
1
1. rowSpanAbove : Replaced integer subtraction with addition → NO_COVERAGE |
int col = currCol - 1; |
565 |
1
1. rowSpanAbove : Replaced integer addition with subtraction → NO_COVERAGE |
aboveRow = (PdfPRow)rows.get(row + 1); |
566 |
1
1. rowSpanAbove : Changed increment from -1 to 1 → NO_COVERAGE |
distance--; |
567 | aboveCell = aboveRow.getCells()[col]; | |
568 |
3
1. rowSpanAbove : changed conditional boundary → NO_COVERAGE 2. rowSpanAbove : negated conditional → NO_COVERAGE 3. rowSpanAbove : negated conditional → NO_COVERAGE |
while ((aboveCell == null) && (col > 0)) |
569 |
1
1. rowSpanAbove : Changed increment from -1 to 1 → NO_COVERAGE |
aboveCell = aboveRow.getCells()[--col]; |
570 | } | |
571 | | |
572 |
4
1. rowSpanAbove : changed conditional boundary → NO_COVERAGE 2. rowSpanAbove : negated conditional → NO_COVERAGE 3. rowSpanAbove : negated conditional → NO_COVERAGE 4. rowSpanAbove : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return aboveCell != null && aboveCell.getRowspan() > distance; |
573 | } | |
574 | | |
575 | | |
576 | /** | |
577 | * Adds a cell element. | |
578 | * | |
579 | * @param text the text for the cell | |
580 | */ | |
581 | public void addCell(String text) { | |
582 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPTable::addCell → NO_COVERAGE |
addCell(new Phrase(text)); |
583 | } | |
584 | | |
585 | /** | |
586 | * Adds a nested table. | |
587 | * | |
588 | * @param table the table to be added to the cell | |
589 | */ | |
590 | public void addCell(PdfPTable table) { | |
591 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPCell::setTable → NO_COVERAGE |
defaultCell.setTable(table); |
592 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPTable::addCell → NO_COVERAGE |
addCell(defaultCell); |
593 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPCell::setTable → NO_COVERAGE |
defaultCell.setTable(null); |
594 | } | |
595 | | |
596 | /** | |
597 | * Adds an Image as Cell. | |
598 | * | |
599 | * @param image the <CODE>Image</CODE> to add to the table. | |
600 | * This image will fit in the cell | |
601 | */ | |
602 | public void addCell(Image image) { | |
603 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPCell::setImage → NO_COVERAGE |
defaultCell.setImage(image); |
604 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPTable::addCell → NO_COVERAGE |
addCell(defaultCell); |
605 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPCell::setImage → NO_COVERAGE |
defaultCell.setImage(null); |
606 | } | |
607 | | |
608 | /** | |
609 | * Adds a cell element. | |
610 | * | |
611 | * @param phrase the <CODE>Phrase</CODE> to be added to the cell | |
612 | */ | |
613 | public void addCell(Phrase phrase) { | |
614 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPCell::setPhrase → NO_COVERAGE |
defaultCell.setPhrase(phrase); |
615 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPTable::addCell → NO_COVERAGE |
addCell(defaultCell); |
616 |
1
1. addCell : removed call to com/lowagie/text/pdf/PdfPCell::setPhrase → NO_COVERAGE |
defaultCell.setPhrase(null); |
617 | } | |
618 | | |
619 | /** | |
620 | * Writes the selected rows to the document. | |
621 | * <CODE>canvases</CODE> is obtained from <CODE>beginWritingRows()</CODE>. | |
622 | * | |
623 | * @param rowStart the first row to be written, zero index | |
624 | * @param rowEnd the last row to be written + 1. If it is -1 all the | |
625 | * rows to the end are written | |
626 | * @param xPos the x write coordinate | |
627 | * @param yPos the y write coordinate | |
628 | * @param canvases an array of 4 <CODE>PdfContentByte</CODE> obtained from | |
629 | * <CODE>beginWrittingRows()</CODE> | |
630 | * @return the y coordinate position of the bottom of the last row | |
631 | * @see #beginWritingRows(com.lowagie.text.pdf.PdfContentByte) | |
632 | */ | |
633 | public float writeSelectedRows(int rowStart, int rowEnd, float xPos, float yPos, PdfContentByte[] canvases) { | |
634 |
1
1. writeSelectedRows : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::writeSelectedRows → NO_COVERAGE |
return writeSelectedRows(0, -1, rowStart, rowEnd, xPos, yPos, canvases); |
635 | } | |
636 | | |
637 | /** | |
638 | * Writes the selected rows and columns to the document. | |
639 | * This method does not clip the columns; this is only important | |
640 | * if there are columns with colspan at boundaries. | |
641 | * <CODE>canvases</CODE> is obtained from <CODE>beginWritingRows()</CODE>. | |
642 | * The table event is only fired for complete rows. | |
643 | * | |
644 | * @param colStart the first column to be written, zero index | |
645 | * @param colEnd the last column to be written + 1. If it is -1 all the | |
646 | * columns to the end are written | |
647 | * @param rowStart the first row to be written, zero index | |
648 | * @param rowEnd the last row to be written + 1. If it is -1 all the | |
649 | * rows to the end are written | |
650 | * @param xPos the x write coordinate | |
651 | * @param yPos the y write coordinate | |
652 | * @param canvases an array of 4 <CODE>PdfContentByte</CODE> obtained from | |
653 | * <CODE>beginWritingRows()</CODE> | |
654 | * @return the y coordinate position of the bottom of the last row | |
655 | * @see #beginWritingRows(com.lowagie.text.pdf.PdfContentByte) | |
656 | */ | |
657 | public float writeSelectedRows(int colStart, int colEnd, int rowStart, int rowEnd, float xPos, float yPos, PdfContentByte[] canvases) { | |
658 |
2
1. writeSelectedRows : changed conditional boundary → NO_COVERAGE 2. writeSelectedRows : negated conditional → NO_COVERAGE |
if (totalWidth <= 0) |
659 | throw new RuntimeException(MessageLocalization.getComposedMessage("the.table.width.must.be.greater.than.zero")); | |
660 | | |
661 | int totalRows = rows.size(); | |
662 |
2
1. writeSelectedRows : changed conditional boundary → NO_COVERAGE 2. writeSelectedRows : negated conditional → NO_COVERAGE |
if (rowStart < 0) |
663 | rowStart = 0; | |
664 |
2
1. writeSelectedRows : changed conditional boundary → NO_COVERAGE 2. writeSelectedRows : negated conditional → NO_COVERAGE |
if (rowEnd < 0) |
665 | rowEnd = totalRows; | |
666 | else | |
667 | rowEnd = Math.min(rowEnd, totalRows); | |
668 |
2
1. writeSelectedRows : changed conditional boundary → NO_COVERAGE 2. writeSelectedRows : negated conditional → NO_COVERAGE |
if (rowStart >= rowEnd) |
669 |
1
1. writeSelectedRows : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::writeSelectedRows → NO_COVERAGE |
return yPos; |
670 | | |
671 | int totalCols = getNumberOfColumns(); | |
672 |
2
1. writeSelectedRows : changed conditional boundary → NO_COVERAGE 2. writeSelectedRows : negated conditional → NO_COVERAGE |
if (colStart < 0) |
673 | colStart = 0; | |
674 | else | |
675 | colStart = Math.min(colStart, totalCols); | |
676 |
2
1. writeSelectedRows : changed conditional boundary → NO_COVERAGE 2. writeSelectedRows : negated conditional → NO_COVERAGE |
if (colEnd < 0) |
677 | colEnd = totalCols; | |
678 | else | |
679 | colEnd = Math.min(colEnd, totalCols); | |
680 | | |
681 | float yPosStart = yPos; | |
682 |
3
1. writeSelectedRows : changed conditional boundary → NO_COVERAGE 2. writeSelectedRows : Changed increment from 1 to -1 → NO_COVERAGE 3. writeSelectedRows : negated conditional → NO_COVERAGE |
for (int k = rowStart; k < rowEnd; ++k) { |
683 | PdfPRow row = (PdfPRow)rows.get(k); | |
684 |
1
1. writeSelectedRows : negated conditional → NO_COVERAGE |
if (row != null) { |
685 |
1
1. writeSelectedRows : removed call to com/lowagie/text/pdf/PdfPRow::writeCells → NO_COVERAGE |
row.writeCells(colStart, colEnd, xPos, yPos, canvases); |
686 |
1
1. writeSelectedRows : Replaced float subtraction with addition → NO_COVERAGE |
yPos -= row.getMaxHeights(); |
687 | } | |
688 | } | |
689 | | |
690 |
3
1. writeSelectedRows : negated conditional → NO_COVERAGE 2. writeSelectedRows : negated conditional → NO_COVERAGE 3. writeSelectedRows : negated conditional → NO_COVERAGE |
if (tableEvent != null && colStart == 0 && colEnd == totalCols) { |
691 |
2
1. writeSelectedRows : Replaced integer subtraction with addition → NO_COVERAGE 2. writeSelectedRows : Replaced integer addition with subtraction → NO_COVERAGE |
float[] heights = new float[rowEnd - rowStart + 1]; |
692 | heights[0] = yPosStart; | |
693 |
3
1. writeSelectedRows : changed conditional boundary → NO_COVERAGE 2. writeSelectedRows : Changed increment from 1 to -1 → NO_COVERAGE 3. writeSelectedRows : negated conditional → NO_COVERAGE |
for (int k = rowStart; k < rowEnd; ++k) { |
694 | PdfPRow row = (PdfPRow)rows.get(k); | |
695 | float hr = 0; | |
696 |
1
1. writeSelectedRows : negated conditional → NO_COVERAGE |
if (row != null) |
697 | hr = row.getMaxHeights(); | |
698 |
4
1. writeSelectedRows : Replaced integer subtraction with addition → NO_COVERAGE 2. writeSelectedRows : Replaced integer addition with subtraction → NO_COVERAGE 3. writeSelectedRows : Replaced integer subtraction with addition → NO_COVERAGE 4. writeSelectedRows : Replaced float subtraction with addition → NO_COVERAGE |
heights[k - rowStart + 1] = heights[k - rowStart] - hr; |
699 | } | |
700 |
2
1. writeSelectedRows : negated conditional → NO_COVERAGE 2. writeSelectedRows : removed call to com/lowagie/text/pdf/PdfPTableEvent::tableLayout → NO_COVERAGE |
tableEvent.tableLayout(this, getEventWidths(xPos, rowStart, rowEnd, headersInEvent), heights, headersInEvent ? headerRows : 0, rowStart, canvases); |
701 | } | |
702 | | |
703 |
1
1. writeSelectedRows : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::writeSelectedRows → NO_COVERAGE |
return yPos; |
704 | } | |
705 | | |
706 | /** | |
707 | * Writes the selected rows to the document. | |
708 | * | |
709 | * @param rowStart the first row to be written, zero index | |
710 | * @param rowEnd the last row to be written + 1. If it is -1 all the | |
711 | * rows to the end are written | |
712 | * @param xPos the x write coordinate | |
713 | * @param yPos the y write coordinate | |
714 | * @param canvas the <CODE>PdfContentByte</CODE> where the rows will | |
715 | * be written to | |
716 | * @return the y coordinate position of the bottom of the last row | |
717 | */ | |
718 | public float writeSelectedRows(int rowStart, int rowEnd, float xPos, float yPos, PdfContentByte canvas) { | |
719 |
1
1. writeSelectedRows : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::writeSelectedRows → NO_COVERAGE |
return writeSelectedRows(0, -1, rowStart, rowEnd, xPos, yPos, canvas); |
720 | } | |
721 | | |
722 | /** | |
723 | * Writes the selected rows and columns to the document. | |
724 | * This method clips the columns; this is only important | |
725 | * if there are columns with colspan at boundaries. | |
726 | * The table event is only fired for complete rows. | |
727 | * | |
728 | * @param colStart the first column to be written, zero index | |
729 | * @param colEnd the last column to be written + 1. If it is -1 all the | |
730 | * columns to the end are written | |
731 | * @param rowStart the first row to be written, zero index | |
732 | * @param rowEnd the last row to be written + 1. If it is -1 all the | |
733 | * rows to the end are written | |
734 | * @param xPos the x write coordinate | |
735 | * @param yPos the y write coordinate | |
736 | * @param canvas the <CODE>PdfContentByte</CODE> where the rows will | |
737 | * be written to | |
738 | * @return the y coordinate position of the bottom of the last row | |
739 | */ | |
740 | public float writeSelectedRows(int colStart, int colEnd, int rowStart, int rowEnd, float xPos, float yPos, PdfContentByte canvas) { | |
741 | int totalCols = getNumberOfColumns(); | |
742 |
2
1. writeSelectedRows : changed conditional boundary → NO_COVERAGE 2. writeSelectedRows : negated conditional → NO_COVERAGE |
if (colStart < 0) |
743 | colStart = 0; | |
744 | else | |
745 | colStart = Math.min(colStart, totalCols); | |
746 | | |
747 |
2
1. writeSelectedRows : changed conditional boundary → NO_COVERAGE 2. writeSelectedRows : negated conditional → NO_COVERAGE |
if (colEnd < 0) |
748 | colEnd = totalCols; | |
749 | else | |
750 | colEnd = Math.min(colEnd, totalCols); | |
751 | | |
752 |
2
1. writeSelectedRows : negated conditional → NO_COVERAGE 2. writeSelectedRows : negated conditional → NO_COVERAGE |
boolean clip = (colStart != 0 || colEnd != totalCols); |
753 | | |
754 |
1
1. writeSelectedRows : negated conditional → NO_COVERAGE |
if (clip) { |
755 | float w = 0; | |
756 |
3
1. writeSelectedRows : changed conditional boundary → NO_COVERAGE 2. writeSelectedRows : Changed increment from 1 to -1 → NO_COVERAGE 3. writeSelectedRows : negated conditional → NO_COVERAGE |
for (int k = colStart; k < colEnd; ++k) |
757 |
1
1. writeSelectedRows : Replaced float addition with subtraction → NO_COVERAGE |
w += absoluteWidths[k]; |
758 |
1
1. writeSelectedRows : removed call to com/lowagie/text/pdf/PdfContentByte::saveState → NO_COVERAGE |
canvas.saveState(); |
759 |
1
1. writeSelectedRows : negated conditional → NO_COVERAGE |
float lx = (colStart == 0) ? 10000 : 0; |
760 |
1
1. writeSelectedRows : negated conditional → NO_COVERAGE |
float rx = (colEnd == totalCols) ? 10000 : 0; |
761 |
4
1. writeSelectedRows : Replaced float subtraction with addition → NO_COVERAGE 2. writeSelectedRows : Replaced float addition with subtraction → NO_COVERAGE 3. writeSelectedRows : Replaced float addition with subtraction → NO_COVERAGE 4. writeSelectedRows : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
canvas.rectangle(xPos - lx, -10000, w + lx + rx, PdfPRow.RIGHT_LIMIT); |
762 |
1
1. writeSelectedRows : removed call to com/lowagie/text/pdf/PdfContentByte::clip → NO_COVERAGE |
canvas.clip(); |
763 |
1
1. writeSelectedRows : removed call to com/lowagie/text/pdf/PdfContentByte::newPath → NO_COVERAGE |
canvas.newPath(); |
764 | } | |
765 | | |
766 | PdfContentByte[] canvases = beginWritingRows(canvas); | |
767 | float y = writeSelectedRows(colStart, colEnd, rowStart, rowEnd, xPos, yPos, canvases); | |
768 |
1
1. writeSelectedRows : removed call to com/lowagie/text/pdf/PdfPTable::endWritingRows → NO_COVERAGE |
endWritingRows(canvases); |
769 | | |
770 |
1
1. writeSelectedRows : negated conditional → NO_COVERAGE |
if (clip) |
771 |
1
1. writeSelectedRows : removed call to com/lowagie/text/pdf/PdfContentByte::restoreState → NO_COVERAGE |
canvas.restoreState(); |
772 | | |
773 |
1
1. writeSelectedRows : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::writeSelectedRows → NO_COVERAGE |
return y; |
774 | } | |
775 | | |
776 | /** | |
777 | * Gets and initializes the 4 layers where the table is written to. The text or graphics are added to | |
778 | * one of the 4 <CODE>PdfContentByte</CODE> returned with the following order:<p> | |
779 | * <ul> | |
780 | * <li><CODE>PdfPtable.BASECANVAS</CODE> - the original <CODE>PdfContentByte</CODE>. Anything placed here | |
781 | * will be under the table. | |
782 | * <li><CODE>PdfPtable.BACKGROUNDCANVAS</CODE> - the layer where the background goes to. | |
783 | * <li><CODE>PdfPtable.LINECANVAS</CODE> - the layer where the lines go to. | |
784 | * <li><CODE>PdfPtable.TEXTCANVAS</CODE> - the layer where the text go to. Anything placed here | |
785 | * will be over the table. | |
786 | * </ul><p> | |
787 | * The layers are placed in sequence on top of each other. | |
788 | * | |
789 | * @param canvas the <CODE>PdfContentByte</CODE> where the rows will | |
790 | * be written to | |
791 | * @return an array of 4 <CODE>PdfContentByte</CODE> | |
792 | * @see #writeSelectedRows(int, int, float, float, PdfContentByte[]) | |
793 | */ | |
794 | public static PdfContentByte[] beginWritingRows(PdfContentByte canvas) { | |
795 |
1
1. beginWritingRows : mutated return of Object value for com/lowagie/text/pdf/PdfPTable::beginWritingRows to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new PdfContentByte[]{ |
796 | canvas, | |
797 | canvas.getDuplicate(), | |
798 | canvas.getDuplicate(), | |
799 | canvas.getDuplicate(), | |
800 | }; | |
801 | } | |
802 | | |
803 | /** | |
804 | * Finishes writing the table. | |
805 | * | |
806 | * @param canvases the array returned by <CODE>beginWritingRows()</CODE> | |
807 | */ | |
808 | public static void endWritingRows(PdfContentByte[] canvases) { | |
809 | PdfContentByte canvas = canvases[BASECANVAS]; | |
810 |
1
1. endWritingRows : removed call to com/lowagie/text/pdf/PdfContentByte::saveState → NO_COVERAGE |
canvas.saveState(); |
811 |
1
1. endWritingRows : removed call to com/lowagie/text/pdf/PdfContentByte::add → NO_COVERAGE |
canvas.add(canvases[BACKGROUNDCANVAS]); |
812 |
1
1. endWritingRows : removed call to com/lowagie/text/pdf/PdfContentByte::restoreState → NO_COVERAGE |
canvas.restoreState(); |
813 |
1
1. endWritingRows : removed call to com/lowagie/text/pdf/PdfContentByte::saveState → NO_COVERAGE |
canvas.saveState(); |
814 |
1
1. endWritingRows : removed call to com/lowagie/text/pdf/PdfContentByte::setLineCap → NO_COVERAGE |
canvas.setLineCap(2); |
815 |
1
1. endWritingRows : removed call to com/lowagie/text/pdf/PdfContentByte::resetRGBColorStroke → NO_COVERAGE |
canvas.resetRGBColorStroke(); |
816 |
1
1. endWritingRows : removed call to com/lowagie/text/pdf/PdfContentByte::add → NO_COVERAGE |
canvas.add(canvases[LINECANVAS]); |
817 |
1
1. endWritingRows : removed call to com/lowagie/text/pdf/PdfContentByte::restoreState → NO_COVERAGE |
canvas.restoreState(); |
818 |
1
1. endWritingRows : removed call to com/lowagie/text/pdf/PdfContentByte::add → NO_COVERAGE |
canvas.add(canvases[TEXTCANVAS]); |
819 | } | |
820 | | |
821 | /** | |
822 | * Gets the number of rows in this table. | |
823 | * | |
824 | * @return the number of rows in this table | |
825 | */ | |
826 | public int size() { | |
827 | return rows.size(); | |
828 | } | |
829 | | |
830 | /** | |
831 | * Gets the total height of the table. | |
832 | * | |
833 | * @return the total height of the table | |
834 | */ | |
835 | public float getTotalHeight() { | |
836 | return totalHeight; | |
837 | } | |
838 | ||
839 | /** | |
840 | * Gets the height of a particular row. | |
841 | * | |
842 | * @param idx the row index (starts at 0) | |
843 | * @return the height of a particular row | |
844 | */ | |
845 | public float getRowHeight(int idx) { | |
846 |
1
1. getRowHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::getRowHeight → NO_COVERAGE |
return getRowHeight(idx, false); |
847 | } | |
848 | /** | |
849 | * Gets the height of a particular row. | |
850 | * | |
851 | * @param idx the row index (starts at 0) | |
852 | * @param firsttime is this the first time the row heigh is calculated? | |
853 | * @return the height of a particular row | |
854 | * @since 5.0.0 | |
855 | */ | |
856 | public float getRowHeight(int idx, boolean firsttime) { | |
857 |
6
1. getRowHeight : changed conditional boundary → NO_COVERAGE 2. getRowHeight : changed conditional boundary → NO_COVERAGE 3. getRowHeight : changed conditional boundary → NO_COVERAGE 4. getRowHeight : negated conditional → NO_COVERAGE 5. getRowHeight : negated conditional → NO_COVERAGE 6. getRowHeight : negated conditional → NO_COVERAGE |
if (totalWidth <= 0 || idx < 0 || idx >= rows.size()) |
858 |
1
1. getRowHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::getRowHeight → NO_COVERAGE |
return 0; |
859 | PdfPRow row = (PdfPRow)rows.get(idx); | |
860 |
1
1. getRowHeight : negated conditional → NO_COVERAGE |
if (row == null) |
861 |
1
1. getRowHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::getRowHeight → NO_COVERAGE |
return 0; |
862 |
1
1. getRowHeight : negated conditional → NO_COVERAGE |
if (firsttime) |
863 | row.setWidths(absoluteWidths); | |
864 | float height = row.getMaxHeights(); | |
865 | PdfPCell cell; | |
866 | PdfPRow tmprow; | |
867 |
3
1. getRowHeight : changed conditional boundary → NO_COVERAGE 2. getRowHeight : Changed increment from 1 to -1 → NO_COVERAGE 3. getRowHeight : negated conditional → NO_COVERAGE |
for (int i = 0; i < relativeWidths.length; i++) { |
868 |
1
1. getRowHeight : negated conditional → NO_COVERAGE |
if(!rowSpanAbove(idx, i)) |
869 | continue; | |
870 | int rs = 1; | |
871 |
2
1. getRowHeight : Replaced integer subtraction with addition → NO_COVERAGE 2. getRowHeight : negated conditional → NO_COVERAGE |
while (rowSpanAbove(idx - rs, i)) { |
872 |
1
1. getRowHeight : Changed increment from 1 to -1 → NO_COVERAGE |
rs++; |
873 | } | |
874 |
1
1. getRowHeight : Replaced integer subtraction with addition → NO_COVERAGE |
tmprow = (PdfPRow)rows.get(idx - rs); |
875 | cell = tmprow.getCells()[i]; | |
876 | float tmp = 0; | |
877 |
3
1. getRowHeight : Replaced integer addition with subtraction → NO_COVERAGE 2. getRowHeight : negated conditional → NO_COVERAGE 3. getRowHeight : negated conditional → NO_COVERAGE |
if (cell != null && cell.getRowspan() == rs + 1) { |
878 | tmp = cell.getMaxHeight(); | |
879 |
2
1. getRowHeight : changed conditional boundary → NO_COVERAGE 2. getRowHeight : negated conditional → NO_COVERAGE |
while (rs > 0) { |
880 |
2
1. getRowHeight : Replaced integer subtraction with addition → NO_COVERAGE 2. getRowHeight : Replaced float subtraction with addition → NO_COVERAGE |
tmp -= getRowHeight(idx - rs); |
881 |
1
1. getRowHeight : Changed increment from -1 to 1 → NO_COVERAGE |
rs--; |
882 | } | |
883 | } | |
884 |
2
1. getRowHeight : changed conditional boundary → NO_COVERAGE 2. getRowHeight : negated conditional → NO_COVERAGE |
if (tmp > height) |
885 | height = tmp; | |
886 | } | |
887 |
1
1. getRowHeight : removed call to com/lowagie/text/pdf/PdfPRow::setMaxHeights → NO_COVERAGE |
row.setMaxHeights(height); |
888 |
1
1. getRowHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::getRowHeight → NO_COVERAGE |
return height; |
889 | } | |
890 | | |
891 | /** | |
892 | * Gets the maximum height of a cell in a particular row (will only be different | |
893 | * from getRowHeight is one of the cells in the row has a rowspan > 1). | |
894 | * | |
895 | * @param rowIndex the row index | |
896 | * @param cellIndex the cell index | |
897 | * @return the height of a particular row including rowspan | |
898 | * @since 2.1.6 | |
899 | */ | |
900 | public float getRowspanHeight(int rowIndex, int cellIndex) { | |
901 |
6
1. getRowspanHeight : changed conditional boundary → NO_COVERAGE 2. getRowspanHeight : changed conditional boundary → NO_COVERAGE 3. getRowspanHeight : changed conditional boundary → NO_COVERAGE 4. getRowspanHeight : negated conditional → NO_COVERAGE 5. getRowspanHeight : negated conditional → NO_COVERAGE 6. getRowspanHeight : negated conditional → NO_COVERAGE |
if (totalWidth <= 0 || rowIndex < 0 || rowIndex >= rows.size()) |
902 |
1
1. getRowspanHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::getRowspanHeight → NO_COVERAGE |
return 0; |
903 | PdfPRow row = (PdfPRow)rows.get(rowIndex); | |
904 |
3
1. getRowspanHeight : changed conditional boundary → NO_COVERAGE 2. getRowspanHeight : negated conditional → NO_COVERAGE 3. getRowspanHeight : negated conditional → NO_COVERAGE |
if (row == null || cellIndex >= row.getCells().length) |
905 |
1
1. getRowspanHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::getRowspanHeight → NO_COVERAGE |
return 0; |
906 | PdfPCell cell = row.getCells()[cellIndex]; | |
907 |
1
1. getRowspanHeight : negated conditional → NO_COVERAGE |
if (cell == null) |
908 |
1
1. getRowspanHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::getRowspanHeight → NO_COVERAGE |
return 0; |
909 | float rowspanHeight = 0; | |
910 |
2
1. getRowspanHeight : changed conditional boundary → NO_COVERAGE 2. getRowspanHeight : negated conditional → NO_COVERAGE |
for (int j = 0; j < cell.getRowspan(); j++) { |
911 |
2
1. getRowspanHeight : Replaced integer addition with subtraction → NO_COVERAGE 2. getRowspanHeight : Replaced float addition with subtraction → NO_COVERAGE |
rowspanHeight += getRowHeight(rowIndex + j); |
912 | } | |
913 |
1
1. getRowspanHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::getRowspanHeight → NO_COVERAGE |
return rowspanHeight; |
914 | } | |
915 | | |
916 | /** | |
917 | * Gets the height of the rows that constitute the header as defined by | |
918 | * <CODE>setHeaderRows()</CODE>. | |
919 | * | |
920 | * @return the height of the rows that constitute the header and footer | |
921 | */ | |
922 | public float getHeaderHeight() { | |
923 | float total = 0; | |
924 | int size = Math.min(rows.size(), headerRows); | |
925 |
3
1. getHeaderHeight : changed conditional boundary → NO_COVERAGE 2. getHeaderHeight : Changed increment from 1 to -1 → NO_COVERAGE 3. getHeaderHeight : negated conditional → NO_COVERAGE |
for (int k = 0; k < size; ++k) { |
926 | PdfPRow row = (PdfPRow)rows.get(k); | |
927 |
1
1. getHeaderHeight : negated conditional → NO_COVERAGE |
if (row != null) |
928 |
1
1. getHeaderHeight : Replaced float addition with subtraction → NO_COVERAGE |
total += row.getMaxHeights(); |
929 | } | |
930 |
1
1. getHeaderHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::getHeaderHeight → NO_COVERAGE |
return total; |
931 | } | |
932 | | |
933 | /** | |
934 | * Gets the height of the rows that constitute the footer as defined by | |
935 | * <CODE>setFooterRows()</CODE>. | |
936 | * | |
937 | * @return the height of the rows that constitute the footer | |
938 | * @since 2.1.1 | |
939 | */ | |
940 | public float getFooterHeight() { | |
941 | float total = 0; | |
942 |
1
1. getFooterHeight : Replaced integer subtraction with addition → NO_COVERAGE |
int start = Math.max(0, headerRows - footerRows); |
943 | int size = Math.min(rows.size(), headerRows); | |
944 |
3
1. getFooterHeight : changed conditional boundary → NO_COVERAGE 2. getFooterHeight : Changed increment from 1 to -1 → NO_COVERAGE 3. getFooterHeight : negated conditional → NO_COVERAGE |
for (int k = start; k < size; ++k) { |
945 | PdfPRow row = (PdfPRow)rows.get(k); | |
946 |
1
1. getFooterHeight : negated conditional → NO_COVERAGE |
if (row != null) |
947 |
1
1. getFooterHeight : Replaced float addition with subtraction → NO_COVERAGE |
total += row.getMaxHeights(); |
948 | } | |
949 |
1
1. getFooterHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPTable::getFooterHeight → NO_COVERAGE |
return total; |
950 | } | |
951 | | |
952 | /** | |
953 | * Deletes a row from the table. | |
954 | * | |
955 | * @param rowNumber the row to be deleted | |
956 | * @return <CODE>true</CODE> if the row was deleted | |
957 | */ | |
958 | public boolean deleteRow(int rowNumber) { | |
959 |
4
1. deleteRow : changed conditional boundary → NO_COVERAGE 2. deleteRow : changed conditional boundary → NO_COVERAGE 3. deleteRow : negated conditional → NO_COVERAGE 4. deleteRow : negated conditional → NO_COVERAGE |
if (rowNumber < 0 || rowNumber >= rows.size()) |
960 |
1
1. deleteRow : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
961 |
2
1. deleteRow : changed conditional boundary → NO_COVERAGE 2. deleteRow : negated conditional → NO_COVERAGE |
if (totalWidth > 0) { |
962 | PdfPRow row = (PdfPRow)rows.get(rowNumber); | |
963 |
1
1. deleteRow : negated conditional → NO_COVERAGE |
if (row != null) |
964 |
1
1. deleteRow : Replaced float subtraction with addition → NO_COVERAGE |
totalHeight -= row.getMaxHeights(); |
965 | } | |
966 | rows.remove(rowNumber); | |
967 |
2
1. deleteRow : changed conditional boundary → NO_COVERAGE 2. deleteRow : negated conditional → NO_COVERAGE |
if (rowNumber < headerRows) { |
968 |
1
1. deleteRow : Replaced integer subtraction with addition → NO_COVERAGE |
--headerRows; |
969 |
3
1. deleteRow : changed conditional boundary → NO_COVERAGE 2. deleteRow : Replaced integer subtraction with addition → NO_COVERAGE 3. deleteRow : negated conditional → NO_COVERAGE |
if (rowNumber >= (headerRows - footerRows)) |
970 |
1
1. deleteRow : Replaced integer subtraction with addition → NO_COVERAGE |
--footerRows; |
971 | } | |
972 |
1
1. deleteRow : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
973 | } | |
974 | | |
975 | /** | |
976 | * Deletes the last row in the table. | |
977 | * | |
978 | * @return <CODE>true</CODE> if the last row was deleted | |
979 | */ | |
980 | public boolean deleteLastRow() { | |
981 |
2
1. deleteLastRow : Replaced integer subtraction with addition → NO_COVERAGE 2. deleteLastRow : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return deleteRow(rows.size() - 1); |
982 | } | |
983 | | |
984 | /** | |
985 | * Removes all of the rows except headers | |
986 | */ | |
987 | public void deleteBodyRows() { | |
988 | ArrayList rows2 = new ArrayList(); | |
989 |
3
1. deleteBodyRows : changed conditional boundary → NO_COVERAGE 2. deleteBodyRows : Changed increment from 1 to -1 → NO_COVERAGE 3. deleteBodyRows : negated conditional → NO_COVERAGE |
for (int k = 0; k < headerRows; ++k) |
990 | rows2.add(rows.get(k)); | |
991 | rows = rows2; | |
992 | totalHeight = 0; | |
993 |
2
1. deleteBodyRows : changed conditional boundary → NO_COVERAGE 2. deleteBodyRows : negated conditional → NO_COVERAGE |
if (totalWidth > 0) |
994 | totalHeight = getHeaderHeight(); | |
995 | } | |
996 | | |
997 | /** | |
998 | * Returns the number of columns. | |
999 | * | |
1000 | * @return the number of columns. | |
1001 | * @since 2.1.1 | |
1002 | */ | |
1003 | public int getNumberOfColumns() { | |
1004 |
1
1. getNumberOfColumns : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return relativeWidths.length; |
1005 | } | |
1006 | ||
1007 | /** | |
1008 | * Gets the number of the rows that constitute the header. | |
1009 | * | |
1010 | * @return the number of the rows that constitute the header | |
1011 | */ | |
1012 | public int getHeaderRows() { | |
1013 | return headerRows; | |
1014 | } | |
1015 | | |
1016 | /** | |
1017 | * Sets the number of the top rows that constitute the header. | |
1018 | * This header has only meaning if the table is added to <CODE>Document</CODE> | |
1019 | * and the table crosses pages. | |
1020 | * | |
1021 | * @param headerRows the number of the top rows that constitute the header | |
1022 | */ | |
1023 | public void setHeaderRows(int headerRows) { | |
1024 |
2
1. setHeaderRows : changed conditional boundary → NO_COVERAGE 2. setHeaderRows : negated conditional → NO_COVERAGE |
if (headerRows < 0) |
1025 | headerRows = 0; | |
1026 | this.headerRows = headerRows; | |
1027 | } | |
1028 | | |
1029 | /** | |
1030 | * Gets all the chunks in this element. | |
1031 | * | |
1032 | * @return an <CODE>ArrayList</CODE> | |
1033 | */ | |
1034 | public ArrayList getChunks() { | |
1035 |
1
1. getChunks : mutated return of Object value for com/lowagie/text/pdf/PdfPTable::getChunks to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new ArrayList(); |
1036 | } | |
1037 | | |
1038 | /** | |
1039 | * Gets the type of the text element. | |
1040 | * | |
1041 | * @return a type | |
1042 | */ | |
1043 | public int type() { | |
1044 | return Element.PTABLE; | |
1045 | } | |
1046 | | |
1047 | /** | |
1048 | * @see com.lowagie.text.Element#isContent() | |
1049 | * @since iText 2.0.8 | |
1050 | */ | |
1051 | public boolean isContent() { | |
1052 | return true; | |
1053 | } | |
1054 | ||
1055 | /** | |
1056 | * @see com.lowagie.text.Element#isNestable() | |
1057 | * @since iText 2.0.8 | |
1058 | */ | |
1059 | public boolean isNestable() { | |
1060 | return true; | |
1061 | } | |
1062 | | |
1063 | /** | |
1064 | * Processes the element by adding it (or the different parts) to an | |
1065 | * <CODE>ElementListener</CODE>. | |
1066 | * | |
1067 | * @param listener an <CODE>ElementListener</CODE> | |
1068 | * @return <CODE>true</CODE> if the element was processed successfully | |
1069 | */ | |
1070 | public boolean process(ElementListener listener) { | |
1071 | try { | |
1072 |
1
1. process : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return listener.add(this); |
1073 | } | |
1074 | catch(DocumentException de) { | |
1075 |
1
1. process : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
1076 | } | |
1077 | } | |
1078 | | |
1079 | /** | |
1080 | * Gets the width percentage that the table will occupy in the page. | |
1081 | * | |
1082 | * @return the width percentage that the table will occupy in the page | |
1083 | */ | |
1084 | public float getWidthPercentage() { | |
1085 | return widthPercentage; | |
1086 | } | |
1087 | | |
1088 | /** | |
1089 | * Sets the width percentage that the table will occupy in the page. | |
1090 | * | |
1091 | * @param widthPercentage the width percentage that the table will occupy in the page | |
1092 | */ | |
1093 | public void setWidthPercentage(float widthPercentage) { | |
1094 | this.widthPercentage = widthPercentage; | |
1095 | } | |
1096 | | |
1097 | /** | |
1098 | * Gets the horizontal alignment of the table relative to the page. | |
1099 | * | |
1100 | * @return the horizontal alignment of the table relative to the page | |
1101 | */ | |
1102 | public int getHorizontalAlignment() { | |
1103 | return horizontalAlignment; | |
1104 | } | |
1105 | | |
1106 | /** | |
1107 | * Sets the horizontal alignment of the table relative to the page. | |
1108 | * It only has meaning if the width percentage is less than 100%. | |
1109 | * | |
1110 | * @param horizontalAlignment the horizontal alignment of the table | |
1111 | * relative to the page | |
1112 | */ | |
1113 | public void setHorizontalAlignment(int horizontalAlignment) { | |
1114 | this.horizontalAlignment = horizontalAlignment; | |
1115 | } | |
1116 | | |
1117 | /** | |
1118 | * Gets a row with a given index | |
1119 | * (added by Jin-Hsia Yang). | |
1120 | * | |
1121 | * @param idx | |
1122 | * @return the row at position idx | |
1123 | */ | |
1124 | public PdfPRow getRow(int idx) { | |
1125 |
1
1. getRow : mutated return of Object value for com/lowagie/text/pdf/PdfPTable::getRow to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return (PdfPRow)rows.get(idx); |
1126 | } | |
1127 | ||
1128 | /** | |
1129 | * Gets an arraylist with all the rows in the table. | |
1130 | * | |
1131 | * @return an arraylist | |
1132 | */ | |
1133 | public ArrayList getRows() { | |
1134 | return rows; | |
1135 | } | |
1136 | | |
1137 | /** | |
1138 | * Gets an arraylist with a selection of rows. | |
1139 | * @param start the first row in the selection | |
1140 | * @param end the first row that isn't part of the selection | |
1141 | * @return a selection of rows | |
1142 | * @since 2.1.6 | |
1143 | */ | |
1144 | public ArrayList getRows(int start, int end) { | |
1145 | ArrayList list = new ArrayList(); | |
1146 |
4
1. getRows : changed conditional boundary → NO_COVERAGE 2. getRows : changed conditional boundary → NO_COVERAGE 3. getRows : negated conditional → NO_COVERAGE 4. getRows : negated conditional → NO_COVERAGE |
if (start < 0 || end > size()) { |
1147 |
1
1. getRows : mutated return of Object value for com/lowagie/text/pdf/PdfPTable::getRows to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return list; |
1148 | } | |
1149 | PdfPRow firstRow = adjustCellsInRow(start, end); | |
1150 | int colIndex = 0; | |
1151 | PdfPCell cell; | |
1152 |
2
1. getRows : changed conditional boundary → NO_COVERAGE 2. getRows : negated conditional → NO_COVERAGE |
while (colIndex < getNumberOfColumns()) { |
1153 | int rowIndex = start; | |
1154 |
2
1. getRows : Changed increment from -1 to 1 → NO_COVERAGE 2. getRows : negated conditional → NO_COVERAGE |
while (rowSpanAbove(rowIndex--, colIndex)) { |
1155 | PdfPRow row = getRow(rowIndex); | |
1156 |
1
1. getRows : negated conditional → NO_COVERAGE |
if (row != null) { |
1157 | PdfPCell replaceCell = row.getCells()[colIndex]; | |
1158 |
1
1. getRows : negated conditional → NO_COVERAGE |
if (replaceCell != null) { |
1159 | firstRow.getCells()[colIndex] = new PdfPCell(replaceCell); | |
1160 | float extra = 0; | |
1161 |
1
1. getRows : Replaced integer addition with subtraction → NO_COVERAGE |
int stop = Math.min(rowIndex + replaceCell.getRowspan(), end); |
1162 |
4
1. getRows : changed conditional boundary → NO_COVERAGE 2. getRows : Changed increment from 1 to -1 → NO_COVERAGE 3. getRows : Replaced integer addition with subtraction → NO_COVERAGE 4. getRows : negated conditional → NO_COVERAGE |
for (int j = start + 1; j < stop; j++) { |
1163 |
1
1. getRows : Replaced float addition with subtraction → NO_COVERAGE |
extra += getRowHeight(j); |
1164 | } | |
1165 |
1
1. getRows : removed call to com/lowagie/text/pdf/PdfPRow::setExtraHeight → NO_COVERAGE |
firstRow.setExtraHeight(colIndex, extra); |
1166 | float diff = getRowspanHeight(rowIndex, colIndex) | |
1167 |
2
1. getRows : Replaced float subtraction with addition → NO_COVERAGE 2. getRows : Replaced float subtraction with addition → NO_COVERAGE |
- getRowHeight(start) - extra; |
1168 |
1
1. getRows : removed call to com/lowagie/text/pdf/PdfPCell::consumeHeight → NO_COVERAGE |
firstRow.getCells()[colIndex].consumeHeight(diff); |
1169 | } | |
1170 | } | |
1171 | } | |
1172 | cell = firstRow.getCells()[colIndex]; | |
1173 |
1
1. getRows : negated conditional → NO_COVERAGE |
if (cell == null) |
1174 |
1
1. getRows : Changed increment from 1 to -1 → NO_COVERAGE |
colIndex++; |
1175 | else | |
1176 |
1
1. getRows : Replaced integer addition with subtraction → NO_COVERAGE |
colIndex += cell.getColspan(); |
1177 | } | |
1178 | list.add(firstRow); | |
1179 |
4
1. getRows : changed conditional boundary → NO_COVERAGE 2. getRows : Changed increment from 1 to -1 → NO_COVERAGE 3. getRows : Replaced integer addition with subtraction → NO_COVERAGE 4. getRows : negated conditional → NO_COVERAGE |
for (int i = start + 1; i < end; i++) { |
1180 | list.add(adjustCellsInRow(i, end)); | |
1181 | } | |
1182 |
1
1. getRows : mutated return of Object value for com/lowagie/text/pdf/PdfPTable::getRows to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return list; |
1183 | } | |
1184 | | |
1185 | /** | |
1186 | * Calculates the extra height needed in a row because of rowspans. | |
1187 | * @param start the index of the start row (the one to adjust) | |
1188 | * @param end the index of the end row on the page | |
1189 | * @since 2.1.6 | |
1190 | */ | |
1191 | protected PdfPRow adjustCellsInRow(int start, int end) { | |
1192 | PdfPRow row = new PdfPRow(getRow(start)); | |
1193 |
1
1. adjustCellsInRow : removed call to com/lowagie/text/pdf/PdfPRow::initExtraHeights → NO_COVERAGE |
row.initExtraHeights(); |
1194 | PdfPCell cell; | |
1195 | PdfPCell[] cells = row.getCells(); | |
1196 |
3
1. adjustCellsInRow : changed conditional boundary → NO_COVERAGE 2. adjustCellsInRow : Changed increment from 1 to -1 → NO_COVERAGE 3. adjustCellsInRow : negated conditional → NO_COVERAGE |
for (int i = 0; i < cells.length; i++) { |
1197 | cell = cells[i]; | |
1198 |
2
1. adjustCellsInRow : negated conditional → NO_COVERAGE 2. adjustCellsInRow : negated conditional → NO_COVERAGE |
if (cell == null || cell.getRowspan() == 1) |
1199 | continue; | |
1200 |
1
1. adjustCellsInRow : Replaced integer addition with subtraction → NO_COVERAGE |
int stop = Math.min(end, start + cell.getRowspan()); |
1201 | float extra = 0; | |
1202 |
4
1. adjustCellsInRow : changed conditional boundary → NO_COVERAGE 2. adjustCellsInRow : Changed increment from 1 to -1 → NO_COVERAGE 3. adjustCellsInRow : Replaced integer addition with subtraction → NO_COVERAGE 4. adjustCellsInRow : negated conditional → NO_COVERAGE |
for (int k = start + 1; k < stop; k++) { |
1203 |
1
1. adjustCellsInRow : Replaced float addition with subtraction → NO_COVERAGE |
extra += getRowHeight(k); |
1204 | } | |
1205 |
1
1. adjustCellsInRow : removed call to com/lowagie/text/pdf/PdfPRow::setExtraHeight → NO_COVERAGE |
row.setExtraHeight(i, extra); |
1206 | } | |
1207 |
1
1. adjustCellsInRow : mutated return of Object value for com/lowagie/text/pdf/PdfPTable::adjustCellsInRow to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return row; |
1208 | } | |
1209 | ||
1210 | /** Sets the table event for this table. | |
1211 | * @param event the table event for this table | |
1212 | */ | |
1213 | public void setTableEvent(PdfPTableEvent event) { | |
1214 |
1
1. setTableEvent : negated conditional → NO_COVERAGE |
if (event == null) |
1215 | this.tableEvent = null; | |
1216 |
1
1. setTableEvent : negated conditional → NO_COVERAGE |
else if (this.tableEvent == null) |
1217 | this.tableEvent = event; | |
1218 |
1
1. setTableEvent : negated conditional → NO_COVERAGE |
else if (this.tableEvent instanceof PdfPTableEventForwarder) |
1219 |
1
1. setTableEvent : removed call to com/lowagie/text/pdf/events/PdfPTableEventForwarder::addTableEvent → NO_COVERAGE |
((PdfPTableEventForwarder)this.tableEvent).addTableEvent(event); |
1220 | else { | |
1221 | PdfPTableEventForwarder forward = new PdfPTableEventForwarder(); | |
1222 |
1
1. setTableEvent : removed call to com/lowagie/text/pdf/events/PdfPTableEventForwarder::addTableEvent → NO_COVERAGE |
forward.addTableEvent(this.tableEvent); |
1223 |
1
1. setTableEvent : removed call to com/lowagie/text/pdf/events/PdfPTableEventForwarder::addTableEvent → NO_COVERAGE |
forward.addTableEvent(event); |
1224 | this.tableEvent = forward; | |
1225 | } | |
1226 | } | |
1227 | | |
1228 | /** | |
1229 | * Gets the table event for this page. | |
1230 | * | |
1231 | * @return the table event for this page | |
1232 | */ | |
1233 | public PdfPTableEvent getTableEvent() { | |
1234 | return tableEvent; | |
1235 | } | |
1236 | | |
1237 | /** | |
1238 | * Gets the absolute sizes of each column width. | |
1239 | * | |
1240 | * @return he absolute sizes of each column width | |
1241 | */ | |
1242 | public float[] getAbsoluteWidths() { | |
1243 | return absoluteWidths; | |
1244 | } | |
1245 | | |
1246 | float [][] getEventWidths(float xPos, int firstRow, int lastRow, boolean includeHeaders) { | |
1247 |
1
1. getEventWidths : negated conditional → NO_COVERAGE |
if (includeHeaders) { |
1248 | firstRow = Math.max(firstRow, headerRows); | |
1249 | lastRow = Math.max(lastRow, headerRows); | |
1250 | } | |
1251 |
3
1. getEventWidths : Replaced integer addition with subtraction → NO_COVERAGE 2. getEventWidths : Replaced integer subtraction with addition → NO_COVERAGE 3. getEventWidths : negated conditional → NO_COVERAGE |
float[][] widths = new float[(includeHeaders ? headerRows : 0) + lastRow - firstRow][]; |
1252 |
1
1. getEventWidths : negated conditional → NO_COVERAGE |
if (isColspan) { |
1253 | int n = 0; | |
1254 |
1
1. getEventWidths : negated conditional → NO_COVERAGE |
if (includeHeaders) { |
1255 |
3
1. getEventWidths : changed conditional boundary → NO_COVERAGE 2. getEventWidths : Changed increment from 1 to -1 → NO_COVERAGE 3. getEventWidths : negated conditional → NO_COVERAGE |
for (int k = 0; k < headerRows; ++k) { |
1256 | PdfPRow row = (PdfPRow)rows.get(k); | |
1257 |
1
1. getEventWidths : negated conditional → NO_COVERAGE |
if (row == null) |
1258 |
1
1. getEventWidths : Changed increment from 1 to -1 → NO_COVERAGE |
++n; |
1259 | else | |
1260 |
1
1. getEventWidths : Changed increment from 1 to -1 → NO_COVERAGE |
widths[n++] = row.getEventWidth(xPos); |
1261 | } | |
1262 | } | |
1263 |
3
1. getEventWidths : changed conditional boundary → NO_COVERAGE 2. getEventWidths : Changed increment from 1 to -1 → NO_COVERAGE 3. getEventWidths : negated conditional → NO_COVERAGE |
for (; firstRow < lastRow; ++firstRow) { |
1264 | PdfPRow row = (PdfPRow)rows.get(firstRow); | |
1265 |
1
1. getEventWidths : negated conditional → NO_COVERAGE |
if (row == null) |
1266 |
1
1. getEventWidths : Changed increment from 1 to -1 → NO_COVERAGE |
++n; |
1267 | else | |
1268 |
1
1. getEventWidths : Changed increment from 1 to -1 → NO_COVERAGE |
widths[n++] = row.getEventWidth(xPos); |
1269 | } | |
1270 | } | |
1271 | else { | |
1272 | int numCols = getNumberOfColumns(); | |
1273 |
1
1. getEventWidths : Replaced integer addition with subtraction → NO_COVERAGE |
float[] width = new float[numCols + 1]; |
1274 | width[0] = xPos; | |
1275 |
3
1. getEventWidths : changed conditional boundary → NO_COVERAGE 2. getEventWidths : Changed increment from 1 to -1 → NO_COVERAGE 3. getEventWidths : negated conditional → NO_COVERAGE |
for (int k = 0; k < numCols; ++k) |
1276 |
2
1. getEventWidths : Replaced integer addition with subtraction → NO_COVERAGE 2. getEventWidths : Replaced float addition with subtraction → NO_COVERAGE |
width[k + 1] = width[k] + absoluteWidths[k]; |
1277 |
2
1. getEventWidths : changed conditional boundary → NO_COVERAGE 2. getEventWidths : negated conditional → NO_COVERAGE |
for (int k = 0; k < widths.length; ++k) |
1278 | widths[k] = width; | |
1279 | } | |
1280 |
1
1. getEventWidths : mutated return of Object value for com/lowagie/text/pdf/PdfPTable::getEventWidths to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return widths; |
1281 | } | |
1282 | ||
1283 | ||
1284 | /** | |
1285 | * Tells you if the first header needs to be skipped | |
1286 | * (for instance if the header says "continued from the previous page"). | |
1287 | * | |
1288 | * @return Value of property skipFirstHeader. | |
1289 | */ | |
1290 | public boolean isSkipFirstHeader() { | |
1291 | return skipFirstHeader; | |
1292 | } | |
1293 | ||
1294 | ||
1295 | /** | |
1296 | * Tells you if the last footer needs to be skipped | |
1297 | * (for instance if the footer says "continued on the next page") | |
1298 | * | |
1299 | * @return Value of property skipLastFooter. | |
1300 | * @since 2.1.6 | |
1301 | */ | |
1302 | public boolean isSkipLastFooter() { | |
1303 | return skipLastFooter; | |
1304 | } | |
1305 | | |
1306 | /** | |
1307 | * Skips the printing of the first header. Used when printing | |
1308 | * tables in succession belonging to the same printed table aspect. | |
1309 | * | |
1310 | * @param skipFirstHeader New value of property skipFirstHeader. | |
1311 | */ | |
1312 | public void setSkipFirstHeader(boolean skipFirstHeader) { | |
1313 | this.skipFirstHeader = skipFirstHeader; | |
1314 | } | |
1315 | | |
1316 | /** | |
1317 | * Skips the printing of the last footer. Used when printing | |
1318 | * tables in succession belonging to the same printed table aspect. | |
1319 | * | |
1320 | * @param skipLastFooter New value of property skipLastFooter. | |
1321 | * @since 2.1.6 | |
1322 | */ | |
1323 | public void setSkipLastFooter(boolean skipLastFooter) { | |
1324 | this.skipLastFooter = skipLastFooter; | |
1325 | } | |
1326 | ||
1327 | /** | |
1328 | * Sets the run direction of the contents of the table. | |
1329 | * | |
1330 | * @param runDirection One of the following values: | |
1331 | * PdfWriter.RUN_DIRECTION_DEFAULT, PdfWriter.RUN_DIRECTION_NO_BIDI, | |
1332 | * PdfWriter.RUN_DIRECTION_LTR or PdfWriter.RUN_DIRECTION_RTL. | |
1333 | */ | |
1334 | public void setRunDirection(int runDirection) { | |
1335 | switch (runDirection) { | |
1336 | case PdfWriter.RUN_DIRECTION_DEFAULT: | |
1337 | case PdfWriter.RUN_DIRECTION_NO_BIDI: | |
1338 | case PdfWriter.RUN_DIRECTION_LTR: | |
1339 | case PdfWriter.RUN_DIRECTION_RTL: | |
1340 | this.runDirection = runDirection; | |
1341 | break; | |
1342 | default: | |
1343 | throw new RuntimeException(MessageLocalization.getComposedMessage("invalid.run.direction.1", runDirection)); | |
1344 | } | |
1345 | } | |
1346 | | |
1347 | /** | |
1348 | * Returns the run direction of the contents in the table. | |
1349 | * | |
1350 | * @return One of the following values: | |
1351 | * PdfWriter.RUN_DIRECTION_DEFAULT, PdfWriter.RUN_DIRECTION_NO_BIDI, | |
1352 | * PdfWriter.RUN_DIRECTION_LTR or PdfWriter.RUN_DIRECTION_RTL. | |
1353 | */ | |
1354 | public int getRunDirection() { | |
1355 | return runDirection; | |
1356 | } | |
1357 | | |
1358 | /** | |
1359 | * Getter for property lockedWidth. | |
1360 | * | |
1361 | * @return Value of property lockedWidth. | |
1362 | */ | |
1363 | public boolean isLockedWidth() { | |
1364 | return this.lockedWidth; | |
1365 | } | |
1366 | | |
1367 | /** | |
1368 | * Uses the value in <CODE>setTotalWidth()</CODE> in <CODE>Document.add()</CODE>. | |
1369 | * | |
1370 | * @param lockedWidth <CODE>true</CODE> to use the value in <CODE>setTotalWidth()</CODE> in <CODE>Document.add()</CODE> | |
1371 | */ | |
1372 | public void setLockedWidth(boolean lockedWidth) { | |
1373 | this.lockedWidth = lockedWidth; | |
1374 | } | |
1375 | | |
1376 | /** | |
1377 | * Gets the split value. | |
1378 | * | |
1379 | * @return true to split; false otherwise | |
1380 | */ | |
1381 | public boolean isSplitRows() { | |
1382 | return this.splitRows; | |
1383 | } | |
1384 | | |
1385 | /** | |
1386 | * When set the rows that won't fit in the page will be split. | |
1387 | * Note that it takes at least twice the memory to handle a split table row | |
1388 | * than a normal table. <CODE>true</CODE> by default. | |
1389 | * | |
1390 | * @param splitRows true to split; false otherwise | |
1391 | */ | |
1392 | public void setSplitRows(boolean splitRows) { | |
1393 | this.splitRows = splitRows; | |
1394 | } | |
1395 | | |
1396 | /** | |
1397 | * Sets the spacing before this table. | |
1398 | * | |
1399 | * @param spacing the new spacing | |
1400 | */ | |
1401 | public void setSpacingBefore(float spacing) { | |
1402 | this.spacingBefore = spacing; | |
1403 | } | |
1404 | | |
1405 | /** | |
1406 | * Sets the spacing after this table. | |
1407 | * | |
1408 | * @param spacing the new spacing | |
1409 | */ | |
1410 | public void setSpacingAfter(float spacing) { | |
1411 | this.spacingAfter = spacing; | |
1412 | } | |
1413 | ||
1414 | /** | |
1415 | * Gets the spacing before this table. | |
1416 | * | |
1417 | * @return the spacing | |
1418 | */ | |
1419 | public float spacingBefore() { | |
1420 | return spacingBefore; | |
1421 | } | |
1422 | | |
1423 | /** | |
1424 | * Gets the spacing after this table. | |
1425 | * | |
1426 | * @return the spacing | |
1427 | */ | |
1428 | public float spacingAfter() { | |
1429 | return spacingAfter; | |
1430 | } | |
1431 | | |
1432 | /** | |
1433 | * Gets the value of the last row extension. | |
1434 | * | |
1435 | * @return true if the last row will extend; false otherwise | |
1436 | */ | |
1437 | public boolean isExtendLastRow() { | |
1438 |
1
1. isExtendLastRow : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return extendLastRow[0]; |
1439 | } | |
1440 | | |
1441 | /** | |
1442 | * When set the last row on every page will be extended to fill | |
1443 | * all the remaining space to the bottom boundary. | |
1444 | * | |
1445 | * @param extendLastRows true to extend the last row; false otherwise | |
1446 | */ | |
1447 | public void setExtendLastRow(boolean extendLastRows) { | |
1448 | extendLastRow[0] = extendLastRows; | |
1449 | extendLastRow[1] = extendLastRows; | |
1450 | } | |
1451 | | |
1452 | /** | |
1453 | * When set the last row on every page will be extended to fill | |
1454 | * all the remaining space to the bottom boundary; except maybe the | |
1455 | * final row. | |
1456 | * | |
1457 | * @param extendLastRows true to extend the last row on each page; false otherwise | |
1458 | * @param extendFinalRow false if you don't want to extend the final row of the complete table | |
1459 | * @since iText 5.0.0 | |
1460 | */ | |
1461 | public void setExtendLastRow(boolean extendLastRows, boolean extendFinalRow) { | |
1462 | extendLastRow[0] = extendLastRows; | |
1463 | extendLastRow[1] = extendFinalRow; | |
1464 | } | |
1465 | | |
1466 | /** | |
1467 | * Gets the value of the last row extension, taking into account | |
1468 | * if the final row is reached or not. | |
1469 | * | |
1470 | * @return true if the last row will extend; false otherwise | |
1471 | * @since iText 5.0.0 | |
1472 | */ | |
1473 | public boolean isExtendLastRow(boolean newPageFollows) { | |
1474 |
1
1. isExtendLastRow : negated conditional → NO_COVERAGE |
if (newPageFollows) { |
1475 |
1
1. isExtendLastRow : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return extendLastRow[0]; |
1476 | } | |
1477 |
1
1. isExtendLastRow : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return extendLastRow[1]; |
1478 | } | |
1479 | ||
1480 | /** | |
1481 | * Gets the header status inclusion in PdfPTableEvent. | |
1482 | * | |
1483 | * @return true if the headers are included; false otherwise | |
1484 | */ | |
1485 | public boolean isHeadersInEvent() { | |
1486 | return headersInEvent; | |
1487 | } | |
1488 | | |
1489 | /** | |
1490 | * When set the PdfPTableEvent will include the headers. | |
1491 | * | |
1492 | * @param headersInEvent true to include the headers; false otherwise | |
1493 | */ | |
1494 | public void setHeadersInEvent(boolean headersInEvent) { | |
1495 | this.headersInEvent = headersInEvent; | |
1496 | } | |
1497 | | |
1498 | /** | |
1499 | * Gets the property splitLate. | |
1500 | * | |
1501 | * @return the property splitLate | |
1502 | */ | |
1503 | public boolean isSplitLate() { | |
1504 | return splitLate; | |
1505 | } | |
1506 | | |
1507 | /** | |
1508 | * If true the row will only split if it's the first one in an empty page. | |
1509 | * It's true by default. | |
1510 | * It's only meaningful if setSplitRows(true). | |
1511 | * | |
1512 | * @param splitLate the property value | |
1513 | */ | |
1514 | public void setSplitLate(boolean splitLate) { | |
1515 | this.splitLate = splitLate; | |
1516 | } | |
1517 | | |
1518 | /** | |
1519 | * If true the table will be kept on one page if it fits, by forcing a | |
1520 | * new page if it doesn't fit on the current page. The default is to | |
1521 | * split the table over multiple pages. | |
1522 | * | |
1523 | * @param keepTogether whether to try to keep the table on one page | |
1524 | */ | |
1525 | public void setKeepTogether(boolean keepTogether) { | |
1526 | this.keepTogether = keepTogether; | |
1527 | } | |
1528 | | |
1529 | /** | |
1530 | * Getter for property keepTogether | |
1531 | * | |
1532 | * @return true if it is tried to keep the table on one page; | |
1533 | * false otherwise | |
1534 | */ | |
1535 | public boolean getKeepTogether() { | |
1536 | return keepTogether; | |
1537 | } | |
1538 | | |
1539 | /** | |
1540 | * Gets the number of rows in the footer. | |
1541 | * | |
1542 | * @return the number of rows in the footer | |
1543 | */ | |
1544 | public int getFooterRows() { | |
1545 | return this.footerRows; | |
1546 | } | |
1547 | | |
1548 | /** | |
1549 | * Sets the number of rows to be used for the footer. The number | |
1550 | * of footer rows are subtracted from the header rows. For | |
1551 | * example, for a table with two header rows and one footer row the | |
1552 | * code would be: | |
1553 | * <pre> | |
1554 | * table.setHeaderRows(3); | |
1555 | * table.setFooterRows(1); | |
1556 | * </pre> | |
1557 | * Row 0 and 1 will be the header rows and row 2 will be the footer row. | |
1558 | * | |
1559 | * @param footerRows the number of rows to be used for the footer | |
1560 | */ | |
1561 | public void setFooterRows(int footerRows) { | |
1562 |
2
1. setFooterRows : changed conditional boundary → NO_COVERAGE 2. setFooterRows : negated conditional → NO_COVERAGE |
if (footerRows < 0) |
1563 | footerRows = 0; | |
1564 | this.footerRows = footerRows; | |
1565 | } | |
1566 | | |
1567 | /** | |
1568 | * Completes the current row with the default cell. An incomplete row will | |
1569 | * be dropped but calling this method will make sure that it will be | |
1570 | * present in the table. | |
1571 | */ | |
1572 | public void completeRow() { | |
1573 |
1
1. completeRow : negated conditional → NO_COVERAGE |
while (!rowCompleted) { |
1574 |
1
1. completeRow : removed call to com/lowagie/text/pdf/PdfPTable::addCell → NO_COVERAGE |
addCell(defaultCell); |
1575 | } | |
1576 | } | |
1577 | | |
1578 | /** | |
1579 | * @since iText 2.0.8 | |
1580 | * @see com.lowagie.text.LargeElement#flushContent() | |
1581 | */ | |
1582 | public void flushContent() { | |
1583 |
1
1. flushContent : removed call to com/lowagie/text/pdf/PdfPTable::deleteBodyRows → NO_COVERAGE |
deleteBodyRows(); |
1584 |
1
1. flushContent : removed call to com/lowagie/text/pdf/PdfPTable::setSkipFirstHeader → NO_COVERAGE |
setSkipFirstHeader(true); |
1585 | } | |
1586 | ||
1587 | /** | |
1588 | * @since iText 2.0.8 | |
1589 | * @see com.lowagie.text.LargeElement#isComplete() | |
1590 | */ | |
1591 | public boolean isComplete() { | |
1592 | return complete; | |
1593 | } | |
1594 | ||
1595 | /** | |
1596 | * @since iText 2.0.8 | |
1597 | * @see com.lowagie.text.LargeElement#setComplete(boolean) | |
1598 | */ | |
1599 | public void setComplete(boolean complete) { | |
1600 | this.complete = complete; | |
1601 | } | |
1602 | } | |
Mutations | ||
204 |
1.1 |
|
206 |
1.1 |
|
209 |
1.1 |
|
211 |
1.1 |
|
222 |
1.1 2.2 |
|
225 |
1.1 2.2 3.3 |
|
228 |
1.1 |
|
239 |
1.1 |
|
240 |
1.1 2.2 |
|
241 |
1.1 |
|
245 |
1.1 2.2 |
|
247 |
1.1 |
|
261 |
1.1 |
|
262 |
1.1 |
|
274 |
1.1 |
|
275 |
1.1 |
|
309 |
1.1 |
|
312 |
1.1 |
|
315 |
1.1 |
|
328 |
1.1 2.2 |
|
330 |
1.1 |
|
337 |
1.1 2.2 |
|
341 |
1.1 2.2 3.3 |
|
342 |
1.1 |
|
343 |
1.1 2.2 3.3 |
|
344 |
1.1 2.2 |
|
353 |
1.1 |
|
357 |
1.1 |
|
369 |
1.1 |
|
372 |
1.1 |
|
373 |
1.1 |
|
384 |
1.1 |
|
387 |
1.1 |
|
388 |
1.1 2.2 3.3 |
|
389 |
1.1 |
|
413 |
1.1 2.2 |
|
414 |
1.1 |
|
416 |
1.1 2.2 |
|
417 |
1.1 |
|
419 |
1.1 |
|
451 |
1.1 |
|
452 |
1.1 |
|
454 |
1.1 |
|
457 |
1.1 |
|
458 |
1.1 |
|
460 |
1.1 |
|
463 |
1.1 2.2 |
|
465 |
1.1 |
|
469 |
1.1 |
|
471 |
1.1 2.2 |
|
473 |
1.1 |
|
476 |
1.1 2.2 3.3 |
|
479 |
1.1 |
|
481 |
1.1 2.2 |
|
486 |
1.1 2.2 |
|
488 |
1.1 |
|
493 |
1.1 |
|
497 |
1.1 |
|
499 |
1.1 |
|
510 |
1.1 |
|
512 |
1.1 |
|
513 |
1.1 |
|
518 |
1.1 2.2 |
|
519 |
1.1 |
|
520 |
1.1 2.2 3.3 4.4 5.5 |
|
521 |
1.1 |
|
525 |
1.1 |
|
536 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
539 |
1.1 |
|
541 |
1.1 |
|
543 |
1.1 |
|
544 |
1.1 |
|
546 |
1.1 2.2 3.3 |
|
547 |
1.1 |
|
548 |
1.1 |
|
549 |
1.1 |
|
553 |
1.1 |
|
555 |
1.1 |
|
556 |
1.1 |
|
558 |
1.1 2.2 3.3 |
|
559 |
1.1 |
|
560 |
1.1 2.2 3.3 4.4 |
|
563 |
1.1 2.2 3.3 |
|
564 |
1.1 |
|
565 |
1.1 |
|
566 |
1.1 |
|
568 |
1.1 2.2 3.3 |
|
569 |
1.1 |
|
572 |
1.1 2.2 3.3 4.4 |
|
582 |
1.1 |
|
591 |
1.1 |
|
592 |
1.1 |
|
593 |
1.1 |
|
603 |
1.1 |
|
604 |
1.1 |
|
605 |
1.1 |
|
614 |
1.1 |
|
615 |
1.1 |
|
616 |
1.1 |
|
634 |
1.1 |
|
658 |
1.1 2.2 |
|
662 |
1.1 2.2 |
|
664 |
1.1 2.2 |
|
668 |
1.1 2.2 |
|
669 |
1.1 |
|
672 |
1.1 2.2 |
|
676 |
1.1 2.2 |
|
682 |
1.1 2.2 3.3 |
|
684 |
1.1 |
|
685 |
1.1 |
|
686 |
1.1 |
|
690 |
1.1 2.2 3.3 |
|
691 |
1.1 2.2 |
|
693 |
1.1 2.2 3.3 |
|
696 |
1.1 |
|
698 |
1.1 2.2 3.3 4.4 |
|
700 |
1.1 2.2 |
|
703 |
1.1 |
|
719 |
1.1 |
|
742 |
1.1 2.2 |
|
747 |
1.1 2.2 |
|
752 |
1.1 2.2 |
|
754 |
1.1 |
|
756 |
1.1 2.2 3.3 |
|
757 |
1.1 |
|
758 |
1.1 |
|
759 |
1.1 |
|
760 |
1.1 |
|
761 |
1.1 2.2 3.3 4.4 |
|
762 |
1.1 |
|
763 |
1.1 |
|
768 |
1.1 |
|
770 |
1.1 |
|
771 |
1.1 |
|
773 |
1.1 |
|
795 |
1.1 |
|
810 |
1.1 |
|
811 |
1.1 |
|
812 |
1.1 |
|
813 |
1.1 |
|
814 |
1.1 |
|
815 |
1.1 |
|
816 |
1.1 |
|
817 |
1.1 |
|
818 |
1.1 |
|
846 |
1.1 |
|
857 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
858 |
1.1 |
|
860 |
1.1 |
|
861 |
1.1 |
|
862 |
1.1 |
|
867 |
1.1 2.2 3.3 |
|
868 |
1.1 |
|
871 |
1.1 2.2 |
|
872 |
1.1 |
|
874 |
1.1 |
|
877 |
1.1 2.2 3.3 |
|
879 |
1.1 2.2 |
|
880 |
1.1 2.2 |
|
881 |
1.1 |
|
884 |
1.1 2.2 |
|
887 |
1.1 |
|
888 |
1.1 |
|
901 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
902 |
1.1 |
|
904 |
1.1 2.2 3.3 |
|
905 |
1.1 |
|
907 |
1.1 |
|
908 |
1.1 |
|
910 |
1.1 2.2 |
|
911 |
1.1 2.2 |
|
913 |
1.1 |
|
925 |
1.1 2.2 3.3 |
|
927 |
1.1 |
|
928 |
1.1 |
|
930 |
1.1 |
|
942 |
1.1 |
|
944 |
1.1 2.2 3.3 |
|
946 |
1.1 |
|
947 |
1.1 |
|
949 |
1.1 |
|
959 |
1.1 2.2 3.3 4.4 |
|
960 |
1.1 |
|
961 |
1.1 2.2 |
|
963 |
1.1 |
|
964 |
1.1 |
|
967 |
1.1 2.2 |
|
968 |
1.1 |
|
969 |
1.1 2.2 3.3 |
|
970 |
1.1 |
|
972 |
1.1 |
|
981 |
1.1 2.2 |
|
989 |
1.1 2.2 3.3 |
|
993 |
1.1 2.2 |
|
1004 |
1.1 |
|
1024 |
1.1 2.2 |
|
1035 |
1.1 |
|
1072 |
1.1 |
|
1075 |
1.1 |
|
1125 |
1.1 |
|
1146 |
1.1 2.2 3.3 4.4 |
|
1147 |
1.1 |
|
1152 |
1.1 2.2 |
|
1154 |
1.1 2.2 |
|
1156 |
1.1 |
|
1158 |
1.1 |
|
1161 |
1.1 |
|
1162 |
1.1 2.2 3.3 4.4 |
|
1163 |
1.1 |
|
1165 |
1.1 |
|
1167 |
1.1 2.2 |
|
1168 |
1.1 |
|
1173 |
1.1 |
|
1174 |
1.1 |
|
1176 |
1.1 |
|
1179 |
1.1 2.2 3.3 4.4 |
|
1182 |
1.1 |
|
1193 |
1.1 |
|
1196 |
1.1 2.2 3.3 |
|
1198 |
1.1 2.2 |
|
1200 |
1.1 |
|
1202 |
1.1 2.2 3.3 4.4 |
|
1203 |
1.1 |
|
1205 |
1.1 |
|
1207 |
1.1 |
|
1214 |
1.1 |
|
1216 |
1.1 |
|
1218 |
1.1 |
|
1219 |
1.1 |
|
1222 |
1.1 |
|
1223 |
1.1 |
|
1247 |
1.1 |
|
1251 |
1.1 2.2 3.3 |
|
1252 |
1.1 |
|
1254 |
1.1 |
|
1255 |
1.1 2.2 3.3 |
|
1257 |
1.1 |
|
1258 |
1.1 |
|
1260 |
1.1 |
|
1263 |
1.1 2.2 3.3 |
|
1265 |
1.1 |
|
1266 |
1.1 |
|
1268 |
1.1 |
|
1273 |
1.1 |
|
1275 |
1.1 2.2 3.3 |
|
1276 |
1.1 2.2 |
|
1277 |
1.1 2.2 |
|
1280 |
1.1 |
|
1438 |
1.1 |
|
1474 |
1.1 |
|
1475 |
1.1 |
|
1477 |
1.1 |
|
1562 |
1.1 2.2 |
|
1573 |
1.1 |
|
1574 |
1.1 |
|
1583 |
1.1 |
|
1584 |
1.1 |