![]() | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
ArrayList
com.lowagie.text.Phrase
Phrase
is a series of Chunk
s.
A Phrase
has a main Font
, but some chunks
within the phrase can have a Font
that differs from the
main Font
. All the Chunk
s in a Phrase
have the same leading
.
Example:
// When no parameters are passed, the default leading = 16 Phrase phrase0 = new Phrase(); Phrase phrase1 = new Phrase("this is a phrase"); // In this example the leading is passed as a parameter Phrase phrase2 = new Phrase(16, "this is a phrase with leading 16"); // When a Font is passed (explicitely or embedded in a chunk), the default leading = 1.5 * size of the font Phrase phrase3 = new Phrase("this is a phrase with a red, normal font Courier, size 12", FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, new Color(255, 0, 0))); Phrase phrase4 = new Phrase(new Chunk("this is a phrase")); Phrase phrase5 = new Phrase(18, new Chunk("this is a phrase", FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0)));
Field Summary | |
protected Font |
|
protected float |
|
protected Properties |
|
private static long |
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 |
|
boolean |
|
private boolean | |
protected void |
|
String |
|
Font |
|
ArrayList |
|
static Phrase |
|
static Phrase |
|
static Phrase |
|
String |
|
Set | |
Properties | |
boolean |
|
static boolean |
|
float |
|
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
int |
|
protected float leading
This is the leading of this phrase.
protected Properties markupAttributes
Contains extra markupAttributes
private static final long serialVersionUID
- Field Value:
- 2643594602455068231L
public Phrase()
Constructs aPhrase
without specifying a leading.
public Phrase(Properties attributes)
Returns aPhrase
that has been constructed taking in account the value of some attributes.
- Parameters:
attributes
- Some attributes
public Phrase(String string)
Constructs aPhrase
with a certainString
.
- Parameters:
string
- aString
public Phrase(String string, Font font)
Constructs aPhrase
with a certainString
and a certainFont
.
- Parameters:
string
- aString
font
- aFont
private Phrase(boolean dummy)
Constructs a Phrase that can be used in the static getInstance() method.
- Parameters:
dummy
- a dummy parameter
public Phrase(Chunk chunk)
Constructs aPhrase
with a certainChunk
.
- Parameters:
chunk
- aChunk
public Phrase(float leading)
Constructs aPhrase
with a certain leading.
- Parameters:
leading
- the leading
public Phrase(float leading, String string)
Constructs aPhrase
with a certain leading and a certainString
.
- Parameters:
leading
- the leadingstring
- aString
public Phrase(float leading, String string, Font font)
Constructs aPhrase
with a certain leading, a certainString
and a certainFont
.
- Parameters:
leading
- the leadingstring
- aString
font
- aFont
public Phrase(float leading, Chunk chunk)
Constructs aPhrase
with a certainChunk
and a certain leading.
- Parameters:
leading
- the leadingchunk
- aChunk
public boolean add(Object o)
Adds aChunk
,Anchor
or anotherPhrase
to thisPhrase
.
- Specified by:
- add in interface TextElementArray
- Parameters:
o
- an object of typeChunk
,Anchor
orPhrase
- Returns:
- a boolean
public void add(int index, Object o)
Adds aChunk
, anAnchor
or anotherPhrase
to thisPhrase
.
- Parameters:
index
- index at which the specified element is to be insertedo
- an object of typeChunk
,Anchor
orPhrase
public boolean addAll(Collection collection)
Adds a collection ofChunk
s to thisPhrase
.
- Parameters:
collection
- a collection ofChunk
s,Anchor
s andPhrase
s.
- Returns:
true
if the action succeeded,false
if not.
private boolean addChunk(Chunk chunk)
Adds a Chunk. This method is a hack to solve a problem I had with phrases that were split between chunks in the wrong place.
- Parameters:
chunk
- a Chunk to add to the Phrase
- Returns:
- true if adding the Chunk succeeded
protected void addSpecial(Object object)
Adds aObject
to theParagraph
.
- Parameters:
object
- the object to add.
public String content()
Returns the content as a String object. This method differs from toString because toString will return an ArrayList with the toString value of the Chunks in this Phrase.
public ArrayList getChunks()
Gets all the chunks in this element.
- Returns:
- an
ArrayList
public static final Phrase getInstance(String string)
Gets a special kind of Phrase that changes some characters into corresponding symbols.
- Parameters:
string
-
- Returns:
- a newly constructed Phrase
public static final Phrase getInstance(int leading, String string)
Gets a special kind of Phrase that changes some characters into corresponding symbols.
- Parameters:
leading
-string
-
- Returns:
- a newly constructed Phrase
public static final Phrase getInstance(int leading, String string, Font font)
Gets a special kind of Phrase that changes some characters into corresponding symbols.
- Parameters:
leading
-string
-font
-
- Returns:
- a newly constructed Phrase
public String getMarkupAttribute(String name)
- Specified by:
- getMarkupAttribute in interface MarkupAttributes
- See Also:
com.lowagie.text.MarkupAttributes.getMarkupAttribute(java.lang.String)
public Set getMarkupAttributeNames()
- Specified by:
- getMarkupAttributeNames in interface MarkupAttributes
public Properties getMarkupAttributes()
- Specified by:
- getMarkupAttributes in interface MarkupAttributes
public boolean isEmpty()
Checks is thisPhrase
contains no or 1 emptyChunk
.
- Returns:
false
if thePhrase
contains more than one or more non-emptyChunk
s.
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 float leading()
Gets the leading of this phrase.
- Returns:
- the linespacing
public boolean leadingDefined()
Checks you if the leading of this phrase is defined.
- Returns:
- true if the leading is defined
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 void setLeading(float leading)
Sets the leading of this phrase.
- Parameters:
leading
- the new leading
public void setMarkupAttribute(String name, String value)
- Specified by:
- setMarkupAttribute in interface MarkupAttributes
- See Also:
com.lowagie.text.MarkupAttributes.setMarkupAttribute(java.lang.String, java.lang.String)
public void setMarkupAttributes(Properties markupAttributes)
- Specified by:
- setMarkupAttributes in interface MarkupAttributes
- See Also:
com.lowagie.text.MarkupAttributes.setMarkupAttributes(java.util.Properties)