|
![]() |
||||||||
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
Element
s.
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 java.util.ArrayList |
arrayList
The ArrayList of Element s
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) java.lang.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(java.util.Properties attributes)
Deprecated. use ElementFactory.getCell(attributes) |
|
Cell(java.lang.String content)
Constructs a Cell with a certain content. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o)
Add an Object to this cell. |
void |
addElement(Element element)
Adds an element to this Cell . |
float |
bottom()
Deprecated. Use getBottom() instead |
float |
bottom(int margin)
This method throws an UnsupportedOperationException . |
java.lang.String |
cellWidth()
Deprecated. Use getWidthAsString() instead |
void |
clear()
Clears all the Element s of this Cell . |
int |
colspan()
Deprecated. Use getColspan() instead |
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 . |
java.util.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. |
java.util.Iterator |
getElements()
Gets an iterator of Element s. |
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. |
java.lang.String |
getShowTruncation()
Getter for showTruncation |
float |
getTop()
This method throws an UnsupportedOperationException . |
int |
getVerticalAlignment()
Gets the vertical alignment. |
float |
getWidth()
Gets the width. |
java.lang.String |
getWidthAsString()
Gets the width as a String. |
boolean |
header()
Deprecated. Use isHeader() instead |
int |
horizontalAlignment()
Deprecated. Use getHorizontalAlignment() instead |
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. Use getLeading() instead |
float |
left()
Deprecated. Use getLeft() instead |
float |
left(int margin)
This method throws an UnsupportedOperationException . |
boolean |
noWrap()
Deprecated. Use getMaxLines() == 1 instead |
boolean |
process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener . |
float |
right()
Deprecated. Use getRight() instead |
float |
right(int margin)
This method throws an UnsupportedOperationException . |
int |
rowspan()
Deprecated. Use getRowspan() instead |
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(java.lang.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. Use setMaxLines(1) instead |
void |
setRight(int value)
This method throws an UnsupportedOperationException . |
void |
setRowspan(int value)
Sets the rowspan. |
void |
setShowTruncation(java.lang.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(java.lang.String alignment)
Sets the alignment of this paragraph. |
void |
setWidth(float value)
Sets the width. |
void |
setWidth(java.lang.String value)
Sets the width. |
int |
size()
Gets the number of Element s in the Cell. |
float |
top()
Deprecated. Use getTop() instead |
float |
top(int margin)
This method throws an UnsupportedOperationException . |
int |
type()
Gets the type of the text element. |
int |
verticalAlignment()
Deprecated. Use getVerticalAlignment() instead |
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 |
---|
toString |
Field Detail |
---|
protected java.util.ArrayList arrayList
ArrayList
of Element
s
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
java.lang.String showTruncation
maxLines
property, then this text will
be added to indicate a truncation has happened.
Default value is null, and means avoiding marking the truncation.
A useful value of this property could be e.g. "..."
(contributed by dperezcar@fcc.es)
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(java.lang.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 Cell
public Cell(java.util.Properties attributes)
Cell
that has been constructed taking in account
the value of some attributes.
attributes
- Some attributesMethod Detail |
---|
public boolean process(ElementListener listener)
ElementListener
.
process
in interface Element
process
in class Rectangle
listener
- an ElementListener
true
if the element was processed successfullypublic int type()
type
in interface Element
type
in class Rectangle
public java.util.ArrayList getChunks()
getChunks
in interface Element
getChunks
in class Rectangle
ArrayList
public int getHorizontalAlignment()
public void setHorizontalAlignment(int value)
value
- the new valuepublic void setHorizontalAlignment(java.lang.String alignment)
alignment
- the new alignment as a String
public int getVerticalAlignment()
public void setVerticalAlignment(int value)
value
- the new valuepublic void setVerticalAlignment(java.lang.String alignment)
alignment
- the new alignment as a String
public void setWidth(float value)
value
- the new valuepublic void setWidth(java.lang.String value)
value
- the new valuepublic float getWidth()
getWidth
in class Rectangle
public java.lang.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)
maxLines
value
- the maximum number of linespublic int getMaxLines()
maxLines
public void setShowTruncation(java.lang.String value)
showTruncation
value
- Can be null for avoiding marking the truncation.public java.lang.String getShowTruncation()
showTruncation
public void setUseAscender(boolean use)
useAscender
.
use
- use ascender height if truepublic boolean isUseAscender()
useAscender
public void setUseDescender(boolean use)
useDescender
.
use
- use descender height if truepublic boolean isUseDescender()
useDescender
public void setUseBorderPadding(boolean use)
useBorderPadding
.
use
- adjust layour for borders if truepublic boolean isUseBorderPadding()
useBorderPadding
.
public boolean getGroupChange()
Cell
force a group change?
public void setGroupChange(boolean value)
value
- the new valuepublic int size()
Element
s in the Cell.
size
.public java.util.Iterator getElements()
Element
s.
Iterator
.public void clear()
Element
s of this Cell
.
public boolean isEmpty()
Cell
is empty.
false
if there are non-empty Element
s 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 ListItem
s, Row
s, Cell
s,
JPEG
s, GIF
s or PNG
s to a Cell
.
element
- The Element
to add
BadElementException
- if the method was called with a ListItem
, Row
or Cell
public boolean add(java.lang.Object o)
Object
to this cell.
add
in interface TextElementArray
o
- the object to add
true
private static Cell getDummyCell()
public PdfPCell createPdfPCell() throws BadElementException
BadElementException
public float top()
getTop()
instead
UnsupportedOperationException
.
top
in class Rectangle
public float getTop()
UnsupportedOperationException
.
getTop
in class Rectangle
public float bottom()
getBottom()
instead
UnsupportedOperationException
.
bottom
in class Rectangle
public float getBottom()
UnsupportedOperationException
.
getBottom
in class Rectangle
public float left()
getLeft()
instead
UnsupportedOperationException
.
left
in class Rectangle
public float getLeft()
UnsupportedOperationException
.
getLeft
in class Rectangle
public float right()
getRight()
instead
UnsupportedOperationException
.
right
in class Rectangle
public float getRight()
UnsupportedOperationException
.
getRight
in class Rectangle
public 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()
instead
public int verticalAlignment()
getVerticalAlignment()
instead
public java.lang.String cellWidth()
getWidthAsString()
instead
public int colspan()
getColspan()
instead
public int rowspan()
getRowspan()
instead
public float leading()
getLeading()
instead
public boolean header()
isHeader()
instead
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 |