Constructor: |
public Anchor() {
super(16);
}
Constructs an Anchor without specifying a leading. |
public Anchor(float leading) {
super(leading);
}
Constructs an Anchor with a certain leading. Parameters:
leading - the leading
|
public Anchor(Chunk chunk) {
super(chunk);
}
Constructs an Anchor with a certain Chunk . Parameters:
chunk - a Chunk
|
public Anchor(String string) {
super(string);
}
Constructs an Anchor with a certain String . Parameters:
string - a String
|
public Anchor(Phrase phrase) {
super(phrase);
if (phrase instanceof Anchor) {
Anchor a = (Anchor) phrase;
setName(a.name);
setReference(a.reference);
}
}
Constructs an Anchor with a certain Phrase . Parameters:
phrase - a Phrase
|
public Anchor(String string,
Font font) {
super(string, font);
}
Constructs an Anchor with a certain String
and a certain Font . Parameters:
string - a String
font - a Font
|
public Anchor(float leading,
Chunk chunk) {
super(leading, chunk);
}
Constructs an Anchor with a certain Chunk
and a certain leading. Parameters:
leading - the leading
chunk - a Chunk
|
public Anchor(float leading,
String string) {
super(leading, string);
}
Constructs an Anchor with a certain leading
and a certain String . Parameters:
leading - the leading
string - a String
|
public Anchor(float leading,
String string,
Font font) {
super(leading, string, 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
|
Method from com.lowagie.text.Anchor Detail: |
public ArrayList getChunks() {
ArrayList tmp = new ArrayList();
Chunk chunk;
Iterator i = iterator();
boolean localDestination = (reference != null && reference.startsWith("#"));
boolean notGotoOK = true;
while (i.hasNext()) {
chunk = (Chunk) i.next();
if (name != null && notGotoOK && !chunk.isEmpty()) {
chunk.setLocalDestination(name);
notGotoOK = false;
}
if (localDestination) {
chunk.setLocalGoto(reference.substring(1));
}
else if (reference != null)
chunk.setAnchor(reference);
tmp.add(chunk);
}
return tmp;
}
Gets all the chunks in this element. |
public String getName() {
return name;
}
Returns the name of this Anchor . |
public String getReference() {
return reference;
}
Gets the reference of this Anchor . |
public URL getUrl() {
try {
return new URL(reference);
}
catch(MalformedURLException mue) {
return null;
}
}
Gets the reference of this Anchor . |
public boolean process(ElementListener listener) {
try {
Chunk chunk;
Iterator i = getChunks().iterator();
boolean localDestination = (reference != null && reference.startsWith("#"));
boolean notGotoOK = true;
while (i.hasNext()) {
chunk = (Chunk) i.next();
if (name != null && notGotoOK && !chunk.isEmpty()) {
chunk.setLocalDestination(name);
notGotoOK = false;
}
if (localDestination) {
chunk.setLocalGoto(reference.substring(1));
}
listener.add(chunk);
}
return true;
}
catch(DocumentException de) {
return false;
}
}
Processes the element by adding it (or the different parts) to an
ElementListener . |
public void setName(String name) {
this.name = name;
}
Sets the name of this Anchor . |
public void setReference(String reference) {
this.reference = reference;
}
Sets the reference of this Anchor . |
public int type() {
return Element.ANCHOR;
}
Gets the type of the text element. |