com.lowagie.text

Class Anchor

Implemented Interfaces:
Element, TextElementArray

public class Anchor
extends Phrase

An Anchor can be a reference or a destination of a reference.

An Anchor is a special kind of Phrase. It is constructed in the same way.

Example:

 Anchor anchor = new Anchor("this is a link");
 anchor.setName("LINK");
 anchor.setReference("http://www.lowagie.com");
 
See Also:
Element, Phrase

Field Summary

static String
ANCHOR
This is the anchor tag.
protected String
name
This is the name of the Anchor.
protected String
reference
This is the reference of the Anchor.
private static long
serialVersionUID

Fields inherited from class com.lowagie.text.Phrase

font, leading, markupAttributes, serialVersionUID

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, HEADER, IMGRAW, IMGTEMPLATE, JPEG, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE

Constructor Summary

Anchor()
Constructs an Anchor without specifying a leading.
Anchor(Properties attributes)
Returns an Anchor that has been constructed taking in account the value of some attributes.
Anchor(String string)
Constructs an Anchor with a certain String.
Anchor(String string, Font font)
Constructs an Anchor with a certain String and a certain Font.
Anchor(Chunk chunk)
Constructs an Anchor with a certain Chunk.
Anchor(float leading)
Constructs an Anchor with a certain leading.
Anchor(float leading, String string)
Constructs an Anchor with a certain leading and a certain String.
Anchor(float leading, String string, Font font)
Constructs an Anchor with a certain leading, a certain String and a certain Font.
Anchor(float leading, Chunk chunk)
Constructs an Anchor with a certain Chunk and a certain leading.

Method Summary

ArrayList
getChunks()
Gets all the chunks in this element.
Iterator
getElements()
Gets an iterator of Elements.
static boolean
isTag(String tag)
Checks if a given tag corresponds with this object.
String
name()
Returns the name of this Anchor.
boolean
process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener.
String
reference()
Gets the reference of this Anchor.
void
setName(String name)
Sets the name of this Anchor.
void
setReference(String reference)
Sets the reference of this Anchor.
int
type()
Gets the type of the text element.
URL
url()
Gets the reference of this Anchor.

Methods inherited from class com.lowagie.text.Phrase

add, add, addAll, addChunk, addSpecial, content, font, getChunks, getInstance, getInstance, getInstance, isEmpty, isTag, leading, leadingDefined, process, setLeading, type

Field Details

ANCHOR

public static final String ANCHOR
This is the anchor tag.

name

protected String name
This is the name of the Anchor.

reference

protected String reference
This is the reference of the Anchor.

serialVersionUID

private static final long serialVersionUID
Field Value:
-852278536049236911L

Constructor Details

Anchor

public Anchor()
Constructs an Anchor without specifying a leading.

Anchor

public Anchor(Properties attributes)
Returns an Anchor that has been constructed taking in account the value of some attributes.
Parameters:
attributes - Some attributes

Anchor

public Anchor(String string)
Constructs an Anchor with a certain String.
Parameters:
string - a String

Anchor

public Anchor(String string,
              Font font)
Constructs an Anchor with a certain String and a certain Font.
Parameters:
string - a String
font - a Font

Anchor

public Anchor(Chunk chunk)
Constructs an Anchor with a certain Chunk.
Parameters:
chunk - a Chunk

Anchor

public Anchor(float leading)
Constructs an Anchor with a certain leading.
Parameters:
leading - the leading

Anchor

public Anchor(float leading,
              String string)
Constructs an Anchor with a certain leading and a certain String.
Parameters:
leading - the leading
string - a String

Anchor

public Anchor(float leading,
              String string,
              Font font)
Constructs an Anchor with a certain leading, a certain String and a certain Font.
Parameters:
leading - the leading
string - a String
font - a Font

Anchor

public Anchor(float leading,
              Chunk chunk)
Constructs an Anchor with a certain Chunk and a certain leading.
Parameters:
leading - the leading
chunk - a Chunk

Method Details

getChunks

public ArrayList getChunks()
Gets all the chunks in this element.
Specified by:
getChunks in interface Element
Overrides:
getChunks in interface Phrase
Returns:
an ArrayList

getElements

public Iterator getElements()
Gets an iterator of Elements.
Returns:
an Iterator

isTag

public static boolean isTag(String tag)
Checks if a given tag corresponds with this object.
Overrides:
isTag in interface Phrase
Parameters:
tag - the given tag
Returns:
true if the tag corresponds

name

public String name()
Returns the name of this Anchor.
Returns:
a name

process

public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener.
Specified by:
process in interface Element
Overrides:
process in interface Phrase
Parameters:
listener - an ElementListener
Returns:
true if the element was processed successfully

reference

public String reference()
Gets the reference of this Anchor.
Returns:
a reference

setName

public void setName(String name)
Sets the name of this Anchor.
Parameters:
name - a new name

setReference

public void setReference(String reference)
Sets the reference of this Anchor.
Parameters:
reference - a new reference

type

public int type()
Gets the type of the text element.
Specified by:
type in interface Element
Overrides:
type in interface Phrase
Returns:
a type

url

public URL url()
Gets the reference of this Anchor.
Returns:
an URL