Class Annotation

java.lang.Object
com.levigo.jadice.annotation.Annotation
All Implemented Interfaces:
PermissionsProvider<Annotation>, PropertiesProvider, com.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation, Serializable, org.jadice.util.base.MementoOriginator
Direct Known Subclasses:
ShapeBasedAnnotation

public abstract class Annotation extends Object implements Serializable, PermissionsProvider<Annotation>, com.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation, PropertiesProvider, org.jadice.util.base.MementoOriginator
An abstract base class for all annotations.
See Also:
  • Field Details

    • createdBy

      protected String createdBy
    • lastModifiedBy

      protected String lastModifiedBy
    • createdAt

      protected Date createdAt
    • lastModifiedAt

      protected Date lastModifiedAt
    • initializer

      protected AnnotationInitializer initializer
    • isModified

      protected boolean isModified
    • id

      protected String id
      anno id
    • doFireAnnotationEvents

      protected boolean doFireAnnotationEvents
      Flag whether annotation events should be fired. As default this flag is set to false until this annotation instance is initialized and the creation process is finished.
  • Constructor Details

    • Annotation

      public Annotation()
  • Method Details

    • translate

      public abstract void translate(double dx, double dy)
      Translates this Annotation the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.
      Parameters:
      dx - the distance to move this Rectangle along the x axis
      dy - the distance to move this Rectangle along the y axis
    • setSize

      public abstract void setSize(double width, double height)
      Set the size of the annotation to the given size. Depending on the type of annotation, this may not be possible. E.g. stamp annotations handle the sizing on their own, so they will refuse to resize themselves. An IllegalArgumentExceptionis thrown in this case. Caveat: it is currently necessary, to force a repaint on the viewer in order to make the results of the modification visible. Moreover there are no modification events fired on the page and document. This will change in the future.
      Parameters:
      width -
      height -
    • setLocation

      public abstract void setLocation(double x, double y)
      Set the location (upper-left corner) of the annotation to the given point. Caveat: it is currently necessary, to force a repaint on the viewer in order to make the results of the modification visible. Moreover there are no modification events fired on the page and document. This will change in the future.
      Parameters:
      x - X-position
      y - Y-position
    • getBounds

      public abstract Rectangle2D getBounds()
      Returns a Rectangle2D that completely encloses the annotation.
      Returns:
      Rectangle2D annotation bounding box
    • fireAnnotationChange

      protected void fireAnnotationChange(Annotation previousState, AnnotationPageSegmentEvent.EventType eventType, Object oldValue, Object newValue)
      Handle an annotation change
    • setID

      public void setID(String id)
      Set annotation id.
      Parameters:
      id - Id to set.
    • getID

      public String getID()
      Returns annotations id.
      Returns:
      Annotation id
    • setProfileId

      public void setProfileId(String profileId)
      Specified by:
      setProfileId in interface com.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation
    • getProfileId

      public String getProfileId()
      Specified by:
      getProfileId in interface com.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation
    • getTypeName

      public String getTypeName()
      Specified by:
      getTypeName in interface com.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation
    • setTypeName

      public void setTypeName(String typeName)
      Specified by:
      setTypeName in interface com.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation
    • setModified

      public void setModified()
      Sets modified-flag.
    • clearModified

      public void clearModified()
      Clears the modified-flag.
    • isModified

      public boolean isModified()
      Returns modify status of the annotation.
      Returns:
      Modify status.
    • copyAttributesTo

      protected void copyAttributesTo(Annotation annotation)
    • isDoFireAnnotationEvents

      public boolean isDoFireAnnotationEvents()
      Return whether this annotation instance propagates annotation events
      Returns:
      true if this annotation propagates its internal changes as annotation event, otherwise false will be returned
    • setDoFireAnnotationEvents

      public void setDoFireAnnotationEvents(boolean doFireAnnotationEvents)
      Changes the annotation event propagation mode.
      Parameters:
      doFireAnnotationEvents - true if this annotation should propagate its internal changes as annotation event, otherwise false should be set.
    • getProperties

      public Map<String,Object> getProperties()
      Description copied from interface: PropertiesProvider
      Return a map of user properties. What to store and which keys to use is largely up to the user of classes implementing this interface, since those classes will generally be oblivious to the map's contents. There are no guarantees regarding the thread-safety of the returned map, unless otherwise specified by implementors.
      Specified by:
      getProperties in interface PropertiesProvider
      Returns:
      the map of user properties
    • setInitializer

      public void setInitializer(AnnotationInitializer initializer)
    • getInitializer

      public AnnotationInitializer getInitializer()
    • isInitialized

      public boolean isInitialized()
    • initialize

      public void initialize(Page page)
    • getCreatedBy

      public String getCreatedBy()
    • setCreatedBy

      public void setCreatedBy(String originatorName)
    • getLastModifiedBy

      public String getLastModifiedBy()
    • setLastModifiedBy

      public void setLastModifiedBy(String userName)
    • getCreatedAt

      public Date getCreatedAt()
    • setCreationTimestamp

      public void setCreationTimestamp(Date creationTimestamp)
    • getLastModifiedAt

      public Date getLastModifiedAt()
    • setModifyTimestamp

      public void setModifyTimestamp(Date modifyTimestamp)
    • getModCount

      public int getModCount()
    • setType

      public void setType(AnnotationType annotationType)
    • getType

      public AnnotationType getType()
      Get the type profile.
      Returns:
      the typeProfile
    • setChangeHandler

      public void setChangeHandler(com.levigo.jadice.web.shared.model.annotation.internal.AnnotationChangeHandler changeHandler)
      Changes the annotation change handler.
      Specified by:
      setChangeHandler in interface com.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation
      Parameters:
      changeHandler -
    • getChangeHandler

      public com.levigo.jadice.web.shared.model.annotation.internal.AnnotationChangeHandler getChangeHandler()
      Returns the annotation change handler
      Specified by:
      getChangeHandler in interface com.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation
      Returns:
      AnnotationChangeHandler
    • getPermissions

      public Permissions<Annotation> getPermissions()
      Specified by:
      getPermissions in interface PermissionsProvider<Annotation>
    • clone

      public Annotation clone()
      Overrides:
      clone in class Object
    • createMemento

      public org.jadice.util.base.Memento createMemento()
      Specified by:
      createMemento in interface org.jadice.util.base.MementoOriginator
    • restoreFrom

      public void restoreFrom(AnnotationMemento memento)
      This method is called back from AnnotationMemento upon Memento.restore()