📄 annotation.java
字号:
* @param llx
* @param lly
* @param urx
* @param ury
* @param moviePath
* path to the media clip file
* @param mimeType
* mime type of the media
* @param showOnDisplay
* if true play on display of the page
*/
public Annotation(float llx, float lly, float urx, float ury,
String moviePath, String mimeType, boolean showOnDisplay) {
this(llx, lly, urx, ury);
annotationtype = SCREEN;
annotationAttributes.put(FILE, moviePath);
annotationAttributes.put(MIMETYPE, mimeType);
annotationAttributes.put(PARAMETERS, new boolean[] {
false /* embedded */, showOnDisplay });
}
/**
* Constructs an <CODE>Annotation</CODE>.
*
* @param llx
* the lower left x-value
* @param lly
* the lower left y-value
* @param urx
* the upper right x-value
* @param ury
* the upper right y-value
* @param file
* an external PDF file
* @param page
* a page number in this file
*/
public Annotation(float llx, float lly, float urx, float ury, String file,
int page) {
this(llx, lly, urx, ury);
annotationtype = FILE_PAGE;
annotationAttributes.put(FILE, file);
annotationAttributes.put(PAGE, new Integer(page));
}
/**
* Constructs an <CODE>Annotation</CODE>.
*
* @param llx
* the lower left x-value
* @param lly
* the lower left y-value
* @param urx
* the upper right x-value
* @param ury
* the upper right y-value
* @param named
* a named destination in this file
*/
public Annotation(float llx, float lly, float urx, float ury, int named) {
this(llx, lly, urx, ury);
annotationtype = NAMED_DEST;
annotationAttributes.put(NAMED, new Integer(named));
}
/**
* Constructs an <CODE>Annotation</CODE>.
*
* @param llx
* the lower left x-value
* @param lly
* the lower left y-value
* @param urx
* the upper right x-value
* @param ury
* the upper right y-value
* @param application
* an external application
* @param parameters
* parameters to pass to this application
* @param operation
* the operation to pass to this application
* @param defaultdir
* the default directory to run this application in
*/
public Annotation(float llx, float lly, float urx, float ury,
String application, String parameters, String operation,
String defaultdir) {
this(llx, lly, urx, ury);
annotationtype = LAUNCH;
annotationAttributes.put(APPLICATION, application);
annotationAttributes.put(PARAMETERS, parameters);
annotationAttributes.put(OPERATION, operation);
annotationAttributes.put(DEFAULTDIR, defaultdir);
}
// implementation of the Element-methods
/**
* Gets the type of the text element.
*
* @return a type
*/
public int type() {
return Element.ANNOTATION;
}
/**
* Processes the element by adding it (or the different parts) to an <CODE>
* ElementListener</CODE>.
*
* @param listener
* an <CODE>ElementListener</CODE>
* @return <CODE>true</CODE> if the element was processed successfully
*/
public boolean process(ElementListener listener) {
try {
return listener.add(this);
} catch (DocumentException de) {
return false;
}
}
/**
* Gets all the chunks in this element.
*
* @return an <CODE>ArrayList</CODE>
*/
public ArrayList getChunks() {
return new ArrayList();
}
// methods
/**
* Sets the dimensions of this annotation.
*
* @param llx
* the lower left x-value
* @param lly
* the lower left y-value
* @param urx
* the upper right x-value
* @param ury
* the upper right y-value
*/
public void setDimensions(float llx, float lly, float urx, float ury) {
this.llx = llx;
this.lly = lly;
this.urx = urx;
this.ury = ury;
}
// methods to retrieve information
/**
* Returns the lower left x-value.
*
* @return a value
*/
public float llx() {
return llx;
}
/**
* Returns the lower left y-value.
*
* @return a value
*/
public float lly() {
return lly;
}
/**
* Returns the uppper right x-value.
*
* @return a value
*/
public float urx() {
return urx;
}
/**
* Returns the uppper right y-value.
*
* @return a value
*/
public float ury() {
return ury;
}
/**
* Returns the lower left x-value.
*
* @param def
* the default value
* @return a value
*/
public float llx(float def) {
if (Float.isNaN(llx))
return def;
return llx;
}
/**
* Returns the lower left y-value.
*
* @param def
* the default value
* @return a value
*/
public float lly(float def) {
if (Float.isNaN(lly))
return def;
return lly;
}
/**
* Returns the upper right x-value.
*
* @param def
* the default value
* @return a value
*/
public float urx(float def) {
if (Float.isNaN(urx))
return def;
return urx;
}
/**
* Returns the upper right y-value.
*
* @param def
* the default value
* @return a value
*/
public float ury(float def) {
if (Float.isNaN(ury))
return def;
return ury;
}
/**
* Returns the type of this <CODE>Annotation</CODE>.
*
* @return a type
*/
public int annotationType() {
return annotationtype;
}
/**
* Returns the title of this <CODE>Annotation</CODE>.
*
* @return a name
*/
public String title() {
String s = (String) annotationAttributes.get(TITLE);
if (s == null)
s = "";
return s;
}
/**
* Gets the content of this <CODE>Annotation</CODE>.
*
* @return a reference
*/
public String content() {
String s = (String) annotationAttributes.get(CONTENT);
if (s == null)
s = "";
return s;
}
/**
* Gets the content of this <CODE>Annotation</CODE>.
*
* @return a reference
*/
public HashMap attributes() {
return annotationAttributes;
}
/**
* Returns an <CODE>Annotation</CODE> that has been constructed taking in
* account the value of some <VAR>attributes </VAR>.
*
* @param attributes
* Some attributes
* @deprecated Use ElementFactory.getAnnotation(attributes)
*/
public Annotation(java.util.Properties attributes) {
this(com.lowagie.text.factories.ElementFactory.getAnnotation(attributes));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -