Class AnnotationTextCalloutFactory


  • public class AnnotationTextCalloutFactory
    extends AnnotationTextFactory

    Create annotations that handle AnnotationText objects with callouts.

    The name of this feature is AnnotationTextCallout

    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.11
    • Constructor Detail

      • AnnotationTextCalloutFactory

        public AnnotationTextCalloutFactory()
        Create a new AnnotationTextCalloutFactory
    • Method Detail

      • 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 class AnnotationTextFactory
        Parameters:
        x1 - the lower left x coordinate
        y1 - the lower left y coordinate
        x2 - the top right x coordinate
        y2 - 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 call paintComponent(this, this.ui, g) followed by paintComponentAnnotations(this, g) - typically, the main reason to override this method is when a different type of object is required (eg. a JTextField)

        Overrides:
        createComponent in class AnnotationTextFactory
        Parameters:
        pagepanel - the panel the JComponent will be added to
        a - 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 class AnnotationTextFactory
        Parameters:
        source - the annotation to copy properties from
        target - 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 class AnnotationTextFactory
        Parameters:
        gannot - the annotation
        readonly - whether we are displaying or editing the annotation
        create - if readonly if false, whether we are editing an existing or creating a new annotation