SimpleCell.java

1
/*
2
 * $Id: SimpleCell.java 4065 2009-09-16 23:09:11Z psoares33 $
3
 *
4
 * Copyright 2005 by Bruno Lowagie.
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
package com.lowagie.text;
50
51
import java.util.ArrayList;
52
53
import com.lowagie.text.error_messages.MessageLocalization;
54
55
import com.lowagie.text.ExceptionConverter;
56
import com.lowagie.text.pdf.PdfContentByte;
57
import com.lowagie.text.pdf.PdfPCell;
58
import com.lowagie.text.pdf.PdfPCellEvent;
59
import com.lowagie.text.pdf.PdfPTable;
60
61
62
/**
63
 * Rectangle that can be used for Cells.
64
 * This Rectangle is padded and knows how to draw itself in a PdfPTable or PdfPcellEvent.
65
 */
66
public class SimpleCell extends Rectangle implements PdfPCellEvent, TextElementArray {
67
68
    // constants
69
    /** the CellAttributes object represents a row. */
70
    public static final boolean ROW = true;
71
    /** the CellAttributes object represents a cell. */
72
    public static final boolean CELL = false;
73
    
74
    // member variables
75
    /** the content of the Cell. */
76
    private ArrayList content = new ArrayList();
77
    /** the width of the Cell. */
78
    private float width = 0f;
79
    /** the widthpercentage of the Cell. */
80
    private float widthpercentage = 0f;
81
    /** an extra spacing variable */
82
    private float spacing_left = Float.NaN;
83
    /** an extra spacing variable */
84
    private float spacing_right = Float.NaN;
85
    /** an extra spacing variable */
86
    private float spacing_top = Float.NaN;
87
    /** an extra spacing variable */
88
    private float spacing_bottom = Float.NaN;
89
    /** an extra padding variable */
90
    private float padding_left = Float.NaN;
91
    /** an extra padding variable */
92
    private float padding_right = Float.NaN;
93
    /** an extra padding variable */
94
    private float padding_top = Float.NaN;
95
    /** an extra padding variable */
96
    private float padding_bottom = Float.NaN;
97
    /** the colspan of a Cell */
98
    private int colspan = 1;
99
    /** horizontal alignment inside the Cell. */
100
    private int horizontalAlignment = Element.ALIGN_UNDEFINED;
101
    /** vertical alignment inside the Cell. */
102
    private int verticalAlignment = Element.ALIGN_UNDEFINED;
103
    /** indicates if these are the attributes of a single Cell (false) or a group of Cells (true). */
104
    private boolean cellgroup = false;
105
    /** Indicates that the largest ascender height should be used to determine the
106
     * height of the first line.  Note that this only has an effect when rendered
107
     * to PDF.  Setting this to true can help with vertical alignment problems. */
108
    protected boolean useAscender = false;
109
    /** Indicates that the largest descender height should be added to the height of
110
     * the last line (so characters like y don't dip into the border).   Note that
111
     * this only has an effect when rendered to PDF. */
112
    protected boolean useDescender = false;
113
    /**
114
     * Adjusts the cell contents to compensate for border widths.  Note that
115
     * this only has an effect when rendered to PDF.
116
     */
117
    protected boolean useBorderPadding;
118
    
119
    /**
120
     * A CellAttributes object is always constructed without any dimensions.
121
     * Dimensions are defined after creation.
122
     * @param row only true if the CellAttributes object represents a row.
123
     */
124
    public SimpleCell(boolean row) {
125
        super(0f, 0f, 0f, 0f);
126
        cellgroup = row;
127 1 1. : removed call to com/lowagie/text/SimpleCell::setBorder → NO_COVERAGE
        setBorder(BOX);
128
    }
129
    
130
    /**
131
     * Adds content to this object.
132
     * @param element
133
     * @throws BadElementException
134
     */
135
    public void addElement(Element element) throws BadElementException {
136 1 1. addElement : negated conditional → NO_COVERAGE
        if (cellgroup) {
137 1 1. addElement : negated conditional → NO_COVERAGE
            if (element instanceof SimpleCell) {
138 1 1. addElement : negated conditional → NO_COVERAGE
                if(((SimpleCell)element).isCellgroup()) {
139
                    throw new BadElementException(MessageLocalization.getComposedMessage("you.can.t.add.one.row.to.another.row"));
140
                }
141
                content.add(element);
142
                return;
143
            }
144
            else {
145
                throw new BadElementException(MessageLocalization.getComposedMessage("you.can.only.add.cells.to.rows.no.objects.of.type.1", element.getClass().getName()));
146
            }
147
        }
148 1 1. addElement : negated conditional → NO_COVERAGE
        if (element.type() == Element.PARAGRAPH
149 1 1. addElement : negated conditional → NO_COVERAGE
                || element.type() == Element.PHRASE
150 1 1. addElement : negated conditional → NO_COVERAGE
                || element.type() == Element.ANCHOR
151 1 1. addElement : negated conditional → NO_COVERAGE
                || element.type() == Element.CHUNK
152 1 1. addElement : negated conditional → NO_COVERAGE
                || element.type() == Element.LIST
153 1 1. addElement : negated conditional → NO_COVERAGE
                || element.type() == Element.MARKED
154 1 1. addElement : negated conditional → NO_COVERAGE
                || element.type() == Element.JPEG
155 1 1. addElement : negated conditional → NO_COVERAGE
                || element.type() == Element.JPEG2000
156 1 1. addElement : negated conditional → NO_COVERAGE
                || element.type() == Element.JBIG2
157 1 1. addElement : negated conditional → NO_COVERAGE
                || element.type() == Element.IMGRAW
158 1 1. addElement : negated conditional → NO_COVERAGE
                || element.type() == Element.IMGTEMPLATE) {
159
            content.add(element);
160
        }
161
        else {
162
            throw new BadElementException(MessageLocalization.getComposedMessage("you.can.t.add.an.element.of.type.1.to.a.simplecell", element.getClass().getName()));
163
        }
164
    }
165
    
166
    /**
167
     * Creates a Cell with these attributes.
168
     * @param rowAttributes
169
     * @return a cell based on these attributes.
170
     * @throws BadElementException
171
     */
172
    public Cell createCell(SimpleCell rowAttributes) throws BadElementException {
173
        Cell cell = new Cell();
174 1 1. createCell : removed call to com/lowagie/text/Cell::cloneNonPositionParameters → NO_COVERAGE
        cell.cloneNonPositionParameters(rowAttributes);
175 1 1. createCell : removed call to com/lowagie/text/Cell::softCloneNonPositionParameters → NO_COVERAGE
        cell.softCloneNonPositionParameters(this);
176 1 1. createCell : removed call to com/lowagie/text/Cell::setColspan → NO_COVERAGE
        cell.setColspan(colspan);
177 1 1. createCell : removed call to com/lowagie/text/Cell::setHorizontalAlignment → NO_COVERAGE
        cell.setHorizontalAlignment(horizontalAlignment);
178 1 1. createCell : removed call to com/lowagie/text/Cell::setVerticalAlignment → NO_COVERAGE
        cell.setVerticalAlignment(verticalAlignment);
179 1 1. createCell : removed call to com/lowagie/text/Cell::setUseAscender → NO_COVERAGE
        cell.setUseAscender(useAscender);
180 1 1. createCell : removed call to com/lowagie/text/Cell::setUseBorderPadding → NO_COVERAGE
        cell.setUseBorderPadding(useBorderPadding);
181 1 1. createCell : removed call to com/lowagie/text/Cell::setUseDescender → NO_COVERAGE
        cell.setUseDescender(useDescender);
182
        Element element;
183
        for (Object o : content) {
184
            element = (Element) o;
185 1 1. createCell : removed call to com/lowagie/text/Cell::addElement → NO_COVERAGE
            cell.addElement(element);
186
        }
187 1 1. createCell : mutated return of Object value for com/lowagie/text/SimpleCell::createCell to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return cell;
188
    }
189
    
190
    /**
191
     * Creates a PdfPCell with these attributes.
192
     * @param rowAttributes
193
     * @return a PdfPCell based on these attributes.
194
     */
195
    public PdfPCell createPdfPCell(SimpleCell rowAttributes) {
196
        PdfPCell cell = new PdfPCell();
197 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setBorder → NO_COVERAGE
        cell.setBorder(NO_BORDER);
198
        SimpleCell tmp = new SimpleCell(CELL);
199 1 1. createPdfPCell : removed call to com/lowagie/text/SimpleCell::setSpacing_left → NO_COVERAGE
        tmp.setSpacing_left(spacing_left);
200 1 1. createPdfPCell : removed call to com/lowagie/text/SimpleCell::setSpacing_right → NO_COVERAGE
        tmp.setSpacing_right(spacing_right);
201 1 1. createPdfPCell : removed call to com/lowagie/text/SimpleCell::setSpacing_top → NO_COVERAGE
        tmp.setSpacing_top(spacing_top);
202 1 1. createPdfPCell : removed call to com/lowagie/text/SimpleCell::setSpacing_bottom → NO_COVERAGE
        tmp.setSpacing_bottom(spacing_bottom);
203 1 1. createPdfPCell : removed call to com/lowagie/text/SimpleCell::cloneNonPositionParameters → NO_COVERAGE
        tmp.cloneNonPositionParameters(rowAttributes);
204 1 1. createPdfPCell : removed call to com/lowagie/text/SimpleCell::softCloneNonPositionParameters → NO_COVERAGE
        tmp.softCloneNonPositionParameters(this);
205 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setCellEvent → NO_COVERAGE
        cell.setCellEvent(tmp);
206 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setHorizontalAlignment → NO_COVERAGE
        cell.setHorizontalAlignment(rowAttributes.horizontalAlignment);
207 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setVerticalAlignment → NO_COVERAGE
        cell.setVerticalAlignment(rowAttributes.verticalAlignment);
208 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setUseAscender → NO_COVERAGE
        cell.setUseAscender(rowAttributes.useAscender);
209 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setUseBorderPadding → NO_COVERAGE
        cell.setUseBorderPadding(rowAttributes.useBorderPadding);
210 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setUseDescender → NO_COVERAGE
        cell.setUseDescender(rowAttributes.useDescender);
211 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setColspan → NO_COVERAGE
        cell.setColspan(colspan);
212 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (horizontalAlignment != Element.ALIGN_UNDEFINED)
213 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setHorizontalAlignment → NO_COVERAGE
            cell.setHorizontalAlignment(horizontalAlignment);
214 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (verticalAlignment != Element.ALIGN_UNDEFINED)
215 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setVerticalAlignment → NO_COVERAGE
            cell.setVerticalAlignment(verticalAlignment);
216 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (useAscender)
217 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setUseAscender → NO_COVERAGE
            cell.setUseAscender(useAscender);
218 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (useBorderPadding)
219 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setUseBorderPadding → NO_COVERAGE
            cell.setUseBorderPadding(useBorderPadding);
220 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (useDescender)
221 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setUseDescender → NO_COVERAGE
            cell.setUseDescender(useDescender);
222
        float p;
223
        float sp_left = spacing_left;
224 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (Float.isNaN(sp_left)) sp_left = 0f;
225
        float sp_right = spacing_right;
226 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (Float.isNaN(sp_right)) sp_right = 0f;
227
        float sp_top = spacing_top;
228 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (Float.isNaN(sp_top)) sp_top = 0f;
229
        float sp_bottom = spacing_bottom;
230 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (Float.isNaN(sp_bottom)) sp_bottom = 0f;
231
        p = padding_left;
232 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (Float.isNaN(p)) p = 0f; 
233 2 1. createPdfPCell : Replaced float addition with subtraction → NO_COVERAGE
2. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setPaddingLeft → NO_COVERAGE
        cell.setPaddingLeft(p + sp_left);
234
        p = padding_right;
235 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (Float.isNaN(p)) p = 0f; 
236 2 1. createPdfPCell : Replaced float addition with subtraction → NO_COVERAGE
2. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setPaddingRight → NO_COVERAGE
        cell.setPaddingRight(p + sp_right);
237
        p = padding_top;
238 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (Float.isNaN(p)) p = 0f; 
239 2 1. createPdfPCell : Replaced float addition with subtraction → NO_COVERAGE
2. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setPaddingTop → NO_COVERAGE
        cell.setPaddingTop(p + sp_top);
240
        p = padding_bottom;
241 1 1. createPdfPCell : negated conditional → NO_COVERAGE
        if (Float.isNaN(p)) p = 0f; 
242 2 1. createPdfPCell : Replaced float addition with subtraction → NO_COVERAGE
2. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::setPaddingBottom → NO_COVERAGE
        cell.setPaddingBottom(p + sp_bottom);
243
        Element element;
244
        for (Object o : content) {
245
            element = (Element) o;
246 1 1. createPdfPCell : removed call to com/lowagie/text/pdf/PdfPCell::addElement → NO_COVERAGE
            cell.addElement(element);
247
        }
248 1 1. createPdfPCell : mutated return of Object value for com/lowagie/text/SimpleCell::createPdfPCell to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return cell;
249
    }
250
251
    /**
252
     * @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
253
     */
254
    public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) {
255
        float sp_left = spacing_left;
256 1 1. cellLayout : negated conditional → NO_COVERAGE
        if (Float.isNaN(sp_left)) sp_left = 0f;
257
        float sp_right = spacing_right;
258 1 1. cellLayout : negated conditional → NO_COVERAGE
        if (Float.isNaN(sp_right)) sp_right = 0f;
259
        float sp_top = spacing_top;
260 1 1. cellLayout : negated conditional → NO_COVERAGE
        if (Float.isNaN(sp_top)) sp_top = 0f;
261
        float sp_bottom = spacing_bottom;
262 1 1. cellLayout : negated conditional → NO_COVERAGE
        if (Float.isNaN(sp_bottom)) sp_bottom = 0f;
263
        Rectangle rect = new Rectangle(position.getLeft(sp_left), position.getBottom(sp_bottom), position.getRight(sp_right), position.getTop(sp_top));
264 1 1. cellLayout : removed call to com/lowagie/text/Rectangle::cloneNonPositionParameters → NO_COVERAGE
        rect.cloneNonPositionParameters(this);
265 1 1. cellLayout : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE
        canvases[PdfPTable.BACKGROUNDCANVAS].rectangle(rect);
266 1 1. cellLayout : removed call to com/lowagie/text/Rectangle::setBackgroundColor → NO_COVERAGE
        rect.setBackgroundColor(null);
267 1 1. cellLayout : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE
        canvases[PdfPTable.LINECANVAS].rectangle(rect);
268
    }
269
    
270
    /** Sets the padding parameters if they are undefined. 
271
     * @param padding
272
     */
273
    public void setPadding(float padding) {
274 1 1. setPadding : negated conditional → NO_COVERAGE
        if (Float.isNaN(padding_right)) {
275 1 1. setPadding : removed call to com/lowagie/text/SimpleCell::setPadding_right → NO_COVERAGE
            setPadding_right(padding);
276
        }
277 1 1. setPadding : negated conditional → NO_COVERAGE
        if (Float.isNaN(padding_left)) {
278 1 1. setPadding : removed call to com/lowagie/text/SimpleCell::setPadding_left → NO_COVERAGE
            setPadding_left(padding);
279
        }
280 1 1. setPadding : negated conditional → NO_COVERAGE
        if (Float.isNaN(padding_top)) {
281 1 1. setPadding : removed call to com/lowagie/text/SimpleCell::setPadding_top → NO_COVERAGE
            setPadding_top(padding);
282
        }
283 1 1. setPadding : negated conditional → NO_COVERAGE
        if (Float.isNaN(padding_bottom)) {
284 1 1. setPadding : removed call to com/lowagie/text/SimpleCell::setPadding_bottom → NO_COVERAGE
            setPadding_bottom(padding);
285
        }
286
    }
