|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.faceless.pdf2.viewer2.ViewerFeature
org.faceless.pdf2.viewer2.AnnotationComponentFactory
public abstract class AnnotationComponentFactory
A type of ViewerFeature that creates a JComponent to represent a
PDFAnnotation on the page. Typically AnnotationComponentFactories
are singleton objects, as they do not need to be tied to a specific viewer.
For viewing components, all that needs to be overridden are the
matches() and createComponent()
methods. If you want to use this factory to edit and/or create new annotations,
it's necessary to override the
createEditComponent(),
getAnnotationType() and
createNewAnnotation() methods as well.
This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.
| Constructor Summary | |
|---|---|
AnnotationComponentFactory(String name)
Create a new AnnotationComponentFactory |
|
| Method Summary | |
|---|---|
static void |
bindComponentLocation(JComponent component,
float[] rect)
Cause the specified JComponent to be positioned at the PDF co-ordinates specified by rect. |
static void |
bindComponentLocation(JComponent component,
float x1,
float y1,
float x2,
float y2)
Cause the specified JComponent to be positioned at the specified PDF co-ordinates. |
static void |
bindComponentLocation(JComponent component,
PDFAnnotation annot)
Cause the specified JComponent to be positioned at same position as the PDFAnnotation. |
abstract JComponent |
createComponent(PagePanel pagepanel,
PDFAnnotation annot)
Return a JComponent that will visually represent the specified PDFAnnotation. |
JComponent |
createEditComponent(PDFAnnotation annot,
boolean readonly,
boolean create)
Return a JComponent that can be used to edit the annotation or display additional information. |
PDFAnnotation |
createNewAnnotation()
Return a brand new annotation of the type that is edited with this factory. |
String |
getAnnotationType()
Return the name of the type of widgets this AnnotationComponentFactory creates or edits. |
abstract boolean |
matches(PDFAnnotation annot)
Return true if this AnnotationComponentFactory could create a JComponent
for the specified PDFAnnotation. |
protected static void |
paintComponent(JComponent comp,
String state,
Graphics g)
This method can be called by the paintComponent method
of each JComponent returned from an AnnotationComponentFactory
to repaint the annotation using the content of the annotation. |
String |
toString()
|
| Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature |
|---|
getAllFeatures, getName, initialize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AnnotationComponentFactory(String name)
name - the name of this ViewerFeature| Method Detail |
|---|
public String toString()
toString in class ViewerFeaturepublic abstract boolean matches(PDFAnnotation annot)
JComponent
for the specified PDFAnnotation.
public abstract JComponent createComponent(PagePanel pagepanel,
PDFAnnotation annot)
pagepanel - the panel the JComponent will be added toannot - the annotation
public JComponent createEditComponent(PDFAnnotation annot,
boolean readonly,
boolean create)
annot - the annotationreadonly - whether we are displaying or editing the annotationcreate - if readonly if false, whether we are editing an existing or creating a new annotationpublic String getAnnotationType()
public PDFAnnotation createNewAnnotation()
null (the default)
protected static final void paintComponent(JComponent comp,
String state,
Graphics g)
paintComponent method
of each JComponent returned from an AnnotationComponentFactory
to repaint the annotation using the content of the annotation.
comp - the componentstate - the state to paint. Typically this will be "N"g - the Graphics objectPagePainter.paintAnnotation(org.faceless.pdf2.PDFAnnotation, java.lang.String, java.awt.Graphics2D, float[])
public static final void bindComponentLocation(JComponent component,
float[] rect)
rect.
If the page is scrolled or zoomed the component will be zoomed and resized to match.
component - the Componentrect - the component location in PDF space, specified as [x1, y1, x2, y2]
public static final void bindComponentLocation(JComponent component,
float x1,
float y1,
float x2,
float y2)
component - the Componentx1 - the left-most X co-ordinate of the component in PDF spacey1 - the bottom-most Y co-ordinate of the component in PDF spacex2 - the right-most X co-ordinate of the component in PDF spacey2 - the top-most Y co-ordinate of the component in PDF space
public static final void bindComponentLocation(JComponent component,
PDFAnnotation annot)
component - the Componentannot - the PDFAnnotation to bind the components position to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||