Class Anchor
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList
-
- com.gitlab.pdftk_java.com.lowagie.text.Phrase
-
- com.gitlab.pdftk_java.com.lowagie.text.Anchor
-
- All Implemented Interfaces:
Element
,MarkupAttributes
,TextElementArray
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable
,java.util.Collection
,java.util.List
,java.util.RandomAccess
public class Anchor extends Phrase implements TextElementArray, MarkupAttributes
AnAnchor
can be a reference or a destination of a reference.An
Anchor
is a special kind ofPhrase
. 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
Fields Modifier and Type Field Description static java.lang.String
ANCHOR
This is the anchor tag.protected java.lang.String
name
This is the name of theAnchor
.protected java.lang.String
reference
This is the reference of theAnchor
.private static long
serialVersionUID
-
Fields inherited from class com.gitlab.pdftk_java.com.lowagie.text.Phrase
font, leading, markupAttributes
-
Fields inherited from interface com.gitlab.pdftk_java.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, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, 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
Constructors Constructor Description Anchor()
Constructs anAnchor
without specifying a leading.Anchor(float leading)
Constructs anAnchor
with a certain leading.Anchor(float leading, Chunk chunk)
Constructs anAnchor
with a certainChunk
and a certain leading.Anchor(float leading, java.lang.String string)
Constructs anAnchor
with a certain leading and a certainString
.Anchor(float leading, java.lang.String string, Font font)
Constructs anAnchor
with a certain leading, a certainString
and a certainFont
.Anchor(Chunk chunk)
Constructs anAnchor
with a certainChunk
.Anchor(java.lang.String string)
Constructs anAnchor
with a certainString
.Anchor(java.lang.String string, Font font)
Constructs anAnchor
with a certainString
and a certainFont
.Anchor(java.util.Properties attributes)
Returns anAnchor
that has been constructed taking in account the value of some attributes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.ArrayList
getChunks()
Gets all the chunks in this element.java.util.Iterator
getElements()
Gets an iterator ofElement
s.static boolean
isTag(java.lang.String tag)
Checks if a given tag corresponds with this object.java.lang.String
name()
Returns the name of thisAnchor
.boolean
process(ElementListener listener)
Processes the element by adding it (or the different parts) to anElementListener
.java.lang.String
reference()
Gets the reference of thisAnchor
.void
setName(java.lang.String name)
Sets the name of thisAnchor
.void
setReference(java.lang.String reference)
Sets the reference of thisAnchor
.int
type()
Gets the type of the text element.java.net.URL
url()
Gets the reference of thisAnchor
.-
Methods inherited from class com.gitlab.pdftk_java.com.lowagie.text.Phrase
add, add, addAll, addSpecial, font, getInstance, getInstance, getInstance, getMarkupAttribute, getMarkupAttributeNames, getMarkupAttributes, isEmpty, leading, leadingDefined, setLeading, setMarkupAttribute, setMarkupAttributes
-
Methods inherited from class java.util.ArrayList
addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.gitlab.pdftk_java.com.lowagie.text.MarkupAttributes
getMarkupAttribute, getMarkupAttributeNames, getMarkupAttributes, setMarkupAttribute, setMarkupAttributes
-
Methods inherited from interface com.gitlab.pdftk_java.com.lowagie.text.TextElementArray
add
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
ANCHOR
public static final java.lang.String ANCHOR
This is the anchor tag.- See Also:
- Constant Field Values
-
name
protected java.lang.String name
This is the name of theAnchor
.
-
reference
protected java.lang.String reference
This is the reference of theAnchor
.
-
-
Constructor Detail
-
Anchor
public Anchor()
Constructs anAnchor
without specifying a leading.
-
Anchor
public Anchor(float leading)
Constructs anAnchor
with a certain leading.- Parameters:
leading
- the leading
-
Anchor
public Anchor(Chunk chunk)
Constructs anAnchor
with a certainChunk
.- Parameters:
chunk
- aChunk
-
Anchor
public Anchor(java.lang.String string)
Constructs anAnchor
with a certainString
.- Parameters:
string
- aString
-
Anchor
public Anchor(java.lang.String string, Font font)
Constructs anAnchor
with a certainString
and a certainFont
.- Parameters:
string
- aString
font
- aFont
-
Anchor
public Anchor(float leading, Chunk chunk)
Constructs anAnchor
with a certainChunk
and a certain leading.- Parameters:
leading
- the leadingchunk
- aChunk
-
Anchor
public Anchor(float leading, java.lang.String string)
Constructs anAnchor
with a certain leading and a certainString
.- Parameters:
leading
- the leadingstring
- aString
-
Anchor
public Anchor(float leading, java.lang.String string, Font font)
Constructs anAnchor
with a certain leading, a certainString
and a certainFont
.- Parameters:
leading
- the leadingstring
- aString
font
- aFont
-
Anchor
public Anchor(java.util.Properties attributes)
Returns anAnchor
that has been constructed taking in account the value of some attributes.- Parameters:
attributes
- Some attributes
-
-
Method Detail
-
process
public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to anElementListener
.
-
getChunks
public java.util.ArrayList getChunks()
Gets all the chunks in this element.
-
type
public int type()
Gets the type of the text element.
-
getElements
public java.util.Iterator getElements()
Gets an iterator ofElement
s.- Returns:
- an
Iterator
-
setName
public void setName(java.lang.String name)
Sets the name of thisAnchor
.- Parameters:
name
- a new name
-
setReference
public void setReference(java.lang.String reference)
Sets the reference of thisAnchor
.- Parameters:
reference
- a new reference
-
name
public java.lang.String name()
Returns the name of thisAnchor
.- Returns:
- a name
-
reference
public java.lang.String reference()
Gets the reference of thisAnchor
.- Returns:
- a reference
-
url
public java.net.URL url()
Gets the reference of thisAnchor
.- Returns:
- an
URL
-
isTag
public static boolean isTag(java.lang.String tag)
Checks if a given tag corresponds with this object.- Parameters:
tag
- the given tag- Returns:
- true if the tag corresponds
-
-