287
    
288
    /**
289
     * @return Returns the colspan.
290
     */
291
    public int getColspan() {
292
        return colspan;
293
    }
294
    /**
295
     * @param colspan The colspan to set.
296
     */
297
    public void setColspan(int colspan) {
298 2 1. setColspan : changed conditional boundary → NO_COVERAGE
2. setColspan : negated conditional → NO_COVERAGE
        if (colspan > 0) this.colspan = colspan;
299
    }
300
    /**
301
     * @return Returns the padding_bottom.
302
     */
303
    public float getPadding_bottom() {
304
        return padding_bottom;
305
    }
306
    /**
307
     * @param padding_bottom The padding_bottom to set.
308
     */
309
    public void setPadding_bottom(float padding_bottom) {
310
        this.padding_bottom = padding_bottom;
311
    }
312
    /**
313
     * @return Returns the padding_left.
314
     */
315
    public float getPadding_left() {
316
        return padding_left;
317
    }
318
    /**
319
     * @param padding_left The padding_left to set.
320
     */
321
    public void setPadding_left(float padding_left) {
322
        this.padding_left = padding_left;
323
    }
324
    /**
325
     * @return Returns the padding_right.
326
     */
327
    public float getPadding_right() {
328
        return padding_right;
329
    }
330
    /**
331
     * @param padding_right The padding_right to set.
332
     */
