|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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. |
protected int |
maxLines
Maximum number of lines allowed in the cell. |
protected boolean |
percentage
|
protected int |
rowspan
The rowspan of the cell. |
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, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK |
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.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(int margin)
This method throws an UnsupportedOperationException . |
void |
clear()
Clears all the Element s of this Cell . |
PdfPCell |
createPdfPCell()
Creates a PdfPCell based on this Cell object. |
float |
getBottom()
This method throws an UnsupportedOperationException . |
java.util.ArrayList |
getChunks()
Gets all the chunks in this element. |
int |
getColspan()
Gets the colspan. |
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 |
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 |
left(int margin)
This method throws an UnsupportedOperationException . |
boolean |
process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener . |
float |
right(int margin)
This method throws an UnsupportedOperationException . |
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 |
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(int margin)
This method throws an UnsupportedOperationException . |
int |
type()
Gets the type of the text element. |
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 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
protected boolean header
Cell
a header?
protected int maxLines
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
Method 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)
value
- the maximum number of linespublic int getMaxLines()
public void setShowTruncation(java.lang.String value)
value
- Can be null for avoiding marking the truncation.public java.lang.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 layout 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()
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
.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
public PdfPCell createPdfPCell() throws BadElementException
BadElementException
public float getTop()
UnsupportedOperationException
.
getTop
in class Rectangle
public float getBottom()
UnsupportedOperationException
.
getBottom
in class Rectangle
public float getLeft()
UnsupportedOperationException
.
getLeft
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
- NA
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |