Class Annotations

java.lang.Object
com.levigo.jadice.web.client.util.helper.Annotations

public class Annotations extends Object
Helper class for various annotation related information, like permission checks or retrieval of annotation collections.
  • Constructor Details

    • Annotations

      public Annotations()
  • Method Details

    • getAnnotationCustomizers

      public static List<AnnotationCustomizer> getAnnotationCustomizers()
      A List of all registered annotation customizers.

      This List is intentionally writable to allow the registration and deregistration of custom AnnotationCustomizer implementations.

      The registered annotation customizers will all be executed during annotation creation by the AnnotationTool. Execution of the registered annotation customizers will be in insertion order of the List.

      AnnotationCustomizer implementations shall be aware that they might encounter different Annotation types as all customizers will be executed regardless of the actual Annotation type.

      Returns:
      the AnnotationCustomizer objects
    • getDeletedAnnotations

      public static Collection<Annotation> getDeletedAnnotations(Page page)
      To a given Page retrieve the list of annotations that have been deleted from the initial set of annotations which was sent from the server to the client
      Parameters:
      page - the Page containing possibly deleted Annotation objects
      Returns:
      the list of deleted Annotation objects
    • getDeletedAnnotations

      public static Collection<Annotation> getDeletedAnnotations(Page page, DocumentLayer documentLayer)
      To a given Page and DocumentLayer retrieve the list of annotations that have been deleted from the initial set of annotations which was sent from the server to the client
      Parameters:
      page - the Page containing possibly deleted Annotation objects
      documentLayer - the DocumentLayer defining the PageSegment where the Annotation objects lie in
      Returns:
      the list of deleted Annotation objects
    • getDeletedAnnotations

      public static Collection<Annotation> getDeletedAnnotations(Document document)
      To a given Document retrieve the list of annotations that have been deleted from the initial set of annotations which was sent from the server to the client
      Parameters:
      document - the Document containing possibly deleted Annotation objects
      Returns:
      the list of deleted Annotation objects
    • getAnnotations

      public static Collection<Annotation> getAnnotations(Page page)
      Retrieves the list of annotations lying in the PageSegment corresponding to the given Page.
      Parameters:
      page - the Page containing possibly deleted Annotation objects
      Returns:
      the list of Annotation objects
    • getAnnotations

      public static Collection<Annotation> getAnnotations(Document document)
      Retrieves the list of annotations in the whole given Document.
      Parameters:
      document - the Document containing Annotation objects.
      Returns:
      the list of Annotation objects in the Document.
    • getAnnotations

      public static Collection<Annotation> getAnnotations(Page page, DocumentLayer documentLayer)
      Retrieves the list of annotations lying in the corresponding PageSegment for a given Page and DocumentLayer.
      Parameters:
      page - the Page containing Annotation objects
      documentLayer - the DocumentLayer defining the PageSegment where the Annotation objects lie in
      Returns:
      the list of Annotation objects
    • isModified

      public static boolean isModified(Page page)
      Checks whether the annotations on the given page were modified after loading it from the server.

      Only modifications regarding annotations are tracked - like adding, deleting or changing annotations. Modifications referring to the base document (rotation, zoom, ...) do not qualify for a modification.

      Parameters:
      page - A Page that may contain Annotation objects
      Returns:
      true if any of the page's annotations was modified after loading it from the server
    • isModified

      public static boolean isModified(Document document)
      Checks whether the annotations on the given document were modified after loading it from the server.

      Only modifications regarding annotations are tracked - like adding, deleting or changing annotations. Modifications referring to the base document (rotation, zoom, ...) do not qualify for a modification.

      Parameters:
      document - A Document that may contain Annotations on its Pages
      Returns:
      true if any of the document's annotations was modified after loading it from the server
    • clearModified

      public static void clearModified(Document document)
      Clear the modified state of all Annotations on the Document.
      Parameters:
      document - a Document which may contains Annotations.
    • clearModified

      public static void clearModified(Page page)
      Clear the modified state of all Annotations on the Page.
      Parameters:
      page - a Page which may contains Annotations.
    • isAnnotationPageSegment

      public boolean isAnnotationPageSegment(Page page, DocumentLayer documentLayer)
      Check if the PageSegment on a given DocumentLayer on a given Page is an AnnotationPageSegment
      Parameters:
      page - the Page containing the PageSegment
      documentLayer - the DocumentLayer containing the PageSegment in question
      Returns:
      true if the PageSegment is an AnnotationPageSegment; else false
    • isAnnotationPageSegment

      public boolean isAnnotationPageSegment(PageSegment pageSegment)
      Check if the given PageSegment is an AnnotationPageSegment
      Parameters:
      pageSegment - the PageSegment to be checked
      Returns:
      true if the PageSegment is an AnnotationPageSegment; else false
    • getRelativeAnnotationBoundsInPixel

      @Deprecated public static Rectangle getRelativeAnnotationBoundsInPixel(PageView pageView, Annotation annotation, com.levigo.jadice.web.shared.model.annotation.internal.AnnotationPageSegment pageSegment)
      Deprecated.
      Returns the Bounds of the given Annotation in Pixel. The Bounds are relative to the viewer unlike Annotation.getBounds() which are relative to the Page containing the Annotation and given in jadice document units.
      Parameters:
      pageView - the PageView
      annotation - the annotation
      pageSegment - the AnnotationPageSegment which contains the Annotation
      Returns:
      the bounds of the annotation
    • getRelativeAnnotationBoundsInPixel

      public static Rectangle getRelativeAnnotationBoundsInPixel(PageView pageView, Annotation annotation, Page page)
      Returns the Bounds of the given Annotation in Pixel. The Bounds are relative to the viewer unlike Annotation.getBounds() which are relative to the Page containing the Annotation and given in jadice document units.
      Parameters:
      pageView - the PageView
      annotation - the annotation
      page - the Page which contains the Annotation
      Returns:
      the bounds of the annotation
    • getAnnotationBoundsInPixel

      public static Rectangle getAnnotationBoundsInPixel(PageView pageView, Annotation annotation, Page page)
      Returns the Bounds of the given Annotation in Pixel. The Bounds are absolute inside of the viewer unlike Annotation.getBounds() which are relative to the Page containing the Annotation and given in jadice document units.
      Parameters:
      pageView - the PageView
      annotation - the annotation
      page - the Page which contains the Annotation
      Returns:
      the bounds of the annotation
    • getAnnotationPageSegment

      public static com.levigo.jadice.web.shared.model.annotation.internal.AnnotationPageSegment getAnnotationPageSegment(Page page, String profileId)
      Returns the AnnotationPageSegment for passed page. If no AnnotationPageSegment exists, a new AnnotationPageSegment is created and added to the page.
      Parameters:
      page - The page where the page segment resides in
      profileId - The id of the used AnnotationProfile
      Returns:
      Either the found AnnotationPageSegment or the newly created.