Class AnnotationTextFactory
- java.lang.Object
-
- org.faceless.pdf2.viewer2.ViewerFeature
-
- org.faceless.pdf2.viewer2.AnnotationComponentFactory
-
- org.faceless.pdf2.viewer2.feature.AnnotationTextFactory
-
- Direct Known Subclasses:
AnnotationTextCalloutFactory
public class AnnotationTextFactory extends AnnotationComponentFactory
Create annotations that handle
AnnotationText
objects (without callouts).The following initialization parameters can be specified to configure this feature.The name of this feature is AnnotationTextcustomfont.n One or more of these options can be set, starting with n=0. Each is the URL of an OpenTypeFont to add to the dialog list (since 2.18.3). defaultFont if set, the name of the font to default to in dialogs. May be overriden by the prevous font selected by the user if those settings are stored (since 2.18.3). defaultFontSize if set, the font size of the font to default to in dialogs. May be override, as above (since 2.18.3). 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.
- Since:
- 2.10
-
-
Field Summary
-
Fields inherited from class org.faceless.pdf2.viewer2.AnnotationComponentFactory
FOCUSBORDER
-
-
Constructor Summary
Constructors Modifier Constructor Description AnnotationTextFactory()
Create a new AnnotationTextFactoryprotected
AnnotationTextFactory(String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
copyAnnotationState(PDFAnnotation source, PDFAnnotation target)
Copies the properties of a given source annotation created by this factory to a target annotation of the same type.JComponent
createComponent(PagePanel pagepanel, PDFAnnotation a)
Return a JComponent that will visually represent the specified PDFAnnotation.JComponent
createEditComponent(PDFAnnotation gannot, boolean readonly, boolean create)
Return a JComponent that can be used to edit the annotation or display additional information.PDFAnnotation
createNewAnnotation(float x1, float y1, float x2, float y2)
Returns a new annotation of this factory's type with specified bounds.String
getAnnotationType()
Return the name of the type of widgets this AnnotationComponentFactory creates or edits.boolean
matches(PDFAnnotation annot)
Return true if this AnnotationComponentFactory could create aJComponent
for the specifiedPDFAnnotation
.-
Methods inherited from class org.faceless.pdf2.viewer2.AnnotationComponentFactory
addStockDetailsToEditComponent, bindComponentLocation, bindComponentLocation, bindComponentLocation, bindComponentLocation, createDeleteAction, createEditAction, createFlattenAction, createNewAnnotation, getPreferences, getViewer, initialize, isFactoryReadOnly, makeComponentInteractive, paintComponent, paintComponentAnnotations, popupPropertyMenu, postEdit, toString
-
Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, isEnabledByDefault, setFeatureName, teardown
-
-
-
-
Constructor Detail
-
AnnotationTextFactory
public AnnotationTextFactory()
Create a new AnnotationTextFactory
-
AnnotationTextFactory
protected AnnotationTextFactory(String name)
-
-
Method Detail
-
matches
public boolean matches(PDFAnnotation annot)
Description copied from class:AnnotationComponentFactory
Return true if this AnnotationComponentFactory could create aJComponent
for the specifiedPDFAnnotation
.- Specified by:
matches
in classAnnotationComponentFactory
-
getAnnotationType
public String getAnnotationType()
Description copied from class:AnnotationComponentFactory
Return the name of the type of widgets this AnnotationComponentFactory creates or edits.- Overrides:
getAnnotationType
in classAnnotationComponentFactory
-
createNewAnnotation
public PDFAnnotation createNewAnnotation(float x1, float y1, float x2, float y2)
Description copied from class:AnnotationComponentFactory
Returns a new annotation of this factory's type with specified bounds.- Overrides:
createNewAnnotation
in classAnnotationComponentFactory
- Parameters:
x1
- the lower left x coordinatey1
- the lower left y coordinatex2
- the top right x coordinatey2
- the top right y coordinate
-
createComponent
public JComponent createComponent(PagePanel pagepanel, PDFAnnotation a)
Description copied from class:AnnotationComponentFactory
Return a JComponent that will visually represent the specified PDFAnnotation. The default implementation returns a JPanel that will display the annotation appearance - it's usually best to call super.createComponent() then add any required listeners in the subclasses.
By default this method returns a JCompoment whose
paintComponent()
method is overridden to callpaintComponent(this, this.ui, g)
followed bypaintComponentAnnotations(this, g)
- typically, the main reason to override this method is when a different type of object is required (eg. aJTextField
)- Overrides:
createComponent
in classAnnotationComponentFactory
- Parameters:
pagepanel
- the panel the JComponent will be added toa
- the annotation- See Also:
paintComponentAnnotations()
,paintComponent()
-
copyAnnotationState
protected void copyAnnotationState(PDFAnnotation source, PDFAnnotation target)
Description copied from class:AnnotationComponentFactory
Copies the properties of a given source annotation created by this factory to a target annotation of the same type. This is used to make a temporary copy of an annotation for editing purposes.- Overrides:
copyAnnotationState
in classAnnotationComponentFactory
- Parameters:
source
- the annotation to copy properties fromtarget
- the annotation to copy properties to
-
createEditComponent
public JComponent createEditComponent(PDFAnnotation gannot, boolean readonly, boolean create)
Description copied from class:AnnotationComponentFactory
Return a JComponent that can be used to edit the annotation or display additional information. If the annotation has no dialog that should work with it in this way, this method should return null (the default)- Overrides:
createEditComponent
in classAnnotationComponentFactory
- Parameters:
gannot
- the annotationreadonly
- whether we are displaying or editing the annotationcreate
- if readonly if false, whether we are editing an existing or creating a new annotation
-
-