com.itextpdf.text
Class Anchor

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<Element>
              extended by com.itextpdf.text.Phrase
                  extended by com.itextpdf.text.Anchor
All Implemented Interfaces:
Element, TextElementArray, Serializable, Cloneable, Iterable<Element>, Collection<Element>, List<Element>, RandomAccess

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, Serialized Form

Field Summary
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.itextpdf.text.Phrase
font, hyphenation, leading
 
Fields inherited from class java.util.AbstractList
modCount
 
Fields inherited from interface com.itextpdf.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, CHAPTER, CHUNK, CREATIONDATE, CREATOR, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, YMARK
 
Constructor Summary
Anchor()
          Constructs an Anchor without specifying a leading.
Anchor(Chunk chunk)
          Constructs an Anchor with a certain Chunk.
Anchor(float leading)
          Constructs an Anchor with a certain leading.
Anchor(float leading, Chunk chunk)
          Constructs an Anchor with a certain Chunk and 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(Phrase phrase)
          Constructs an Anchor with a certain Phrase.
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.
 
Method Summary
 ArrayList<Chunk> getChunks()
          Gets all the chunks in this element.
 String getName()
          Returns the name of this Anchor.
 String getReference()
          Gets the reference of this Anchor.
 URL getUrl()
          Gets the reference of this Anchor.
 boolean process(ElementListener listener)
          Processes the element by adding it (or the different parts) to an ElementListener.
 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.
 
Methods inherited from class com.itextpdf.text.Phrase
add, add, add, addAll, addChunk, addSpecial, getContent, getFont, getHyphenation, getInstance, getInstance, getInstance, getLeading, hasLeading, isContent, isEmpty, isNestable, setFont, setHyphenation, setLeading
 
Methods inherited from class java.util.ArrayList
addAll, clear, clone, contains, ensureCapacity, get, indexOf, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.itextpdf.text.Element
toString
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

name

protected String name
This is the name of the Anchor.


reference

protected String reference
This is the reference of the Anchor.

Constructor Detail

Anchor

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


Anchor

public Anchor(float leading)
Constructs an Anchor with a certain leading.

Parameters:
leading - the leading

Anchor

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

Parameters:
chunk - a Chunk

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(float leading,
              Chunk chunk)
Constructs an Anchor with a certain Chunk and a certain leading.

Parameters:
leading - the leading
chunk - a Chunk

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(Phrase phrase)
Constructs an Anchor with a certain Phrase.

Parameters:
phrase - a Phrase
Method Detail

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 class Phrase
Parameters:
listener - an ElementListener
Returns:
true if the element was processed successfully

getChunks

public ArrayList<Chunk> getChunks()
Gets all the chunks in this element.

Specified by:
getChunks in interface Element
Overrides:
getChunks in class Phrase
Returns:
an ArrayList

type

public int type()
Gets the type of the text element.

Specified by:
type in interface Element
Overrides:
type in class Phrase
Returns:
a type

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

getName

public String getName()
Returns the name of this Anchor.

Returns:
a name

getReference

public String getReference()
Gets the reference of this Anchor.

Returns:
a reference

getUrl

public URL getUrl()
Gets the reference of this Anchor.

Returns:
an URL

Hosted by Hostbasket