| java.util.ArrayList com.lowagie.text.Phrase
All known Subclasses: com.lowagie.text.Anchor, com.lowagie.text.Paragraph,
Phrase | public class Phrase extends ArrayList implements TextElementArray(Code) | | A 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)));
See Also: Element See Also: Chunk See Also: Paragraph See Also: Anchor |
Field Summary | |
protected Font | font This is the font of this phrase. | protected float | leading This is the leading of this phrase. |
Constructor Summary | |
public | Phrase() Constructs a Phrase without specifying a leading. | public | Phrase(Phrase phrase) Copy constructor for Phrase . | public | Phrase(float leading) Constructs a Phrase with a certain leading. | public | Phrase(Chunk chunk) Constructs a Phrase with a certain Chunk . | public | Phrase(float leading, Chunk chunk) Constructs a Phrase with a certain Chunk
and a certain leading. | public | Phrase(String string) Constructs a Phrase with a certain String . | public | Phrase(String string, Font font) Constructs a Phrase with a certain String and a certain Font . | public | Phrase(float leading, String string) Constructs a Phrase with a certain leading and a certain String . | public | Phrase(float leading, String string, Font font) Constructs a Phrase with a certain leading, a certain String
and a certain Font . | public | Phrase(Properties attributes) Returns a Phrase that has been constructed taking in account
the value of some attributes. |
Method Summary | |
public void | add(int index, Object o) Adds a Chunk , an Anchor or another Phrase
to this Phrase . | public boolean | add(Object o) Adds a Chunk , Anchor or another Phrase
to this Phrase . | public boolean | addAll(Collection collection) Adds a collection of Chunk s
to this Phrase . | protected boolean | addChunk(Chunk chunk) Adds a Chunk. | protected void | addSpecial(Object object) Adds a Object to the Paragraph . | public String | content() Returns the content as a String object. | public Font | font() Gets the font of the first Chunk that appears in this Phrase . | public ArrayList | getChunks() Gets all the chunks in this element. | public String | getContent() Returns the content as a String object. | public Font | getFont() Gets the font of the first Chunk that appears in this Phrase . | final public static Phrase | getInstance(String string) Gets a special kind of Phrase that changes some characters into corresponding symbols. | final public static Phrase | getInstance(int leading, String string) Gets a special kind of Phrase that changes some characters into corresponding symbols. | final public static Phrase | getInstance(int leading, String string, Font font) Gets a special kind of Phrase that changes some characters into corresponding symbols. | public float | getLeading() Gets the leading of this phrase. | public boolean | hasLeading() Checks you if the leading of this phrase is defined. | public boolean | isEmpty() Checks is this Phrase contains no or 1 empty Chunk . | public float | leading() Gets the leading of this phrase. | public boolean | leadingDefined() Checks you if the leading of this phrase is defined. | public boolean | process(ElementListener listener) Processes the element by adding it (or the different parts) to an
ElementListener . | public void | setFont(Font font) Sets the main font of this phrase. | public void | setLeading(float leading) Sets the leading of this phrase. | public int | type() Gets the type of the text element. |
font | protected Font font(Code) | | This is the font of this phrase.
|
leading | protected float leading(Code) | | This is the leading of this phrase.
|
Phrase | public Phrase()(Code) | | Constructs a Phrase without specifying a leading.
|
Phrase | public Phrase(Phrase phrase)(Code) | | Copy constructor for Phrase .
|
Phrase | public Phrase(float leading)(Code) | | Constructs a Phrase with a certain leading.
Parameters: leading - the leading |
Phrase | public Phrase(Chunk chunk)(Code) | | Constructs a Phrase with a certain Chunk .
Parameters: chunk - a Chunk |
Phrase | public Phrase(float leading, Chunk chunk)(Code) | | Constructs a Phrase with a certain Chunk
and a certain leading.
Parameters: leading - the leading Parameters: chunk - a Chunk |
Phrase | public Phrase(String string)(Code) | | Constructs a Phrase with a certain String .
Parameters: string - a String |
Phrase | public Phrase(String string, Font font)(Code) | | Constructs a Phrase with a certain String and a certain Font .
Parameters: string - a String Parameters: font - a Font |
Phrase | public Phrase(float leading, String string)(Code) | | Constructs a Phrase with a certain leading and a certain String .
Parameters: leading - the leading Parameters: string - a String |
Phrase | public Phrase(float leading, String string, Font font)(Code) | | Constructs a Phrase with a certain leading, a certain String
and a certain Font .
Parameters: leading - the leading Parameters: string - a String Parameters: font - a Font |
Phrase | public Phrase(Properties attributes)(Code) | | Returns a Phrase that has been constructed taking in account
the value of some attributes.
Parameters: attributes - Some attributes |
add | public void add(int index, Object o)(Code) | | Adds a Chunk , an Anchor or another Phrase
to this Phrase .
Parameters: index - index at which the specified element is to be inserted Parameters: o - an object of type Chunk , Anchor or Phrase throws: ClassCastException - when you try to add something that isn't a Chunk , Anchor or Phrase |
add | public boolean add(Object o)(Code) | | Adds a Chunk , Anchor or another Phrase
to this Phrase .
Parameters: o - an object of type Chunk , Anchor or Phrase a boolean throws: ClassCastException - when you try to add something that isn't a Chunk , Anchor or Phrase |
addAll | public boolean addAll(Collection collection)(Code) | | Adds a collection of Chunk s
to this Phrase .
Parameters: collection - a collection of Chunk s, Anchor s and Phrase s. true if the action succeeded, false if not. throws: ClassCastException - when you try to add something that isn't a Chunk , Anchor or Phrase |
addChunk | protected boolean addChunk(Chunk chunk)(Code) | | 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 true if adding the Chunk succeeded |
addSpecial | protected void addSpecial(Object object)(Code) | | Adds a Object to the Paragraph .
Parameters: object - the object to add. |
content | public String content()(Code) | | 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.
Phrase.getContent() |
getChunks | public ArrayList getChunks()(Code) | | Gets all the chunks in this element.
an ArrayList |
getContent | public String getContent()(Code) | | 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.
|
getFont | public Font getFont()(Code) | | Gets the font of the first Chunk that appears in this Phrase .
a Font |
getInstance | final public static Phrase getInstance(String string)(Code) | | Gets a special kind of Phrase that changes some characters into corresponding symbols.
Parameters: string - a newly constructed Phrase |
getInstance | final public static Phrase getInstance(int leading, String string)(Code) | | Gets a special kind of Phrase that changes some characters into corresponding symbols.
Parameters: leading - Parameters: string - a newly constructed Phrase |
getInstance | final public static Phrase getInstance(int leading, String string, Font font)(Code) | | Gets a special kind of Phrase that changes some characters into corresponding symbols.
Parameters: leading - Parameters: string - Parameters: font - a newly constructed Phrase |
getLeading | public float getLeading()(Code) | | Gets the leading of this phrase.
the linespacing |
hasLeading | public boolean hasLeading()(Code) | | Checks you if the leading of this phrase is defined.
true if the leading is defined |
isEmpty | public boolean isEmpty()(Code) | | Checks is this Phrase contains no or 1 empty Chunk .
false if the Phrase contains more than one or more non-emptyChunk s. |
leadingDefined | public boolean leadingDefined()(Code) | | Checks you if the leading of this phrase is defined.
true if the leading is definedPhrase.hasLeading() |
process | public boolean process(ElementListener listener)(Code) | | Processes the element by adding it (or the different parts) to an
ElementListener .
Parameters: listener - an ElementListener true if the element was processed successfully |
setFont | public void setFont(Font font)(Code) | | Sets the main font of this phrase.
Parameters: font - the new font |
setLeading | public void setLeading(float leading)(Code) | | Sets the leading of this phrase.
Parameters: leading - the new leading |
type | public int type()(Code) | | Gets the type of the text element.
a type |
|
|