333
    public void setPadding_right(float padding_right) {
334
        this.padding_right = padding_right;
335
    }
336
    /**
337
     * @return Returns the padding_top.
338
     */
339
    public float getPadding_top() {
340
        return padding_top;
341
    }
342
    /**
343
     * @param padding_top The padding_top to set.
344
     */
345
    public void setPadding_top(float padding_top) {
346
        this.padding_top = padding_top;
347
    }
348
    /**
349
     * @return Returns the spacing.
350
     */
351
    public float getSpacing_left() {
352
        return spacing_left;
353
    }
354
    /**
355
     * @return Returns the spacing.
356
     */
357
    public float getSpacing_right() {
358
        return spacing_right;
359
    }
360
    /**
361
     * @return Returns the spacing.
362
     */
363
    public float getSpacing_top() {
364
        return spacing_top;
365
    }
366
    /**
367
     * @return Returns the spacing.
368
     */
369
    public float getSpacing_bottom() {
370
        return spacing_bottom;
371
    }
372
    
373
    /**
374
     * @param spacing The spacing to set.
375
     */
376
    public void setSpacing(float spacing) {
377
        this.spacing_left = spacing;
378
        this.spacing_right = spacing;
379
        this.spacing_top = spacing;
380
        this.spacing_bottom = spacing;
381
    }
382
    
383
    /**
384
     * @param spacing The spacing to set.
385
     */
386
    public void setSpacing_left(float spacing) {
387
        this.spacing_left = spacing;
388
    }
389
    
390
    /**
391
     * @param spacing The spacing to set.
392
     */
393
    public void setSpacing_right(float spacing) {
394
        this.spacing_right = spacing;
395
    }
396
    
397
    /**
398
     * @param spacing The spacing to set.
399
     */
400
    public void setSpacing_top(float spacing) {
401
        this.spacing_top = spacing;
402
    }
403
    
404
    /**
405
     * @param spacing The spacing to set.
406
     */
407
    public void setSpacing_bottom(float spacing) {
408
        this.spacing_bottom = spacing;
409
    }
410
    
411
    /**
412
     * @return Returns the cellgroup.
413
     */
414
    public boolean isCellgroup() {
415
        return cellgroup;
416
    }
417
    /**
418
     * @param cellgroup The cellgroup to set.
419
     */
420
    public void setCellgroup(boolean cellgroup) {
421
        this.cellgroup = cellgroup;
422
    }
423
    /**
424
     * @return Returns the horizontal alignment.
425
     */
426
    public int getHorizontalAlignment() {
427
        return horizontalAlignment;
428
    }
429
    /**
430
     * @param horizontalAlignment The horizontalAlignment to set.
431
     */
432
    public void setHorizontalAlignment(int horizontalAlignment) {
433
        this.horizontalAlignment = horizontalAlignment;
434
    }
435
    /**
436
     * @return Returns the vertical alignment.
437
     */
438
    public int getVerticalAlignment() {
439
        return verticalAlignment;
440
    }
441
    /**
442
     * @param verticalAlignment The verticalAligment to set.
443
     */
444
    public void setVerticalAlignment(int verticalAlignment) {
445
        this.verticalAlignment = verticalAlignment;
446
    }
447
    /**
448
     * @return Returns the width.
449
     */
450
    public float getWidth() {
451
        return width;
452
    }
