![]() | |
| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
ArrayListcom.lowagie.text.PhrasePhrase is a series of Chunks.
A Phrase has a main Font, but some chunks
within the phrase can have a Font that differs from the
main Font. All the Chunks 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 aPhrasewithout specifying a leading.
public Phrase(Properties attributes)
Returns aPhrasethat has been constructed taking in account the value of some attributes.
- Parameters:
attributes- Some attributes
public Phrase(String string)
Constructs aPhrasewith a certainString.
- Parameters:
string- aString
public Phrase(String string,
Font font)Constructs aPhrasewith a certainStringand a certainFont.
- Parameters:
string- aStringfont- 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 aPhrasewith a certainChunk.
- Parameters:
chunk- aChunk
public Phrase(float leading)
Constructs aPhrasewith a certain leading.
- Parameters:
leading- the leading
public Phrase(float leading,
String string)Constructs aPhrasewith a certain leading and a certainString.
- Parameters:
leading- the leadingstring- aString
public Phrase(float leading,
String string,
Font font)Constructs aPhrasewith a certain leading, a certainStringand a certainFont.
- Parameters:
leading- the leadingstring- aStringfont- aFont
public Phrase(float leading,
Chunk chunk)Constructs aPhrasewith a certainChunkand a certain leading.
- Parameters:
leading- the leadingchunk- aChunk
public boolean add(Object o)
Adds aChunk,Anchoror anotherPhraseto thisPhrase.
- Specified by:
- add in interface TextElementArray
- Parameters:
o- an object of typeChunk,AnchororPhrase
- Returns:
- a boolean
public void add(int index,
Object o)Adds aChunk, anAnchoror anotherPhraseto thisPhrase.
- Parameters:
index- index at which the specified element is to be insertedo- an object of typeChunk,AnchororPhrase
public boolean addAll(Collection collection)
Adds a collection ofChunks to thisPhrase.
- Parameters:
collection- a collection ofChunks,Anchors andPhrases.
- Returns:
trueif the action succeeded,falseif 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 aObjectto 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 thisPhrasecontains no or 1 emptyChunk.
- Returns:
falseif thePhrasecontains more than one or more non-emptyChunks.
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:
trueif 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)