Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
com.lowagie.text.Rectangle
com.lowagie.text.Cell
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");
Field Summary | |
protected ArrayList |
|
protected int |
|
protected boolean |
|
protected boolean |
|
protected int |
|
(package private) float |
|
protected int |
|
protected int |
|
(package private) String |
|
protected boolean |
|
protected boolean |
|
protected boolean |
|
protected int |
|
protected String |
|
Fields inherited from class com.lowagie.text.Rectangle | |
BOTTOM , BOX , LEFT , NO_BORDER , RIGHT , TOP , UNDEFINED , background , border , borderColorBottom , borderColorLeft , borderColorRight , borderColorTop , borderWidth , borderWidthBottom , borderWidthLeft , borderWidthRight , borderWidthTop , color , grayFill , llx , lly , markupAttributes , rotation , 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 , CCITTG3_1D , CCITTG3_2D , CCITTG4 , CCITT_BLACKIS1 , CCITT_ENCODEDBYTEALIGN , CCITT_ENDOFBLOCK , CCITT_ENDOFLINE , CELL , CHAPTER , CHUNK , CREATIONDATE , CREATOR , GRAPHIC , HEADER , IMGRAW , IMGTEMPLATE , JPEG , KEYWORDS , LIST , LISTITEM , MULTI_COLUMN_TEXT , PARAGRAPH , PHRASE , PRODUCER , PTABLE , RECTANGLE , ROW , SECTION , SUBJECT , TABLE , TITLE |
Constructor Summary | |
| |
| |
| |
| |
Method Summary | |
boolean |
|
void |
|
float |
|
float |
|
String |
|
void |
|
int |
|
(package private) void |
|
ArrayList |
|
static Cell |
|
Iterator |
|
boolean |
|
int |
|
String |
|
boolean |
|
int |
|
boolean |
|
boolean |
|
static boolean |
|
boolean |
|
boolean |
|
boolean |
|
float |
|
float |
|
float |
|
boolean |
|
boolean |
|
float |
|
float |
|
int |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
int |
|
float |
|
float |
|
int |
|
int |
|
protected ArrayList arrayList
This is theArrayList
ofElement
s.
protected int colspan
This is the colspan.
protected boolean groupChange
Does thisCell
force a group change?
protected boolean header
Is thisCell
a header?
protected int horizontalAlignment
This is the horizontal alignment.
(package private) float leading
This is the leading.
protected int maxLines
Maximum number of lines allowed in the cell. The default value of this property is not to limit the maximum number of lines (contributed by dperezcar@fcc.es)
protected int rowspan
This is the rowspan.
(package private) String showTruncation
If a truncation happens due to themaxLines
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
Indicates that the largest ascender height should be used to determine the height of the first line. Note that this only has an effect when rendered to PDF. Setting this to true can help with vertical alignment problems.
protected boolean useBorderPadding
Adjusts the cell contents to compensate for border widths. Note that this only has an effect when rendered to PDF.
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). Note that this only has an effect when rendered to PDF.
protected int verticalAlignment
This is the vertical alignment.
protected String width
This is the vertical alignment.
public Cell()
Constructs an emptyCell
.
public Cell(Properties attributes)
Returns aCell
that has been constructed taking in account the value of some attributes.
- Parameters:
attributes
- Some attributes
public Cell(String content)
Constructs aCell
with a certain content. TheString
will be converted into aParagraph
.
- Parameters:
content
- aString
public Cell(boolean dummy)
Constructs an emptyCell
(for internal use only).
- Parameters:
dummy
- a dummy value
public Cell(Element element) throws BadElementException
Constructs aCell
with a certainElement
. if the element is aListItem
,Row
orCell
, an exception will be thrown.
- Parameters:
element
- the element
- Throws:
BadElementException
- when the creator was called with aListItem
,Row
orCell
public boolean add(Object o)
Add anObject
to this cell.
- Specified by:
- add in interface TextElementArray
- Parameters:
o
- the object to add
- Returns:
- always
true
public void addElement(Element element) throws BadElementException
Adds an element to thisCell
. Remark: you can't addListItem
s,Row
s,Cell
s,JPEG
s,GIF
s orPNG
s to aCell
.
- Parameters:
element
- TheElement
to add
- Throws:
BadElementException
- if the method was called with aListItem
,Row
orCell
public float bottom()
This method throws anUnsupportedOperationException
.
- Returns:
- NA
public float bottom(int margin)
This method throws anUnsupportedOperationException
.
- Parameters:
margin
-
- Returns:
- NA
public String cellWidth()
Gets the width.
- Returns:
- a value
public void clear()
Clears all theElement
s of thisCell
.
public int colspan()
Gets the colspan.
- Returns:
- a value
(package private) void fill()
Makes sure there is at least 1 object in the Cell. Otherwise it might not be shown in the table.
public ArrayList getChunks()
Gets all the chunks in this element.
- Returns:
- an
ArrayList
public static Cell getDummyCell()
Get dummy cell used when merging inner tables.
- Returns:
- a cell with colspan 3 and no border
public Iterator getElements()
Gets an iterator ofElement
s.
- Returns:
- an
Iterator
.
public boolean getGroupChange()
Does thisCell
force a group change?
- Returns:
- a value
public String getShowTruncation()
Getter forshowTruncation
- Returns:
- the showTruncation value
public boolean header()
Is thisCell
a header?
- Returns:
- a value
public int horizontalAlignment()
Gets the horizontal alignment.
- Returns:
- a value
public boolean isEmpty()
Checks if theCell
is empty.
- Returns:
false
if there are non-emptyElement
s in theCell
.
public boolean isTable()
Checks if theCell
is empty.
- Returns:
false
if there are non-emptyElement
s in theCell
.
public static boolean isTag(String tag)
Checks if a given tag corresponds with this object.
- Parameters:
tag
- the given tag
- Returns:
- true if the tag corresponds
public boolean isUseBorderPadding()
Gets the value ofuseBorderPadding
.
- Returns:
- useBorderPadding
public float leading()
Gets the leading.
- Returns:
- a value
public float left()
This method throws anUnsupportedOperationException
.
- Returns:
- NA
public float left(int margin)
This method throws anUnsupportedOperationException
.
- Parameters:
margin
-
- Returns:
- NA
public boolean noWrap()
Get nowrap.
- Returns:
- a value
public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to anElementListener
.
- Parameters:
listener
- anElementListener
- Returns:
true
if the element was processed successfully
public float right()
This method throws anUnsupportedOperationException
.
- Returns:
- NA
public float right(int margin)
This method throws anUnsupportedOperationException
.
- Parameters:
margin
- NA
- Returns:
- NA
public int rowspan()
Gets the rowspan.
- Returns:
- a value
public void setBottom(int value)
This method throws anUnsupportedOperationException
.
- Parameters:
value
- NA
public void setColspan(int value)
Sets the colspan.
- Parameters:
value
- the new value
public void setGroupChange(boolean value)
Sets group change.
- Parameters:
value
- the new value
public void setHeader(boolean value)
Sets header.
- Parameters:
value
- the new value
public void setHorizontalAlignment(String alignment)
Sets the alignment of this cell.
- Parameters:
alignment
- the new alignment as aString
public void setHorizontalAlignment(int value)
Sets the horizontal alignment.
- Parameters:
value
- the new value
public void setLeading(float value)
Sets the leading.
- Parameters:
value
- the new value
public void setLeft(int value)
This method throws anUnsupportedOperationException
.
- Parameters:
value
- NA
public void setMaxLines(int value)
Setter formaxLines
- Parameters:
value
- the maximum number of lines
public void setNoWrap(boolean value)
Set nowrap.
- Parameters:
value
- the new value
public void setRight(int value)
This method throws anUnsupportedOperationException
.
- Parameters:
value
- NA
public void setRowspan(int value)
Sets the rowspan.
- Parameters:
value
- the new value
public void setShowTruncation(String value)
Setter forshowTruncation
- Parameters:
value
- Can be null for avoiding marking the truncation.
public void setTop(int value)
This method throws anUnsupportedOperationException
.
- Parameters:
value
- NA
public void setUseAscender(boolean use)
Sets the value ofuseAscender
.
- Parameters:
use
- use ascender height if true
public void setUseBorderPadding(boolean use)
Sets the value ofuseBorderPadding
.
- Parameters:
use
- adjust layour for borders if true
public void setUseDescender(boolean use)
Sets the value ofuseDescender
.
- Parameters:
use
- use descender height if true
public void setVerticalAlignment(String alignment)
Sets the alignment of this paragraph.
- Parameters:
alignment
- the new alignment as aString
public void setVerticalAlignment(int value)
Sets the vertical alignment.
- Parameters:
value
- the new value
public void setWidth(String value)
Sets the width.
- Parameters:
value
- the new value
public int size()
Gets the number ofElement
s in the Cell.
- Returns:
- a
size
.
public float top()
This method throws anUnsupportedOperationException
.
- Returns:
- NA
public float top(int margin)
This method throws anUnsupportedOperationException
.
- Parameters:
margin
-
- Returns:
- NA
public int type()
Gets the type of the text element.
- Returns:
- a type
public int verticalAlignment()
Gets the vertical alignment.
- Returns:
- a value