453
    /**
454
     * @param width The width to set.
455
     */
456
    public void setWidth(float width) {
457
        this.width = width;
458
    }
459
    /**
460
     * @return Returns the widthpercentage.
461
     */
462
    public float getWidthpercentage() {
463
        return widthpercentage;
464
    }
465
    /**
466
     * @param widthpercentage The widthpercentage to set.
467
     */
468
    public void setWidthpercentage(float widthpercentage) {
469
        this.widthpercentage = widthpercentage;
470
    }
471
    /**
472
     * @return Returns the useAscender.
473
     */
474
    public boolean isUseAscender() {
475
        return useAscender;
476
    }
477
    /**
478
     * @param useAscender The useAscender to set.
479
     */
480
    public void setUseAscender(boolean useAscender) {
481
        this.useAscender = useAscender;
482
    }
483
    /**
484
     * @return Returns the useBorderPadding.
485
     */
486
    public boolean isUseBorderPadding() {
487
        return useBorderPadding;
488
    }
489
    /**
490
     * @param useBorderPadding The useBorderPadding to set.
491
     */
492
    public void setUseBorderPadding(boolean useBorderPadding) {
493
        this.useBorderPadding = useBorderPadding;
494
    }
495
    /**
496
     * @return Returns the useDescender.
497
     */
498
    public boolean isUseDescender() {
499
        return useDescender;
500
    }
501
    /**
502
     * @param useDescender The useDescender to set.
503
     */
504
    public void setUseDescender(boolean useDescender) {
505
        this.useDescender = useDescender;
506
    }
507
    
508
    /**
509
     * @return Returns the content.
510
     */
511
    ArrayList getContent() {
512
        return content;
513
    }
514
515
    /**
516
     * @see com.lowagie.text.TextElementArray#add(java.lang.Object)
517
     */
518
    public boolean add(Object o) {
519
        try {
520 1 1. add : removed call to com/lowagie/text/SimpleCell::addElement → NO_COVERAGE
            addElement((Element)o);
521 1 1. add : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return true;
522
        }
523
        catch(ClassCastException e) {
524 1 1. add : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return false;
525
        }
526
        catch(BadElementException e) {
527
            throw new ExceptionConverter(e);
528
        }
529
    }
530
    /**
531
     * @see com.lowagie.text.Element#type()
532
     */
533
    public int type() {
534
        return Element.CELL;
535
    }
536
}

Mutations

127

1.1
Location :
Killed by : none
removed call to com/lowagie/text/SimpleCell::setBorder → NO_COVERAGE

136

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

137

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

138

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

148

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

149

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

150

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

151

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

152

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

153

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

154

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

155

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

156

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

157

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

158

1.1
Location : addElement
Killed by : none
negated conditional → NO_COVERAGE

174

1.1
Location : createCell
Killed by : none
removed call to com/lowagie/text/Cell::cloneNonPositionParameters → NO_COVERAGE

175

1.1
Location : createCell
Killed by : none
removed call to com/lowagie/text/Cell::softCloneNonPositionParameters → NO_COVERAGE

176

1.1
Location : createCell
Killed by : none
removed call to com/lowagie/text/Cell::setColspan → NO_COVERAGE

177

1.1
Location : createCell
Killed by : none
removed call to com/lowagie/text/Cell::setHorizontalAlignment → NO_COVERAGE

178

1.1
Location : createCell
Killed by : none
removed call to com/lowagie/text/Cell::setVerticalAlignment → NO_COVERAGE

179

1.1
Location : createCell
Killed by : none
removed call to com/lowagie/text/Cell::setUseAscender → NO_COVERAGE

180

1.1
Location : createCell
Killed by : none
removed call to com/lowagie/text/Cell::setUseBorderPadding → NO_COVERAGE

181

1.1
Location : createCell
Killed by : none
removed call to com/lowagie/text/Cell::setUseDescender → NO_COVERAGE

185

1.1
Location : createCell
Killed by : none
removed call to com/lowagie/text/Cell::addElement → NO_COVERAGE

187

1.1
Location : createCell
Killed by : none
mutated return of Object value for com/lowagie/text/SimpleCell::createCell to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

