Class Paragraph
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList
-
- com.gitlab.pdftk_java.com.lowagie.text.Phrase
-
- com.gitlab.pdftk_java.com.lowagie.text.Paragraph
-
- All Implemented Interfaces:
Element
,MarkupAttributes
,TextElementArray
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable
,java.util.Collection
,java.util.List
,java.util.RandomAccess
- Direct Known Subclasses:
ListItem
public class Paragraph extends Phrase implements TextElementArray, MarkupAttributes
AParagraph
is a series ofChunk
s and/orPhrases
.A
Paragraph
has the same qualities of aPhrase
, but also some additional layout-parameters:- the indentation
- the alignment of the text
Paragraph p = new Paragraph("This is a paragraph", FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)));
- See Also:
Element
,Phrase
,ListItem
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
alignment
The alignment of the text.private float
extraParagraphSpace
Holds value of property extraParagraphSpace.private float
firstLineIndent
Holds value of property firstLineIndent.protected float
indentationLeft
The indentation of this paragraph on the left side.protected float
indentationRight
The indentation of this paragraph on the right side.protected boolean
keeptogether
Does the paragraph has to be kept together on 1 page.protected float
multipliedLeading
The text leading that is multiplied by the biggest font size in the line.private static long
serialVersionUID
A serial version UIDprotected float
spacingAfter
The spacing after the paragraph.protected float
spacingBefore
The spacing before the paragraph.-
Fields inherited from class com.gitlab.pdftk_java.com.lowagie.text.Phrase
font, leading, markupAttributes
-
Fields inherited from interface com.gitlab.pdftk_java.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, GRAPHIC, HEADER, IMGRAW, IMGTEMPLATE, JPEG, KEYWORDS, LIST, LISTITEM, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE
-
-
Constructor Summary
Constructors Constructor Description Paragraph()
Constructs aParagraph
.Paragraph(float leading)
Constructs aParagraph
with a certain leading.Paragraph(float leading, Chunk chunk)
Constructs aParagraph
with a certainChunk
and a certain leading.Paragraph(float leading, java.lang.String string)
Constructs aParagraph
with a certainString
and a certain leading.Paragraph(float leading, java.lang.String string, Font font)
Constructs aParagraph
with a certain leading,String
andFont
.Paragraph(Chunk chunk)
Constructs aParagraph
with a certainChunk
.Paragraph(Phrase phrase)
Constructs aParagraph
with a certainPhrase
.Paragraph(java.lang.String string)
Constructs aParagraph
with a certainString
.Paragraph(java.lang.String string, Font font)
Constructs aParagraph
with a certainString
and a certainFont
.Paragraph(java.util.Properties attributes)
Returns aParagraph
that has been constructed taking in account the value of some attributes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(java.lang.Object o)
Adds anObject
to theParagraph
.int
alignment()
Gets the alignment of this paragraph.float
getExtraParagraphSpace()
Getter for property extraParagraphSpace.float
getFirstLineIndent()
Getter for property firstLineIndent.boolean
getKeepTogether()
Checks if this paragraph has to be kept together on one page.float
getMultipliedLeading()
Gets the variable leadingfloat
indentationLeft()
Gets the indentation of this paragraph on the left side.float
indentationRight()
Gets the indentation of this paragraph on the right side.static boolean
isTag(java.lang.String tag)
Checks if a given tag corresponds with this object.void
setAlignment(int alignment)
Sets the alignment of this paragraph.void
setAlignment(java.lang.String alignment)
Sets the alignment of this paragraph.void
setExtraParagraphSpace(float extraParagraphSpace)
Setter for property extraParagraphSpace.void
setFirstLineIndent(float firstLineIndent)
Setter for property firstLineIndent.void
setIndentationLeft(float indentation)
Sets the indentation of this paragraph on the left side.void
setIndentationRight(float indentation)
Sets the indentation of this paragraph on the right side.void
setKeepTogether(boolean keeptogether)
Indicates that the paragraph has to be kept together on one page.void
setLeading(float fixedLeading)
Sets the leading of this phrase.void
setLeading(float fixedLeading, float multipliedLeading)
Sets the leading fixed and variable.void
setSpacingAfter(float spacing)
Sets the spacing after this paragraph.void
setSpacingBefore(float spacing)
Sets the spacing before this paragraph.float
spacingAfter()
Gets the spacing before this paragraph.float
spacingBefore()
Gets the spacing before this paragraph.int
type()
Gets the type of the text element.-
Methods inherited from class com.gitlab.pdftk_java.com.lowagie.text.Phrase
add, addAll, addSpecial, font, getChunks, getInstance, getInstance, getInstance, getMarkupAttribute, getMarkupAttributeNames, getMarkupAttributes, isEmpty, leading, leadingDefined, process, setMarkupAttribute, setMarkupAttributes
-
Methods inherited from class java.util.ArrayList
addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.gitlab.pdftk_java.com.lowagie.text.Element
getChunks, process, toString
-
Methods inherited from interface com.gitlab.pdftk_java.com.lowagie.text.MarkupAttributes
getMarkupAttribute, getMarkupAttributeNames, getMarkupAttributes, setMarkupAttribute, setMarkupAttributes
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
A serial version UID- See Also:
- Constant Field Values
-
alignment
protected int alignment
The alignment of the text.
-
indentationLeft
protected float indentationLeft
The indentation of this paragraph on the left side.
-
indentationRight
protected float indentationRight
The indentation of this paragraph on the right side.
-
spacingBefore
protected float spacingBefore
The spacing before the paragraph.
-
spacingAfter
protected float spacingAfter
The spacing after the paragraph.
-
keeptogether
protected boolean keeptogether
Does the paragraph has to be kept together on 1 page.
-
multipliedLeading
protected float multipliedLeading
The text leading that is multiplied by the biggest font size in the line.
-
firstLineIndent
private float firstLineIndent
Holds value of property firstLineIndent.
-
extraParagraphSpace
private float extraParagraphSpace
Holds value of property extraParagraphSpace.
-
-
Constructor Detail
-
Paragraph
public Paragraph()
Constructs aParagraph
.
-
Paragraph
public Paragraph(float leading)
Constructs aParagraph
with a certain leading.- Parameters:
leading
- the leading
-
Paragraph
public Paragraph(Chunk chunk)
Constructs aParagraph
with a certainChunk
.- Parameters:
chunk
- aChunk
-
Paragraph
public Paragraph(float leading, Chunk chunk)
Constructs aParagraph
with a certainChunk
and a certain leading.- Parameters:
leading
- the leadingchunk
- aChunk
-
Paragraph
public Paragraph(java.lang.String string)
Constructs aParagraph
with a certainString
.- Parameters:
string
- aString
-
Paragraph
public Paragraph(java.lang.String string, Font font)
Constructs aParagraph
with a certainString
and a certainFont
.- Parameters:
string
- aString
font
- aFont
-
Paragraph
public Paragraph(float leading, java.lang.String string)
Constructs aParagraph
with a certainString
and a certain leading.- Parameters:
leading
- the leadingstring
- aString
-
Paragraph
public Paragraph(float leading, java.lang.String string, Font font)
Constructs aParagraph
with a certain leading,String
andFont
.- Parameters:
leading
- the leadingstring
- aString
font
- aFont
-
Paragraph
public Paragraph(Phrase phrase)
Constructs aParagraph
with a certainPhrase
.- Parameters:
phrase
- aPhrase
-
Paragraph
public Paragraph(java.util.Properties attributes)
Returns aParagraph
that has been constructed taking in account the value of some attributes.- Parameters:
attributes
- Some attributes
-
-
Method Detail
-
type
public int type()
Gets the type of the text element.
-
add
public boolean add(java.lang.Object o)
Adds anObject
to theParagraph
.- Specified by:
add
in interfacejava.util.Collection
- Specified by:
add
in interfacejava.util.List
- Specified by:
add
in interfaceTextElementArray
- Overrides:
add
in classPhrase
- Parameters:
o
- object the object to add.- Returns:
- true is adding the object succeeded
-
setAlignment
public void setAlignment(int alignment)
Sets the alignment of this paragraph.- Parameters:
alignment
- the new alignment
-
setAlignment
public void setAlignment(java.lang.String alignment)
Sets the alignment of this paragraph.- Parameters:
alignment
- the new alignment as aString
-
setIndentationLeft
public void setIndentationLeft(float indentation)
Sets the indentation of this paragraph on the left side.- Parameters:
indentation
- the new indentation
-
setIndentationRight
public void setIndentationRight(float indentation)
Sets the indentation of this paragraph on the right side.- Parameters:
indentation
- the new indentation
-
setSpacingBefore
public void setSpacingBefore(float spacing)
Sets the spacing before this paragraph.- Parameters:
spacing
- the new spacing
-
setSpacingAfter
public void setSpacingAfter(float spacing)
Sets the spacing after this paragraph.- Parameters:
spacing
- the new spacing
-
setKeepTogether
public void setKeepTogether(boolean keeptogether)
Indicates that the paragraph has to be kept together on one page.- Parameters:
keeptogether
- true of the paragraph may not be split over 2 pages
-
getKeepTogether
public boolean getKeepTogether()
Checks if this paragraph has to be kept together on one page.- Returns:
- true if the paragraph may not be split over 2 pages.
-
alignment
public int alignment()
Gets the alignment of this paragraph.- Returns:
- alignment
-
indentationLeft
public float indentationLeft()
Gets the indentation of this paragraph on the left side.- Returns:
- the indentation
-
indentationRight
public float indentationRight()
Gets the indentation of this paragraph on the right side.- Returns:
- the indentation
-
spacingBefore
public float spacingBefore()
Gets the spacing before this paragraph.- Returns:
- the spacing
-
spacingAfter
public float spacingAfter()
Gets the spacing before this paragraph.- Returns:
- the spacing
-
isTag
public static boolean isTag(java.lang.String tag)
Checks if a given tag corresponds with this object.- Parameters:
tag
- the given tag- Returns:
- true if the tag corresponds
-
setLeading
public void setLeading(float fixedLeading, float multipliedLeading)
Sets the leading fixed and variable. The resultant leading will be fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the size of the bigest font in the line.- Parameters:
fixedLeading
- the fixed leadingmultipliedLeading
- the variable leading
-
setLeading
public void setLeading(float fixedLeading)
Description copied from class:Phrase
Sets the leading of this phrase.- Overrides:
setLeading
in classPhrase
- Parameters:
fixedLeading
- the new leading- See Also:
Phrase.setLeading(float)
-
getMultipliedLeading
public float getMultipliedLeading()
Gets the variable leading- Returns:
- the leading
-
getFirstLineIndent
public float getFirstLineIndent()
Getter for property firstLineIndent.- Returns:
- Value of property firstLineIndent.
-
setFirstLineIndent
public void setFirstLineIndent(float firstLineIndent)
Setter for property firstLineIndent.- Parameters:
firstLineIndent
- New value of property firstLineIndent.
-
getExtraParagraphSpace
public float getExtraParagraphSpace()
Getter for property extraParagraphSpace.- Returns:
- Value of property extraParagraphSpace.
-
setExtraParagraphSpace
public void setExtraParagraphSpace(float extraParagraphSpace)
Setter for property extraParagraphSpace.- Parameters:
extraParagraphSpace
- New value of property extraParagraphSpace.
-
-