|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.lowagie.text.Rectangle
com.lowagie.text.Cell
public class Cell
A Cell is a Rectangle containing other
Elements.
A Cell must be added to a Table.
The Table will place the Cell in
a Row.
Example:
Table table = new Table(3);
table.setBorderWidth(1);
table.setBorderColor(new Color(0, 0, 255));
table.setCellpadding(5);
table.setCellspacing(5);
Cell cell = new Cell("header");
cell.setHeader(true);
cell.setColspan(3);
table.addCell(cell);
cell = new Cell("example cell with colspan 1 and rowspan 2");
cell.setRowspan(2);
cell.setBorderColor(new Color(255, 0, 0));
table.addCell(cell);
table.addCell("1.1");
table.addCell("2.1");
table.addCell("1.2");
table.addCell("2.2");
Rectangle,
Element,
Table,
Row| Field Summary | |
|---|---|
protected ArrayList |
arrayList
The ArrayList of Elements
that are part of the content of the Cell. |
protected int |
colspan
The colspan of the cell. |
protected boolean |
groupChange
Does this Cell force a group change? |
protected boolean |
header
Is this Cell a header? |
protected int |
horizontalAlignment
The horizontal alignment of the cell content. |
(package private) float |
leading
The leading of the content inside the cell. |
protected int |
maxLines
Maximum number of lines allowed in the cell. |
protected boolean |
percentage
|
protected int |
rowspan
The rowspan of the cell. |
(package private) String |
showTruncation
If a truncation happens due to the maxLines property, then this text will be added to indicate a truncation has happened. |
protected boolean |
useAscender
Indicates that the largest ascender height should be used to determine the height of the first line. |
protected boolean |
useBorderPadding
Adjusts the cell contents to compensate for border widths. |
protected boolean |
useDescender
Indicates that the largest descender height should be added to the height of the last line (so characters like y don't dip into the border). |
protected int |
verticalAlignment
The vertical alignment of the cell content. |
protected float |
width
The width of the cell as a String. |
| Fields inherited from class com.lowagie.text.Rectangle |
|---|
backgroundColor, border, borderColor, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, LEFT, llx, lly, NO_BORDER, RIGHT, rotation, TOP, UNDEFINED, urx, ury, useVariableBorders |
| Fields inherited from interface com.lowagie.text.Element |
|---|
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, HEADER, IMGRAW, IMGTEMPLATE, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE |
| Constructor Summary | |
|---|---|
Cell()
Constructs an empty Cell. |
|
Cell(boolean dummy)
Constructs an empty Cell (for internal use only). |
|
Cell(Element element)
Constructs a Cell with a certain Element. |
|
Cell(Properties attributes)
Deprecated. As of iText 2.0.3, use ElementFactory.getCell(Properties),
scheduled for removal at 2.1.0 |
|
Cell(String content)
Constructs a Cell with a certain content. |
|
| Method Summary | |
|---|---|
boolean |
add(Object o)
Add an Object to this cell. |
void |
addElement(Element element)
Adds an element to this Cell. |
float |
bottom()
Deprecated. As of iText 2.0.3, replaced by getBottom(),
scheduled for removal at 2.1.0 |
float |
bottom(int margin)
This method throws an UnsupportedOperationException. |
String |
cellWidth()
Deprecated. As of iText 2.0.3, replaced by getWidthAsString(),
scheduled for removal at 2.1.0 |
void |
clear()
Clears all the Elements of this Cell. |
int |
colspan()
Deprecated. As of iText 2.0.3, replaced by getColspan(),
scheduled for removal at 2.1.0 |
PdfPCell |
createPdfPCell()
Creates a PdfPCell based on this Cell object. |
(package private) void |
fill()
Makes sure there is at least 1 object in the Cell. |
float |
getBottom()
This method throws an UnsupportedOperationException. |
ArrayList |
getChunks()
Gets all the chunks in this element. |
int |
getColspan()
Gets the colspan. |
private static Cell |
getDummyCell()
Get dummy cell used when merging inner tables. |
Iterator |
getElements()
Gets an iterator of Elements. |
boolean |
getGroupChange()
Does this Cell force a group change? |
int |
getHorizontalAlignment()
Gets the horizontal alignment. |
float |
getLeading()
Gets the leading. |
float |
getLeft()
This method throws an UnsupportedOperationException. |
int |
getMaxLines()
Getter for maxLines |
float |
getRight()
This method throws an UnsupportedOperationException. |
int |
getRowspan()
Gets the rowspan. |
String |
getShowTruncation()
Getter for showTruncation |
float |
getTop()
This method throws an UnsupportedOperationException. |
int |
getVerticalAlignment()
Gets the vertical alignment. |
float |
getWidth()
Gets the width. |
String |
getWidthAsString()
Gets the width as a String. |
boolean |
header()
Deprecated. As of iText 2.0.3, replaced by isHeader(),
scheduled for removal at 2.1.0 |
int |
horizontalAlignment()
Deprecated. As of iText 2.0.3, replaced by getHorizontalAlignment(),
scheduled for removal at 2.1.0 |
boolean |
isEmpty()
Checks if the Cell is empty. |
boolean |
isHeader()
Is this Cell a header? |
boolean |
isTable()
Checks if this Cell is a placeholder for a (nested) table. |
boolean |
isUseAscender()
Gets the value of useAscender |
boolean |
isUseBorderPadding()
Gets the value of useBorderPadding. |
boolean |
isUseDescender()
gets the value of useDescender |
float |
leading()
Deprecated. As of iText 2.0.3, replaced by getLeading(),
scheduled for removal at 2.1.0 |
float |
left()
Deprecated. As of iText 2.0.3, replaced by getLeft(),
scheduled for removal at 2.1.0 |
float |
left(int margin)
This method throws an UnsupportedOperationException. |
boolean |
noWrap()
Deprecated. As of iText 2.0.3, use getMaxLines() == 1 instead, scheduled for removal at 2.1.0 |
boolean |
process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener. |
float |
right()
Deprecated. As of iText 2.0.3, replaced by getRight(),
scheduled for removal at 2.1.0 |
float |
right(int margin)
This method throws an UnsupportedOperationException. |
int |
rowspan()
Deprecated. As of iText 2.0.3, replaced by getRowspan(),
scheduled for removal at 2.1.0 |
void |
setBottom(int value)
This method throws an UnsupportedOperationException. |
void |
setColspan(int value)
Sets the colspan. |
void |
setGroupChange(boolean value)
Sets group change. |
void |
setHeader(boolean value)
Sets header. |
void |
setHorizontalAlignment(int value)
Sets the horizontal alignment. |
void |
setHorizontalAlignment(String alignment)
Sets the alignment of this cell. |
void |
setLeading(float value)
Sets the leading. |
void |
setLeft(int value)
This method throws an UnsupportedOperationException. |
void |
setMaxLines(int value)
Setter for maxLines |
void |
setNoWrap(boolean value)
Deprecated. As of iText 2.0.3, use setMaxLines(1) instead, scheduled for removal at 2.1.0 |
void |
setRight(int value)
This method throws an UnsupportedOperationException. |
void |
setRowspan(int value)
Sets the rowspan. |
void |
setShowTruncation(String value)
Setter for showTruncation |
void |
setTop(int value)
This method throws an UnsupportedOperationException. |
void |
setUseAscender(boolean use)
Sets the value of useAscender. |
void |
setUseBorderPadding(boolean use)
Sets the value of useBorderPadding. |
void |
setUseDescender(boolean use)
Sets the value of useDescender. |
void |
setVerticalAlignment(int value)
Sets the vertical alignment. |
void |
setVerticalAlignment(String alignment)
Sets the alignment of this paragraph. |
void |
setWidth(float value)
Sets the width. |
void |
setWidth(String value)
Sets the width. |
int |
size()
Gets the number of Elements in the Cell. |
float |
top()
Deprecated. As of iText 2.0.3, replaced by getTop(),
scheduled for removal at 2.1.0 |
float |
top(int margin)
This method throws an UnsupportedOperationException. |
int |
type()
Gets the type of the text element. |
int |
verticalAlignment()
Deprecated. As of iText 2.0.3, replaced by getVerticalAlignment(),
scheduled for removal at 2.1.0 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.lowagie.text.Element |
|---|
isContent, isNestable, toString |
| Field Detail |
|---|
protected ArrayList arrayList
ArrayList of Elements
that are part of the content of the Cell.
protected int horizontalAlignment
protected int verticalAlignment
protected float width
protected boolean percentage
protected int colspan
protected int rowspan
float leading
protected boolean header
Cell a header?
protected int maxLines
String showTruncation
protected boolean useAscender
protected boolean useDescender
protected boolean useBorderPadding
protected boolean groupChange
Cell force a group change?
| Constructor Detail |
|---|
public Cell()
Cell.
public Cell(boolean dummy)
Cell (for internal use only).
dummy - a dummy valuepublic Cell(String content)
Cell with a certain content.
The String will be converted into a Paragraph.
content - a String
public Cell(Element element)
throws BadElementException
Cell with a certain Element.
if the element is a ListItem, Row or
Cell, an exception will be thrown.
element - the element
BadElementException - when the creator was called with a ListItem, Row or Cellpublic Cell(Properties attributes)
ElementFactory.getCell(Properties),
scheduled for removal at 2.1.0
Cell that has been constructed taking in account
the value of some attributes.
attributes - Some attributes| Method Detail |
|---|
public boolean process(ElementListener listener)
ElementListener.
process in interface Elementprocess in class Rectanglelistener - an ElementListener
true if the element was processed successfullypublic int type()
type in interface Elementtype in class Rectanglepublic ArrayList getChunks()
getChunks in interface ElementgetChunks in class RectangleArrayListpublic int getHorizontalAlignment()
public void setHorizontalAlignment(int value)
value - the new valuepublic void setHorizontalAlignment(String alignment)
alignment - the new alignment as a Stringpublic int getVerticalAlignment()
public void setVerticalAlignment(int value)
value - the new valuepublic void setVerticalAlignment(String alignment)
alignment - the new alignment as a Stringpublic void setWidth(float value)
value - the new valuepublic void setWidth(String value)
value - the new valuepublic float getWidth()
getWidth in class Rectanglepublic String getWidthAsString()
public void setColspan(int value)
value - the new valuepublic int getColspan()
public void setRowspan(int value)
value - the new valuepublic int getRowspan()
public void setLeading(float value)
value - the new valuepublic float getLeading()
public void setHeader(boolean value)
value - the new valuepublic boolean isHeader()
Cell a header?
public void setMaxLines(int value)
value - the maximum number of linespublic int getMaxLines()
public void setShowTruncation(String value)
value - Can be null for avoiding marking the truncation.public String getShowTruncation()
public void setUseAscender(boolean use)
use - use ascender height if truepublic boolean isUseAscender()
public void setUseDescender(boolean use)
use - use descender height if truepublic boolean isUseDescender()
public void setUseBorderPadding(boolean use)
use - adjust layour for borders if truepublic boolean isUseBorderPadding()
public boolean getGroupChange()
Cell force a group change?
public void setGroupChange(boolean value)
value - the new valuepublic int size()
Elements in the Cell.
size.public Iterator getElements()
Elements.
Iterator.public void clear()
Elements of this Cell.
public boolean isEmpty()
Cell is empty.
false if there are non-empty Elements in the Cell.void fill()
public boolean isTable()
Cell is a placeholder for a (nested) table.
public void addElement(Element element)
throws BadElementException
Cell.
Remark: you can't add ListItems, Rows, Cells,
JPEGs, GIFs or PNGs to a Cell.
element - The Element to add
BadElementException - if the method was called with a ListItem, Row or Cellpublic boolean add(Object o)
Object to this cell.
add in interface TextElementArrayo - the object to add
trueprivate static Cell getDummyCell()
public PdfPCell createPdfPCell()
throws BadElementException
BadElementExceptionpublic float top()
getTop(),
scheduled for removal at 2.1.0
UnsupportedOperationException.
top in class Rectanglepublic float getTop()
UnsupportedOperationException.
getTop in class Rectanglepublic float bottom()
getBottom(),
scheduled for removal at 2.1.0
UnsupportedOperationException.
bottom in class Rectanglepublic float getBottom()
UnsupportedOperationException.
getBottom in class Rectanglepublic float left()
getLeft(),
scheduled for removal at 2.1.0
UnsupportedOperationException.
left in class Rectanglepublic float getLeft()
UnsupportedOperationException.
getLeft in class Rectanglepublic float right()
getRight(),
scheduled for removal at 2.1.0
UnsupportedOperationException.
right in class Rectanglepublic float getRight()
UnsupportedOperationException.
getRight in class Rectanglepublic float top(int margin)
UnsupportedOperationException.
margin -
public float bottom(int margin)
UnsupportedOperationException.
margin -
public float left(int margin)
UnsupportedOperationException.
margin -
public float right(int margin)
UnsupportedOperationException.
margin - NA
public void setTop(int value)
UnsupportedOperationException.
value - NApublic void setBottom(int value)
UnsupportedOperationException.
value - NApublic void setLeft(int value)
UnsupportedOperationException.
value - NApublic void setRight(int value)
UnsupportedOperationException.
value - NApublic int horizontalAlignment()
getHorizontalAlignment(),
scheduled for removal at 2.1.0
public int verticalAlignment()
getVerticalAlignment(),
scheduled for removal at 2.1.0
public String cellWidth()
getWidthAsString(),
scheduled for removal at 2.1.0
public int colspan()
getColspan(),
scheduled for removal at 2.1.0
public int rowspan()
getRowspan(),
scheduled for removal at 2.1.0
public float leading()
getLeading(),
scheduled for removal at 2.1.0
public boolean header()
isHeader(),
scheduled for removal at 2.1.0
Cell a header?
public void setNoWrap(boolean value)
value - the new valuepublic boolean noWrap()
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||