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,Serializable,Cloneable,Iterable,Collection,List,RandomAccess
public class Anchor extends Phrase implements TextElementArray, MarkupAttributes
AnAnchorcan be a reference or a destination of a reference.An
Anchoris 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 StringANCHORThis is the anchor tag.protected StringnameThis is the name of theAnchor.protected StringreferenceThis is the reference of theAnchor.-
Fields inherited from class com.gitlab.pdftk_java.com.lowagie.text.Phrase
font, leading, markupAttributes
-
Fields inherited from class java.util.AbstractList
modCount
-
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 anAnchorwithout specifying a leading.Anchor(float leading)Constructs anAnchorwith a certain leading.Anchor(float leading, Chunk chunk)Constructs anAnchorwith a certainChunkand a certain leading.Anchor(float leading, String string)Constructs anAnchorwith a certain leading and a certainString.Anchor(float leading, String string, Font font)Constructs anAnchorwith a certain leading, a certainStringand a certainFont.Anchor(Chunk chunk)Constructs anAnchorwith a certainChunk.Anchor(String string)Constructs anAnchorwith a certainString.Anchor(String string, Font font)Constructs anAnchorwith a certainStringand a certainFont.Anchor(Properties attributes)Returns anAnchorthat 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 ArrayListgetChunks()Gets all the chunks in this element.IteratorgetElements()Gets an iterator ofElements.static booleanisTag(String tag)Checks if a given tag corresponds with this object.Stringname()Returns the name of thisAnchor.booleanprocess(ElementListener listener)Processes the element by adding it (or the different parts) to anElementListener.Stringreference()Gets the reference of thisAnchor.voidsetName(String name)Sets the name of thisAnchor.voidsetReference(String reference)Sets the reference of thisAnchor.inttype()Gets the type of the text element.URLurl()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.util.AbstractCollection
containsAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.List
containsAll
-
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
-
ANCHOR
public static final String ANCHOR
This is the anchor tag.- See Also:
- Constant Field Values
-
name
protected String name
This is the name of theAnchor.
-
reference
protected String reference
This is the reference of theAnchor.
-
-
Constructor Detail
-
Anchor
public Anchor()
Constructs anAnchorwithout specifying a leading.
-
Anchor
public Anchor(float leading)
Constructs anAnchorwith a certain leading.- Parameters:
leading- the leading
-
Anchor
public Anchor(Chunk chunk)
Constructs anAnchorwith a certainChunk.- Parameters:
chunk- aChunk
-
Anchor
public Anchor(String string)
Constructs anAnchorwith a certainString.- Parameters:
string- aString
-
Anchor
public Anchor(String string, Font font)
Constructs anAnchorwith a certainStringand a certainFont.- Parameters:
string- aStringfont- aFont
-
Anchor
public Anchor(float leading, Chunk chunk)Constructs anAnchorwith a certainChunkand a certain leading.- Parameters:
leading- the leadingchunk- aChunk
-
Anchor
public Anchor(float leading, String string)Constructs anAnchorwith a certain leading and a certainString.- Parameters:
leading- the leadingstring- aString
-
Anchor
public Anchor(float leading, String string, Font font)Constructs anAnchorwith a certain leading, a certainStringand a certainFont.- Parameters:
leading- the leadingstring- aStringfont- aFont
-
Anchor
public Anchor(Properties attributes)
Returns anAnchorthat 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 ArrayList getChunks()
Gets all the chunks in this element.
-
type
public int type()
Gets the type of the text element.
-
getElements
public Iterator getElements()
Gets an iterator ofElements.- Returns:
- an
Iterator
-
setName
public void setName(String name)
Sets the name of thisAnchor.- Parameters:
name- a new name
-
setReference
public void setReference(String reference)
Sets the reference of thisAnchor.- Parameters:
reference- a new reference
-
name
public String name()
Returns the name of thisAnchor.- Returns:
- a name
-
reference
public String reference()
Gets the reference of thisAnchor.- Returns:
- a reference
-
url
public URL url()
Gets the reference of thisAnchor.- Returns:
- an
URL
-
isTag
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
-
-