197

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setBorder → NO_COVERAGE

199

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/SimpleCell::setSpacing_left → NO_COVERAGE

200

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/SimpleCell::setSpacing_right → NO_COVERAGE

201

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/SimpleCell::setSpacing_top → NO_COVERAGE

202

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/SimpleCell::setSpacing_bottom → NO_COVERAGE

203

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/SimpleCell::cloneNonPositionParameters → NO_COVERAGE

204

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/SimpleCell::softCloneNonPositionParameters → NO_COVERAGE

205

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setCellEvent → NO_COVERAGE

206

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setHorizontalAlignment → NO_COVERAGE

207

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setVerticalAlignment → NO_COVERAGE

208

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setUseAscender → NO_COVERAGE

209

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setUseBorderPadding → NO_COVERAGE

210

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setUseDescender → NO_COVERAGE

211

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setColspan → NO_COVERAGE

212

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

213

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setHorizontalAlignment → NO_COVERAGE

214

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

215

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setVerticalAlignment → NO_COVERAGE

216

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

217

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setUseAscender → NO_COVERAGE

218

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

219

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setUseBorderPadding → NO_COVERAGE

220

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

221

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setUseDescender → NO_COVERAGE

224

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

226

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

228

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

230

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

232

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

233

1.1
Location : createPdfPCell
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

2.2
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setPaddingLeft → NO_COVERAGE

235

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

236

1.1
Location : createPdfPCell
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

2.2
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setPaddingRight → NO_COVERAGE

238

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

239

1.1
Location : createPdfPCell
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

2.2
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setPaddingTop → NO_COVERAGE

241

1.1
Location : createPdfPCell
Killed by : none
negated conditional → NO_COVERAGE

242

1.1
Location : createPdfPCell
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

2.2
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::setPaddingBottom → NO_COVERAGE

246

1.1
Location : createPdfPCell
Killed by : none
removed call to com/lowagie/text/pdf/PdfPCell::addElement → NO_COVERAGE

248

1.1
Location : createPdfPCell
Killed by : none
mutated return of Object value for com/lowagie/text/SimpleCell::createPdfPCell to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

256

1.1
Location : cellLayout
Killed by : none
negated conditional → NO_COVERAGE

258

1.1
Location : cellLayout
Killed by : none
negated conditional → NO_COVERAGE

260

1.1
Location : cellLayout
Killed by : none
negated conditional → NO_COVERAGE

262

1.1
Location : cellLayout
Killed by : none
negated conditional → NO_COVERAGE

264

1.1
Location : cellLayout
Killed by : none
removed call to com/lowagie/text/Rectangle::cloneNonPositionParameters → NO_COVERAGE

265

1.1
Location : cellLayout
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE

266

1.1
Location : cellLayout
Killed by : none
removed call to com/lowagie/text/Rectangle::setBackgroundColor → NO_COVERAGE

267

1.1
Location : cellLayout
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE

274

1.1
Location : setPadding
Killed by : none
negated conditional → NO_COVERAGE

275

1.1
Location : setPadding
Killed by : none
removed call to com/lowagie/text/SimpleCell::setPadding_right → NO_COVERAGE

277

1.1
Location : setPadding
Killed by : none
negated conditional → NO_COVERAGE

278

1.1
Location : setPadding
Killed by : none
removed call to com/lowagie/text/SimpleCell::setPadding_left → NO_COVERAGE

280

1.1
Location : setPadding
Killed by : none
negated conditional → NO_COVERAGE

281

1.1
Location : setPadding
Killed by : none
removed call to com/lowagie/text/SimpleCell::setPadding_top → NO_COVERAGE

283

1.1
Location : setPadding
Killed by : none
negated conditional → NO_COVERAGE

284

1.1
Location : setPadding
Killed by : none
removed call to com/lowagie/text/SimpleCell::setPadding_bottom → NO_COVERAGE

298

1.1
Location : setColspan
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : setColspan
Killed by : none
negated conditional → NO_COVERAGE

520

1.1
Location : add
Killed by : none
removed call to com/lowagie/text/SimpleCell::addElement → NO_COVERAGE

521

1.1
Location : add
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

524

1.1
Location : add
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.4.2